#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 */
scalar_t__ play_game();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main(void) {
  int wins = 0, losses = 0;
  char play_again;
  srand((unsigned)time(NULL));
  for (;;) {
    if (play_game())
      wins++;
    else
      losses++;
    printf("Play again? ");
    scanf("%c", &play_again);
    if (play_again == 'n')
      break;
    else
      continue;
  }
  printf("Wins:  %d  Losses:  %d\n", wins, losses);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1070 <play_game@plt>
cmp    $0x0,%rax
je     119c <main+0x4c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a5 <main+0x55>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe53(%rip),%rdi
lea    -0xd(%rbp),%rsi
call   1060 <scanf@plt>
movsbl -0xd(%rbp),%eax
cmp    $0x6e,%eax
jne    11d5 <main+0x85>
jmp    11da <main+0x8a>
jmp    117d <main+0x2d>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xe8f(%rip),%r14
lea    0xe95(%rip),%r15
lea    0xf(%rsp),%r12
xor    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <play_game@plt>
xor    %ecx,%ecx
xor    %edx,%edx
test   %rax,%rax
sete   %cl
setne  %dl
add    %edx,%ebx
add    %ecx,%ebp
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
cmpb   $0x6e,0xf(%rsp)
jne    1190 <main+0x40>
lea    0xe45(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Play again? \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [24 x i8] c"Wins: %d Losses: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%5 = call i64 @time(i32* null)
%6 = trunc i64 %5 to i32
%7 = call i32 @srand(i32 %6)
br label %8
8: ; preds = %24, %0
%9 = call i64 (...) @play_game()
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %17
14: ; preds = %8
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %17
17: ; preds = %14, %11
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 110
br i1 %22, label %23, label %24
23: ; preds = %17
br label %25
24: ; preds = %17
br label %8
25: ; preds = %23
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %26, i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Play again? \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [24 x i8] c"Wins: %d Losses: %d\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i64 @time(i32* null)
%3 = trunc i64 %2 to i32
%4 = tail call i32 @srand(i32 %3)
br label %5
5: ; preds = %5, %0
%6 = phi i32 [ 0, %0 ], [ %12, %5 ]
%7 = phi i32 [ 0, %0 ], [ %14, %5 ]
%8 = call i64 (...) @play_game()
%9 = icmp eq i64 %8, 0
%10 = xor i1 %9, true
%11 = zext i1 %10 to i32
%12 = add nuw nsw i32 %6, %11
%13 = zext i1 %9 to i32
%14 = add nuw nsw i32 %7, %13
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%17 = load i8, i8* %1
%18 = icmp eq i8 %17, 110
br i1 %18, label %19, label %5
19: ; preds = %5
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %14)
ret i32 0
}