#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 */
int /*<<< orphan*/ printf(char *, int);
int roll_dice();
bool play_game(void) {
  int point, roll;
  point = roll_dice();
  printf("you rolled: %d\n", point);
  if (point == 7 || point == 11) {
    return true;
  } else if (point == 2 || point == 3 || point == 11) {
    return false;
  } else {
    printf("your point is %d\n", point);
    for (;;) {
      roll = roll_dice();
      if (roll == point) {
        printf("you rolled: %d\n", roll);
        return true;
      } else if (roll == 7) {
        printf("you rolled: %d\n", roll);
        return false;
      } else {
        printf("you rolled: %d\n", roll);
        continue;
      }
    }
  }
}


x86 assembly (clang, -O0):
<play_game>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <roll_dice@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x7,-0x8(%rbp)
je     1155 <play_game+0x35>
cmpl   $0xb,-0x8(%rbp)
jne    1161 <play_game+0x41>
movl   $0x1,-0x4(%rbp)
jmp    1204 <play_game+0xe4>
cmpl   $0x2,-0x8(%rbp)
je     117f <play_game+0x5f>
cmpl   $0x3,-0x8(%rbp)
je     117f <play_game+0x5f>
cmpl   $0xb,-0x8(%rbp)
jne    118b <play_game+0x6b>
movl   $0x0,-0x4(%rbp)
jmp    1204 <play_game+0xe4>
mov    -0x8(%rbp),%esi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <roll_dice@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11cb <play_game+0xab>
mov    -0xc(%rbp),%esi
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1204 <play_game+0xe4>
cmpl   $0x7,-0xc(%rbp)
jne    11f0 <play_game+0xd0>
mov    -0xc(%rbp),%esi
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1204 <play_game+0xe4>
mov    -0xc(%rbp),%esi
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
jmp    119a <play_game+0x7a>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<play_game>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <roll_dice@plt>
mov    %eax,%ebx
lea    0xecc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x1,%ebp
cmp    $0x7,%ebx
je     11b4 <play_game+0x94>
cmp    $0xb,%ebx
je     11b4 <play_game+0x94>
mov    %ebx,%eax
and    $0xfffffffe,%eax
xor    %ebp,%ebp
cmp    $0x2,%eax
je     11b4 <play_game+0x94>
lea    0xeb3(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <roll_dice@plt>
cmp    %ebx,%eax
je     119a <play_game+0x7a>
lea    0xe8a(%rip),%r14
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
cmp    $0x7,%eax
je     11a1 <play_game+0x81>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <roll_dice@plt>
cmp    %ebx,%eax
jne    1180 <play_game+0x60>
mov    $0x1,%ebp
jmp    11a6 <play_game+0x86>
mov    $0x7,%ebx
lea    0xe53(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"you rolled: %d\0A\00"
@.str.1 = [18 x i8] c"your point is %d\0A\00"
define i32 @play_game() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @roll_dice()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 7
br i1 %8, label %12, label %9
9: ; preds = %0
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 11
br i1 %11, label %12, label %13
12: ; preds = %9, %0
store i32 1, i32* %1
br label %43
13: ; preds = %9
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 2
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 3
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 11
br i1 %21, label %22, label %23
22: ; preds = %19, %16, %13
store i32 0, i32* %1
br label %43
23: ; preds = %19
%24 = load i32, i32* %2
%25 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %40, %23
%27 = call i32 (...) @roll_dice()
store i32 %27, i32* %3
%28 = load i32, i32* %3
%29 = load i32, i32* %2
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %34
31: ; preds = %26
%32 = load i32, i32* %3
%33 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %32)
store i32 1, i32* %1
br label %43
34: ; preds = %26
%35 = load i32, i32* %3
%36 = icmp eq i32 %35, 7
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* %3
%39 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %38)
store i32 0, i32* %1
br label %43
40: ; preds = %34
%41 = load i32, i32* %3
%42 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %41)
br label %26
43: ; preds = %37, %31, %22, %12
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
@.str = [16 x i8] c"you rolled: %d\0A\00"
@.str.1 = [18 x i8] c"your point is %d\0A\00"
define i32 @play_game() {
%1 = tail call i32 (...) @roll_dice()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
switch i32 %1, label %3 [
i32 11, label %21
i32 7, label %21
]
3: ; preds = %0
%4 = and i32 %1, -2
%5 = icmp eq i32 %4, 2
br i1 %5, label %21, label %6
6: ; preds = %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%8 = tail call i32 (...) @roll_dice()
%9 = icmp eq i32 %8, %1
br i1 %9, label %17, label %10
10: ; preds = %6, %13
%11 = phi i32 [ %15, %13 ], [ %8, %6 ]
%12 = icmp eq i32 %11, 7
br i1 %12, label %17, label %13
13: ; preds = %10
%14 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %11)
%15 = tail call i32 (...) @roll_dice()
%16 = icmp eq i32 %15, %1
br i1 %16, label %17, label %10
17: ; preds = %10, %13, %6
%18 = phi i32 [ %1, %6 ], [ %1, %13 ], [ 7, %10 ]
%19 = phi i32 [ 1, %6 ], [ 1, %13 ], [ 0, %10 ]
%20 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %21
21: ; preds = %17, %3, %0, %0
%22 = phi i32 [ 1, %0 ], [ 1, %0 ], [ 0, %3 ], [ %19, %17 ]
ret i32 %22
}