#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 */
typedef int uint8_t;

/* Variables and functions */
int getchar();
int /*<<< orphan*/ printf(char *);
int main() {
  uint8_t i = getchar();
  int branch_counter = 1;
  if (!(128 & i)) {
    branch_counter++;
    if (64 & i) {
      branch_counter++;
      if (!(32 & i)) {
        branch_counter++;
        if (16 & i) {
          branch_counter++;
          if (8 & i) {
            branch_counter++;
            if (!(4 & i)) {
              branch_counter++;
              if (!(2 & i)) {
                branch_counter++;
                if (!(1 & i)) {
                  branch_counter++;
                  printf("You got it!\n");
                  return 0;
                }
              }
            }
          }
        }
      }
    }
  }
  printf("You lose :/\n");
  return -1 * branch_counter;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    123d <main+0x11d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1238 <main+0x118>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
jne    1233 <main+0x113>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     122e <main+0x10e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1229 <main+0x109>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    1224 <main+0x104>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jne    121f <main+0xff>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    121a <main+0xfa>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xdf7(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1253 <main+0x133>
jmp    121f <main+0xff>
jmp    1224 <main+0x104>
jmp    1229 <main+0x109>
jmp    122e <main+0x10e>
jmp    1233 <main+0x113>
jmp    1238 <main+0x118>
jmp    123d <main+0x11d>
lea    0xdc9(%rip),%rdi
call   1030 <printf@plt>
imul   $0xffffffff,-0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    $0xffffffff,%ebx
test   $0x80,%al
jne    117b <main+0x5b>
mov    $0xfffffffe,%ebx
test   $0x40,%al
je     117b <main+0x5b>
mov    $0xfffffffd,%ebx
test   $0x20,%al
jne    117b <main+0x5b>
mov    $0xfffffffc,%ebx
test   $0x10,%al
je     117b <main+0x5b>
mov    $0xfffffffb,%ebx
test   $0x8,%al
je     117b <main+0x5b>
mov    $0xfffffffa,%ebx
test   $0x4,%al
jne    117b <main+0x5b>
mov    $0xfffffff9,%ebx
test   $0x2,%al
jne    117b <main+0x5b>
mov    $0xfffffff8,%ebx
test   $0x1,%al
jne    117b <main+0x5b>
xor    %ebx,%ebx
lea    0xe93(%rip),%rdi
jmp    1182 <main+0x62>
lea    0xe7e(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"You got it!\0A\00"
@.str.1 = [13 x i8] c"You lose :/\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
store i32 1, i32* %3
%5 = load i32, i32* %2
%6 = and i32 128, %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %61, label %8
8: ; preds = %0
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = and i32 64, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %60
14: ; preds = %8
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
%17 = load i32, i32* %2
%18 = and i32 32, %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %59, label %20
20: ; preds = %14
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
%23 = load i32, i32* %2
%24 = and i32 16, %23
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %58
26: ; preds = %20
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
%29 = load i32, i32* %2
%30 = and i32 8, %29
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %57
32: ; preds = %26
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
%35 = load i32, i32* %2
%36 = and i32 4, %35
%37 = icmp ne i32 %36, 0
br i1 %37, label %56, label %38
38: ; preds = %32
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
%41 = load i32, i32* %2
%42 = and i32 2, %41
%43 = icmp ne i32 %42, 0
br i1 %43, label %55, label %44
44: ; preds = %38
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
%47 = load i32, i32* %2
%48 = and i32 1, %47
%49 = icmp ne i32 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %44
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
store i32 %52, i32* %3
%53 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %65
54: ; preds = %44
br label %55
55: ; preds = %54, %38
br label %56
56: ; preds = %55, %32
br label %57
57: ; preds = %56, %26
br label %58
58: ; preds = %57, %20
br label %59
59: ; preds = %58, %14
br label %60
60: ; preds = %59, %8
br label %61
61: ; preds = %60, %0
%62 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%63 = load i32, i32* %3
%64 = mul nsw i32 -1, %63
store i32 %64, i32* %1
br label %65
65: ; preds = %61, %50
%66 = load i32, i32* %1
ret i32 %66
}

LLVM IR (-O2):
@str = [12 x i8] c"You lose :/\00"
@str.2 = [12 x i8] c"You got it!\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = and i32 %1, 128
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %25
4: ; preds = %0
%5 = and i32 %1, 64
%6 = icmp eq i32 %5, 0
br i1 %6, label %25, label %7
7: ; preds = %4
%8 = and i32 %1, 32
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %25
10: ; preds = %7
%11 = and i32 %1, 16
%12 = icmp eq i32 %11, 0
br i1 %12, label %25, label %13
13: ; preds = %10
%14 = and i32 %1, 8
%15 = icmp eq i32 %14, 0
br i1 %15, label %25, label %16
16: ; preds = %13
%17 = and i32 %1, 4
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = and i32 %1, 2
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = and i32 %1, 1
%24 = icmp eq i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %4, %10, %16, %22, %19, %13, %7, %0
%26 = phi i32 [ -1, %0 ], [ -3, %7 ], [ -6, %16 ], [ -7, %19 ], [ -8, %22 ], [ -5, %13 ], [ -4, %10 ], [ -2, %4 ]
br label %27
27: ; preds = %22, %25
%28 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0), %25 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.2, i64 0, i64 0), %22 ]
%29 = phi i32 [ %26, %25 ], [ 0, %22 ]
%30 = tail call i32 @puts(i8* dereferenceable(1) %28)
ret i32 %29
}