int critical_blow(weight, plus, dam, player_level)
int weight, player_level;
double plus, dam;
{
  int critical;
  int added_dam;
  double chance_critical, chance_dam, total_chance;
  int debug = 0;
  critical = dam;
  chance_critical = ((int)(weight + 5 * plus + 3 * player_level)) / 5000.;
  if (debug)
    printf("chance_critical=%g  chance_dam=(", chance_critical);
  chance_dam =
      ((0.) > ((((400. - weight)) < ((400. - weight) - (400. - (650. + weight)))
                    ? ((400. - weight))
                    : ((400. - weight) - (400. - (650. + weight)))))
           ? (0.)
           : ((((400. - weight)) < ((400. - weight) - (400. - (650. + weight)))
                   ? ((400. - weight))
                   : ((400. - weight) - (400. - (650. + weight)))))) /
      650.;
  if (debug)
    printf("%g", chance_dam);
  total_chance = chance_dam;
  added_dam = (2 * dam + 5) * chance_dam;
  chance_dam =
      ((0.) > ((((700. - 400.)) < ((700. - 400.) - (700. - (650. + weight)))
                    ? ((700. - 400.))
                    : ((700. - 400.) - (700. - (650. + weight)))))
           ? (0.)
           : ((((700. - 400.)) < ((700. - 400.) - (700. - (650. + weight)))
                   ? ((700. - 400.))
                   : ((700. - 400.) - (700. - (650. + weight)))))) /
      650.;
  if (debug)
    printf("+%g", chance_dam);
  total_chance += chance_dam;
  added_dam += (3 * dam + 10) * chance_dam;
  chance_dam =
      ((0.) > ((((900. - 700.)) < ((900. - 700.) - (900. - (650. + weight)))
                    ? ((900. - 700.))
                    : ((900. - 700.) - (900. - (650. + weight)))))
           ? (0.)
           : ((((900. - 700.)) < ((900. - 700.) - (900. - (650. + weight)))
                   ? ((900. - 700.))
                   : ((900. - 700.) - (900. - (650. + weight)))))) /
      650.;
  if (debug)
    printf("+%g", chance_dam);
  total_chance += chance_dam;
  added_dam += (4 * dam + 15) * chance_dam;
  chance_dam =
      ((0.) > ((((2000. - 900.)) < ((2000. - 900.) - (2000. - (650. + weight)))
                    ? ((2000. - 900.))
                    : ((2000. - 900.) - (2000. - (650. + weight)))))
           ? (0.)
           : ((((2000. - 900.)) < ((2000. - 900.) - (2000. - (650. + weight)))
                   ? ((2000. - 900.))
                   : ((2000. - 900.) - (2000. - (650. + weight)))))) /
      650.;
  if (debug)
    printf("+%g)  ", chance_dam);
  total_chance += chance_dam;
  added_dam += (5 * dam + 20) * chance_dam;
  if (debug)
    printf("added_dam = %d\n", added_dam);
  if (((total_chance - 1.) < 0 ? -(total_chance - 1.) : (total_chance - 1.)) >
      1e-14) {
    printf("ERROR:  total_chance=%g (%g)\n", total_chance, total_chance - 1.);
    exit(1);
  }
  return (critical + added_dam * chance_critical);
}


