#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 */
double blacks_advantage(double, unsigned int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void rank_diff_print(void) {
  static struct {
    double komi;
    unsigned hcap;
    unsigned trad;
  } tset[12] = {{5.5, 0, 3}, {0.5, 0, 1}, {5.5, 2, 2}, {0.5, 2, 1},
                {5.5, 3, 2}, {0.5, 3, 1}, {5.5, 4, 2}, {0.5, 4, 1},
                {5.5, 5, 2}, {0.5, 5, 1}, {0.0, 0, 0}};
  unsigned i;
  fprintf(stderr, "  Game differences\n  Hcap  Komi  Trad. Corr.\n");
  for (i = 0; tset[i].trad != 0; i++) {
    double a = blacks_advantage(tset[i].komi, tset[i].hcap);
    switch (tset[i].trad) {
    case 1:
      fprintf(stderr, "  %3u  %5.1f %5.2f\n", tset[i].hcap, tset[i].komi, a);
      break;
    case 2:
      fprintf(stderr, "  %3u  %5.1f       %5.2f\n", tset[i].hcap, tset[i].komi,
              a);
      break;
    default:
      fprintf(stderr, "  %3u  %5.1f %5.2f %5.2f\n", tset[i].hcap, tset[i].komi,
              a, a);
      break;
    }
  }
  fprintf(stderr, "  ...\n");
}


x86 assembly (clang, -O0):
<rank_diff_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    0xec8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2eee(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
cmpl   $0x0,0xc(%rax)
je     12b6 <rank_diff_print+0x196>
mov    -0x4(%rbp),%eax
shl    $0x4,%rax
lea    0x2ecf(%rip),%rcx
mov    %rcx,-0x20(%rbp)
movsd  (%rax,%rcx,1),%xmm0
mov    0x8(%rax,%rcx,1),%edi
call   1040 <blacks_advantage@plt>
mov    -0x20(%rbp),%rcx
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x4,%rax
mov    0xc(%rax,%rcx,1),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     11b9 <rank_diff_print+0x99>
jmp    11a8 <rank_diff_print+0x88>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1207 <rank_diff_print+0xe7>
jmp    1255 <rank_diff_print+0x135>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2e72(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%edx
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2e5c(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    0xe33(%rip),%rsi
mov    $0x2,%al
call   1030 <fprintf@plt>
jmp    12a3 <rank_diff_print+0x183>
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2e24(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%edx
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2e0e(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    0xdf9(%rip),%rsi
mov    $0x2,%al
call   1030 <fprintf@plt>
jmp    12a3 <rank_diff_print+0x183>
mov    0x2d84(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2dd6(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%edx
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2dc0(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
lea    0xdc0(%rip),%rsi
mov    $0x3,%al
call   1030 <fprintf@plt>
jmp    12a8 <rank_diff_print+0x188>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1146 <rank_diff_print+0x26>
mov    0x2d23(%rip),%rax
mov    (%rax),%edi
lea    0xdb0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rank_diff_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2eae(%rip),%r13
mov    0x0(%r13),%edi
lea    0xf83(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0xc,%ebx
lea    0xeb0(%rip),%r14
lea    0xf97(%rip),%r15
lea    0xfbe(%rip),%r12
jmp    1185 <rank_diff_print+0x65>
mov    0x0(%r13),%edi
mov    %r12,%rsi
mov    %ebp,%edx
movsd  (%rsp),%xmm0
movaps %xmm1,%xmm2
mov    $0x3,%al
call   1030 <fprintf@plt>
add    $0x10,%rbx
cmp    $0xac,%rbx
je     11db <rank_diff_print+0xbb>
movsd  -0xc(%rbx,%r14,1),%xmm0
mov    -0x4(%rbx,%r14,1),%ebp
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
call   1040 <blacks_advantage@plt>
movaps %xmm0,%xmm1
mov    (%rbx,%r14,1),%eax
cmp    $0x2,%eax
je     11c0 <rank_diff_print+0xa0>
cmp    $0x1,%eax
jne    1160 <rank_diff_print+0x40>
mov    0x0(%r13),%edi
mov    %r15,%rsi
jmp    11cb <rank_diff_print+0xab>
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
lea    0xf37(%rip),%rsi
mov    %ebp,%edx
movsd  (%rsp),%xmm0
mov    $0x2,%al
call   1030 <fprintf@plt>
jmp    1178 <rank_diff_print+0x58>
mov    0x0(%r13),%edi
lea    0xf50(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
%struct.anon = type { double, i32, i32 }
@rank_diff_print.tset = internal global [12 x %struct.anon] [%struct.anon { double 5.500000e+00, i32 0, i32 3 }, %struct.anon { double 5.000000e-01, i32 0, i32 1 }, %struct.anon { double 5.500000e+00, i32 2, i32 2 }, %struct.anon { double 5.000000e-01, i32 2, i32 1 }, %struct.anon { double 5.500000e+00, i32 3, i32 2 }, %struct.anon { double 5.000000e-01, i32 3, i32 1 }, %struct.anon { double 5.500000e+00, i32 4, i32 2 }, %struct.anon { double 5.000000e-01, i32 4, i32 1 }, %struct.anon { double 5.500000e+00, i32 5, i32 2 }, %struct.anon { double 5.000000e-01, i32 5, i32 1 }, %struct.anon zeroinitializer, %struct.anon zeroinitializer]
@stderr = global i32 0
@.str = [46 x i8] c" Game differences\0A Hcap Komi Trad. Corr.\0A\00"
@.str.1 = [20 x i8] c" %3u %5.1f %5.2f\0A\00"
@.str.2 = [26 x i8] c" %3u %5.1f %5.2f\0A\00"
@.str.3 = [26 x i8] c" %3u %5.1f %5.2f %5.2f\0A\00"
@.str.4 = [7 x i8] c" ...\0A\00"
define void @rank_diff_print() {
%1 = alloca i32
%2 = alloca double
%3 = load i32, i32* @stderr
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %5
5: ; preds = %73, %0
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds [12 x %struct.anon], [12 x %struct.anon]* @rank_diff_print.tset, i64 0, i64 %7
%9 = getelementptr inbounds %struct.anon, %struct.anon* %8, i32 0, i32 2
%10 = load i32, i32* %9
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %76
12: ; preds = %5
%13 = load i32, i32* %1
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds [12 x %struct.anon], [12 x %struct.anon]* @rank_diff_print.tset, i64 0, i64 %14
%16 = getelementptr inbounds %struct.anon, %struct.anon* %15, i32 0, i32 0
%17 = load double, double* %16
%18 = load i32, i32* %1
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds [12 x %struct.anon], [12 x %struct.anon]* @rank_diff_print.tset, i64 0, i64 %19
%21 = getelementptr inbounds %struct.anon, %struct.anon* %20, i32 0, i32 1
%22 = load i32, i32* %21
%23 = call double @blacks_advantage(double %17, i32 %22)
store double %23, double* %2
%24 = load i32, i32* %1
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds [12 x %struct.anon], [12 x %struct.anon]* @rank_diff_print.tset, i64 0, i64 %25
%27 = getelementptr inbounds %struct.anon, %struct.anon* %26, i32 0, i32 2
%28 = load i32, i32* %27
switch i32 %28, label %57 [
i32 1, label %29
i32 2, label %43
]
29: ; preds = %12
%30 = load i32, i32* @stderr
%31 = load i32, i32* %1
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds [12 x %struct.anon], [12 x %struct.anon]* @rank_diff_print.tset, i64 0, i64 %32
%34 = getelementptr inbounds %struct.anon, %struct.anon* %33, i32 0, i32 1
%35 = load i32, i32* %34
%36 = load i32, i32* %1
%37 = zext i32 %36 to i64
%38 = getelementptr inbounds [12 x %struct.anon], [12 x %struct.anon]* @rank_diff_print.tset, i64 0, i64 %37
%39 = getelementptr inbounds %struct.anon, %struct.anon* %38, i32 0, i32 0
%40 = load double, double* %39
%41 = load double, double* %2
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %35, double %40, double %41)
br label %72
43: ; preds = %12
%44 = load i32, i32* @stderr
%45 = load i32, i32* %1
%46 = zext i32 %45 to i64
%47 = getelementptr inbounds [12 x %struct.anon], [12 x %struct.anon]* @rank_diff_print.tset, i64 0, i64 %46
%48 = getelementptr inbounds %struct.anon, %struct.anon* %47, i32 0, i32 1
%49 = load i32, i32* %48
%50 = load i32, i32* %1
%51 = zext i32 %50 to i64
%52 = getelementptr inbounds [12 x %struct.anon], [12 x %struct.anon]* @rank_diff_print.tset, i64 0, i64 %51
%53 = getelementptr inbounds %struct.anon, %struct.anon* %52, i32 0, i32 0
%54 = load double, double* %53
%55 = load double, double* %2
%56 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %49, double %54, double %55)
br label %72
57: ; preds = %12
%58 = load i32, i32* @stderr
%59 = load i32, i32* %1
%60 = zext i32 %59 to i64
%61 = getelementptr inbounds [12 x %struct.anon], [12 x %struct.anon]* @rank_diff_print.tset, i64 0, i64 %60
%62 = getelementptr inbounds %struct.anon, %struct.anon* %61, i32 0, i32 1
%63 = load i32, i32* %62
%64 = load i32, i32* %1
%65 = zext i32 %64 to i64
%66 = getelementptr inbounds [12 x %struct.anon], [12 x %struct.anon]* @rank_diff_print.tset, i64 0, i64 %65
%67 = getelementptr inbounds %struct.anon, %struct.anon* %66, i32 0, i32 0
%68 = load double, double* %67
%69 = load double, double* %2
%70 = load double, double* %2
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %63, double %68, double %69, double %70)
br label %72
72: ; preds = %57, %43, %29
br label %73
73: ; preds = %72
%74 = load i32, i32* %1
%75 = add i32 %74, 1
store i32 %75, i32* %1
br label %5
76: ; preds = %5
%77 = load i32, i32* @stderr
%78 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.anon = type { double, i32, i32 }
@rank_diff_print.tset = internal unnamed_addr constant [12 x %struct.anon] [%struct.anon { double 5.500000e+00, i32 0, i32 3 }, %struct.anon { double 5.000000e-01, i32 0, i32 1 }, %struct.anon { double 5.500000e+00, i32 2, i32 2 }, %struct.anon { double 5.000000e-01, i32 2, i32 1 }, %struct.anon { double 5.500000e+00, i32 3, i32 2 }, %struct.anon { double 5.000000e-01, i32 3, i32 1 }, %struct.anon { double 5.500000e+00, i32 4, i32 2 }, %struct.anon { double 5.000000e-01, i32 4, i32 1 }, %struct.anon { double 5.500000e+00, i32 5, i32 2 }, %struct.anon { double 5.000000e-01, i32 5, i32 1 }, %struct.anon zeroinitializer, %struct.anon zeroinitializer]
@stderr = global i32 0
@.str = [46 x i8] c" Game differences\0A Hcap Komi Trad. Corr.\0A\00"
@.str.1 = [20 x i8] c" %3u %5.1f %5.2f\0A\00"
@.str.2 = [26 x i8] c" %3u %5.1f %5.2f\0A\00"
@.str.3 = [26 x i8] c" %3u %5.1f %5.2f %5.2f\0A\00"
@.str.4 = [7 x i8] c" ...\0A\00"
define void @rank_diff_print() {
%1 = load i32, i32* @stderr
%2 = tail call i32 (i32, i8*, ...) @fprintf(i32 %1, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %0, %21
%4 = phi i64 [ 0, %0 ], [ %22, %21 ]
%5 = getelementptr inbounds [12 x %struct.anon], [12 x %struct.anon]* @rank_diff_print.tset, i64 0, i64 %4, i32 2
%6 = getelementptr inbounds [12 x %struct.anon], [12 x %struct.anon]* @rank_diff_print.tset, i64 0, i64 %4, i32 0
%7 = load double, double* %6
%8 = getelementptr inbounds [12 x %struct.anon], [12 x %struct.anon]* @rank_diff_print.tset, i64 0, i64 %4, i32 1
%9 = load i32, i32* %8
%10 = tail call double @blacks_advantage(double %7, i32 %9)
%11 = load i32, i32* %5
switch i32 %11, label %18 [
i32 1, label %12
i32 2, label %15
]
12: ; preds = %3
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %9, double %7, double %10)
br label %21
15: ; preds = %3
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %9, double %7, double %10)
br label %21
18: ; preds = %3
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %9, double %7, double %10, double %10)
br label %21
21: ; preds = %18, %15, %12
%22 = add nuw nsw i64 %4, 1
%23 = icmp eq i64 %22, 10
br i1 %23, label %24, label %3
24: ; preds = %21
%25 = load i32, i32* @stderr
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
ret void
}