int toupper(int c) {
  switch (c) {
  case 'a':
    return 'A';
  case 'b':
    return 'B';
  case 'c':
    return 'C';
  case 'd':
    return 'D';
  case 'e':
    return 'E';
  case 'f':
    return 'F';
  case 'g':
    return 'G';
  case 'h':
    return 'H';
  case 'i':
    return 'I';
  case 'j':
    return 'J';
  case 'k':
    return 'K';
  case 'l':
    return 'L';
  case 'm':
    return 'M';
  case 'n':
    return 'N';
  case 'o':
    return 'O';
  case 'p':
    return 'P';
  case 'q':
    return 'Q';
  case 'r':
    return 'R';
  case 's':
    return 'S';
  case 't':
    return 'T';
  case 'u':
    return 'U';
  case 'v':
    return 'V';
  case 'w':
    return 'W';
  case 'x':
    return 'X';
  case 'y':
    return 'Y';
  case 'z':
    return 'Z';
  default:
    return c;
  }
}


x86 assembly (clang, -O0):
<toupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x19,%eax
ja     1268 <toupper+0x168>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x41,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x42,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x43,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x44,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x45,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x46,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x47,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x48,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x49,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x4a,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x4b,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x4c,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x4d,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x4e,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x4f,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x50,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x51,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x52,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x53,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x54,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x55,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x56,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x57,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x58,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x59,-0x4(%rbp)
jmp    126e <toupper+0x16e>
movl   $0x5a,-0x4(%rbp)
jmp    126e <toupper+0x16e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toupper>:
lea    -0x61(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @toupper(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %31 [
i32 97, label %5
i32 98, label %6
i32 99, label %7
i32 100, label %8
i32 101, label %9
i32 102, label %10
i32 103, label %11
i32 104, label %12
i32 105, label %13
i32 106, label %14
i32 107, label %15
i32 108, label %16
i32 109, label %17
i32 110, label %18
i32 111, label %19
i32 112, label %20
i32 113, label %21
i32 114, label %22
i32 115, label %23
i32 116, label %24
i32 117, label %25
i32 118, label %26
i32 119, label %27
i32 120, label %28
i32 121, label %29
i32 122, label %30
]
5: ; preds = %1
store i32 65, i32* %2
br label %33
6: ; preds = %1
store i32 66, i32* %2
br label %33
7: ; preds = %1
store i32 67, i32* %2
br label %33
8: ; preds = %1
store i32 68, i32* %2
br label %33
9: ; preds = %1
store i32 69, i32* %2
br label %33
10: ; preds = %1
store i32 70, i32* %2
br label %33
11: ; preds = %1
store i32 71, i32* %2
br label %33
12: ; preds = %1
store i32 72, i32* %2
br label %33
13: ; preds = %1
store i32 73, i32* %2
br label %33
14: ; preds = %1
store i32 74, i32* %2
br label %33
15: ; preds = %1
store i32 75, i32* %2
br label %33
16: ; preds = %1
store i32 76, i32* %2
br label %33
17: ; preds = %1
store i32 77, i32* %2
br label %33
18: ; preds = %1
store i32 78, i32* %2
br label %33
19: ; preds = %1
store i32 79, i32* %2
br label %33
20: ; preds = %1
store i32 80, i32* %2
br label %33
21: ; preds = %1
store i32 81, i32* %2
br label %33
22: ; preds = %1
store i32 82, i32* %2
br label %33
23: ; preds = %1
store i32 83, i32* %2
br label %33
24: ; preds = %1
store i32 84, i32* %2
br label %33
25: ; preds = %1
store i32 85, i32* %2
br label %33
26: ; preds = %1
store i32 86, i32* %2
br label %33
27: ; preds = %1
store i32 87, i32* %2
br label %33
28: ; preds = %1
store i32 88, i32* %2
br label %33
29: ; preds = %1
store i32 89, i32* %2
br label %33
30: ; preds = %1
store i32 90, i32* %2
br label %33
31: ; preds = %1
%32 = load i32, i32* %3
store i32 %32, i32* %2
br label %33
33: ; preds = %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @toupper(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}