x86 assembly (clang, -O0):
<critical_blow>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
movl   $0x0,-0x44(%rbp)
cvttsd2si -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  0xeac(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
imul   $0x3,-0x1c(%rbp),%eax
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe80(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     11a6 <critical_blow+0x86>
movsd  -0x30(%rbp),%xmm0
lea    0xee9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xe5d(%rip),%xmm1
subsd  %xmm0,%xmm1
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xe4c(%rip),%xmm0
subsd  %xmm2,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xe43(%rip),%xmm3
addsd  %xmm2,%xmm3
movsd  0xe2f(%rip),%xmm2
subsd  %xmm3,%xmm2
subsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    120e <critical_blow+0xee>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe10(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1245 <critical_blow+0x125>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xdf5(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xdec(%rip),%xmm2
addsd  %xmm1,%xmm2
movsd  0xdd8(%rip),%xmm1
subsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1264 <critical_blow+0x144>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    130d <critical_blow+0x1ed>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xd9f(%rip),%xmm1
subsd  %xmm0,%xmm1
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xd8e(%rip),%xmm0
subsd  %xmm2,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xd85(%rip),%xmm3
addsd  %xmm2,%xmm3
movsd  0xd71(%rip),%xmm2
subsd  %xmm3,%xmm2
subsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    12cc <critical_blow+0x1ac>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xd52(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    1303 <critical_blow+0x1e3>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xd37(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xd2e(%rip),%xmm2
addsd  %xmm1,%xmm2
movsd  0xd1a(%rip),%xmm1
subsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  0xcfe(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     1340 <critical_blow+0x220>
movsd  -0x38(%rbp),%xmm0
lea    0xd71(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xcad(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xca0(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xca4(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xc90(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  0xc84(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    13b8 <critical_blow+0x298>
movsd  0xc72(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    13e6 <critical_blow+0x2c6>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xc53(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xc57(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xc43(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1405 <critical_blow+0x2e5>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    148a <critical_blow+0x36a>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xc06(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xc0a(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xbf6(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  0xbea(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1452 <critical_blow+0x332>
movsd  0xbd8(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    1480 <critical_blow+0x360>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xbb9(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xbbd(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xba9(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  0xb81(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     14bd <critical_blow+0x39d>
movsd  -0x38(%rbp),%xmm0
lea    0xbf3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xb67(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xb63(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm2
cvtsi2sdl -0x24(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xb09(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xb1d(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xb09(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  0xafd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    154f <critical_blow+0x42f>
movsd  0xaeb(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    157d <critical_blow+0x45d>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xabc(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xad0(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xabc(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    159f <critical_blow+0x47f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    1630 <critical_blow+0x510>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xa6c(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xa80(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xa6c(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  0xa60(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    15ef <critical_blow+0x4cf>
movsd  0xa4e(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    1620 <critical_blow+0x500>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xa1c(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xa30(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xa1c(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  0x9d8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     1666 <critical_blow+0x546>
movsd  -0x38(%rbp),%xmm0
lea    0xa4a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0x9de(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x9da(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm2
cvtsi2sdl -0x24(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0x960(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0x994(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0x980(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  0x974(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    16fb <critical_blow+0x5db>
movsd  0x962(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    172c <critical_blow+0x60c>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0x910(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0x944(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0x930(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm1
ff
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1751 <critical_blow+0x631>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    17e2 <critical_blow+0x6c2>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0x8ba(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0x8ee(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0x8da(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  0x8ce(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    17a1 <critical_blow+0x681>
movsd  0x8bc(%rip),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
jmp    17d2 <critical_blow+0x6b2>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0x86a(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0x89e(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0x88a(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  0x826(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     1818 <critical_blow+0x6f8>
movsd  -0x38(%rbp),%xmm0
lea    0x89c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0x7d4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x830(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm2
cvtsi2sdl -0x24(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     1878 <critical_blow+0x758>
mov    -0x24(%rbp),%esi
lea    0x843(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x40(%rbp),%xmm1
movsd  0x7f3(%rip),%xmm0
subsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    18cb <critical_blow+0x7ab>
movsd  -0x40(%rbp),%xmm0
movsd  0x7d5(%rip),%xmm1
subsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    18e4 <critical_blow+0x7c4>
movsd  -0x40(%rbp),%xmm0
movsd  0x7a0(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  0x78c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    192c <critical_blow+0x80c>
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  0x768(%rip),%xmm2
subsd  %xmm2,%xmm1
lea    0x7a9(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
cvtsi2sdl -0x20(%rbp),%xmm1
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<critical_blow>:
push   %rax
cvtsi2sd %edi,%xmm9
movsd  0xed2(%rip),%xmm4
movapd %xmm4,%xmm6
subsd  %xmm9,%xmm6
movsd  0xec8(%rip),%xmm10
movapd %xmm9,%xmm3
addsd  %xmm10,%xmm3
subsd  %xmm3,%xmm4
movapd %xmm6,%xmm5
subsd  %xmm4,%xmm5
minsd  %xmm5,%xmm6
xorpd  %xmm8,%xmm8
xorpd  %xmm11,%xmm11
maxsd  %xmm6,%xmm11
movsd  0xe9f(%rip),%xmm4
addsd  %xmm3,%xmm4
movsd  0xe9b(%rip),%xmm2
addsd  %xmm2,%xmm4
ucomisd %xmm2,%xmm4
movapd %xmm4,%xmm6
cmpltsd %xmm8,%xmm6
movapd %xmm2,%xmm7
cmpltsd %xmm4,%xmm7
andpd  %xmm2,%xmm7
andpd  %xmm6,%xmm7
andnpd %xmm2,%xmm6
orpd   %xmm7,%xmm6
movapd %xmm6,%xmm7
ja     11b2 <critical_blow+0x92>
movapd %xmm4,%xmm7
divsd  %xmm10,%xmm11
ucomisd %xmm4,%xmm8
ja     11c2 <critical_blow+0xa2>
movapd %xmm7,%xmm6
divsd  %xmm10,%xmm6
movapd %xmm11,%xmm2
addsd  %xmm6,%xmm2
unpcklpd %xmm3,%xmm3
addpd  0xe94(%rip),%xmm3
movapd 0xe9c(%rip),%xmm5
addpd  %xmm5,%xmm3
movapd %xmm5,%xmm4
cmpnltpd %xmm3,%xmm4
xorpd  %xmm10,%xmm10
movapd %xmm3,%xmm7
cmpltpd %xmm10,%xmm7
andpd  %xmm7,%xmm4
andnpd %xmm5,%xmm4
cmpltpd %xmm3,%xmm5
orpd   %xmm5,%xmm7
andpd  %xmm7,%xmm4
andnpd %xmm3,%xmm7
orpd   %xmm4,%xmm7
divpd  0xe6b(%rip),%xmm7
movapd %xmm7,%xmm10
unpckhpd %xmm7,%xmm10
addsd  %xmm10,%xmm2
addsd  %xmm7,%xmm2
movsd  0xde0(%rip),%xmm4
addsd  %xmm2,%xmm4
movapd 0xe54(%rip),%xmm5
xorpd  %xmm4,%xmm5
movapd %xmm4,%xmm3
cmpltsd %xmm8,%xmm3
andpd  %xmm3,%xmm5
andnpd %xmm4,%xmm3
orpd   %xmm5,%xmm3
ucomisd 0xdba(%rip),%xmm3
ja     133f <critical_blow+0x21f>
movsd  0xdb3(%rip),%xmm8
movapd %xmm1,%xmm2
mulsd  %xmm8,%xmm2
addsd  0xdaa(%rip),%xmm2
movsd  0xdaa(%rip),%xmm4
mulsd  %xmm1,%xmm4
addsd  0xda6(%rip),%xmm4
movsd  0xda6(%rip),%xmm5
mulsd  %xmm1,%xmm5
addsd  0xda2(%rip),%xmm5
movapd %xmm1,%xmm3
addsd  %xmm1,%xmm3
addsd  %xmm8,%xmm3
mulsd  %xmm11,%xmm3
cvttpd2dq %xmm3,%xmm3
cvtdq2pd %xmm3,%xmm3
mulsd  %xmm6,%xmm5
addsd  %xmm3,%xmm5
cvttpd2dq %xmm5,%xmm3
cvtdq2pd %xmm3,%xmm3
mulsd  %xmm10,%xmm4
addsd  %xmm3,%xmm4
cvttpd2dq %xmm4,%xmm3
cvtdq2pd %xmm3,%xmm3
mulsd  %xmm7,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm8,%xmm0
lea    (%rsi,%rsi,2),%eax
xorps  %xmm3,%xmm3
cvtsi2sd %eax,%xmm3
addsd  %xmm9,%xmm0
addsd  %xmm0,%xmm3
cvttpd2dq %xmm3,%xmm0
cvtdq2pd %xmm0,%xmm0
divsd  0xd3f(%rip),%xmm0
cvttpd2dq %xmm1,%xmm1
cvtdq2pd %xmm1,%xmm1
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
cvttsd2si %xmm2,%eax
pop    %rcx
ret
lea    0xd6a(%rip),%rdi
movapd %xmm2,%xmm0
movapd %xmm4,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"chance_critical=%g chance_dam=(\00"
@.str.1 = [3 x i8] c"%g\00"
@.str.2 = [4 x i8] c"+%g\00"
@.str.3 = [7 x i8] c"+%g) \00"
@.str.4 = [16 x i8] c"added_dam = %d\0A\00"
@.str.5 = [30 x i8] c"ERROR: total_chance=%g (%g)\0A\00"
define i32 @critical_blow(i32 %0, double %1, double %2, i32 %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
store i32 %0, i32* %5
store double %1, double* %6
store double %2, double* %7
store i32 %3, i32* %8
store i32 0, i32* %14
%15 = load double, double* %7
%16 = fptosi double %15 to i32
store i32 %16, i32* %9
%17 = load i32, i32* %5
%18 = sitofp i32 %17 to double
%19 = load double, double* %6
%20 = call double @llvm.fmuladd.f64(double 5.000000e+00, double %19, double %18)
%21 = load i32, i32* %8
%22 = mul nsw i32 3, %21
%23 = sitofp i32 %22 to double
%24 = fadd double %20, %23
%25 = fptosi double %24 to i32
%26 = sitofp i32 %25 to double
%27 = fdiv double %26, 5.000000e+03
store double %27, double* %11
%28 = load i32, i32* %14
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %4
%31 = load double, double* %11
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), double %31)
br label %33
33: ; preds = %30, %4
%34 = load i32, i32* %5
%35 = sitofp i32 %34 to double
%36 = fsub double 4.000000e+02, %35
%37 = load i32, i32* %5
%38 = sitofp i32 %37 to double
%39 = fsub double 4.000000e+02, %38
%40 = load i32, i32* %5
%41 = sitofp i32 %40 to double
%42 = fadd double 6.500000e+02, %41
%43 = fsub double 4.000000e+02, %42
%44 = fsub double %39, %43
%45 = fcmp olt double %36, %44
br i1 %45, label %46, label %50
46: ; preds = %33
%47 = load i32, i32* %5
%48 = sitofp i32 %47 to double
%49 = fsub double 4.000000e+02, %48
br label %59
50: ; preds = %33
%51 = load i32, i32* %5
%52 = sitofp i32 %51 to double
%53 = fsub double 4.000000e+02, %52
%54 = load i32, i32* %5
%55 = sitofp i32 %54 to double
%56 = fadd double 6.500000e+02, %55
%57 = fsub double 4.000000e+02, %56
%58 = fsub double %53, %57
br label %59
59: ; preds = %50, %46
%60 = phi double [ %49, %46 ], [ %58, %50 ]
%61 = fcmp ogt double 0.000000e+00, %60
br i1 %61, label %62, label %63
62: ; preds = %59
br label %91
63: ; preds = %59
%64 = load i32, i32* %5
%65 = sitofp i32 %64 to double
%66 = fsub double 4.000000e+02, %65
%67 = load i32, i32* %5
%68 = sitofp i32 %67 to double
%69 = fsub double 4.000000e+02, %68
%70 = load i32, i32* %5
%71 = sitofp i32 %70 to double
%72 = fadd double 6.500000e+02, %71
%73 = fsub double 4.000000e+02, %72
%74 = fsub double %69, %73
%75 = fcmp olt double %66, %74
br i1 %75, label %76, label %80
76: ; preds = %63
%77 = load i32, i32* %5
%78 = sitofp i32 %77 to double
%79 = fsub double 4.000000e+02, %78
br label %89
80: ; preds = %63
%81 = load i32, i32* %5
%82 = sitofp i32 %81 to double
%83 = fsub double 4.000000e+02, %82
%84 = load i32, i32* %5
%85 = sitofp i32 %84 to double
%86 = fadd double 6.500000e+02, %85
%87 = fsub double 4.000000e+02, %86
%88 = fsub double %83, %87
br label %89
89: ; preds = %80, %76
%90 = phi double [ %79, %76 ], [ %88, %80 ]
br label %91
91: ; preds = %89, %62
%92 = phi double [ 0.000000e+00, %62 ], [ %90, %89 ]
%93 = fdiv double %92, 6.500000e+02
store double %93, double* %12
%94 = load i32, i32* %14
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %91
%97 = load double, double* %12
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %97)
br label %99
99: ; preds = %96, %91
%100 = load double, double* %12
store double %100, double* %13
%101 = load double, double* %7
%102 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %101, double 5.000000e+00)
%103 = load double, double* %12
%104 = fmul double %102, %103
%105 = fptosi double %104 to i32
store i32 %105, i32* %10
%106 = load i32, i32* %5
%107 = sitofp i32 %106 to double
%108 = fadd double 6.500000e+02, %107
%109 = fsub double 7.000000e+02, %108
%110 = fsub double 3.000000e+02, %109
%111 = fcmp olt double 3.000000e+02, %110
br i1 %111, label %112, label %113
112: ; preds = %99
br label %119
113: ; preds = %99
%114 = load i32, i32* %5
%115 = sitofp i32 %114 to double
%116 = fadd double 6.500000e+02, %115
%117 = fsub double 7.000000e+02, %116
%118 = fsub double 3.000000e+02, %117
br label %119
119: ; preds = %113, %112
%120 = phi double [ 3.000000e+02, %112 ], [ %118, %113 ]
%121 = fcmp ogt double 0.000000e+00, %120
br i1 %121, label %122, label %123
122: ; preds = %119
br label %139
123: ; preds = %119
%124 = load i32, i32* %5
%125 = sitofp i32 %124 to double
%126 = fadd double 6.500000e+02, %125
%127 = fsub double 7.000000e+02, %126
%128 = fsub double 3.000000e+02, %127
%129 = fcmp olt double 3.000000e+02, %128
br i1 %129, label %130, label %131
130: ; preds = %123
br label %137
131: ; preds = %123
%132 = load i32, i32* %5
%133 = sitofp i32 %132 to double
%134 = fadd double 6.500000e+02, %133
%135 = fsub double 7.000000e+02, %134
%136 = fsub double 3.000000e+02, %135
br label %137
137: ; preds = %131, %130
%138 = phi double [ 3.000000e+02, %130 ], [ %136, %131 ]
br label %139
139: ; preds = %137, %122
%140 = phi double [ 0.000000e+00, %122 ], [ %138, %137 ]
%141 = fdiv double %140, 6.500000e+02
store double %141, double* %12
%142 = load i32, i32* %14
%143 = icmp ne i32 %142, 0
br i1 %143, label %144, label %147
144: ; preds = %139
%145 = load double, double* %12
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %145)
br label %147
147: ; preds = %144, %139
%148 = load double, double* %12
%149 = load double, double* %13
%150 = fadd double %149, %148
store double %150, double* %13
%151 = load double, double* %7
%152 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %151, double 1.000000e+01)
%153 = load double, double* %12
%154 = load i32, i32* %10
%155 = sitofp i32 %154 to double
%156 = call double @llvm.fmuladd.f64(double %152, double %153, double %155)
%157 = fptosi double %156 to i32
store i32 %157, i32* %10
%158 = load i32, i32* %5
%159 = sitofp i32 %158 to double
%160 = fadd double 6.500000e+02, %159
%161 = fsub double 9.000000e+02, %160
%162 = fsub double 2.000000e+02, %161
%163 = fcmp olt double 2.000000e+02, %162
br i1 %163, label %164, label %165
164: ; preds = %147
br label %171
165: ; preds = %147
%166 = load i32, i32* %5
%167 = sitofp i32 %166 to double
%168 = fadd double 6.500000e+02, %167
%169 = fsub double 9.000000e+02, %168
%170 = fsub double 2.000000e+02, %169
br label %171
171: ; preds = %165, %164
%172 = phi double [ 2.000000e+02, %164 ], [ %170, %165 ]
%173 = fcmp ogt double 0.000000e+00, %172
br i1 %173, label %174, label %175
174: ; preds = %171
br label %191
175: ; preds = %171
%176 = load i32, i32* %5
%177 = sitofp i32 %176 to double
%178 = fadd double 6.500000e+02, %177
%179 = fsub double 9.000000e+02, %178
%180 = fsub double 2.000000e+02, %179
%181 = fcmp olt double 2.000000e+02, %180
br i1 %181, label %182, label %183
182: ; preds = %175
br label %189
183: ; preds = %175
%184 = load i32, i32* %5
%185 = sitofp i32 %184 to double
%186 = fadd double 6.500000e+02, %185
%187 = fsub double 9.000000e+02, %186
%188 = fsub double 2.000000e+02, %187
br label %189
189: ; preds = %183, %182
%190 = phi double [ 2.000000e+02, %182 ], [ %188, %183 ]
br label %191
191: ; preds = %189, %174
%192 = phi double [ 0.000000e+00, %174 ], [ %190, %189 ]
%193 = fdiv double %192, 6.500000e+02
store double %193, double* %12
%194 = load i32, i32* %14
%195 = icmp ne i32 %194, 0
br i1 %195, label %196, label %199
196: ; preds = %191
%197 = load double, double* %12
%198 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %197)
br label %199
199: ; preds = %196, %191
%200 = load double, double* %12
%201 = load double, double* %13
%202 = fadd double %201, %200
store double %202, double* %13
%203 = load double, double* %7
%204 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %203, double 1.500000e+01)
%205 = load double, double* %12
%206 = load i32, i32* %10
%207 = sitofp i32 %206 to double
%208 = call double @llvm.fmuladd.f64(double %204, double %205, double %207)
%209 = fptosi double %208 to i32
store i32 %209, i32* %10
%210 = load i32, i32* %5
%211 = sitofp i32 %210 to double
%212 = fadd double 6.500000e+02, %211
%213 = fsub double 2.000000e+03, %212
%214 = fsub double 1.100000e+03, %213
%215 = fcmp olt double 1.100000e+03, %214
br i1 %215, label %216, label %217
216: ; preds = %199
br label %223
217: ; preds = %199
%218 = load i32, i32* %5
%219 = sitofp i32 %218 to double
%220 = fadd double 6.500000e+02, %219
%221 = fsub double 2.000000e+03, %220
%222 = fsub double 1.100000e+03, %221
br label %223
223: ; preds = %217, %216
%224 = phi double [ 1.100000e+03, %216 ], [ %222, %217 ]
%225 = fcmp ogt double 0.000000e+00, %224
br i1 %225, label %226, label %227
226: ; preds = %223
br label %243
227: ; preds = %223
%228 = load i32, i32* %5
%229 = sitofp i32 %228 to double
%230 = fadd double 6.500000e+02, %229
%231 = fsub double 2.000000e+03, %230
%232 = fsub double 1.100000e+03, %231
%233 = fcmp olt double 1.100000e+03, %232
br i1 %233, label %234, label %235
234: ; preds = %227
br label %241
235: ; preds = %227
%236 = load i32, i32* %5
%237 = sitofp i32 %236 to double
%238 = fadd double 6.500000e+02, %237
%239 = fsub double 2.000000e+03, %238
%240 = fsub double 1.100000e+03, %239
br label %241
241: ; preds = %235, %234
%242 = phi double [ 1.100000e+03, %234 ], [ %240, %235 ]
br label %243
243: ; preds = %241, %226
%244 = phi double [ 0.000000e+00, %226 ], [ %242, %241 ]
%245 = fdiv double %244, 6.500000e+02
store double %245, double* %12
%246 = load i32, i32* %14
%247 = icmp ne i32 %246, 0
br i1 %247, label %248, label %251
248: ; preds = %243
%249 = load double, double* %12
%250 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %249)
br label %251
251: ; preds = %248, %243
%252 = load double, double* %12
%253 = load double, double* %13
%254 = fadd double %253, %252
store double %254, double* %13
%255 = load double, double* %7
%256 = call double @llvm.fmuladd.f64(double 5.000000e+00, double %255, double 2.000000e+01)
%257 = load double, double* %12
%258 = load i32, i32* %10
%259 = sitofp i32 %258 to double
%260 = call double @llvm.fmuladd.f64(double %256, double %257, double %259)
%261 = fptosi double %260 to i32
store i32 %261, i32* %10
%262 = load i32, i32* %14
%263 = icmp ne i32 %262, 0
br i1 %263, label %264, label %267
264: ; preds = %251
%265 = load i32, i32* %10
%266 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %265)
br label %267
267: ; preds = %264, %251
%268 = load double, double* %13
%269 = fsub double %268, 1.000000e+00
%270 = fcmp olt double %269, 0.000000e+00
br i1 %270, label %271, label %275
271: ; preds = %267
%272 = load double, double* %13
%273 = fsub double %272, 1.000000e+00
%274 = fneg double %273
br label %278
275: ; preds = %267
%276 = load double, double* %13
%277 = fsub double %276, 1.000000e+00
br label %278
278: ; preds = %275, %271
%279 = phi double [ %274, %271 ], [ %277, %275 ]
%280 = fcmp ogt double %279, 0x3D06849B86A12B9B
br i1 %280, label %281, label %286
281: ; preds = %278
%282 = load double, double* %13
%283 = load double, double* %13
%284 = fsub double %283, 1.000000e+00
%285 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %282, double %284)
unreachable
286: ; preds = %278
%287 = load i32, i32* %9
%288 = sitofp i32 %287 to double
%289 = load i32, i32* %10
%290 = sitofp i32 %289 to double
%291 = load double, double* %11
%292 = call double @llvm.fmuladd.f64(double %290, double %291, double %288)
%293 = fptosi double %292 to i32
ret i32 %293
}

LLVM IR (-O2):
@.str.5 = [30 x i8] c"ERROR: total_chance=%g (%g)\0A\00"
define i32 @critical_blow(i32 %0, double %1, double %2, i32 %3) {
%5 = sitofp i32 %0 to double
%6 = fsub double 4.000000e+02, %5
%7 = fadd double %5, 6.500000e+02
%8 = fsub double 4.000000e+02, %7
%9 = fsub double %6, %8
%10 = fcmp olt double %6, %9
%11 = select i1 %10, double %6, double %9
%12 = fcmp olt double %11, 0.000000e+00
%13 = select i1 %12, double 0.000000e+00, double %11
%14 = fdiv double %13, 6.500000e+02
%15 = fadd double %7, -7.000000e+02
%16 = fadd double %15, 3.000000e+02
%17 = fcmp ogt double %16, 3.000000e+02
%18 = fcmp olt double %16, 0.000000e+00
%19 = xor i1 %17, true
%20 = and i1 %18, %19
%21 = or i1 %18, %17
%22 = select i1 %20, double 0.000000e+00, double 3.000000e+02
%23 = select i1 %21, double %22, double %16
%24 = fdiv double %23, 6.500000e+02
%25 = fadd double %14, %24
%26 = insertelement <2 x double> poison, double %7, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = fadd <2 x double> %27, <double -2.000000e+03, double -9.000000e+02>
%29 = fadd <2 x double> %28, <double 1.100000e+03, double 2.000000e+02>
%30 = fcmp ogt <2 x double> %29, <double 1.100000e+03, double 2.000000e+02>
%31 = fcmp olt <2 x double> %29, zeroinitializer
%32 = xor <2 x i1> %30, <i1 true, i1 true>
%33 = and <2 x i1> %31, %32
%34 = or <2 x i1> %31, %30
%35 = select <2 x i1> %33, <2 x double> zeroinitializer, <2 x double> <double 1.100000e+03, double 2.000000e+02>
%36 = select <2 x i1> %34, <2 x double> %35, <2 x double> %29
%37 = fdiv <2 x double> %36, <double 6.500000e+02, double 6.500000e+02>
%38 = extractelement <2 x double> %37, i64 1
%39 = fadd double %38, %25
%40 = extractelement <2 x double> %37, i64 0
%41 = fadd double %40, %39
%42 = fadd double %41, -1.000000e+00
%43 = fcmp olt double %42, 0.000000e+00
%44 = fneg double %42
%45 = select i1 %43, double %44, double %42
%46 = fcmp ogt double %45, 0x3D06849B86A12B9B
br i1 %46, label %47, label %49
47: ; preds = %4
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %41, double %42)
tail call void @exit(i32 1)
unreachable
49: ; preds = %4
%50 = tail call double @llvm.fmuladd.f64(double %2, double 5.000000e+00, double 2.000000e+01)
%51 = tail call double @llvm.fmuladd.f64(double %2, double 4.000000e+00, double 1.500000e+01)
%52 = tail call double @llvm.fmuladd.f64(double %2, double 3.000000e+00, double 1.000000e+01)
%53 = tail call double @llvm.fmuladd.f64(double %2, double 2.000000e+00, double 5.000000e+00)
%54 = fmul double %53, %14
%55 = fptosi double %54 to i32
%56 = sitofp i32 %55 to double
%57 = tail call double @llvm.fmuladd.f64(double %52, double %24, double %56)
%58 = fptosi double %57 to i32
%59 = sitofp i32 %58 to double
%60 = tail call double @llvm.fmuladd.f64(double %51, double %38, double %59)
%61 = fptosi double %60 to i32
%62 = sitofp i32 %61 to double
%63 = tail call double @llvm.fmuladd.f64(double %50, double %40, double %62)
%64 = fptosi double %63 to i32
%65 = tail call double @llvm.fmuladd.f64(double %1, double 5.000000e+00, double %5)
%66 = mul nsw i32 %3, 3
%67 = sitofp i32 %66 to double
%68 = fadd double %65, %67
%69 = fptosi double %68 to i32
%70 = sitofp i32 %69 to double
%71 = fdiv double %70, 5.000000e+03
%72 = fptosi double %2 to i32
%73 = sitofp i32 %72 to double
%74 = sitofp i32 %64 to double
%75 = tail call double @llvm.fmuladd.f64(double %74, double %71, double %73)
%76 = fptosi double %75 to i32
ret i32 %76
}