#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__ in(int, int, int);
int u8toupper(int chr) {
  if (in(chr, 0x61, 0x7A) || in(chr, 0xE0, 0xFE) || in(chr, 0x3B1, 0x3C9) ||
      in(chr, 0x430, 0x44F))
    return chr - 32;
  if (in(chr, 0x450, 0x45F))
    return chr - 0x50;
  if (in(chr, 0x101, 0x17E) && chr % 2 == 1)
    return chr - 1;
  if ((in(chr, 0x461, 0x481) || in(chr, 0x48B, 0x52F)) && chr % 2 == 1)
    return chr - 1;
  return chr;
}


x86 assembly (clang, -O0):
<u8toupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x61,%esi
mov    $0x7a,%edx
call   1030 <in@plt>
cmp    $0x0,%rax
jne    118b <u8toupper+0x7b>
mov    -0x8(%rbp),%edi
mov    $0xe0,%esi
mov    $0xfe,%edx
call   1030 <in@plt>
cmp    $0x0,%rax
jne    118b <u8toupper+0x7b>
mov    -0x8(%rbp),%edi
mov    $0x3b1,%esi
mov    $0x3c9,%edx
call   1030 <in@plt>
cmp    $0x0,%rax
jne    118b <u8toupper+0x7b>
mov    -0x8(%rbp),%edi
mov    $0x430,%esi
mov    $0x44f,%edx
call   1030 <in@plt>
cmp    $0x0,%rax
je     1199 <u8toupper+0x89>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    1261 <u8toupper+0x151>
mov    -0x8(%rbp),%edi
mov    $0x450,%esi
mov    $0x45f,%edx
call   1030 <in@plt>
cmp    $0x0,%rax
je     11c3 <u8toupper+0xb3>
mov    -0x8(%rbp),%eax
sub    $0x50,%eax
mov    %eax,-0x4(%rbp)
jmp    1261 <u8toupper+0x151>
mov    -0x8(%rbp),%edi
mov    $0x101,%esi
mov    $0x17e,%edx
call   1030 <in@plt>
cmp    $0x0,%rax
je     1201 <u8toupper+0xf1>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    1201 <u8toupper+0xf1>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1261 <u8toupper+0x151>
mov    -0x8(%rbp),%edi
mov    $0x461,%esi
mov    $0x481,%edx
call   1030 <in@plt>
cmp    $0x0,%rax
jne    1239 <u8toupper+0x129>
mov    -0x8(%rbp),%edi
mov    $0x48b,%esi
mov    $0x52f,%edx
call   1030 <in@plt>
cmp    $0x0,%rax
je     125b <u8toupper+0x14b>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    125b <u8toupper+0x14b>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1261 <u8toupper+0x151>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<u8toupper>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x61,%esi
mov    $0x7a,%edx
call   1030 <in@plt>
test   %rax,%rax
jne    116b <u8toupper+0x5b>
mov    %ebx,%edi
mov    $0xe0,%esi
mov    $0xfe,%edx
call   1030 <in@plt>
test   %rax,%rax
jne    116b <u8toupper+0x5b>
mov    %ebx,%edi
mov    $0x3b1,%esi
mov    $0x3c9,%edx
call   1030 <in@plt>
test   %rax,%rax
jne    116b <u8toupper+0x5b>
mov    %ebx,%edi
mov    $0x430,%esi
mov    $0x44f,%edx
call   1030 <in@plt>
test   %rax,%rax
je     1177 <u8toupper+0x67>
add    $0xffffffe0,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %ebx,%edi
mov    $0x450,%esi
mov    $0x45f,%edx
call   1030 <in@plt>
test   %rax,%rax
je     1192 <u8toupper+0x82>
add    $0xffffffb0,%ebx
jmp    116e <u8toupper+0x5e>
mov    %ebx,%edi
mov    $0x101,%esi
mov    $0x17e,%edx
call   1030 <in@plt>
mov    %ebx,%ecx
shr    $0x1f,%ecx
add    %ebx,%ecx
and    $0xfffffffe,%ecx
mov    %ebx,%ebp
sub    %ecx,%ebp
cmp    $0x1,%ebp
jne    11bb <u8toupper+0xab>
test   %rax,%rax
jne    11f7 <u8toupper+0xe7>
mov    %ebx,%edi
mov    $0x461,%esi
mov    $0x481,%edx
call   1030 <in@plt>
test   %rax,%rax
je     11d8 <u8toupper+0xc8>
cmp    $0x1,%ebp
jne    116e <u8toupper+0x5e>
jmp    11f7 <u8toupper+0xe7>
mov    %ebx,%edi
mov    $0x48b,%esi
mov    $0x52f,%edx
call   1030 <in@plt>
cmp    $0x1,%ebp
jne    116e <u8toupper+0x5e>
test   %rax,%rax
je     116e <u8toupper+0x5e>
add    $0xffffffff,%ebx
jmp    116e <u8toupper+0x5e>

