#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*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
int pointPhase(int sum, int dice1, int dice2) {
  int sum2;
  printf("Point Phase\n");
  printf("Win if roll sum = %d\n", sum);
  printf("Lose if roll sum = 7\n\n");
  system("pause");
  dice1 = getRand(1, 6);
  printf("Dice 1: %d\n", dice1);
  dice2 = getRand(1, 6);
  printf("Dice 2: %d\n", dice2);
  sum2 = dice1 + dice2;
  printf("Your roll sum is: %d\n\n", sum2);
  if (sum == sum2) {
    printf("CONGRATS you win!!!\n");
    return 0;
  } else if (sum2 == 7) {
    printf("SORRY you lost\n");
    return 0;
  } else {
    pointPhase(sum, dice1, dice2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<pointPhase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1050 <system@plt>
mov    $0x1,%edi
mov    $0x6,%esi
call   1040 <getRand@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
mov    $0x6,%esi
call   1040 <getRand@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1210 <pointPhase+0xd0>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    124e <pointPhase+0x10e>
cmpl   $0x7,-0x14(%rbp)
jne    1234 <pointPhase+0xf4>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    124e <pointPhase+0x10e>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <pointPhase@plt>
jmp    1247 <pointPhase+0x107>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pointPhase>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xec8(%rip),%r13
lea    0xecd(%rip),%r14
lea    0xed2(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe77(%rip),%rdi
call   1050 <system@plt>
mov    $0x1,%edi
mov    $0x6,%esi
call   1040 <getRand@plt>
mov    %eax,%ebp
mov    %r13,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
mov    $0x6,%esi
call   1040 <getRand@plt>
mov    %eax,%r12d
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    %ebp,%r12d
mov    %r15,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    %ebx,%r12d
je     1207 <pointPhase+0xc7>
cmp    $0x7,%r12d
jne    1170 <pointPhase+0x30>
lea    0xe68(%rip),%rdi
jmp    120e <pointPhase+0xce>
lea    0xe6e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Point Phase\0A\00"
@.str.1 = [22 x i8] c"Win if roll sum = %d\0A\00"
@.str.2 = [23 x i8] c"Lose if roll sum = 7\0A\0A\00"
@.str.3 = [6 x i8] c"pause\00"
@.str.4 = [12 x i8] c"Dice 1: %d\0A\00"
@.str.5 = [12 x i8] c"Dice 2: %d\0A\00"
@.str.6 = [23 x i8] c"Your roll sum is: %d\0A\0A\00"
@.str.7 = [21 x i8] c"CONGRATS you win!!!\0A\00"
@.str.8 = [16 x i8] c"SORRY you lost\0A\00"
define i32 @pointPhase(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @getRand(i32 1, i32 6)
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%17 = call i32 @getRand(i32 1, i32 6)
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = add nsw i32 %20, %21
store i32 %22, i32* %8
%23 = load i32, i32* %8
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %5
%26 = load i32, i32* %8
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %3
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %4
br label %42
30: ; preds = %3
%31 = load i32, i32* %8
%32 = icmp eq i32 %31, 7
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %4
br label %42
35: ; preds = %30
%36 = load i32, i32* %5
%37 = load i32, i32* %6
%38 = load i32, i32* %7
%39 = call i32 @pointPhase(i32 %36, i32 %37, i32 %38)
br label %40
40: ; preds = %35
br label %41
41: ; preds = %40
store i32 0, i32* %4
br label %42
42: ; preds = %41, %33, %28
%43 = load i32, i32* %4
ret i32 %43
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"Win if roll sum = %d\0A\00"
@.str.3 = [6 x i8] c"pause\00"
@.str.4 = [12 x i8] c"Dice 1: %d\0A\00"
@.str.5 = [12 x i8] c"Dice 2: %d\0A\00"
@.str.6 = [23 x i8] c"Your roll sum is: %d\0A\0A\00"
@str = [12 x i8] c"Point Phase\00"
@str.9 = [22 x i8] c"Lose if roll sum = 7\0A\00"
@str.10 = [15 x i8] c"SORRY you lost\00"
@str.11 = [20 x i8] c"CONGRATS you win!!!\00"
define i32 @pointPhase(i32 %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %16, %3
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.9, i64 0, i64 0))
%8 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 @getRand(i32 1, i32 6)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = tail call i32 @getRand(i32 1, i32 6)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %11)
%13 = add nsw i32 %11, %9
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %13)
%15 = icmp eq i32 %13, %0
br i1 %15, label %18, label %16
16: ; preds = %4
%17 = icmp eq i32 %13, 7
br i1 %17, label %18, label %4
18: ; preds = %16, %4
%19 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @str.11, i64 0, i64 0), %4 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.10, i64 0, i64 0), %16 ]
%20 = tail call i32 @puts(i8* dereferenceable(1) %19)
ret i32 0
}