#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int main() {
  int dice_roll1;
  int dice_roll2;
  int dice_total;
  int point;
  int play_flag;
  int play_again_flag;
  int win_lose_flag;
  char name_buffer[50];
  char play_buffer[4];
  char again_buffer[3];
  play_flag = 0;
  printf("Welcome to Bryan's Casino!\n");
  printf("Please enter your name: ");
  scanf("%50s", name_buffer);
  printf("%s, would you like to Play or Quit?: ");
  while (play_flag == 0) {
    scanf("%4s", play_buffer);
    if (strncmp(play_buffer, "play", 4) == 0 ||
        strncmp(play_buffer, "Play", 4) == 0 ||
        strncmp(play_buffer, "PLAY", 4) == 0)
      play_flag = 1;
    if (strncmp(play_buffer, "quit", 4) == 0 ||
        strncmp(play_buffer, "Quit", 4) == 0 ||
        strncmp(play_buffer, "QUIT", 4) == 0)
      play_flag = -1;
    if (play_flag == 0)
      printf("\nYou have entered an invalid input, please try again: ");
  }
  if (play_flag == -1) {
    printf("\nYou chose to quit! Goodbye!\n");
    return 0;
  }
  play_again_flag = 1;
  FILE *fd = fopen("/dev/dice", "r");
  if (fd != NULL) {
    while (play_again_flag == 1) {
      win_lose_flag = 0;
      printf("\n");
      fread(&dice_roll1, sizeof(char), 1, fd);
      fread(&dice_roll2, sizeof(char), 1, fd);
      dice_total = dice_roll1 + dice_roll2;
      printf("You first rolled a: %d + %d = %d\n", dice_roll1, dice_roll2,
             dice_total);
      if (dice_total == 7 || dice_total == 11)
        win_lose_flag = 1;
      if (dice_total == 2 || dice_total == 3 || dice_total == 12)
        win_lose_flag = -1;
      while (win_lose_flag == 0) {
        fread(&dice_roll1, sizeof(char), 1, fd);
        fread(&dice_roll2, sizeof(char), 1, fd);
        point = dice_roll1 + dice_roll2;
        printf("Your next roll was: %d + %d = %d\n", dice_roll1, dice_roll2,
               point);
        if (point == 7)
          win_lose_flag = -1;
        if (point == dice_total)
          win_lose_flag = 1;
      }
      if (win_lose_flag == 1)
        printf("You WIN!\n\n");
      if (win_lose_flag == -1)
        printf("Sorry, you lost.\n\n");
      printf("Would you like to play again? (yes/no): ");
      play_again_flag = 0;
      while (play_again_flag == 0) {
        scanf("%3s", again_buffer);
        if (strncmp(again_buffer, "no", 2) == 0 ||
            strncmp(again_buffer, "No", 2) == 0 ||
            strncmp(again_buffer, "NO", 2) == 0)
          play_again_flag = -1;
        if (strncmp(again_buffer, "yes", 3) == 0 ||
            strncmp(again_buffer, "Yes", 3) == 0 ||
            strncmp(again_buffer, "YES", 3) == 0)
          play_again_flag = 1;
        if (play_again_flag == 0)
          printf("\nYou have entered an invalid input, please try again: ");
      }
    }
    printf("Goodbye %s! Hope to see you soon.\n\n", name_buffer);
    return 0;
  } else
    printf("Unable to open the dice module, ensure it is installed.");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1060 <scanf@plt>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    129f <main+0x14f>
