#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 getRand(int, int);
int /*<<< orphan*/ introduction();
int /*<<< orphan*/ pointPhase(int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  int dice1, dice2, sum;
  char initiate;
  introduction();
  printf("Press \"r\" to Roll the dice (q = Quit)\n");
  scanf("%s", &initiate);
  while (initiate != 'q') {
    dice1 = getRand(1, 6);
    printf("Dice 1: %d\n", dice1);
    dice2 = getRand(1, 6);
    printf("Dice 2: %d\n", dice2);
    sum = dice1 + dice2;
    printf("Your roll sum is: %d\n\n", sum);
    if (sum == 7 || sum == 11) {
      printf("CONGRATS you win!!! \n");
    } else if (sum == 2 || sum == 3 || sum == 12) {
      printf("SORRY you lost\n");
    } else {
      pointPhase(sum, dice1, dice2);
    }
    printf("Play Again? (r = Roll q = Quit)\n");
    scanf("%s", &initiate);
  }
  printf("Thank You for playing \n\n");
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <introduction@plt>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0x1d(%rbp),%rsi
call   1080 <scanf@plt>
movsbl -0x1d(%rbp),%eax
cmp    $0x71,%eax
je     1296 <main+0x136>
mov    $0x1,%edi
mov    $0x6,%esi
call   1040 <getRand@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
mov    $0x6,%esi
call   1040 <getRand@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x7,-0x1c(%rbp)
je     121c <main+0xbc>
cmpl   $0xb,-0x1c(%rbp)
jne    122f <main+0xcf>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1273 <main+0x113>
cmpl   $0x2,-0x1c(%rbp)
je     124d <main+0xed>
cmpl   $0x3,-0x1c(%rbp)
je     124d <main+0xed>
cmpl   $0xc,-0x1c(%rbp)
jne    1260 <main+0x100>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    126e <main+0x10e>
mov    -0x1c(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <pointPhase@plt>
jmp    1273 <main+0x113>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xd9f(%rip),%rdi
lea    -0x1d(%rbp),%rsi
call   1080 <scanf@plt>
jmp    119b <main+0x3b>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe0e(%rip),%rdi
call   1060 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <introduction@plt>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6b(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1090 <scanf@plt>
cmpb   $0x71,0x7(%rsp)
jne    11cf <main+0x5f>
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
lea    0xe79(%rip),%rdi
call   1070 <system@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea0(%rip),%r13
lea    0xe23(%rip),%rbx
lea    0x7(%rsp),%rbp
jmp    1216 <main+0xa6>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1090 <scanf@plt>
cmpb   $0x71,0x7(%rsp)
je     11a6 <main+0x36>
mov    $0x1,%edi
mov    $0x6,%esi
call   1050 <getRand@plt>
mov    %eax,%r14d
lea    0xdd4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%edi
mov    $0x6,%esi
call   1050 <getRand@plt>
mov    %eax,%r15d
lea    0xdbe(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    (%r15,%r14,1),%r12d
lea    0xdb6(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
cmp    $0xc,%r12d
ja     129b <main+0x12b>
mov    $0x100c,%eax
bt     %r12d,%eax
jb     11f0 <main+0x80>
mov    $0x880,%eax
bt     %r12d,%eax
jae    129b <main+0x12b>
lea    0xe0f(%rip),%rdi
jmp    11f7 <main+0x87>
mov    %r12d,%edi
mov    %r14d,%esi
mov    %r15d,%edx
call   1040 <pointPhase@plt>
jmp    11fc <main+0x8c>

LLVM IR (-O0):
@.str = [39 x i8] c"Press \22r\22 to Roll the dice (q = Quit)\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [12 x i8] c"Dice 1: %d\0A\00"
@.str.3 = [12 x i8] c"Dice 2: %d\0A\00"
@.str.4 = [23 x i8] c"Your roll sum is: %d\0A\0A\00"
@.str.5 = [22 x i8] c"CONGRATS you win!!! \0A\00"
@.str.6 = [16 x i8] c"SORRY you lost\0A\00"
@.str.7 = [33 x i8] c"Play Again? (r = Roll q = Quit)\0A\00"
@.str.8 = [25 x i8] c"Thank You for playing \0A\0A\00"
@.str.9 = [6 x i8] c"PAUSE\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (...) @introduction()
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
br label %13
13: ; preds = %53, %2
%14 = load i8, i8* %9
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 113
br i1 %16, label %17, label %56
17: ; preds = %13
%18 = call i32 @getRand(i32 1, i32 6)
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = call i32 @getRand(i32 1, i32 6)
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = add nsw i32 %24, %25
store i32 %26, i32* %8
%27 = load i32, i32* %8
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %8
%30 = icmp eq i32 %29, 7
br i1 %30, label %34, label %31
31: ; preds = %17
%32 = load i32, i32* %8
%33 = icmp eq i32 %32, 11
br i1 %33, label %34, label %36
34: ; preds = %31, %17
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
br label %53
36: ; preds = %31
%37 = load i32, i32* %8
%38 = icmp eq i32 %37, 2
br i1 %38, label %45, label %39
39: ; preds = %36
%40 = load i32, i32* %8
%41 = icmp eq i32 %40, 3
br i1 %41, label %45, label %42
42: ; preds = %39
%43 = load i32, i32* %8
%44 = icmp eq i32 %43, 12
br i1 %44, label %45, label %47
45: ; preds = %42, %39, %36
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %52
47: ; preds = %42
%48 = load i32, i32* %8
%49 = load i32, i32* %6
%50 = load i32, i32* %7
%51 = call i32 @pointPhase(i32 %48, i32 %49, i32 %50)
br label %52
52: ; preds = %47, %45
br label %53
53: ; preds = %52, %34
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%55 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
br label %13
56: ; preds = %13
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
%58 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [12 x i8] c"Dice 1: %d\0A\00"
@.str.3 = [12 x i8] c"Dice 2: %d\0A\00"
@.str.4 = [23 x i8] c"Your roll sum is: %d\0A\0A\00"
@.str.9 = [6 x i8] c"PAUSE\00"
@str = [38 x i8] c"Press \22r\22 to Roll the dice (q = Quit)\00"
@str.10 = [24 x i8] c"Thank You for playing \0A\00"
@str.11 = [32 x i8] c"Play Again? (r = Roll q = Quit)\00"
@str.12 = [15 x i8] c"SORRY you lost\00"
@str.13 = [21 x i8] c"CONGRATS you win!!! \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = tail call i32 (...) @introduction()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = load i8, i8* %3
%8 = icmp eq i8 %7, 113
br i1 %8, label %27, label %9
9: ; preds = %2, %22
%10 = call i32 @getRand(i32 1, i32 6)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = call i32 @getRand(i32 1, i32 6)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = add nsw i32 %12, %10
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %14)
switch i32 %14, label %20 [
i32 11, label %16
i32 7, label %16
i32 12, label %18
i32 3, label %18
i32 2, label %18
]
16: ; preds = %9, %9
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.13, i64 0, i64 0))
br label %22
18: ; preds = %9, %9, %9
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.12, i64 0, i64 0))
br label %22
20: ; preds = %9
%21 = call i32 @pointPhase(i32 %14, i32 %10, i32 %12)
br label %22
22: ; preds = %18, %20, %16
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.11, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%25 = load i8, i8* %3
%26 = icmp eq i8 %25, 113
br i1 %26, label %27, label %9
27: ; preds = %22, %2
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.10, i64 0, i64 0))
%29 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}