[Question]
  [
# Challenge
You will be given a string that can contain lowercase letters, uppercase letters, or spaces. You have to turn the vowels (a, e, i, o, u) in the string to upper case and consonants to lower case. This applies whether or not the letter was originally upper case or lower case. Spaces remain as is. Note that "y" is a consonant.
# Examples
```
Hello World -> hEllO wOrld
abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVXWYZ -> AbcdEfghIjklmnOpqrstUvwxyz AbcdEfghIjklmnOpqrstUvxwyz
```
# Info
* The input string can contain letters A to Z, lowercase or uppercase, and spaces.
# Input
The string
# Output
The formatted string (Vowels uppercase and consonants lowercase).
  
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~55 ... 46~~ 45 bytes
*Saved 1 byte thanks to @KevinCruijssen*
```
s=>Buffer(s).map(c=>c^(c^~68174912>>c)&32)+''
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@7/Y1s6pNC0ttUijWFMvN7FAI9nWLjlOIzmuzszC0NzE0tDIzi5ZU83YSFNbXf1/cn5ecX5Oql5OfrpGmoaSR2pOTr5CeH5RToqSpiYXmmxiamZ@aVJySlp6RlZ2Tm5eQWFRcUlZeUVllYKjq6d/qJOzi5u7h5e3j69fQGBQcEhYeERkFNCc/wA "JavaScript (Node.js) – Try It Online")
### How?
The constant \$68174912\$ is a bitmask describing the positions of the vowels:
```
00000100000100000100010001000000
     v     v     v   v   v
zyxwvutsrqponmlkjihgfedcba`_^]\[
```
As per [the ECMAScript specification](https://www.ecma-international.org/ecma-262/10.0/index.html#sec-signed-right-shift-operator-runtime-semantics-evaluation), the following expression:
```
~68174912 >> c & 32
```
is equivalent to:
```
~68174912 >> (c % 32) & 32
```
and therefore evaluates to \$32\$ for a consonant or \$0\$ for a vowel, no matter the case of \$c\$.
### Commented
```
s =>                   // s = input string
  Buffer(s)            // turn s into a buffer
  .map(c =>            // for each ASCII code c:
    c ^                //   change the case if:
      ( c              //     c is not in lower case
        ^              //     XOR
        ~68174912 >> c //     c is a consonant
      ) & 32           //
  ) + ''               // end of map(); coerce back to a string
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 49 bytes
Port of [my JS answer](https://codegolf.stackexchange.com/a/201521/58563).
```
f(char*s){for(;*s;s++)*s^=(*s^~68174912>>*s)&32;}
```
[Try it online!](https://tio.run/##S9ZNT07@/z9NIzkjsUirWLM6Lb9Iw1qr2LpYW1tTqzjOVgNI1JlZGJqbWBoa2dkBlagZG1nX/s/MK1HITczM0yjLz0zRVKjmUlAAGaFQHB2rYKug5JGak5OvEO5flJOikJiamV@alJySlp6RlZ2Tm1dQWFRcUlZeUVml4Ojq6R/q5Ozi5u7h5e3j6xcQGBQcEhYeERmlZA00MU2jWBNEF5SWFIOZtf8B "C (gcc) – Try It Online")
---
# [C (clang)](http://clang.llvm.org/), 48 bytes
*A version suggested by @Neil*
This is abusing the way clang is dealing with the pointer post-increment.
```
f(char*s){for(;*s;)*s++^=(*s^~68174912>>*s)&32;}
```
[Try it online!](https://tio.run/##HYzHCsJAFADvfsXDg2wiHixYCAbsvXdFYd24MbommheNBf1013KaOQzDIkxQ25SSE7alrorKgzsu0VTUFBXD4VWWqLh6JdPRVCITjen6twjFY9pTWrYHB2rZ5OJYhgKPAMDvALhYQhaC1Y0QDkw6rjCAbiznvGYGN7e7vTjYx5OL3sW/3u6QK9U6o3yhWK5U641mq93t9QfD8WQ6mwe175ETVH48nj3861O@GRfURBnxPw "C (clang) – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/) `-p`, ~~20~~ 19 bytes
*-1 due to @NahuelFouilleul*
```
$_=lc;y;aeiou;AEIOU
```
[Try it online!](https://tio.run/##K0gtyjH9/18l3jYn2brSOjE1M7/U2tHV0z/0/3@P1JycfIXw/KKclH/5BSWZ@XnF/3ULAA "Perl 5 – Try It Online")
Convert everything to lower case, then change vowels to upper case.
[Answer]
# [Python 3](https://docs.python.org/3/), 55 bytes
```
lambda s:[[c,c.upper()][c in"aeiou"]for c in s.lower()]
```
[Try it online!](https://tio.run/##HYoxDoMwEAR7XnGiwZYSN@mQSJ0fpCAUBGzlIuOz7owihHi7A3Q7MxuX9KFwy655Zd9P77EHqdt2uAxmjtGy0l07AIayt0hz2TliOBjEePqdPeMUiRPIIsWRPQZ7PhYxkkYMdQEg0JxhN4xR6V3xrpySY0bGkJQrV9ngeoe1qsyXMCjWW6nzw3pP8CT24x8 "Python 3 – Try It Online")
**Input**: A string/sequence of characters  
**Output**: a list of characters.
### Explanation
The solution converts the string to lower case, then convert all vowels to uppercase.
* `for c in s.lower()` converts the string to lower case, then loop through each character in the string.
* `[c,c.upper()][c in "aeiou"]` converts any vowel to uppercase, and consonant to lower case.  
`c in "aeiou"` evaluates to `0` or `1`, which is used to index into the list `[c,c.upper()]`.
[Answer]
# [Python](https://docs.python.org/2/), 53 bytes
```
lambda s:[(c*2).title().strip('aeiou')[-1]for c in s]
```
[Try it online!](https://tio.run/##DcTHDoIwAADQu1/R9EJrhESOJpi4994iB1alCG1ti4o/j77DE6VOOLMr4tyqzM@DyAeq5aKwbmNLU53FCFtKSyqQ4ceUFwZ2zaZHuAQhoAwor1IOZaLQCNeEpEwD1QDQbMP/0Eo5ZYgghXEF/SCMYnJPaPrIcsbFUypdvN6f8gs63V5/MByNJ9PZfLFcrTfb3f5wPJ8uV/gD "Python 2 – Try It Online")
Outputs a list of characters.
Here is an explanation of how it transforms each character `c`, with examples `c='A'` and `c='B'`:
```
                'A'  'B'
(c*2)           'AA' 'BB'  # Two copies of c in a two-character string
.title()        'Aa' 'Bb'  # Title case: uppercase first letter and the rest lowercase
                           # This disregards the case of c
.strip("aeiou") 'A'  'Bb'  # Remove any leading or trailing lowercase vowels 'aeiou'
                           # For a two-character string, this removes all such letters
[-1]            'A'  'b'   # Take the last letter
```
**55 bytes**
```
lambda s:[(c*2).title()[~(c in'aieouAEIOU')]for c in s]
```
[Try it online!](https://tio.run/##Fci5DoIwAADQ3a9outAaZWA0wcQDFS@88EIGTilCW2lRcfDXUZc3PF7JhFGtjvVLnXm5H3pAdBwUNDWsSiKzCGHngwJAqOKRiJU9w7RsBbsxK8B/gXBroRPKS4lwgxeESiBaALa78CdUU0YoipHAuIaeH4RRfE1Iestyyvi9ELJ8PF/VG/T6g6ExGk/M6Wy@WFqr9Wa7s/fHw@kMvw "Python 2 – Try It Online")
If we were instead lowercasing vowels and uppercasing consonants, we wouldn't need the `~()` and would have 52 bytes.
[Answer]
# [CJam](https://sourceforge.net/p/cjam), 15 bytes
```
lel"aeiou"_euer
```
[Try it online!](https://tio.run/##S85KzP3/Pyc1RykxNTO/VCk@tTS16P9/j9ScnHwdhfL8opwURQA "CJam – Try It Online")
### Explanation
```
l         e# Read line
el        e# To lowercase
"aeiou"   e# Push this string
_         e# Duplicate
eu        e# To uppercase
er        e# Transliterate. Implicitly display
```
[Answer]
# [Bash](https://www.gnu.org/software/bash/) + Core utilities, ~~25~~ 23 bytes
```
tr aeiou AEIOU<<<${1,,}
```
[Try it online!](https://tio.run/##S0oszvj/v6RIITE1M79UwdHV0z/UxsZGpdpQR6f2////iUnJKalp6RmZWdk5uXn5BYVFxSWlZeUVlVUKjk7OLq5u7h6eXt4@vn7@AYFBwaFh4RGRUQA "Bash – Try It Online")
*Saved 2 bytes thanks to a suggestion of Nahuel Fouilleul.*
Input is passed as an argument, output is on stdout.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~9~~ 7 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
Saved 2 using a variation of [Luis Mendo's CJam approach](https://codegolf.stackexchange.com/a/201519/53748)
```
ØCŒHyŒu
```
A monadic Link accepting a list of characters which yields a list of characters.
**[Try it online!](https://tio.run/##y0rNyan8///wDOejkzwqj04q/f//vwdQLF8hPL8oJ0VHwdHf2x4A "Jelly – Try It Online")**
### How?
```
ØCŒHyŒu - Link: list of characters, S   e.g. "I am OK!"
ØC      - consonants                         "BCDF...XYZbcdf...xyz"
  ŒH    - split into two                     ["BCDF...XYZ", "bcdf...xyz"]
     Œu - convert (S) to upper-case          "I AM OK!"
    y   - translate                          "I Am Ok!"
```
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 14 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
Anonymous tacit prefix function.
```
⌈@(∊∘'aeiou')⌊
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn//1FPh4PGo46uRx0z1BNTM/NL1TUf9XT9T3vUNuFRb9@jruZHvWse9W45tN74UdvER31Tg4OcgWSIh2fw/zQFdY/UnJx8hfD8opwUdQA "APL (Dyalog Extended) – Try It Online")
`⌊` lowercase
`⌈@(`…`)` uppercase **at** the following positions:
 `∊∘'aeiou'` members of "aeiou"
[Answer]
# [sed](https://www.gnu.org/software/sed/), ~~41~~ ~~25~~ 24 bytes
Saved 16 bytes thanks to [Surculose Sputum](https://codegolf.stackexchange.com/users/92237/surculose-sputum)!!!  
Saved a byte thanks to [S.S. Anne](https://codegolf.stackexchange.com/users/89298/s-s-anne)!!! 
```
s/./\L&/g
y/aeiou/AEIOU/
```
[Try it online!](https://tio.run/##K05N0U3PK/3/v1hfTz/GR00/natSPzE1M79U39HV0z9U//9/j9ScnHyFcP@inBQFsAxYQqGisioiMgoA "sed – Try It Online")
[Answer]
# Java 8, ~~86~~ 34 bytes
```
S->S.map(c->c^(c^~68174912>>c)&32)
```
-52 bytes by porting [*@Arnauld*'s JavaScript answer](https://codegolf.stackexchange.com/a/201521/52210), so make sure to upvote him!!
**Original 86 bytes answer:**
```
s->{s=s.toLowerCase();for(var p:"aeiou".toCharArray())s=s.replace(p,p&=~32);return s;}
```
[Try it online.](https://tio.run/##dZDfT8IwEMff@SsuezBdlD3oGwsmiCgoP9Sh@CM@lK3AoLS1vQ2R4L8@uzlJiCFpmuvd9@776c1pSqvzaJGFnBoDPRqLTQUgFsj0hIYM@vkTIEAdiymEpAyM69v8tmIvgxTjEPogoJ6Z6vnG1I2HsitXTDepYcT1J1KTlGpQNYeyWCaOrTdnVDe0pmviunmHZopbQ6JO1FH9@@zU9TXDRAsw/jbzcyOVjLk1Kv1SGUewtLwl0ts7UPcXFplB4rQZ5xJGUvPIKWj/CgXCOIwm09l8wZdCfWiD6epz/QWNVmfweNG8vLpu39x2e/27@4dg@DR6fnndH2E/19L7KWzHAdjTAGyZofNvPwVvIS1XmMf5fkroYG2QLT2ZoKdsHbkgTkeoBGsAzvFO7B8UDxIs1M6x8EKyazjcUSJusx8)
**Explanation:**
```
s->{                               // Method with String as both parameter and return-type
  s=s.toLowerCase();               //  Convert the entire String to lowercase
  for(var p:"aeiou".toCharArray()) //  Loop over the vowels as characters:
    s=s.replace(p,p&=~32);         //   And replace the lowercase vowels to uppercase ones
  return s;}                       //  Then return the modified String as result
```
[Answer]
# x86-64 machine code, 21 bytes
(Or **20 bytes** for an x86-32 version with an explicit length input, allowing `dec/jnz` as the loop condition. Using `cl` for a shift count makes it not a win to use `loop`, and 64-bit mode has 2-byte `dec` so it's break-even to make it explicit-length).
Callable as `void vucd_implicit(char *rdi)` with the x86-64 System V calling convention. (It leaves RDI pointing to the terminating `0` byte if you want to use that bonus return value.)
```
# disassembly: objdump -drwC -Mintel
0000000000401000 <theloop>:
  401000:       b8 a0 bb ef fb          mov    eax,0xfbefbba0
  401005:       d3 e8                   shr    eax,cl
  401007:       30 c8                   xor    al,cl
  401009:       24 20                   and    al,0x20
  40100b:       30 c8                   xor    al,cl
  40100d:       aa                      stos   BYTE PTR es:[rdi],al
000000000040100e <vowel_up_consonant_down>:        # the function entry point
  40100e:       8a 0f                   mov    cl,BYTE PTR [rdi]
  401010:       84 c9                   test   cl,cl
  401012:       75 ec                   jne    401000 <theloop>
  401014:       c3                      ret    
```
Notice that the function entry point is in the middle of the loop. This is something you can do in real life; as far as other tools are concerned, `theloop` is another function that falls into this one as a tailcall.
This uses something like Arnauld's xor/and/xor idea for applying the lcase bit to an input character, instead of the more obvious `and cl, ~0x20` to clear it in the original, `and al, 0x20` to isolate it from the mask, and `or al, cl` to combine. That would be 1 byte larger because `and cl, imm8` can't use the AL,imm special encoding with no ModRM.
Having the bitmap left-shifted by 5 so the bit we want lines up with 0x20 is also due to [@Arnauld's answer](https://codegolf.stackexchange.com/questions/201508/vowels-up-consonants-down/201521#201521). I had been planning to use `bt`/`salc` like in [a previous vowel/consonant bitmap answer](https://codegolf.stackexchange.com/questions/123194/user-appreciation-challenge-1-dennis/123458#123458) and mask that with `0x20` until I tried Arnauld's way and found it could be done even more efficiently.
NASM source ([Try it online!](https://tio.run/##lVZrV9s4EP3uXzFfKAlN2DjQLgeXnoWUlLS8yqO09LA@sq0koorklew8@PPsSLKdNEALPoeESJqrq5k71yJa01HEZ01B9Oj@HvAJAugQzpkYQCzFmIqMSQE7cD7TX2G69bb5dtMr1o0lS2Ccx0nIRilnMctq8ZAoWFMJqz9cRKfLixqg2R0NM1AaAwZcRoRjwITyME9D3F5LQUQWJnIivGxIuZTptgV@9hNABQMRy0YkdcTmK66/f7v6enlxfvbl9OT46PDzp97Bx@7@h87e7j9muisVMJHQqcnIhGVD2D3v9HoQv9rwIWGKxhmfWcyRHOMnJdMG@OZpLX26vwjevYM3lgImmUKeOlQ8HvCYaGpovvSMNlhOTCgwDT5kElJFNVVjCq1puwWrsGpB9VCVJGP@AGf3EF659YgyRMACmKqSGazpocx5sgYRBU0d06k0oIQ/gomgGJWwfh81VBsR/fP9@7iOu8Q2koikiLS7LkUyLTnJ6EMWz9i1z1n6a1KB9UFQmtDEZSKTOnoyo4YYrlDUe0KP2ws1j5HDD9TzjR3LqM7cWMztwK24g0K99rfCtHkBSI6NQVH6UngryK31hw4Ix7739NS2F2C3Ea3zkUkYyYBTAe93wPfW533j@CYV32C5CH934d@yFtg7nGKrPky/i9N5VMSt7q4uJk8RMaBNPWT9zCjRzO7g8WxQPErLoOvVZhUYmOrg2SdEI3GtzRGEiWwAVm7CODeCI8CJGmDTCM0GgiYg8lFElUO@JQDrQoqQ8HRISv9BSe9AKjWzPsYE2NmIZlBrNdtv6niW4NmOgJOtpnUDFJGLK7o@@W3XR7860V@2jIUfQR91nGNirQ1E2Qv9yS/5IIaxqMKdZEL1o/ak2e@IvpxplEEJi0lYbqNOF7Nvuh47vuZfGu@rGees163kO6eXRycf9mFnBzbarisJj5/2OX8Pv6TgM2M92tW2BciqNe121wGOZQZkTBgnEaem2G83m6bzR5gOb4VyTd0mUVSaIH4sb9Lec5MldtNvAIljiQ2D@UU9d7rrCCbQ1JZ8KOHPMLXbHO3hT45WIFmP8uai3rZZ6x2dHvY6vYvwcP/448XBgumYWDI3Hdv4C@c2P6tBy7/yI/f7Pnj0KY0p1BlRmee@nKEEKwntm/fY6cXZee96HzbdC0nl1MplutG2@dhoV4VYd7sGVpDU3AJ@KJ2@3oTXsLnm35hwlBNmH1t9/MO/matXVYu3cPFWsVgtLra7m3e2ooMczaK4skBNoDSQTH0BzW83DCQ6wCNZNZpsefOy6Uyhodaqq828pRApRiU1/Wrc1XGusGpC0RRTpbHoUeGUsZFZ04FDE9rVUsO3wK7GEhpXY8GCAt1xorRhZ5byhce0IzHe6p68XC3E6IUYVyJ7o7F0w/D4LJwoltGFabOJv/jbHDpyrzo903bfMos2tmYaypWrUeQ1RA3WvdKzjceYDilEs7vXA7w94n8FHOLjxdT0t5GX8TqrNV1eQ2cFkOHj2BcDDG@BrelW65eGtNA1TK4QTIec/aS1gl0dCk62oPag@FEd1UC3N/wCprAaQ9YAhgMl87SGFlJfzIR3f39AOZdwJRW@/3F558N@9@NB79Pnw6Pjk9MvZ@cXl1@vvn2/BhLF2FuDIbv9yUdCpv8pneXjyXR29z8 "Assembly (nasm, x64, Linux) – Try It Online") with a test caller that does strlen on a command line arg and uses a write() system call afterward)
```
global vowel_up_consonant_down
theloop:
                                             ; consonant bitmap
    ;          ZYXWVUTSRQPONMLKJIHGFEDCBA@    For indexing with ASCII c&31 directly
    mov   eax, 111110111110111110111011101b << 5   ; line up with the lcase bit
                                             ; the low bit is 1 to preserve 0x20 ' '
    shr   eax, cl               ; AL & 0x20 is how the lowercase bit *should* be set
    xor   al, cl                ; bitdiff = (mask>>c) & c
    and   al, 0x20              ; isolate the lowercase bit
    xor   al, cl                ; flip the lcase bit if needed
    stosb                       ; and store
vowel_up_consonant_down:
    mov   cl, [rdi]
    test  cl, cl
    jnz  theloop               ; }while(c != 0)
    ret
```
---
## Variants
### no spaces: 19 bytes
If we didn't need to handle spaces (ASCII 0x20), we enter the function at the top, with the `mov cl, [rdi]` load at the top, but still leave the loop condition at the bottom. So we'd load and re-store the terminating `0`, and the XOR that produced it would set ZF. The low bit of the bitmap would be 0 instead of 1.
```
vucd_pure_alphabetic:
.loop:
    mov   cl, [rdi]
   ...               ; same, but with bitmap[0] => 0
    xor   al,cl
    jnz  .loop       ; mask>>0 leave the terminating 0 unmodified; xor sets ZF
```
### Upper-case-only input, like the A to Z in the question indicates: 19 bytes
(Or 17 without spaces either.)
If we can assume the lower-case bit was already cleared on input ASCII bytes, we can save one XOR (and change the other one to an OR)
```
    ...
    shr   eax, cl
    and   al, 0x20
    or    al, cl
    ...
```
---
### Using the `bt` instruction:
Normally testing a bitmap is a job for the `bt` instruction, but where we're not branching on the result, it turns out to be cheaper to shift it, even though that means we can't easily use the `loop` instruction. (I haven't gone back to this idea to re-golf it after realizing we need to handle spaces).
I suspect there's room for more golfing, but the first version of this I tried was
```
vucd:
.loop:
    mov   dl, [rdi]
    ;          ZYXWVUTSRQPONMLKJIHGFEDCBA@    1-indexed using ASCII codes directly
    mov   esi, 111110111110111110111011101b   ; consonant/vowel bitmap for use with bt
    bt    esi, edx              ; CF = mask & (1U << (c&31))
%if CPUMODE == 32
    salc                        ; 1B   only sets AL = 0 or 0xFF.  Not available in 64-bit mode
%else
    sbb   eax, eax              ; 2B   eax = 0 or -1, according to CF.
%endif
    xor   al, dl
    and   al, 0x20              ; just the lowercase bit
    xor   al, dl
    loop .loop
    ret
```
Not re-tested after tweaking to handle spaces.
`bt` + `salc` in 32-bit mode costs the same as `shr reg,cl` + the extra `test cl,cl` that's needed because we can't use `loop`. So I think this is also 21 bytes. But 32-bit mode explicit-length can just `dec/jnz` a reg other than `cl` for a 20-byte total.
`mov esi, imm32` can be hoisted out of the loop, or we can use EAX. Neither affects byte count, only efficiency or the calling-convention.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 33 bytes
```
->s{s.downcase.tr"aeiou","AEIOU"}
```
Straightforward solution: downcase everything, then upcase vowels.
[Try it online!](https://tio.run/##TcrLCoJAFIDhfU9xOOvyDQoM71oSFkXhwstIgnmmGUebomefaBG0/b9fqFKbZmkWK/mSVk1TXxWSWYPAgrWkcI62G6YHfBuuBgnNBQPWdQRHEl2N@exX7xMTg1YtcbAzx/ODKE7g@ajGsr/9bfurCzsVVjGsRTptwaMTRGrDM0hHV8CXk@KswSEfc/MB "Ruby – Try It Online")
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 9 bytes
```
T`vVL`VVl
```
[Try it online!](https://tio.run/##K0otycxLNPz/PyShLMwnISws5/9/j9ScnHyF8PyinBQA "Retina – Try It Online") Explanation:
```
T`v`V
```
Lowercase vowels get uppercased.
```
T`V`V
```
Uppercase vowels also get uppercased, to avoid being matched later.
```
T`L`l
```
All other uppercase letters get lowercased.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~75~~ \$\cdots\$~~72~~ 71 bytes
Added 4 bytes to fixed a bug.  
Saved a byte thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)!!! 
```
u;f(char*s){for(;*s;*s++=u-65&&u-69&&u-73&&u-79&&u-85?*s|32:u)u=*s&95;}
```
[Try it online!](https://tio.run/##S9ZNT07@/7/UOk0jOSOxSKtYszotv0jDWqsYiLS1bUt1zUzV1ICkJYg0NwaTYLaFqb1WcY2xkVWpZqmtVrGapal17f/cxMw8Dc1qLpBZChnRsbZKHqk5OfkK4f5FOSlK1hDxkmhDo1hrrtzU3OSCSo0SnQwdQyNNa66Cosy8kjQNJdViBV07BSWdEqBYmkYJikxMHkS89j/U3HyguQA "C (gcc) – Try It Online")
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~58~~ \$\cdots\$ 58 bytes
```
f(char*s){for(;*s;)*s++=index("aeiou",*s|32)?*s&95:*s|32;}
```
I tried to find a pattern in the vowels' representations using the modulo operator but nothing short enough. Instead, use `strchr`.
*Fixed a bug kindly pointed out by [Noodle9](https://codegolf.stackexchange.com/users/9481/noodle9) at the cost of 3 bytes.*  
*-1 byte thanks to [Noodle9](https://codegolf.stackexchange.com/users/9481/noodle9)!*  
*-1 byte thanks to [Surculose Sputum](https://codegolf.stackexchange.com/users/92237/surculose-sputum)!*  
*-1 byte thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)!*
[Try it online!](https://tio.run/##S9ZNT07@/z9NIzkjsUirWLM6Lb9Iw1qr2FpTq1hb2zYzLyW1QkMpMTUzv1RJR6u4xthI016rWM3S1ArMsa79n5lXopCbmJmnUZafmaLJVc2lAAQg0xQyUnNy8qNjFWwVlDxATIVw/6KcFAWwYQqOrp7@oUrWYNVpGmClmhBeQWlJMVyg9j8A "C (gcc) – Try It Online")
[Answer]
# x86 platform-independent machine code, 46 bytes.
Expects the string pointer to be passed in `eax`, trashes `ebx` and `edx`.
Entry point is located at 0x26.
Hex dump:
```
BA 22 82 20 00 D3 EA F6 C2 01 74 0B 8D
51 9F 83 FA 19 8D 59 E0 EB 09 8D 51 BF
83 FA 19 8D 59 20 0F 46 CB 88 08 40 0F
BE 08 85 C9 75 D3 C3
```
Disassembly:
```
00000000  BA22822000        mov edx,0x208222
00000005  D3EA              shr edx,cl
00000007  F6C201            test dl,0x1
0000000A  740B              jz 0x17
0000000C  8D519F            lea edx,[ecx-0x61]
0000000F  83FA19            cmp edx,byte +0x19
00000012  8D59E0            lea ebx,[ecx-0x20]
00000015  EB09              jmp short 0x20
00000017  8D51BF            lea edx,[ecx-0x41]
0000001A  83FA19            cmp edx,byte +0x19
0000001D  8D5920            lea ebx,[ecx+0x20]
00000020  0F46CB            cmovna ecx,ebx
00000023  8808              mov [eax],cl
00000025  40                inc eax
00000026  0FBE08            movsx ecx,byte [eax]
00000029  85C9              test ecx,ecx
0000002B  75D3              jnz 0x0
0000002D  C3                ret
```
byte count = 0x2E = 46
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~9~~ 6 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
Saved 3 using [Luis Mendo's CJam approach](https://codegolf.stackexchange.com/a/201519/53748)
```
lžMDu‡
```
**[Try it online!](https://tio.run/##yy9OTMpM/f8/5@g@X5fSRw0L///3SM3JyVcIzy/KSdFRcPT3tgcA "05AB1E – Try It Online")** (Footer formats the resulting list of characters as a plain string)
### How?
```
lžMDu‡         e.g. input="LowEr"  stack: []
l      - push lower-case (input)          ["lower"]
 žM    - push lower-case vowels           ["aeiou", "lower"]
   D   - duplicate                        ["aeiou", "aeiou", "lower"]
    u  - upper-case                       ["AEIOU", "aeiou", "lower"]
     ‡ - transliterate                    ["lOwEr"]
       - implicit print                   lOwEr
```
[Answer]
# [Io](http://iolanguage.org/), 72 bytes
Takes input as a special format.
```
method(x,x map(i,if("aeiou"containsSeq(i),i asUppercase,i asLowercase)))
```
[Try it online!](https://tio.run/##LcyxCgIxEATQX1m22oV8gWBvYSdiYxMuKy7ksjHJcff3MWiKBzNTjFrfcrA9wekMz75Ke1ugwx2w@kzq9EXoRW3DxVLzmupNPqTsFHy95yxl8VV@7Wr7vzHzPKWotRFe0KEMcbIBhsfMZe4BmSEXTS2m/gU "Io – Try It Online")
[Answer]
# [Red](http://www.red-lang.org), ~~83~~ 82 bytes
```
func[s][v: charset"aoeiu"parse lowercase s[any[to v change t: v(uppercase t/1)]]s]
```
[Try it online!](https://tio.run/##PYq7CgIxEAD7@4plK63ENq2F1jYWIUVINnqwZMPmcfj10QOxmxlGKc47ReuWZGbqOdjq7DAQXl4rNfRCa8eyC7BspMF/qVqf37YJjH3MT4JmYBx6Kb@hnc5H56qbRdfcIAHeiFngIcoRl3@9SCS4CiecHw "Red – Try It Online")
[Answer]
# [Javascript (V8)](https://v8.dev/), 97 bytes
```
s=>[...s].map(c=>{t="aeiouAEIOU";return(t.includes(c)?c.toUpperCase():c.toLowerCase())}).join('')
```
Takes a string, iterate over every chars and check if the char is a vowel. If so return the char in uppercase, otherwise in lowercase. Then join the return of the map with a void char.
* First post/answer here, if you see some errors or missed case, or just want to improve my code feel free to do so
[Answer]
# [Haskell](https://www.haskell.org/), 68 bytes
```
import Data.Char
f=map(g.toLower)
g x|x`elem`"aeiou"=toUpper x|1<2=x
```
[Try it online!](https://tio.run/##DcnLEoIgFADQvV/BMC1q00ytY1Ha297Za@WtUEkQQkxq@nfqbE8GZU45d44JJbVBARho@xloLyECVDNtGxnKmuqWlyL7tTHlVMQYKJMVJkZGSlH9j06vS6wTwAqiNCtMI0EYrrc7TdKMPXIuCqmeujTVq7bvD@oP/GA4Gk@ms3m4WK7Wm@1uHx1Ox/MFux8 "Haskell – Try It Online")
[Answer]
# [JavaScript (V8)](https://v8.dev/), 93...77 bytes
Log:
* -5 bytes thanks to @Benji
* -14 bytes: switched to case insensitive matching and `.test()`
```
s=>[...s].map(c=>/[aeiou]/i.test(c)?c.toUpperCase():c.toLowerCase()).join('')
```
[Try it online!](https://tio.run/##bY/ZVsIwFEXf/QpwaqISnEW0IJOCMs/QgpY0xdbSpE0YHX69Vpe8uHg86@519rmWNtM49kwmIrOYb8g@lxMKQogP0ERjAMuJqKIRk04HURMJwgXAMImRoC3GiJfROAEw/pOLdL7OEFnUdIAkQR9Th1ObIJuOgQGkPLFtGupQz9bDEoRb/86/InfuiSXjujF@td7s1QLPRs5kEzzCOgkgM6AmDmWux8V0vliuQql0Jpu7f8gXHp@KpXKlWqs3mq12p9vrb6h5OTk9O7@4vIpdH0dkN/hBLKcmZcpAVbX1iBtV@ttxhKJf4bud3b3h/gGAz4e1Tq7e7LUKler750eqkQ2sgTS@3e9m2uly6TaRDJT@Nw "JavaScript (V8) – Try It Online")
```
s=> // es6 arrow function
    [...s]. // split input string into array
        map(c => // another es6 arrow function, this time for a callback iterating over the array
             /[aeiou]/i // case insensitive regex
                .test(c)? // use a ternary operator to check if the character matches the regex
                    c.toUpperCase(): // if true return character to uppercase
                        c.toLowerCase()) // otherwise return lowercase
                            .join('') // join the array back into a string
```
Methods mentioned:
* [arrow function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions)
* [ternary operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator)
[Answer]
# [Japt](https://github.com/ETHproductions/japt) v2.0a0 ~~[`-m`](https://codegolf.meta.stackexchange.com/a/14339/)~~, ~~10~~ 7 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
u r\c_v
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=2.0a0&code=dSByXGNfdg&input=IkhlbGxvIFdvcmxkIg)
[Answer]
# [Python 3](https://docs.python.org/3/), 50 bytes
```
lambda s:bytes(c^(c^~68174912>>c%32)&32for c in s)
```
[Try it online!](https://tio.run/##DcJZC4IwAADg937FEIoN7EGNLlDovu87InDqcqXT3LTsob@@@vjiXPgRMyQxLzKwQ@zagDdxLjwOnev/t1rXapWGpluWUzR0VDJ0EiXAAZQBjiQ3vcwOIGVxKiBChTihTECuAqVsKSogkCMksWJjx/XIzaf3RxCyKH4mXKTZ651/QKvd6fb6g@FoPJnO5ovlar3Z7vbHw@ms/AA "Python 3 – Try It Online")
Port of [Arnauld's JS answer](https://codegolf.stackexchange.com/a/201521/78410) using bytes object in Python. Because Python's `>>` does not imply `%32` on its right argument, it must be done manually.
[Answer]
# T-SQL, 48 bytes
```
SELECT TRANSLATE(LOWER(v),'aeiou','AEIOU')FROM t
```
Takes input from a pre-existing table *t* with varchar column *v*, [per our IO rules](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods/5341#5341).
Converts the entire string to lowercase, then makes just the vowels uppercase. The function [`TRANSLATE`](https://docs.microsoft.com/en-us/sql/t-sql/functions/translate-transact-sql?view=sql-server-2017) works in SQL 2017 and later.
[Answer]
# [K4](https://kx.com/download/), 24 bytes
**Solution:**
```
.q.ssr/[;_v;v:"AEIOU"]@_
```
**Explanation:**
Replace each lowercase vowel with the uppercase equivalent.
```
.q.ssr/[;_v;v:"AEIOU"]@_ / the solution
                       _ / lowercase
                      @  / apply
.q.ssr/[;  ;         ]   / search/replace, iterate over vowels
            v:"AEIOU"    / store uppercase vowels as 'v'
         _v              / lowercase vowels
```
[Answer]
# [K (oK)](https://github.com/JohnEarnest/ok), ~~27~~ ~~23~~ 21 bytes
**Solution:**
```
`c$x-32*~^"aeiou"?x:_
```
[Try it online!](https://tio.run/##y9bNz/7/PyFZpULX2EirLk4pMTUzv1TJvsIqXikxKTklNS09IzMrOyc3L7@gsKi4pLSsvKKySsHRydnF1c3dw9PL28fXzz8gMCg4JDQsIjwySun/fwA "K (oK) – Try It Online")
**Explanation:**
Even nicer approach thanks to @ngn... either substract 0 or 32 from the input based on whether or not it's a vowel:
```
`c$x-32*~^"aeiou"?x:_ / the solution
                    _ / lowercase input
                  x:  / store as 'x'
          "aeiou"?    / lookup input in "aeiou" else null
         ^            / is null?
        ~             / not
    -32*              / multiply boolean list by -32 (yields 0 or -32)
   x                  / subtract from x
`c$                   / cast back to characters
```
**Notes:**
* **-6 bytes** thanks to @ngn
[Answer]
# [Julia](https://julialang.org) 49 bytes
## [Try it!](https://tio.run/##BcFBCoAgEADAryyeFDSobkHWsR90lk3J2NpQxH5vM1eh6PqvhbmRsbd7JRobH4laOB@5CAULoBkHmAA1cfUJXfadJKXamk@uEKTYPBHDzokOodoP)
```
f=l->map(c->in(c,"aeiou") ? c-32 : c,lowercase.(l))
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 20 bytes
```
K"aeiou"smrd}d+KrK1w
```
[Try it online!](https://tio.run/##K6gsyfj/31spMTUzv1SpOLcopTZF27vI27D8//@SjFSFwFBPZ2@FpKL88jwFN/8IhazS3IJiBf8w1yAFkLSPY1SkQkp@OgA "Pyth – Try It Online")
# Explanation
```
                       w=input()
K"aeiou"               K="aeiou"
        s              "".join(
         m              map(
          r              lambda d:r(
           d              d,
             d             d
            }             in
               K           K
              +            +
                 rK1       K.upper())),
                    w    w)
```
]