#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 */
scalar_t__ islower(int);
int toupper(int c) {
  if (islower(c)) {
    if (c == 168)
      return (c = 166);
    else if (c == 184)
      return (c = 180);
    else if (c == 189)
      return (c = 188);
    else if (c == 255)
      return (c = 190);
    else
      return (c - 32);
  } else
    return (c);
}


x86 assembly (clang, -O0):
<toupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     11bb <toupper+0xab>
cmpl   $0xa8,-0x8(%rbp)
jne    114d <toupper+0x3d>
movl   $0xa6,-0x8(%rbp)
movl   $0xa6,-0x4(%rbp)
jmp    11c1 <toupper+0xb1>
cmpl   $0xb8,-0x8(%rbp)
jne    116d <toupper+0x5d>
movl   $0xb4,-0x8(%rbp)
movl   $0xb4,-0x4(%rbp)
jmp    11c1 <toupper+0xb1>
cmpl   $0xbd,-0x8(%rbp)
jne    118d <toupper+0x7d>
movl   $0xbc,-0x8(%rbp)
movl   $0xbc,-0x4(%rbp)
jmp    11c1 <toupper+0xb1>
cmpl   $0xff,-0x8(%rbp)
jne    11ad <toupper+0x9d>
movl   $0xbe,-0x8(%rbp)
movl   $0xbe,-0x4(%rbp)
jmp    11c1 <toupper+0xb1>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    11c1 <toupper+0xb1>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toupper>:
push   %rbx
mov    %edi,%ebx
call   1030 <islower@plt>
test   %rax,%rax
je     1164 <toupper+0x54>
cmp    $0xbc,%ebx
jg     113c <toupper+0x2c>
cmp    $0xa8,%ebx
je     1158 <toupper+0x48>
cmp    $0xb8,%ebx
jne    1153 <toupper+0x43>
mov    $0xb4,%ebx
jmp    1164 <toupper+0x54>
cmp    $0xbd,%ebx
je     115f <toupper+0x4f>
cmp    $0xff,%ebx
jne    1153 <toupper+0x43>
mov    $0xbe,%ebx
jmp    1164 <toupper+0x54>
add    $0xffffffe0,%ebx
jmp    1164 <toupper+0x54>
mov    $0xa6,%ebx
jmp    1164 <toupper+0x54>
mov    $0xbc,%ebx
mov    %ebx,%eax
pop    %rbx
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
%5 = call i64 @islower(i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %26
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 168
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 166, i32* %3
store i32 166, i32* %2
br label %28
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 184
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 180, i32* %3
store i32 180, i32* %2
br label %28
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 189
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 188, i32* %3
store i32 188, i32* %2
br label %28
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 255
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 190, i32* %3
store i32 190, i32* %2
br label %28
23: ; preds = %19
%24 = load i32, i32* %3
%25 = sub nsw i32 %24, 32
store i32 %25, i32* %2
br label %28
26: ; preds = %1
%27 = load i32, i32* %3
store i32 %27, i32* %2
br label %28
28: ; preds = %26, %23, %22, %18, %14, %10
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @toupper(i32 %0) {
%2 = tail call i64 @islower(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %1
switch i32 %0, label %8 [
i32 168, label %10
i32 184, label %5
i32 189, label %6
i32 255, label %7
]
5: ; preds = %4
br label %10
6: ; preds = %4
br label %10
7: ; preds = %4
br label %10
8: ; preds = %4
%9 = add nsw i32 %0, -32
br label %10
10: ; preds = %1, %4, %8, %7, %6, %5
%11 = phi i32 [ 180, %5 ], [ 188, %6 ], [ 190, %7 ], [ %9, %8 ], [ 166, %4 ], [ %0, %1 ]
ret i32 %11
}