#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
unsigned char toupper(unsigned char);
unsigned char cctoupper(unsigned char c) {
  if (c >= 'a' && c <= 'z')
    return toupper(c);
  switch (c) {
  case 0x7e:
    return 0x7d;
  case 0x2a:
    return 0x90;
  case 0x5c:
    return 0x91;
  case 0x5e:
    return 0xb2;
  case 0x5f:
    return 0x92;
  case 0x60:
    return 0x93;
  case 0x7b:
    return 0xa2;
  case 0x88:
    return 0xa0;
  case 0x8a:
    return 0xa3;
  case 0x8b:
    return 0xa1;
  case 0x8c:
    return 0xa4;
  case 0x8d:
    return 0xa7;
  case 0x8e:
    return 0xaa;
  case 0x8f:
    return 0xad;
  case 0x95:
    return 0x94;
  case 0xa6:
    return 0xa5;
  case 0xa9:
    return 0xa8;
  case 0xac:
    return 0xab;
  case 0xb1:
    return 0xb0;
  case 0xb4:
    return 0xb3;
  case 0xb6:
    return 0xb5;
  case 0xb8:
    return 0xb7;
  case 0xc1:
    return 0xc0;
  case 0xc3:
    return 0xc2;
  case 0xc9:
    return 0xc8;
  case 0xcb:
    return 0xca;
  }
  return c;
}


