#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__ __llair_choice();
int main() {
  int x = 0;
  while (__llair_choice()) {
    x += 1;
    while (__llair_choice()) {
      x += 3;
      if (__llair_choice()) {
        x += 5;
      } else {
        x += 7;
      }
      x += 9;
    }
  }
  return x;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__llair_choice@plt>
cmp    $0x0,%rax
je     1195 <main+0x85>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__llair_choice@plt>
cmp    $0x0,%rax
je     1190 <main+0x80>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__llair_choice@plt>
cmp    $0x0,%rax
je     1179 <main+0x69>
mov    -0x8(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x8(%rbp)
jmp    1182 <main+0x72>
mov    -0x8(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0x8(%rbp)
jmp    1140 <main+0x30>
jmp    1126 <main+0x16>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <__llair_choice@plt>
test   %rax,%rax
je     1163 <main+0x53>
xor    %ebx,%ebx
jmp    113c <main+0x2c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <__llair_choice@plt>
test   %rax,%rax
je     1163 <main+0x53>
add    $0x1,%ebx
nop
xor    %eax,%eax
call   1030 <__llair_choice@plt>
test   %rax,%rax
je     1130 <main+0x20>
xor    %eax,%eax
call   1030 <__llair_choice@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
lea    (%rbx,%rcx,2),%ebx
add    $0x11,%ebx
jmp    1140 <main+0x30>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %26, %0
%4 = call i64 (...) @__llair_choice()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %27
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
store i32 %8, i32* %2
br label %9
9: ; preds = %23, %6
%10 = call i64 (...) @__llair_choice()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %26
12: ; preds = %9
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 3
store i32 %14, i32* %2
%15 = call i64 (...) @__llair_choice()
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 5
store i32 %19, i32* %2
br label %23
20: ; preds = %12
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 7
store i32 %22, i32* %2
br label %23
23: ; preds = %20, %17
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 9
store i32 %25, i32* %2
br label %9
26: ; preds = %9
br label %3
27: ; preds = %3
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 (...) @__llair_choice()
%2 = icmp eq i64 %1, 0
br i1 %2, label %21, label %7
3: ; preds = %12, %7
%4 = phi i32 [ %9, %7 ], [ %18, %12 ]
%5 = tail call i64 (...) @__llair_choice()
%6 = icmp eq i64 %5, 0
br i1 %6, label %21, label %7
7: ; preds = %0, %3
%8 = phi i32 [ %4, %3 ], [ 0, %0 ]
%9 = add nsw i32 %8, 1
%10 = tail call i64 (...) @__llair_choice()
%11 = icmp eq i64 %10, 0
br i1 %11, label %3, label %12
12: ; preds = %7, %12
%13 = phi i32 [ %18, %12 ], [ %9, %7 ]
%14 = tail call i64 (...) @__llair_choice()
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i32 10, i32 8
%17 = add i32 %13, 9
%18 = add i32 %17, %16
%19 = tail call i64 (...) @__llair_choice()
%20 = icmp eq i64 %19, 0
br i1 %20, label %3, label %12
21: ; preds = %3, %0
%22 = phi i32 [ 0, %0 ], [ %4, %3 ]
ret i32 %22
}