#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*/ game_init(int, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf_s(char *, int *);
int /*<<< orphan*/ system(char *);
int main(void) {
  int choice;
  int min, max, total_rounds;
  printf(
      "Welcome to Multplication Drills! \n Press 0 to start, 1 to customize.");
  scanf_s("%d", &choice);
  if (choice == 0)
    game_init(2, 12, 30);
  else {
    printf("Enter a minimum multiplier (integer): ");
    scanf_s("%d", &min);
    printf("Enter a maximum multiplier (integer): ");
    scanf_s("%d", &max);
    printf("How many rounds would you like to play? (max 150): ");
    scanf_s("%d", &total_rounds);
    while (total_rounds > 150) {
      printf("That's too many rounds!\n");
      printf("How many rounds would you like to play? (max 150): ");
      scanf_s("%d", &total_rounds);
    }
    game_init(min, max, total_rounds);
  }
  printf("Goodbye!\n\n");
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf_s@plt>
cmpl   $0x0,-0x8(%rbp)
jne    118e <main+0x4e>
mov    $0x2,%edi
mov    $0xc,%esi
mov    $0x1e,%edx
call   1050 <game_init@plt>
jmp    122a <main+0xea>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf_s@plt>
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf_s@plt>
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
lea    0xe6c(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf_s@plt>
cmpl   $0x96,-0x14(%rbp)
jle    121c <main+0xdc>
lea    0xed4(%rip),%rdi
call   1040 <printf@plt>
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
lea    0xe37(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf_s@plt>
jmp    11e2 <main+0xa2>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <game_init@plt>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe9e(%rip),%rdi
call   1050 <printf@plt>
lea    0xed7(%rip),%rdi
lea    0x14(%rsp),%rsi
call   1070 <scanf_s@plt>
cmpl   $0x0,0x14(%rsp)
je     1231 <main+0xe1>
lea    0xebe(%rip),%rdi
call   1050 <printf@plt>
lea    0xeaf(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf_s@plt>
lea    0xec5(%rip),%rdi
call   1050 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf_s@plt>
lea    0xed3(%rip),%rdi
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf_s@plt>
mov    0x8(%rsp),%edx
cmp    $0x97,%edx
jl     1227 <main+0xd7>
lea    0xef2(%rip),%r14
lea    0xea7(%rip),%r15
lea    0xe4f(%rip),%r12
lea    0x8(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <scanf_s@plt>
mov    0x8(%rsp),%edx
cmp    $0x96,%edx
jg     1200 <main+0xb0>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
jmp    1240 <main+0xf0>
mov    $0x2,%edi
mov    $0xc,%esi
mov    $0x1e,%edx
call   1060 <game_init@plt>
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
lea    0xe72(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [69 x i8] c"Welcome to Multplication Drills! \0A Press 0 to start, 1 to customize.\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [39 x i8] c"Enter a minimum multiplier (integer): \00"
@.str.3 = [39 x i8] c"Enter a maximum multiplier (integer): \00"
@.str.4 = [52 x i8] c"How many rounds would you like to play? (max 150): \00"
@.str.5 = [25 x i8] c"That's too many rounds!\0A\00"
@.str.6 = [11 x i8] c"Goodbye!\0A\0A\00"
@.str.7 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @game_init(i32 2, i32 12, i32 30)
br label %31
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%15 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%17 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
br label %19
19: ; preds = %22, %12
%20 = load i32, i32* %5
%21 = icmp sgt i32 %20, 150
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
br label %19
26: ; preds = %19
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = call i32 @game_init(i32 %27, i32 %28, i32 %29)
br label %31
31: ; preds = %26, %10
%32 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%33 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [69 x i8] c"Welcome to Multplication Drills! \0A Press 0 to start, 1 to customize.\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [39 x i8] c"Enter a minimum multiplier (integer): \00"
@.str.3 = [39 x i8] c"Enter a maximum multiplier (integer): \00"
@.str.4 = [52 x i8] c"How many rounds would you like to play? (max 150): \00"
@.str.7 = [6 x i8] c"PAUSE\00"
@str = [10 x i8] c"Goodbye!\0A\00"
@str.8 = [24 x i8] c"That's too many rounds!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @game_init(i32 2, i32 12, i32 30)
br label %35
15: ; preds = %0
%16 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%18 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%22 = load i32, i32* %4
%23 = icmp sgt i32 %22, 150
br i1 %23, label %24, label %30
24: ; preds = %15, %24
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.8, i64 0, i64 0))
%26 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
%27 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%28 = load i32, i32* %4
%29 = icmp sgt i32 %28, 150
br i1 %29, label %24, label %30
30: ; preds = %24, %15
%31 = phi i32 [ %22, %15 ], [ %28, %24 ]
%32 = load i32, i32* %2
%33 = load i32, i32* %3
%34 = call i32 @game_init(i32 %32, i32 %33, i32 %31)
br label %35
35: ; preds = %30, %13
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%37 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}