#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 exp10(double);
double game_adapt_K(double);
double game_adapt_result(double);
int rint(double);
void ios_game_rate(double f, int ogb, int ogw, int orb, int orw, int *nrb,
                   int *nrw) {
  double vb, vw, nb, nw;
  double gb, gw, rb, rw, K, w;
  w = game_adapt_result(f);
  K = game_adapt_K(f);
  gb = (double)ogb;
  gw = (double)ogw;
  rb = (double)orb;
  rw = (double)orw;
  if (rb == 0)
    rb = 1600;
  if (rw == 0)
    rw = 1600;
  if (gb < 10 && gw < 10) {
    vb = (rb + rw) / 2 + 200 * w;
    nb = (rb * gb + vb) / (gb + 1);
    vw = (rb + rw) / 2 - 200 * w;
    nw = (rw * gw + vw) / (gw + 1);
    goto END;
  } else if (gb < 10 && gw >= 10) {
    vb = rw + 400 * w;
    nb = (rb * gb + vb) / (gb + 1);
    vw = (1 - w) / 2;
    nw = rw + K * (vw - 1 / (1 + exp10((rb - rw) / 400))) * gb / 10;
    goto END;
  } else if (gb >= 10 && gw < 10) {
    vw = rb - 400 * w;
    nw = (rw * gw + vw) / (gw + 1);
    vb = (1 + w) / 2;
    nb = rb + K * (vb - 1 / (1 + exp10((rw - rb) / 400))) * gw / 10;
    goto END;
  } else {
    vb = (1 + w) / 2;
    nb = rb + K * (vb - 1 / (1 + exp10((rw - rb) / 400)));
    vw = (1 - w) / 2;
    nw = rw + K * (vw - 1 / (1 + exp10((rb - rw) / 400)));
    goto END;
  }
END:;
  *nrb = rint(nb);
  *nrw = rint(nw);
}