lea    -0x64(%rbp),%rsi
lea    0xeab(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x64(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1217 <main+0xc7>
lea    -0x64(%rbp),%rdi
lea    0xe85(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1217 <main+0xc7>
lea    -0x64(%rbp),%rdi
lea    0xe6b(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    121e <main+0xce>
movl   $0x1,-0x18(%rbp)
lea    -0x64(%rbp),%rdi
lea    0xe4a(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     127b <main+0x12b>
lea    -0x64(%rbp),%rdi
lea    0xe30(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     127b <main+0x12b>
lea    -0x64(%rbp),%rdi
lea    0xe16(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1282 <main+0x132>
movl   $0xffffffff,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    129a <main+0x14a>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11a0 <main+0x50>
cmpl   $0xffffffff,-0x18(%rbp)
jne    12c3 <main+0x173>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    158d <main+0x43d>
movl   $0x1,-0x1c(%rbp)
lea    0xe06(%rip),%rdi
lea    0xe09(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
je     157f <main+0x42f>
jmp    12f1 <main+0x1a1>
cmpl   $0x1,-0x1c(%rbp)
jne    1561 <main+0x411>
movl   $0x0,-0x20(%rbp)
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x70(%rbp),%rcx
lea    -0x8(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fread@plt>
mov    -0x70(%rbp),%rcx
lea    -0xc(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fread@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x7,-0x10(%rbp)
je     136c <main+0x21c>
cmpl   $0xb,-0x10(%rbp)
jne    1373 <main+0x223>
movl   $0x1,-0x20(%rbp)
cmpl   $0x2,-0x10(%rbp)
je     1391 <main+0x241>
cmpl   $0x3,-0x10(%rbp)
je     1391 <main+0x241>
cmpl   $0xc,-0x10(%rbp)
jne    1398 <main+0x248>
movl   $0xffffffff,-0x20(%rbp)
jmp    139d <main+0x24d>
cmpl   $0x0,-0x20(%rbp)
jne    1418 <main+0x2c8>
mov    -0x70(%rbp),%rcx
lea    -0x8(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fread@plt>
mov    -0x70(%rbp),%rcx
lea    -0xc(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fread@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xd1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x7,-0x14(%rbp)
jne    1400 <main+0x2b0>
movl   $0xffffffff,-0x20(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1413 <main+0x2c3>
movl   $0x1,-0x20(%rbp)
jmp    139d <main+0x24d>
cmpl   $0x1,-0x20(%rbp)
jne    1430 <main+0x2e0>
lea    0xcfe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0xffffffff,-0x20(%rbp)
jne    1448 <main+0x2f8>
lea    0xcf1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcf6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    155c <main+0x40c>
lea    -0x67(%rbp),%rsi
lea    0xcfc(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x67(%rbp),%rdi
lea    0xcf0(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     14d4 <main+0x384>
lea    -0x67(%rbp),%rdi
lea    0xcd4(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     14d4 <main+0x384>
lea    -0x67(%rbp),%rdi
lea    0xcb8(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    14db <main+0x38b>
movl   $0xffffffff,-0x1c(%rbp)
lea    -0x67(%rbp),%rdi
lea    0xc95(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1538 <main+0x3e8>
lea    -0x67(%rbp),%rdi
lea    0xc7a(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1538 <main+0x3e8>
lea    -0x67(%rbp),%rdi
lea    0xc5f(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    153f <main+0x3ef>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1557 <main+0x407>
lea    0xb32(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    145d <main+0x30d>
jmp    12f1 <main+0x1a1>
lea    -0x60(%rbp),%rsi
lea    0xc1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    158d <main+0x43d>
lea    0xc25(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0x1006(%rip),%rdi
call   1050 <puts@plt>
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe7a(%rip),%rdi
lea    0x20(%rsp),%rsi
call   1080 <scanf@plt>
lea    0xe6e(%rip),%rdi
lea    0xe8d(%rip),%r14
lea    0x1c(%rsp),%rbp
lea    0xe85(%rip),%r15
lea    0xe8d(%rip),%rbx
xor    %eax,%eax
call   1070 <printf@plt>
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %r13d,%r13d
jne    12b8 <main+0x148>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1080 <scanf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1240 <main+0xd0>
mov    %rbp,%rdi
lea    0xe3a(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1240 <main+0xd0>
mov    %rbp,%rdi
lea    0xe26(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1240 <main+0xd0>
xor    %r12d,%r12d
jmp    1243 <main+0xd3>
mov    $0x1,%r12b
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
mov    $0xffffffff,%r13d
test   %rax,%rax
je     11e0 <main+0x70>
mov    %rbp,%rdi
lea    0xdf4(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     11e0 <main+0x70>
mov    %rbp,%rdi
lea    0xddc(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
sete   %cl
or     %cl,%r12b
cmp    $0x1,%rax
sbb    %r13d,%r13d
or     $0x1,%r13d
test   %r12b,%r12b
jne    11e0 <main+0x70>
lea    0xdb3(%rip),%rdi
jmp    11ca <main+0x5a>
cmp    $0xffffffff,%r13d
jne    12cf <main+0x15f>
lea    0xefd(%rip),%rdi
call   1050 <puts@plt>
jmp    158f <main+0x41f>
lea    0xdc7(%rip),%rdi
lea    0xdca(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     1581 <main+0x411>
mov    %rax,%rbp
lea    0xc(%rsp),%r14
lea    0x8(%rsp),%rbx
lea    0x19(%rsp),%r12
mov    %rax,0x10(%rsp)
jmp    1326 <main+0x1b6>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x1,%ebp
mov    %r13,%r14
lea    0x8(%rsp),%rbx
mov    0x10(%rsp),%rbp
jne    156c <main+0x3fc>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1060 <fread@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1060 <fread@plt>
mov    0xc(%rsp),%ebp
mov    0x8(%rsp),%r13d
lea    0x0(%r13,%rbp,1),%r15d
lea    0xd3a(%rip),%rdi
mov    %ebp,%esi
mov    %r13d,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
lea    -0x7(%r13,%rbp,1),%ecx
xor    %eax,%eax
test   $0xfffffffb,%ecx
sete   %al
cmp    $0xc,%r15d
ja     13a4 <main+0x234>
mov    $0x100c,%ecx
bt     %r15d,%ecx
jae    13a4 <main+0x234>
mov    $0xffffffff,%eax
lea    0x8(%rsp),%r13
mov    0x10(%rsp),%rbx
test   %eax,%eax
jne    141e <main+0x2ae>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fread@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fread@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    (%rdx,%rsi,1),%ebp
lea    0xccf(%rip),%rdi
mov    %ebp,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
cmp    $0x7,%ebp
sete   %al
neg    %eax
cmp    %r15d,%ebp
mov    $0x1,%ecx
cmove  %ecx,%eax
test   %eax,%eax
je     13c0 <main+0x250>
cmp    $0xffffffff,%eax
je     1440 <main+0x2d0>
cmp    $0x1,%eax
jne    144c <main+0x2dc>
lea    0xd89(%rip),%rdi
jmp    1447 <main+0x2d7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xd5f(%rip),%rdi
call   1050 <puts@plt>
mov    %r14,%r13
lea    0xc97(%rip),%rdi
lea    0xcb9(%rip),%r14
xor    %eax,%eax
call   1070 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r12,%rsi
call   1080 <scanf@plt>
mov    %r12,%rdi
lea    0xc95(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     14d0 <main+0x360>
mov    %r12,%rdi
lea    0xc7f(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     14d0 <main+0x360>
mov    %r12,%rdi
lea    0xc69(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
xor    %r15d,%r15d
mov    $0x0,%ebx
test   %rax,%rax
jne    14d8 <main+0x368>
xchg   %ax,%ax
mov    $0xffffffff,%ebx
mov    $0x1,%r15b
mov    %r12,%rdi
lea    0xc41(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     1310 <main+0x1a0>
mov    %r12,%rdi
lea    0xc23(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1310 <main+0x1a0>
mov    %r12,%rdi
lea    0xc0a(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
sete   %al
mov    $0x1,%ecx
cmove  %ecx,%ebx
or     %al,%r15b
cmp    $0x1,%r15b
jne    1560 <main+0x3f0>
mov    %ebx,%ebp
test   %ebx,%ebx
je     1470 <main+0x300>
jmp    1310 <main+0x1a0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xaff(%rip),%rdi
jmp    145d <main+0x2ed>
lea    0xbbc(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    158f <main+0x41f>
lea    0xbcb(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Welcome to Bryan's Casino!\0A\00"
@.str.1 = [25 x i8] c"Please enter your name: \00"
@.str.2 = [5 x i8] c"%50s\00"
@.str.3 = [38 x i8] c"%s, would you like to Play or Quit?: \00"
@.str.4 = [4 x i8] c"%4s\00"
@.str.5 = [5 x i8] c"play\00"
@.str.6 = [5 x i8] c"Play\00"
@.str.7 = [5 x i8] c"PLAY\00"
@.str.8 = [5 x i8] c"quit\00"
@.str.9 = [5 x i8] c"Quit\00"
@.str.10 = [5 x i8] c"QUIT\00"
@.str.11 = [55 x i8] c"\0AYou have entered an invalid input, please try again: \00"
@.str.12 = [30 x i8] c"\0AYou chose to quit! Goodbye!\0A\00"
@.str.13 = [10 x i8] c"/dev/dice\00"
@.str.14 = [2 x i8] c"r\00"
@.str.15 = [2 x i8] c"\0A\00"
@.str.16 = [34 x i8] c"You first rolled a: %d + %d = %d\0A\00"
@.str.17 = [34 x i8] c"Your next roll was: %d + %d = %d\0A\00"
@.str.18 = [11 x i8] c"You WIN!\0A\0A\00"
@.str.19 = [19 x i8] c"Sorry, you lost.\0A\0A\00"
@.str.20 = [41 x i8] c"Would you like to play again? (yes/no): \00"
@.str.21 = [4 x i8] c"%3s\00"
@.str.22 = [3 x i8] c"no\00"
@.str.23 = [3 x i8] c"No\00"
@.str.24 = [3 x i8] c"NO\00"
@.str.25 = [4 x i8] c"yes\00"
@.str.26 = [4 x i8] c"Yes\00"
@.str.27 = [4 x i8] c"YES\00"
@.str.28 = [36 x i8] c"Goodbye %s! Hope to see you soon.\0A\0A\00"
@.str.29 = [56 x i8] c"Unable to open the dice module, ensure it is installed.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [50 x i8]
%10 = alloca [4 x i8]
%11 = alloca [3 x i8]
%12 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %54, %0
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %55
21: ; preds = %18
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%23 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%25 = call i64 @strncmp(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%26 = icmp eq i64 %25, 0
br i1 %26, label %35, label %27
27: ; preds = %21
%28 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%29 = call i64 @strncmp(i8* %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%30 = icmp eq i64 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %27
%32 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%33 = call i64 @strncmp(i8* %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %31, %27, %21
store i32 1, i32* %6
br label %36
36: ; preds = %35, %31
%37 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%38 = call i64 @strncmp(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 4)
%39 = icmp eq i64 %38, 0
br i1 %39, label %48, label %40
40: ; preds = %36
%41 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%42 = call i64 @strncmp(i8* %41, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 4)
%43 = icmp eq i64 %42, 0
br i1 %43, label %48, label %44
44: ; preds = %40
%45 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%46 = call i64 @strncmp(i8* %45, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 4)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %44, %40, %36
store i32 -1, i32* %6
br label %49
49: ; preds = %48, %44
%50 = load i32, i32* %6
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.11, i64 0, i64 0))
br label %54
54: ; preds = %52, %49
br label %18
55: ; preds = %18
%56 = load i32, i32* %6
%57 = icmp eq i32 %56, -1
br i1 %57, label %58, label %60
58: ; preds = %55
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %1
br label %177
60: ; preds = %55
store i32 1, i32* %7
%61 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i32* %61, i32** %12
%62 = load i32*, i32** %12
%63 = icmp ne i32* %62, null
br i1 %63, label %64, label %175
64: ; preds = %60
br label %65
65: ; preds = %171, %64
%66 = load i32, i32* %7
%67 = icmp eq i32 %66, 1
br i1 %67, label %68, label %172
68: ; preds = %65
store i32 0, i32* %8
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
%70 = load i32*, i32** %12
%71 = call i32 @fread(i32* %2, i32 1, i32 1, i32* %70)
%72 = load i32*, i32** %12
%73 = call i32 @fread(i32* %3, i32 1, i32 1, i32* %72)
%74 = load i32, i32* %2
%75 = load i32, i32* %3
%76 = add nsw i32 %74, %75
store i32 %76, i32* %4
%77 = load i32, i32* %2
%78 = load i32, i32* %3
%79 = load i32, i32* %4
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0), i32 %77, i32 %78, i32 %79)
%81 = load i32, i32* %4
%82 = icmp eq i32 %81, 7
br i1 %82, label %86, label %83
83: ; preds = %68
%84 = load i32, i32* %4
%85 = icmp eq i32 %84, 11
br i1 %85, label %86, label %87
86: ; preds = %83, %68
store i32 1, i32* %8
br label %87
87: ; preds = %86, %83
%88 = load i32, i32* %4
%89 = icmp eq i32 %88, 2
br i1 %89, label %96, label %90
90: ; preds = %87
%91 = load i32, i32* %4
%92 = icmp eq i32 %91, 3
br i1 %92, label %96, label %93
93: ; preds = %90
%94 = load i32, i32* %4
%95 = icmp eq i32 %94, 12
br i1 %95, label %96, label %97
96: ; preds = %93, %90, %87
store i32 -1, i32* %8
br label %97
97: ; preds = %96, %93
br label %98
98: ; preds = %121, %97
%99 = load i32, i32* %8
%100 = icmp eq i32 %99, 0
br i1 %100, label %101, label %122
101: ; preds = %98
%102 = load i32*, i32** %12
%103 = call i32 @fread(i32* %2, i32 1, i32 1, i32* %102)
%104 = load i32*, i32** %12
%105 = call i32 @fread(i32* %3, i32 1, i32 1, i32* %104)
%106 = load i32, i32* %2
%107 = load i32, i32* %3
%108 = add nsw i32 %106, %107
store i32 %108, i32* %5
%109 = load i32, i32* %2
%110 = load i32, i32* %3
%111 = load i32, i32* %5
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.17, i64 0, i64 0), i32 %109, i32 %110, i32 %111)
%113 = load i32, i32* %5
%114 = icmp eq i32 %113, 7
br i1 %114, label %115, label %116
115: ; preds = %101
store i32 -1, i32* %8
br label %116
116: ; preds = %115, %101
%117 = load i32, i32* %5
%118 = load i32, i32* %4
%119 = icmp eq i32 %117, %118
br i1 %119, label %120, label %121
120: ; preds = %116
store i32 1, i32* %8
br label %121
121: ; preds = %120, %116
br label %98
122: ; preds = %98
%123 = load i32, i32* %8
%124 = icmp eq i32 %123, 1
br i1 %124, label %125, label %127
125: ; preds = %122
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.18, i64 0, i64 0))
br label %127
127: ; preds = %125, %122
%128 = load i32, i32* %8
%129 = icmp eq i32 %128, -1
br i1 %129, label %130, label %132
130: ; preds = %127
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.19, i64 0, i64 0))
br label %132
132: ; preds = %130, %127
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.20, i64 0, i64 0))
store i32 0, i32* %7
br label %134
134: ; preds = %170, %132
%135 = load i32, i32* %7
%136 = icmp eq i32 %135, 0
br i1 %136, label %137, label %171
137: ; preds = %134
%138 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%139 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0), i8* %138)
%140 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%141 = call i64 @strncmp(i8* %140, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0), i32 2)
%142 = icmp eq i64 %141, 0
br i1 %142, label %151, label %143
143: ; preds = %137
%144 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%145 = call i64 @strncmp(i8* %144, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i64 0, i64 0), i32 2)
%146 = icmp eq i64 %145, 0
br i1 %146, label %151, label %147
147: ; preds = %143
%148 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%149 = call i64 @strncmp(i8* %148, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i64 0, i64 0), i32 2)
%150 = icmp eq i64 %149, 0
br i1 %150, label %151, label %152
151: ; preds = %147, %143, %137
store i32 -1, i32* %7
br label %152
152: ; preds = %151, %147
%153 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%154 = call i64 @strncmp(i8* %153, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.25, i64 0, i64 0), i32 3)
%155 = icmp eq i64 %154, 0
br i1 %155, label %164, label %156
156: ; preds = %152
%157 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%158 = call i64 @strncmp(i8* %157, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i64 0, i64 0), i32 3)
%159 = icmp eq i64 %158, 0
br i1 %159, label %164, label %160
160: ; preds = %156
%161 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%162 = call i64 @strncmp(i8* %161, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.27, i64 0, i64 0), i32 3)
%163 = icmp eq i64 %162, 0
br i1 %163, label %164, label %165
164: ; preds = %160, %156, %152
store i32 1, i32* %7
br label %165
165: ; preds = %164, %160
%166 = load i32, i32* %7
%167 = icmp eq i32 %166, 0
br i1 %167, label %168, label %170
168: ; preds = %165
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.11, i64 0, i64 0))
br label %170
170: ; preds = %168, %165
br label %134
171: ; preds = %134
br label %65
172: ; preds = %65
%173 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.28, i64 0, i64 0), i8* %173)
store i32 0, i32* %1
br label %177
175: ; preds = %60
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.29, i64 0, i64 0))
br label %177
177: ; preds = %58, %172, %175
%178 = load i32, i32* %1
ret i32 %178
}

LLVM IR (-O2):
@.str.1 = [25 x i8] c"Please enter your name: \00"
@.str.2 = [5 x i8] c"%50s\00"
@.str.3 = [38 x i8] c"%s, would you like to Play or Quit?: \00"
@.str.4 = [4 x i8] c"%4s\00"
@.str.5 = [5 x i8] c"play\00"
@.str.6 = [5 x i8] c"Play\00"
@.str.7 = [5 x i8] c"PLAY\00"
@.str.8 = [5 x i8] c"quit\00"
@.str.9 = [5 x i8] c"Quit\00"
@.str.10 = [5 x i8] c"QUIT\00"
@.str.11 = [55 x i8] c"\0AYou have entered an invalid input, please try again: \00"
@.str.13 = [10 x i8] c"/dev/dice\00"
@.str.14 = [2 x i8] c"r\00"
@.str.16 = [34 x i8] c"You first rolled a: %d + %d = %d\0A\00"
@.str.17 = [34 x i8] c"Your next roll was: %d + %d = %d\0A\00"
@.str.20 = [41 x i8] c"Would you like to play again? (yes/no): \00"
@.str.21 = [4 x i8] c"%3s\00"
@.str.22 = [3 x i8] c"no\00"
@.str.23 = [3 x i8] c"No\00"
@.str.24 = [3 x i8] c"NO\00"
@.str.25 = [4 x i8] c"yes\00"
@.str.26 = [4 x i8] c"Yes\00"
@.str.27 = [4 x i8] c"YES\00"
@.str.28 = [36 x i8] c"Goodbye %s! Hope to see you soon.\0A\0A\00"
@.str.29 = [56 x i8] c"Unable to open the dice module, ensure it is installed.\00"
@str = [27 x i8] c"Welcome to Bryan's Casino!\00"
@str.30 = [18 x i8] c"Sorry, you lost.\0A\00"
@str.31 = [10 x i8] c"You WIN!\0A\00"
@str.32 = [29 x i8] c"\0AYou chose to quit! Goodbye!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [50 x i8]
%4 = alloca [4 x i8]
%5 = alloca [3 x i8]
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %8)
br label %14
14: ; preds = %37, %0
%15 = phi i8* [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), %0 ], [ getelementptr inbounds ([55 x i8], [55 x i8]* @.str.11, i64 0, i64 0), %37 ]
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %15)
br label %17
17: ; preds = %42, %14
%18 = phi i32 [ 0, %14 ], [ %43, %42 ]
switch i32 %18, label %46 [
i32 0, label %19
i32 -1, label %44
]
19: ; preds = %17
%20 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%21 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%22 = icmp eq i64 %21, 0
br i1 %22, label %29, label %23
23: ; preds = %19
%24 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%25 = icmp eq i64 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %26, %23, %19
br label %30
30: ; preds = %29, %26
%31 = phi i1 [ true, %29 ], [ false, %26 ]
%32 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 4)
%33 = icmp eq i64 %32, 0
br i1 %33, label %42, label %34
34: ; preds = %30
%35 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 4)
%36 = icmp eq i64 %35, 0
br i1 %36, label %42, label %37
37: ; preds = %34
%38 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 4)
%39 = icmp eq i64 %38, 0
%40 = or i1 %31, %39
%41 = select i1 %39, i32 -1, i32 1
br i1 %40, label %42, label %14
42: ; preds = %37, %34, %30
%43 = phi i32 [ -1, %30 ], [ -1, %34 ], [ %41, %37 ]
br label %17
44: ; preds = %17
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.32, i64 0, i64 0))
br label %118
46: ; preds = %17
%47 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%48 = icmp eq i32* %47, null
br i1 %48, label %116, label %52
49: ; preds = %104, %99, %112
%50 = phi i32 [ %111, %112 ], [ 1, %99 ], [ 1, %104 ]
%51 = icmp eq i32 %50, 1
br i1 %51, label %52, label %114
52: ; preds = %46, %49
%53 = call i32 @putchar(i32 10)
%54 = call i32 @fread(i32* %1, i32 1, i32 1, i32* %47)
%55 = call i32 @fread(i32* %2, i32 1, i32 1, i32* %47)
%56 = load i32, i32* %1
%57 = load i32, i32* %2
%58 = add nsw i32 %57, %56
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0), i32 %56, i32 %57, i32 %58)
%60 = icmp eq i32 %58, 11
%61 = icmp eq i32 %58, 7
%62 = or i1 %60, %61
%63 = zext i1 %62 to i32
switch i32 %58, label %65 [
i32 12, label %64
i32 3, label %64
i32 2, label %64
]
64: ; preds = %52, %52, %52
br label %65
65: ; preds = %52, %64
%66 = phi i32 [ %63, %52 ], [ -1, %64 ]
br label %67
67: ; preds = %65, %69
%68 = phi i32 [ %79, %69 ], [ %66, %65 ]
switch i32 %68, label %84 [
i32 0, label %69
i32 1, label %81
i32 -1, label %80
]
69: ; preds = %67
%70 = call i32 @fread(i32* %1, i32 1, i32 1, i32* %47)
%71 = call i32 @fread(i32* %2, i32 1, i32 1, i32* %47)
%72 = load i32, i32* %1
%73 = load i32, i32* %2
%74 = add nsw i32 %73, %72
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.17, i64 0, i64 0), i32 %72, i32 %73, i32 %74)
%76 = icmp eq i32 %74, 7
%77 = sext i1 %76 to i32
%78 = icmp eq i32 %74, %58
%79 = select i1 %78, i32 1, i32 %77
br label %67
80: ; preds = %67
br label %81
81: ; preds = %67, %80
%82 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.30, i64 0, i64 0), %80 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.31, i64 0, i64 0), %67 ]
%83 = call i32 @puts(i8* dereferenceable(1) %82)
br label %84
84: ; preds = %67, %81
br label %85
85: ; preds = %107, %84
%86 = phi i8* [ getelementptr inbounds ([41 x i8], [41 x i8]* @.str.20, i64 0, i64 0), %84 ], [ getelementptr inbounds ([55 x i8], [55 x i8]* @.str.11, i64 0, i64 0), %107 ]
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %86)
br label %88
88: ; preds = %85, %112
%89 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0), i8* %10)
%90 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0), i32 2)
%91 = icmp eq i64 %90, 0
br i1 %91, label %98, label %92
92: ; preds = %88
%93 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i64 0, i64 0), i32 2)
%94 = icmp eq i64 %93, 0
br i1 %94, label %98, label %95
95: ; preds = %92
%96 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i64 0, i64 0), i32 2)
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %99
98: ; preds = %95, %92, %88
br label %99
99: ; preds = %98, %95
%100 = phi i1 [ true, %98 ], [ false, %95 ]
%101 = phi i32 [ -1, %98 ], [ 0, %95 ]
%102 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.25, i64 0, i64 0), i32 3)
%103 = icmp eq i64 %102, 0
br i1 %103, label %49, label %104
104: ; preds = %99
%105 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i64 0, i64 0), i32 3)
%106 = icmp eq i64 %105, 0
br i1 %106, label %49, label %107
107: ; preds = %104
%108 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.27, i64 0, i64 0), i32 3)
%109 = icmp eq i64 %108, 0
%110 = or i1 %100, %109
%111 = select i1 %109, i32 1, i32 %101
br i1 %110, label %112, label %85
112: ; preds = %107
%113 = icmp eq i32 %111, 0
br i1 %113, label %88, label %49
114: ; preds = %49
%115 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.28, i64 0, i64 0), i8* %8)
br label %118
116: ; preds = %46
%117 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.29, i64 0, i64 0))
br label %118
118: ; preds = %114, %116, %44
ret i32 0
}