#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 */
unsigned long long atoll(char const *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ racquetball();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, const char *argv[]) {
  if (argc < 2) {
    printf("Usage: %s <number of times to test>\n", argv[0]);
    exit(1);
  }
  srand(time(NULL));
  unsigned long long num_tests = atoll(argv[1]);
  unsigned long long player1_wins = 0;
  for (unsigned long long i = 0; i < num_tests; i++)
    if (racquetball())
      player1_wins++;
  double prob = (double)player1_wins / (double)num_tests;
  printf("Player1 won %.2f%%\n", prob * 100);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    119f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoll@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1211 <main+0xb1>
mov    $0x0,%al
call   1030 <racquetball@plt>
cmp    $0x0,%rax
je     11fb <main+0x9b>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1200 <main+0xa0>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11d0 <main+0x70>
movq   -0x20(%rbp),%xmm0
movaps 0xdf3(%rip),%xmm3
punpckldq %xmm3,%xmm0
movapd 0xdf7(%rip),%xmm2
subpd  %xmm2,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movq   -0x18(%rbp),%xmm1
punpckldq %xmm3,%xmm1
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xd9f(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
lea    0xde8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
cmp    $0x1,%edi
jle    121f <main+0xbf>
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    0x8(%rbx),%rdi
call   1060 <atoll@plt>
mov    %rax,%r14
test   %rax,%rax
je     11d8 <main+0x78>
mov    %r14,%rbx
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <racquetball@plt>
cmp    $0x1,%rax
sbb    $0xffffffffffffffff,%r15
add    $0xffffffffffffffff,%rbx
jne    11a0 <main+0x40>
movq   %r15,%xmm1
punpckldq 0xe3e(%rip),%xmm1
subpd  0xe46(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
jmp    11dc <main+0x7c>
xorpd  %xmm0,%xmm0
movq   %r14,%xmm1
punpckldq 0xe17(%rip),%xmm1
subpd  0xe1f(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xe17(%rip),%xmm0
lea    0xe3d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    (%rbx),%rsi
lea    0xdff(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Usage: %s <number of times to test>\0A\00"
@.str.1 = [20 x i8] c"Player1 won %.2f%%\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %2
%19 = call i32 @time(i32* null)
%20 = call i32 @srand(i32 %19)
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i64 @atoll(i8* %23)
store i64 %24, i64* %6
store i64 0, i64* %7
store i64 0, i64* %8
br label %25
25: ; preds = %36, %18
%26 = load i64, i64* %8
%27 = load i64, i64* %6
%28 = icmp ult i64 %26, %27
br i1 %28, label %29, label %39
29: ; preds = %25
%30 = call i64 (...) @racquetball()
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i64, i64* %7
%34 = add i64 %33, 1
store i64 %34, i64* %7
br label %35
35: ; preds = %32, %29
br label %36
36: ; preds = %35
%37 = load i64, i64* %8
%38 = add i64 %37, 1
store i64 %38, i64* %8
br label %25
39: ; preds = %25
%40 = load i64, i64* %7
%41 = uitofp i64 %40 to double
%42 = load i64, i64* %6
%43 = uitofp i64 %42 to double
%44 = fdiv double %41, %43
store double %44, double* %9
%45 = load double, double* %9
%46 = fmul double %45, 1.000000e+02
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %46)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"Usage: %s <number of times to test>\0A\00"
@.str.1 = [20 x i8] c"Player1 won %.2f%%\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = tail call i32 @time(i32* null)
%10 = tail call i32 @srand(i32 %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i64 @atoll(i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %23
15: ; preds = %23
%16 = uitofp i64 %29 to double
br label %17
17: ; preds = %15, %8
%18 = phi double [ 0.000000e+00, %8 ], [ %16, %15 ]
%19 = uitofp i64 %13 to double
%20 = fdiv double %18, %19
%21 = fmul double %20, 1.000000e+02
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %21)
ret i32 0
23: ; preds = %8, %23
%24 = phi i64 [ %29, %23 ], [ 0, %8 ]
%25 = phi i64 [ %30, %23 ], [ 0, %8 ]
%26 = tail call i64 (...) @racquetball()
%27 = icmp ne i64 %26, 0
%28 = zext i1 %27 to i64
%29 = add i64 %24, %28
%30 = add nuw i64 %25, 1
%31 = icmp eq i64 %30, %13
br i1 %31, label %15, label %23
}