#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 menu();
int /*<<< orphan*/ play(int, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  srand(time(NULL));
  int stay_here = 1;
  int menu_choice = -1;
  while (stay_here) {
    if (menu_choice == -1) {
      menu_choice = menu();
    } else if (menu_choice == 1 || menu_choice == 2) {
      int generate_mystery = (menu_choice == 1) ? 1 : 0;
      play(7, 0, 100, generate_mystery);
      menu_choice = -1;
    } else if (menu_choice == 0) {
      stay_here = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x1,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11f7 <main+0xb7>
cmpl   $0xffffffff,-0xc(%rbp)
jne    1190 <main+0x50>
mov    $0x0,%al
call   1030 <menu@plt>
mov    %eax,-0xc(%rbp)
jmp    11f2 <main+0xb2>
cmpl   $0x1,-0xc(%rbp)
je     11a4 <main+0x64>
cmpl   $0x2,-0xc(%rbp)
jne    11d7 <main+0x97>
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    $0x7,%edi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <play@plt>
movl   $0xffffffff,-0xc(%rbp)
jmp    11ed <main+0xad>
cmpl   $0x0,-0xc(%rbp)
jne    11e8 <main+0xa8>
movl   $0x0,-0x8(%rbp)
jmp    11ed <main+0xad>
jmp    11f2 <main+0xb2>
jmp    116d <main+0x2d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0xffffffff,%eax
jmp    1170 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <menu@plt>
mov    $0x1,%ecx
test   %ecx,%ecx
je     11b5 <main+0x75>
cmp    $0xffffffff,%eax
je     1160 <main+0x20>
lea    -0x1(%rax),%ecx
cmp    $0x1,%ecx
jbe    1190 <main+0x50>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
jmp    116c <main+0x2c>
cs nopw 0x0(%rax,%rax,1)
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
mov    $0x7,%edi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <play@plt>
mov    $0x1,%ecx
mov    $0xffffffff,%eax
jmp    116c <main+0x2c>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @time(i32* null)
%6 = call i32 @srand(i32 %5)
store i32 1, i32* %2
store i32 -1, i32* %3
br label %7
7: ; preds = %34, %0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %35
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (...) @menu()
store i32 %14, i32* %3
br label %34
15: ; preds = %10
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 1
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 2
br i1 %20, label %21, label %28
21: ; preds = %18, %15
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 1
%24 = zext i1 %23 to i64
%25 = select i1 %23, i32 1, i32 0
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = call i32 @play(i32 7, i32 0, i32 100, i32 %26)
store i32 -1, i32* %3
br label %33
28: ; preds = %18
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %28
store i32 0, i32* %2
br label %32
32: ; preds = %31, %28
br label %33
33: ; preds = %32, %21
br label %34
34: ; preds = %33, %13
br label %7
35: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
br label %3
3: ; preds = %0, %18
%4 = phi i32 [ -1, %0 ], [ %19, %18 ]
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (...) @menu()
br label %18
8: ; preds = %3
%9 = add i32 %4, -1
%10 = icmp ult i32 %9, 2
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = icmp eq i32 %4, 1
%13 = zext i1 %12 to i32
%14 = tail call i32 @play(i32 7, i32 0, i32 100, i32 %13)
br label %18
15: ; preds = %8
%16 = icmp ne i32 %4, 0
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %15, %11, %6
%19 = phi i32 [ %7, %6 ], [ -1, %11 ], [ %4, %15 ]
%20 = phi i32 [ 1, %6 ], [ 1, %11 ], [ %17, %15 ]
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %3
22: ; preds = %18
ret i32 0
}