#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;
      }
      if (__llair_choice())
        break;
    }
  }
  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     11a2 <main+0x92>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__llair_choice@plt>
cmp    $0x0,%rax
je     119d <main+0x8d>
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    $0x0,%al
call   1030 <__llair_choice@plt>
cmp    $0x0,%rax
je     1198 <main+0x88>
jmp    119d <main+0x8d>
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     116f <main+0x5f>
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     116f <main+0x5f>
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    $0x8,%ebx
xor    %eax,%eax
call   1030 <__llair_choice@plt>
test   %rax,%rax
je     1140 <main+0x30>
jmp    1130 <main+0x20>
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 = %28, %0
%4 = call i64 (...) @__llair_choice()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %29
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
store i32 %8, i32* %2
br label %9
9: ; preds = %27, %6
%10 = call i64 (...) @__llair_choice()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %28
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 = call i64 (...) @__llair_choice()
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %23
br label %28
27: ; preds = %23
br label %9
28: ; preds = %26, %9
br label %3
29: ; preds = %3
%30 = load i32, i32* %2
ret i32 %30
}

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