x86 assembly (clang, -O0):
<ios_game_rate>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <game_adapt_result@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <game_adapt_K@plt>
movsd  %xmm0,-0x70(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11cf <ios_game_rate+0x8f>
jp     11cf <ios_game_rate+0x8f>
movsd  0xe36(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x68(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11f4 <ios_game_rate+0xb4>
jp     11f4 <ios_game_rate+0xb4>
movsd  0xe11(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xe0c(%rip),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    12d9 <ios_game_rate+0x199>
movsd  0xdf9(%rip),%xmm0
ucomisd -0x58(%rbp),%xmm0
jbe    12d9 <ios_game_rate+0x199>
movsd  -0x60(%rbp),%xmm1
addsd  -0x68(%rbp),%xmm1
movsd  0xdec(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  0xdfb(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdb7(%rip),%xmm1
addsd  -0x50(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x60(%rbp),%xmm1
addsd  -0x68(%rbp),%xmm1
movsd  0xd8f(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  0xd96(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd5a(%rip),%xmm1
addsd  -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1653 <ios_game_rate+0x513>
movsd  0xd27(%rip),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    13f9 <ios_game_rate+0x2b9>
movsd  -0x58(%rbp),%xmm0
movsd  0xd0f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     13f9 <ios_game_rate+0x2b9>
movsd  -0x68(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  0xcfb(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xcdf(%rip),%xmm1
addsd  -0x50(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xcc9(%rip),%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  0xcb4(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  0xc6d(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <exp10@plt>
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x80(%rbp),%xmm0
mov    %eax,%ecx
add    $0x1,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
mulsd  -0x50(%rbp),%xmm1
movsd  0xc21(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1653 <ios_game_rate+0x513>
movsd  -0x50(%rbp),%xmm0
movsd  0xc02(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     151f <ios_game_rate+0x3df>
movsd  0xbf0(%rip),%xmm0
ucomisd -0x58(%rbp),%xmm0
jbe    151f <ios_game_rate+0x3df>
movsd  -0x60(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  0xbf3(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xbbf(%rip),%xmm1
addsd  -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xba9(%rip),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  0xb94(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  0xb4a(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <exp10@plt>
movsd  -0xa8(%rbp),%xmm2
ff
movsd  -0xa0(%rbp),%xmm1
ff
movsd  -0x98(%rbp),%xmm0
ff
mov    %eax,%ecx
add    $0x1,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
mulsd  -0x58(%rbp),%xmm1
movsd  0xafb(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1653 <ios_game_rate+0x513>
movsd  0xaf9(%rip),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  0xae4(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  0xa9a(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <exp10@plt>
movsd  -0xd8(%rbp),%xmm2
ff
movsd  -0xd0(%rbp),%xmm0
ff
movsd  -0xc8(%rbp),%xmm1
ff
mov    %eax,%ecx
add    $0x1,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xa5f(%rip),%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  0xa4a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  0xa00(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <exp10@plt>
movsd  -0xc0(%rbp),%xmm2
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  -0xb0(%rbp),%xmm1
ff
mov    %eax,%ecx
add    $0x1,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1050 <rint@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x48(%rbp),%xmm0
call   1050 <rint@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ios_game_rate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,%r14
mov    %r8,%r15
mov    %ecx,%r13d
mov    %edx,%ebp
mov    %esi,%r12d
mov    %edi,%ebx
movsd  %xmm0,0x8(%rsp)
call   1040 <game_adapt_result@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <game_adapt_K@plt>
movsd  0xe7e(%rip),%xmm2
movapd %xmm2,%xmm3
test   %ebp,%ebp
je     1191 <ios_game_rate+0x51>
xorps  %xmm3,%xmm3
cvtsi2sd %ebp,%xmm3
test   %r13d,%r13d
je     119e <ios_game_rate+0x5e>
xorps  %xmm2,%xmm2
cvtsi2sd %r13d,%xmm2
cvtsi2sd %ebx,%xmm6
cvtsi2sd %r12d,%xmm5
cmp    $0x9,%ebx
jg     121b <ios_game_rate+0xdb>
cmp    $0x9,%r12d
jg     121b <ios_game_rate+0xdb>
movapd %xmm3,%xmm0
addsd  %xmm2,%xmm0
mulsd  0xe4e(%rip),%xmm0
movsd  0xe66(%rip),%xmm1
movsd  0x10(%rsp),%xmm4
mulsd  %xmm4,%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm6,%xmm3
addsd  %xmm1,%xmm3
movsd  0xe20(%rip),%xmm1
addsd  %xmm1,%xmm6
divsd  %xmm6,%xmm3
mulsd  0xe40(%rip),%xmm4
addsd  %xmm0,%xmm4
mulsd  %xmm5,%xmm2
addsd  %xmm4,%xmm2
addsd  %xmm1,%xmm5
divsd  %xmm5,%xmm2
movsd  %xmm2,0x8(%rsp)
movapd %xmm3,%xmm0
jmp    147d <ios_game_rate+0x33d>
cmp    $0x9,%ebx
movsd  %xmm0,0x28(%rsp)
jg     12e5 <ios_game_rate+0x1a5>
cmp    $0xa,%r12d
jl     12e5 <ios_game_rate+0x1a5>
movsd  0xddc(%rip),%xmm0
movsd  0x10(%rsp),%xmm4
movapd %xmm4,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm3,%xmm5
mulsd  %xmm6,%xmm5
addsd  %xmm1,%xmm5
movsd  0xda6(%rip),%xmm7
movapd %xmm6,%xmm1
addsd  %xmm7,%xmm1
divsd  %xmm1,%xmm5
movsd  %xmm5,0x18(%rsp)
subsd  %xmm4,%xmm7
mulsd  0xd90(%rip),%xmm7
movsd  %xmm7,0x10(%rsp)
subsd  %xmm2,%xmm3
divsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
movsd  %xmm2,0x20(%rsp)
movsd  %xmm6,0x8(%rsp)
call   1060 <exp10@plt>
lea    0x1(%rax),%ecx
add    $0x2,%eax
xor    %edx,%edx
cmp    $0x3,%eax
cmovb  %ecx,%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
movsd  0x10(%rsp),%xmm2
subsd  %xmm0,%xmm2
movsd  0x18(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
mulsd  %xmm2,%xmm1
mulsd  0x8(%rsp),%xmm1
divsd  0xd48(%rip),%xmm1
jmp    1471 <ios_game_rate+0x331>
cmp    $0xa,%ebx
movsd  %xmm3,0x30(%rsp)
jl     13a9 <ios_game_rate+0x269>
cmp    $0x9,%r12d
jg     13a9 <ios_game_rate+0x269>
movsd  0xd1a(%rip),%xmm0
movsd  0x10(%rsp),%xmm6
mulsd  %xmm6,%xmm0
addsd  %xmm3,%xmm0
movapd %xmm2,%xmm4
mulsd  %xmm5,%xmm4
addsd  %xmm0,%xmm4
movsd  0xce0(%rip),%xmm0
movapd %xmm5,%xmm1
addsd  %xmm0,%xmm1
addsd  %xmm0,%xmm6
mulsd  0xcd4(%rip),%xmm6
movsd  %xmm6,0x10(%rsp)
divsd  %xmm1,%xmm4
movsd  %xmm4,0x8(%rsp)
subsd  %xmm3,%xmm2
divsd  0xcc0(%rip),%xmm2
movapd %xmm2,%xmm0
movsd  %xmm5,0x18(%rsp)
call   1060 <exp10@plt>
lea    0x1(%rax),%ecx
add    $0x2,%eax
xor    %edx,%edx
cmp    $0x3,%eax
cmovb  %ecx,%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x28(%rsp),%xmm0
mulsd  %xmm1,%xmm0
mulsd  0x18(%rsp),%xmm0
divsd  0xc8a(%rip),%xmm0
addsd  0x30(%rsp),%xmm0
jmp    147d <ios_game_rate+0x33d>
movsd  0x10(%rsp),%xmm0
addsd  0xc51(%rip),%xmm0
mulsd  0xc51(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
movapd %xmm2,%xmm0
subsd  %xmm3,%xmm0
divsd  0xc43(%rip),%xmm0
movsd  %xmm2,0x20(%rsp)
call   1060 <exp10@plt>
lea    0x1(%rax),%ecx
add    $0x2,%eax
xor    %ebx,%ebx
cmp    $0x3,%eax
cmovae %ebx,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  0x18(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0x28(%rsp),%xmm1
movsd  0x30(%rsp),%xmm2
addsd  %xmm2,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0xbeb(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
mulsd  0xbe5(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
subsd  0x20(%rsp),%xmm2
divsd  0xbd9(%rip),%xmm2
movapd %xmm2,%xmm0
call   1060 <exp10@plt>
lea    0x1(%rax),%ecx
add    $0x2,%eax
cmp    $0x3,%eax
cmovae %ebx,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x18(%rsp),%xmm0
mulsd  0x28(%rsp),%xmm1
addsd  0x20(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
call   1050 <rint@plt>
mov    %eax,(%r15)
movsd  0x8(%rsp),%xmm0
call   1050 <rint@plt>
mov    %eax,(%r14)
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ios_game_rate(double %0, i32 %1, i32 %2, i32 %3, i32 %4, i32* %5, i32* %6) {
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
store double %0, double* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32* %5, i32** %13
store i32* %6, i32** %14
%25 = load double, double* %8
%26 = call double @game_adapt_result(double %25)
store double %26, double* %24
%27 = load double, double* %8
%28 = call double @game_adapt_K(double %27)
store double %28, double* %23
%29 = load i32, i32* %9
%30 = sitofp i32 %29 to double
store double %30, double* %19
%31 = load i32, i32* %10
%32 = sitofp i32 %31 to double
store double %32, double* %20
%33 = load i32, i32* %11
%34 = sitofp i32 %33 to double
store double %34, double* %21
%35 = load i32, i32* %12
%36 = sitofp i32 %35 to double
store double %36, double* %22
%37 = load double, double* %21
%38 = fcmp oeq double %37, 0.000000e+00
br i1 %38, label %39, label %40
39: ; preds = %7
store double 1.600000e+03, double* %21
br label %40
40: ; preds = %39, %7
%41 = load double, double* %22
%42 = fcmp oeq double %41, 0.000000e+00
br i1 %42, label %43, label %44
43: ; preds = %40
store double 1.600000e+03, double* %22
br label %44
44: ; preds = %43, %40
%45 = load double, double* %19
%46 = fcmp olt double %45, 1.000000e+01
br i1 %46, label %47, label %77
47: ; preds = %44
%48 = load double, double* %20
%49 = fcmp olt double %48, 1.000000e+01
br i1 %49, label %50, label %77
50: ; preds = %47
%51 = load double, double* %21
%52 = load double, double* %22
%53 = fadd double %51, %52
%54 = fdiv double %53, 2.000000e+00
%55 = load double, double* %24
%56 = call double @llvm.fmuladd.f64(double 2.000000e+02, double %55, double %54)
store double %56, double* %15
%57 = load double, double* %21
%58 = load double, double* %19
%59 = load double, double* %15
%60 = call double @llvm.fmuladd.f64(double %57, double %58, double %59)
%61 = load double, double* %19
%62 = fadd double %61, 1.000000e+00
%63 = fdiv double %60, %62
store double %63, double* %17
%64 = load double, double* %21
%65 = load double, double* %22
%66 = fadd double %64, %65
%67 = fdiv double %66, 2.000000e+00
%68 = load double, double* %24
%69 = call double @llvm.fmuladd.f64(double -2.000000e+02, double %68, double %67)
store double %69, double* %16
%70 = load double, double* %22
%71 = load double, double* %20
%72 = load double, double* %16
%73 = call double @llvm.fmuladd.f64(double %70, double %71, double %72)
%74 = load double, double* %20
%75 = fadd double %74, 1.000000e+00
%76 = fdiv double %73, %75
store double %76, double* %18
br label %184
77: ; preds = %47, %44
%78 = load double, double* %19
%79 = fcmp olt double %78, 1.000000e+01
br i1 %79, label %80, label %114
80: ; preds = %77
%81 = load double, double* %20
%82 = fcmp oge double %81, 1.000000e+01
br i1 %82, label %83, label %114
83: ; preds = %80
%84 = load double, double* %22
%85 = load double, double* %24
%86 = call double @llvm.fmuladd.f64(double 4.000000e+02, double %85, double %84)
store double %86, double* %15
%87 = load double, double* %21
%88 = load double, double* %19
%89 = load double, double* %15
%90 = call double @llvm.fmuladd.f64(double %87, double %88, double %89)
%91 = load double, double* %19
%92 = fadd double %91, 1.000000e+00
%93 = fdiv double %90, %92
store double %93, double* %17
%94 = load double, double* %24
%95 = fsub double 1.000000e+00, %94
%96 = fdiv double %95, 2.000000e+00
store double %96, double* %16
%97 = load double, double* %22
%98 = load double, double* %23
%99 = load double, double* %16
%100 = load double, double* %21
%101 = load double, double* %22
%102 = fsub double %100, %101
%103 = fdiv double %102, 4.000000e+02
%104 = call i32 @exp10(double %103)
%105 = add nsw i32 1, %104
%106 = sdiv i32 1, %105
%107 = sitofp i32 %106 to double
%108 = fsub double %99, %107
%109 = fmul double %98, %108
%110 = load double, double* %19
%111 = fmul double %109, %110
%112 = fdiv double %111, 1.000000e+01
%113 = fadd double %97, %112
store double %113, double* %18
br label %184
114: ; preds = %80, %77
%115 = load double, double* %19
%116 = fcmp oge double %115, 1.000000e+01
br i1 %116, label %117, label %151
117: ; preds = %114
%118 = load double, double* %20
%119 = fcmp olt double %118, 1.000000e+01
br i1 %119, label %120, label %151
120: ; preds = %117
%121 = load double, double* %21
%122 = load double, double* %24
%123 = call double @llvm.fmuladd.f64(double -4.000000e+02, double %122, double %121)
store double %123, double* %16
%124 = load double, double* %22
%125 = load double, double* %20
%126 = load double, double* %16
%127 = call double @llvm.fmuladd.f64(double %124, double %125, double %126)
%128 = load double, double* %20
%129 = fadd double %128, 1.000000e+00
%130 = fdiv double %127, %129
store double %130, double* %18
%131 = load double, double* %24
%132 = fadd double 1.000000e+00, %131
%133 = fdiv double %132, 2.000000e+00
store double %133, double* %15
%134 = load double, double* %21
%135 = load double, double* %23
%136 = load double, double* %15
%137 = load double, double* %22
%138 = load double, double* %21
%139 = fsub double %137, %138
%140 = fdiv double %139, 4.000000e+02
%141 = call i32 @exp10(double %140)
%142 = add nsw i32 1, %141
%143 = sdiv i32 1, %142
%144 = sitofp i32 %143 to double
%145 = fsub double %136, %144
%146 = fmul double %135, %145
%147 = load double, double* %20
%148 = fmul double %146, %147
%149 = fdiv double %148, 1.000000e+01
%150 = fadd double %134, %149
store double %150, double* %17
br label %184
151: ; preds = %117, %114
%152 = load double, double* %24
%153 = fadd double 1.000000e+00, %152
%154 = fdiv double %153, 2.000000e+00
store double %154, double* %15
%155 = load double, double* %21
%156 = load double, double* %23
%157 = load double, double* %15
%158 = load double, double* %22
%159 = load double, double* %21
%160 = fsub double %158, %159
%161 = fdiv double %160, 4.000000e+02
%162 = call i32 @exp10(double %161)
%163 = add nsw i32 1, %162
%164 = sdiv i32 1, %163
%165 = sitofp i32 %164 to double
%166 = fsub double %157, %165
%167 = call double @llvm.fmuladd.f64(double %156, double %166, double %155)
store double %167, double* %17
%168 = load double, double* %24
%169 = fsub double 1.000000e+00, %168
%170 = fdiv double %169, 2.000000e+00
store double %170, double* %16
%171 = load double, double* %22
%172 = load double, double* %23
%173 = load double, double* %16
%174 = load double, double* %21
%175 = load double, double* %22
%176 = fsub double %174, %175
%177 = fdiv double %176, 4.000000e+02
%178 = call i32 @exp10(double %177)
%179 = add nsw i32 1, %178
%180 = sdiv i32 1, %179
%181 = sitofp i32 %180 to double
%182 = fsub double %173, %181
%183 = call double @llvm.fmuladd.f64(double %172, double %182, double %171)
store double %183, double* %18
br label %184
184: ; preds = %151, %120, %83, %50
%185 = load double, double* %17
%186 = call i32 @rint(double %185)
%187 = load i32*, i32** %13
store i32 %186, i32* %187
%188 = load double, double* %18
%189 = call i32 @rint(double %188)
%190 = load i32*, i32** %14
store i32 %189, i32* %190
ret void
}

LLVM IR (-O2):
define void @ios_game_rate(double %0, i32 %1, i32 %2, i32 %3, i32 %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6) {
%8 = tail call double @game_adapt_result(double %0)
%9 = tail call double @game_adapt_K(double %0)
%10 = sitofp i32 %1 to double
%11 = sitofp i32 %2 to double
%12 = sitofp i32 %3 to double
%13 = sitofp i32 %4 to double
%14 = icmp eq i32 %3, 0
%15 = select i1 %14, double 1.600000e+03, double %12
%16 = icmp eq i32 %4, 0
%17 = select i1 %16, double 1.600000e+03, double %13
%18 = icmp slt i32 %1, 10
%19 = icmp slt i32 %2, 10
%20 = and i1 %18, %19
br i1 %20, label %21, label %32
21: ; preds = %7
%22 = fadd double %15, %17
%23 = fmul double %22, 5.000000e-01
%24 = tail call double @llvm.fmuladd.f64(double %8, double 2.000000e+02, double %23)
%25 = tail call double @llvm.fmuladd.f64(double %15, double %10, double %24)
%26 = fadd double %10, 1.000000e+00
%27 = fdiv double %25, %26
%28 = tail call double @llvm.fmuladd.f64(double %8, double -2.000000e+02, double %23)
%29 = tail call double @llvm.fmuladd.f64(double %17, double %11, double %28)
%30 = fadd double %11, 1.000000e+00
%31 = fdiv double %29, %30
br label %103
32: ; preds = %7
%33 = icmp sgt i32 %2, 9
%34 = and i1 %18, %33
br i1 %34, label %35, label %55
35: ; preds = %32
%36 = tail call double @llvm.fmuladd.f64(double %8, double 4.000000e+02, double %17)
%37 = tail call double @llvm.fmuladd.f64(double %15, double %10, double %36)
%38 = fadd double %10, 1.000000e+00
%39 = fdiv double %37, %38
%40 = fsub double 1.000000e+00, %8
%41 = fmul double %40, 5.000000e-01
%42 = fsub double %15, %17
%43 = fdiv double %42, 4.000000e+02
%44 = tail call i32 @exp10(double %43)
%45 = add nsw i32 %44, 1
%46 = add i32 %44, 2
%47 = icmp ult i32 %46, 3
%48 = select i1 %47, i32 %45, i32 0
%49 = sitofp i32 %48 to double
%50 = fsub double %41, %49
%51 = fmul double %9, %50
%52 = fmul double %51, %10
%53 = fdiv double %52, 1.000000e+01
%54 = fadd double %17, %53
br label %103
55: ; preds = %32
%56 = icmp sgt i32 %1, 9
%57 = and i1 %56, %19
br i1 %57, label %58, label %78
58: ; preds = %55
%59 = tail call double @llvm.fmuladd.f64(double %8, double -4.000000e+02, double %15)
%60 = tail call double @llvm.fmuladd.f64(double %17, double %11, double %59)
%61 = fadd double %11, 1.000000e+00
%62 = fdiv double %60, %61
%63 = fadd double %8, 1.000000e+00
%64 = fmul double %63, 5.000000e-01
%65 = fsub double %17, %15
%66 = fdiv double %65, 4.000000e+02
%67 = tail call i32 @exp10(double %66)
%68 = add nsw i32 %67, 1
%69 = add i32 %67, 2
%70 = icmp ult i32 %69, 3
%71 = select i1 %70, i32 %68, i32 0
%72 = sitofp i32 %71 to double
%73 = fsub double %64, %72
%74 = fmul double %9, %73
%75 = fmul double %74, %11
%76 = fdiv double %75, 1.000000e+01
%77 = fadd double %15, %76
br label %103
78: ; preds = %55
%79 = fadd double %8, 1.000000e+00
%80 = fmul double %79, 5.000000e-01
%81 = fsub double %17, %15
%82 = fdiv double %81, 4.000000e+02
%83 = tail call i32 @exp10(double %82)
%84 = add nsw i32 %83, 1
%85 = add i32 %83, 2
%86 = icmp ult i32 %85, 3
%87 = select i1 %86, i32 %84, i32 0
%88 = sitofp i32 %87 to double
%89 = fsub double %80, %88
%90 = tail call double @llvm.fmuladd.f64(double %9, double %89, double %15)
%91 = fsub double 1.000000e+00, %8
%92 = fmul double %91, 5.000000e-01
%93 = fsub double %15, %17
%94 = fdiv double %93, 4.000000e+02
%95 = tail call i32 @exp10(double %94)
%96 = add nsw i32 %95, 1
%97 = add i32 %95, 2
%98 = icmp ult i32 %97, 3
%99 = select i1 %98, i32 %96, i32 0
%100 = sitofp i32 %99 to double
%101 = fsub double %92, %100
%102 = tail call double @llvm.fmuladd.f64(double %9, double %101, double %17)
br label %103
103: ; preds = %78, %58, %35, %21
%104 = phi double [ %31, %21 ], [ %54, %35 ], [ %62, %58 ], [ %102, %78 ]
%105 = phi double [ %27, %21 ], [ %39, %35 ], [ %77, %58 ], [ %90, %78 ]
%106 = tail call i32 @rint(double %105)
store i32 %106, i32* %5
%107 = tail call i32 @rint(double %104)
store i32 %107, i32* %6
ret void
}