LLVM IR (-O0):
define i32 @u8toupper(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @in(i32 %4, i32 97, i32 122)
%6 = icmp ne i64 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = call i64 @in(i32 %8, i32 224, i32 254)
%10 = icmp ne i64 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = call i64 @in(i32 %12, i32 945, i32 969)
%14 = icmp ne i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %11
%16 = load i32, i32* %3
%17 = call i64 @in(i32 %16, i32 1072, i32 1103)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15, %11, %7, %1
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 32
store i32 %21, i32* %2
br label %57
22: ; preds = %15
%23 = load i32, i32* %3
%24 = call i64 @in(i32 %23, i32 1104, i32 1119)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i32, i32* %3
%28 = sub nsw i32 %27, 80
store i32 %28, i32* %2
br label %57
29: ; preds = %22
%30 = load i32, i32* %3
%31 = call i64 @in(i32 %30, i32 257, i32 382)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %40
33: ; preds = %29
%34 = load i32, i32* %3
%35 = srem i32 %34, 2
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = load i32, i32* %3
%39 = sub nsw i32 %38, 1
store i32 %39, i32* %2
br label %57
40: ; preds = %33, %29
%41 = load i32, i32* %3
%42 = call i64 @in(i32 %41, i32 1121, i32 1153)
%43 = icmp ne i64 %42, 0
br i1 %43, label %48, label %44
44: ; preds = %40
%45 = load i32, i32* %3
%46 = call i64 @in(i32 %45, i32 1163, i32 1327)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %55
48: ; preds = %44, %40
%49 = load i32, i32* %3
%50 = srem i32 %49, 2
%51 = icmp eq i32 %50, 1
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = load i32, i32* %3
%54 = sub nsw i32 %53, 1
store i32 %54, i32* %2
br label %57
55: ; preds = %48, %44
%56 = load i32, i32* %3
store i32 %56, i32* %2
br label %57
57: ; preds = %55, %52, %37, %26, %19
%58 = load i32, i32* %2
ret i32 %58
}

LLVM IR (-O2):
define i32 @u8toupper(i32 %0) {
%2 = tail call i64 @in(i32 %0, i32 97, i32 122)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = tail call i64 @in(i32 %0, i32 224, i32 254)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = tail call i64 @in(i32 %0, i32 945, i32 969)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = tail call i64 @in(i32 %0, i32 1072, i32 1103)
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10, %7, %4, %1
%14 = add nsw i32 %0, -32
br label %38
15: ; preds = %10
%16 = tail call i64 @in(i32 %0, i32 1104, i32 1119)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = add nsw i32 %0, -80
br label %38
20: ; preds = %15
%21 = tail call i64 @in(i32 %0, i32 257, i32 382)
%22 = icmp ne i64 %21, 0
%23 = srem i32 %0, 2
%24 = icmp eq i32 %23, 1
%25 = and i1 %24, %22
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = add nsw i32 %0, -1
br label %38
28: ; preds = %20
%29 = tail call i64 @in(i32 %0, i32 1121, i32 1153)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %28
%32 = tail call i64 @in(i32 %0, i32 1163, i32 1327)
%33 = icmp ne i64 %32, 0
%34 = and i1 %24, %33
br i1 %34, label %36, label %38
35: ; preds = %28
br i1 %24, label %36, label %38
36: ; preds = %31, %35
%37 = add nsw i32 %0, -1
br label %38
38: ; preds = %31, %35, %36, %26, %18, %13
%39 = phi i32 [ %14, %13 ], [ %19, %18 ], [ %27, %26 ], [ %37, %36 ], [ %0, %35 ], [ %0, %31 ]
ret i32 %39
}