x86 assembly (clang, -O0):
<cctoupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0x61,%eax
jl     1149 <cctoupper+0x39>
movzbl -0x2(%rbp),%eax
cmp    $0x7a,%eax
jg     1149 <cctoupper+0x39>
movzbl -0x2(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movzbl -0x2(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xa1,%eax
ja     125f <cctoupper+0x14f>
mov    -0x10(%rbp),%rax
lea    0xe94(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x7d,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0x90,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0x91,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xb2,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0x92,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0x93,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xa2,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xa0,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xa3,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xa1,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xa4,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xa7,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xaa,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xad,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0x94,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xa5,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xa8,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xab,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xb0,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xb3,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xb5,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xb7,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xc0,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xc2,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xc8,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
movb   $0xca,-0x1(%rbp)
jmp    1265 <cctoupper+0x155>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cctoupper>:
lea    -0x61(%rdi),%eax
cmp    $0x19,%al
ja     1120 <cctoupper+0x10>
movzbl %dil,%edi
jmp    1030 <toupper@plt>
lea    0x78(%rdi),%ecx
cmp    $0xf6,%cl
ja     1140 <cctoupper+0x30>
mov    $0x7d,%al
movzbl %cl,%ecx
lea    0xecc(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0xa0,%al
ret
mov    %edi,%eax
ret
mov    $0xa3,%al
ret
mov    $0xa1,%al
ret
mov    $0xa4,%al
ret
mov    $0xa7,%al
ret
mov    $0xaa,%al
ret
mov    $0xad,%al
ret
mov    $0x94,%al
ret
mov    $0xa5,%al
ret
mov    $0xa8,%al
ret
mov    $0xab,%al
ret
mov    $0xb0,%al
ret
mov    $0xb3,%al
ret
mov    $0xb5,%al
ret
mov    $0xb7,%al
ret
mov    $0xc0,%al
ret
mov    $0xc2,%al
ret
mov    $0xc8,%al
ret
mov    $0xca,%al
ret
mov    $0x90,%al
ret
mov    $0x91,%al
ret
mov    $0xb2,%al
ret
mov    $0x92,%al
ret
mov    $0x93,%al
ret
mov    $0xa2,%al
ret

LLVM IR (-O0):
define zeroext i8 @cctoupper(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = icmp sle i32 %9, 122
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i8, i8* %3
%13 = call zeroext i8 @toupper(i8 zeroext %12)
store i8 %13, i8* %2
br label %45
14: ; preds = %7, %1
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
switch i32 %16, label %43 [
i32 126, label %17
i32 42, label %18
i32 92, label %19
i32 94, label %20
i32 95, label %21
i32 96, label %22
i32 123, label %23
i32 136, label %24
i32 138, label %25
i32 139, label %26
i32 140, label %27
i32 141, label %28
i32 142, label %29
i32 143, label %30
i32 149, label %31
i32 166, label %32
i32 169, label %33
i32 172, label %34
i32 177, label %35
i32 180, label %36
i32 182, label %37
i32 184, label %38
i32 193, label %39
i32 195, label %40
i32 201, label %41
i32 203, label %42
]
17: ; preds = %14
store i8 125, i8* %2
br label %45
18: ; preds = %14
store i8 -112, i8* %2
br label %45
19: ; preds = %14
store i8 -111, i8* %2
br label %45
20: ; preds = %14
store i8 -78, i8* %2
br label %45
21: ; preds = %14
store i8 -110, i8* %2
br label %45
22: ; preds = %14
store i8 -109, i8* %2
br label %45
23: ; preds = %14
store i8 -94, i8* %2
br label %45
24: ; preds = %14
store i8 -96, i8* %2
br label %45
25: ; preds = %14
store i8 -93, i8* %2
br label %45
26: ; preds = %14
store i8 -95, i8* %2
br label %45
27: ; preds = %14
store i8 -92, i8* %2
br label %45
28: ; preds = %14
store i8 -89, i8* %2
br label %45
29: ; preds = %14
store i8 -86, i8* %2
br label %45
30: ; preds = %14
store i8 -83, i8* %2
br label %45
31: ; preds = %14
store i8 -108, i8* %2
br label %45
32: ; preds = %14
store i8 -91, i8* %2
br label %45
33: ; preds = %14
store i8 -88, i8* %2
br label %45
34: ; preds = %14
store i8 -85, i8* %2
br label %45
35: ; preds = %14
store i8 -80, i8* %2
br label %45
36: ; preds = %14
store i8 -77, i8* %2
br label %45
37: ; preds = %14
store i8 -75, i8* %2
br label %45
38: ; preds = %14
store i8 -73, i8* %2
br label %45
39: ; preds = %14
store i8 -64, i8* %2
br label %45
40: ; preds = %14
store i8 -62, i8* %2
br label %45
41: ; preds = %14
store i8 -56, i8* %2
br label %45
42: ; preds = %14
store i8 -54, i8* %2
br label %45
43: ; preds = %14
%44 = load i8, i8* %3
store i8 %44, i8* %2
br label %45
45: ; preds = %43, %42, %41, %40, %39, %38, %37, %36, %35, %34, %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %11
%46 = load i8, i8* %2
ret i8 %46
}

LLVM IR (-O2):
define zeroext i8 @cctoupper(i8 zeroext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call zeroext i8 @toupper(i8 zeroext %0)
br label %33
6: ; preds = %1
switch i8 %0, label %32 [
i8 126, label %33
i8 42, label %7
i8 92, label %8
i8 94, label %9
i8 95, label %10
i8 96, label %11
i8 123, label %12
i8 -120, label %13
i8 -118, label %14
i8 -117, label %15
i8 -116, label %16
i8 -115, label %17
i8 -114, label %18
i8 -113, label %19
i8 -107, label %20
i8 -90, label %21
i8 -87, label %22
i8 -84, label %23
i8 -79, label %24
i8 -76, label %25
i8 -74, label %26
i8 -72, label %27
i8 -63, label %28
i8 -61, label %29
i8 -55, label %30
i8 -53, label %31
]
7: ; preds = %6
br label %33
8: ; preds = %6
br label %33
9: ; preds = %6
br label %33
10: ; preds = %6
br label %33
11: ; preds = %6
br label %33
12: ; preds = %6
br label %33
13: ; preds = %6
br label %33
14: ; preds = %6
br label %33
15: ; preds = %6
br label %33
16: ; preds = %6
br label %33
17: ; preds = %6
br label %33
18: ; preds = %6
br label %33
19: ; preds = %6
br label %33
20: ; preds = %6
br label %33
21: ; preds = %6
br label %33
22: ; preds = %6
br label %33
23: ; preds = %6
br label %33
24: ; preds = %6
br label %33
25: ; preds = %6
br label %33
26: ; preds = %6
br label %33
27: ; preds = %6
br label %33
28: ; preds = %6
br label %33
29: ; preds = %6
br label %33
30: ; preds = %6
br label %33
31: ; preds = %6
br label %33
32: ; preds = %6
br label %33
33: ; preds = %6, %32, %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, %4
%34 = phi i8 [ %5, %4 ], [ %0, %32 ], [ -54, %31 ], [ -56, %30 ], [ -62, %29 ], [ -64, %28 ], [ -73, %27 ], [ -75, %26 ], [ -77, %25 ], [ -80, %24 ], [ -85, %23 ], [ -88, %22 ], [ -91, %21 ], [ -108, %20 ], [ -83, %19 ], [ -86, %18 ], [ -89, %17 ], [ -92, %16 ], [ -95, %15 ], [ -93, %14 ], [ -96, %13 ], [ -94, %12 ], [ -109, %11 ], [ -110, %10 ], [ -78, %9 ], [ -111, %8 ], [ -112, %7 ], [ 125, %6 ]
ret i8 %34
}