#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*/ printf(char *, ...);
void gover_stats(int wplayer1, int wplayer2, int nreplays, int nstalemates,
                 int mode) {
  int p1stats, p2stats;
  p1stats = wplayer1 * 100 / nreplays;
  p2stats = wplayer2 * 100 / nreplays;
  printf("\n---- Game has ended ----\n");
  if (mode == 1) {
    printf("Human player has won %d game(s) ", wplayer1);
    printf("with a %d%% win(s) and %d%% loss(es)\n", p1stats, p2stats);
    printf("Computer player has won %d game(s) ", wplayer2);
    printf("with a %d%% win(s) and %d%% loss(es)\n", p2stats, p1stats);
  } else {
    printf("Player 1 has won %d game(s) ", wplayer1);
    printf("with a %d%% win(s) and %d%% loss(es)\n", p1stats, p2stats);
    printf("Player 2 has won %d game(s) ", wplayer2);
    printf("with a %d%% win(s) and %d%% loss(es)\n", p2stats, p1stats);
  }
  printf("%d game(s) were played resulting in ", nreplays);
  printf("%d stalemate(s)\n\n", nstalemates);
}


x86 assembly (clang, -O0):
<gover_stats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
imul   $0x64,-0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x18(%rbp)
imul   $0x64,-0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x1c(%rbp)
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    11a5 <gover_stats+0x95>
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ef <gover_stats+0xdf>
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gover_stats>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r13d
mov    %ecx,0x4(%rsp)
mov    %edx,%r12d
mov    %esi,(%rsp)
mov    %edi,%r14d
imul   $0x64,%edi,%eax
cltd
idiv   %r12d
mov    %eax,%ebp
imul   $0x64,%esi,%eax
cltd
idiv   %r12d
mov    %eax,%r15d
lea    0xf87(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x1,%r13d
lea    0xe9b(%rip),%rax
lea    0xeff(%rip),%rdi
cmove  %rax,%rdi
lea    0xed0(%rip),%rax
lea    0xf0a(%rip),%rbx
cmove  %rax,%rbx
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8e(%rip),%r14
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    (%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee0(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef4(%rip),%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"\0A---- Game has ended ----\0A\00"
@.str.1 = [33 x i8] c"Human player has won %d game(s) \00"
@.str.2 = [38 x i8] c"with a %d%% win(s) and %d%% loss(es)\0A\00"
@.str.3 = [36 x i8] c"Computer player has won %d game(s) \00"
@.str.4 = [29 x i8] c"Player 1 has won %d game(s) \00"
@.str.5 = [29 x i8] c"Player 2 has won %d game(s) \00"
@.str.6 = [37 x i8] c"%d game(s) were played resulting in \00"
@.str.7 = [18 x i8] c"%d stalemate(s)\0A\0A\00"
define void @gover_stats(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%13 = load i32, i32* %6
%14 = mul nsw i32 %13, 100
%15 = load i32, i32* %8
%16 = sdiv i32 %14, %15
store i32 %16, i32* %11
%17 = load i32, i32* %7
%18 = mul nsw i32 %17, 100
%19 = load i32, i32* %8
%20 = sdiv i32 %18, %19
store i32 %20, i32* %12
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%22 = load i32, i32* %10
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %35
24: ; preds = %5
%25 = load i32, i32* %6
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %11
%28 = load i32, i32* %12
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %27, i32 %28)
%30 = load i32, i32* %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %12
%33 = load i32, i32* %11
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %32, i32 %33)
br label %46
35: ; preds = %5
%36 = load i32, i32* %6
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %11
%39 = load i32, i32* %12
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %38, i32 %39)
%41 = load i32, i32* %7
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %12
%44 = load i32, i32* %11
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %43, i32 %44)
br label %46
46: ; preds = %35, %24
%47 = load i32, i32* %8
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %9
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %49)
ret void
}

LLVM IR (-O2):
@.str.1 = [33 x i8] c"Human player has won %d game(s) \00"
@.str.2 = [38 x i8] c"with a %d%% win(s) and %d%% loss(es)\0A\00"
@.str.3 = [36 x i8] c"Computer player has won %d game(s) \00"
@.str.4 = [29 x i8] c"Player 1 has won %d game(s) \00"
@.str.5 = [29 x i8] c"Player 2 has won %d game(s) \00"
@.str.6 = [37 x i8] c"%d game(s) were played resulting in \00"
@.str.7 = [18 x i8] c"%d stalemate(s)\0A\0A\00"
@str = [26 x i8] c"\0A---- Game has ended ----\00"
define void @gover_stats(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = mul nsw i32 %0, 100
%7 = sdiv i32 %6, %2
%8 = mul nsw i32 %1, 100
%9 = sdiv i32 %8, %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%11 = icmp eq i32 %4, 1
%12 = select i1 %11, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0)
%13 = select i1 %11, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %12, i32 %0)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %9)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %13, i32 %1)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %7)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i32 %2)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %3)
ret void
}