#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__ connection(int *, int *);
int /*<<< orphan*/ fatShuffle(int *);
int /*<<< orphan*/ guardInit(int *);
int /*<<< orphan*/ printf(char *, int, double, ...);
int /*<<< orphan*/ srand(int);
int main(void) {
  int S[((9 * 9) + 1)];
  int fatV[((9 + 2) * (9 + 2))];
  guardInit(fatV);
  srand(9913987);
  int j, wins = 0;
  for (j = 0; j < 1000000; j++) {
    fatShuffle(fatV);
    wins += connection(S, fatV);
  }
  printf("%2dx%2d board (%d)/(", 9, 9, wins);
  printf("%d) = %f\n", 1000000, (1.0 * wins) / (1.0 * 1000000));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x350,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x340(%rbp),%rdi
call   1060 <guardInit@plt>
mov    $0x974683,%edi
call   1050 <srand@plt>
movl   $0x0,-0x348(%rbp)
movl   $0x0,-0x344(%rbp)
cmpl   $0xf4240,-0x344(%rbp)
jge    11e2 <main+0x92>
lea    -0x340(%rbp),%rdi
call   1070 <fatShuffle@plt>
lea    -0x150(%rbp),%rdi
lea    -0x340(%rbp),%rsi
call   1030 <connection@plt>
mov    %rax,%rcx
movslq -0x348(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x348(%rbp)
mov    -0x344(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x344(%rbp)
jmp    118c <main+0x3c>
mov    -0x348(%rbp),%edx
lea    0xe29(%rip),%rdi
mov    $0x9,%esi
movsd  0xe14(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
cvtsi2sdl -0x348(%rbp),%xmm1
ff
movsd  0xdf5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xde1(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe03(%rip),%rdi
mov    $0xf4240,%esi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x350,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x338,%rsp
lea    0x150(%rsp),%r14
mov    %r14,%rdi
call   1060 <guardInit@plt>
mov    $0x974683,%edi
call   1050 <srand@plt>
xor    %ebx,%ebx
mov    $0xf4240,%ebp
mov    %rsp,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1070 <fatShuffle@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <connection@plt>
add    %eax,%ebx
add    $0xffffffff,%ebp
jne    1190 <main+0x40>
lea    0xe5f(%rip),%rdi
movsd  0xe47(%rip),%xmm0
mov    $0x9,%esi
mov    %ebx,%edx
mov    $0x1,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  0xe32(%rip),%xmm0
lea    0xe48(%rip),%rdi
mov    $0xf4240,%esi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x338,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"%2dx%2d board (%d)/(\00"
@.str.1 = [10 x i8] c"%d) = %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [82 x i32]
%3 = alloca [121 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = getelementptr inbounds [121 x i32], [121 x i32]* %3, i64 0, i64 0
%7 = call i32 @guardInit(i32* %6)
%8 = call i32 @srand(i32 9913987)
store i32 0, i32* %5
store i32 0, i32* %4
br label %9
9: ; preds = %22, %0
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 1000000
br i1 %11, label %12, label %25
12: ; preds = %9
%13 = getelementptr inbounds [121 x i32], [121 x i32]* %3, i64 0, i64 0
%14 = call i32 @fatShuffle(i32* %13)
%15 = getelementptr inbounds [82 x i32], [82 x i32]* %2, i64 0, i64 0
%16 = getelementptr inbounds [121 x i32], [121 x i32]* %3, i64 0, i64 0
%17 = call i64 @connection(i32* %15, i32* %16)
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = add nsw i64 %19, %17
%21 = trunc i64 %20 to i32
store i32 %21, i32* %5
br label %22
22: ; preds = %12
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %9
25: ; preds = %9
%26 = load i32, i32* %5
%27 = call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 9, double 9.000000e+00, i32 %26)
%28 = load i32, i32* %5
%29 = sitofp i32 %28 to double
%30 = fmul double 1.000000e+00, %29
%31 = fdiv double %30, 1.000000e+06
%32 = call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 1000000, double %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"%2dx%2d board (%d)/(\00"
@.str.1 = [10 x i8] c"%d) = %f\0A\00"
define i32 @main() {
%1 = alloca [82 x i32]
%2 = alloca [121 x i32]
%3 = bitcast [82 x i32]* %1 to i8*
%4 = bitcast [121 x i32]* %2 to i8*
%5 = getelementptr inbounds [121 x i32], [121 x i32]* %2, i64 0, i64 0
%6 = call i32 @guardInit(i32* %5)
%7 = call i32 @srand(i32 9913987)
%8 = getelementptr inbounds [82 x i32], [82 x i32]* %1, i64 0, i64 0
br label %9
9: ; preds = %0, %9
%10 = phi i32 [ 0, %0 ], [ %15, %9 ]
%11 = phi i32 [ 0, %0 ], [ %16, %9 ]
%12 = call i32 @fatShuffle(i32* %5)
%13 = call i64 @connection(i32* %8, i32* %5)
%14 = trunc i64 %13 to i32
%15 = add i32 %10, %14
%16 = add nuw nsw i32 %11, 1
%17 = icmp eq i32 %16, 1000000
br i1 %17, label %18, label %9
18: ; preds = %9
%19 = call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 9, double 9.000000e+00, i32 %15)
%20 = sitofp i32 %15 to double
%21 = fdiv double %20, 1.000000e+06
%22 = call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 1000000, double %21)
ret i32 0
}