#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 K0(double);
int exp(double);
double log(double);
double W(double ra, double rb) {
  double ug, og, hi, sub1, sub2, x2, x4, s2, s4;
  int i;
  if (ra < 1e-20)
    return (2 * K0(rb));
  if (ra > 2000.0)
    return (0.0);
  ug = log(ra);
  og = 10.0;
  hi = (og - ug) / 24;
  sub1 = rb * rb / 4.0;
  sub2 = hi * 2;
  x4 = ug + hi;
  x2 = ug;
  s4 = s2 = 0.0;
  i = 0;
  while (1) {
    s4 += exp(-exp(x4) - sub1 / exp(x4));
    x4 += sub2;
    if (i == 10)
      break;
    x2 += sub2;
    s2 += exp(-exp(x2) - sub1 / exp(x2));
    i++;
  }
  return (hi *
          (exp(-exp(ug) - sub1 / exp(ug)) + 4 * s4 + 2 * s2 +
           exp(-exp(og) - sub1 / exp(og))) /
          3);
}


x86 assembly (clang, -O0):
<W>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  0xeb3(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1173 <W+0x43>
movsd  -0x18(%rbp),%xmm0
call   1030 <K0@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1428 <W+0x2f8>
movsd  -0x10(%rbp),%xmm0
movsd  0xe88(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1197 <W+0x67>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1428 <W+0x2f8>
movsd  -0x10(%rbp),%xmm0
call   1050 <log@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xe7a(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xe5b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xe38(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe1f(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1040 <exp@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1040 <exp@plt>
movsd  -0x78(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
call   1040 <exp@plt>
cvtsi2sd %eax,%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
cmpl   $0xa,-0x64(%rbp)
jne    129f <W+0x16f>
jmp    1318 <W+0x1e8>
movsd  -0x40(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1040 <exp@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1040 <exp@plt>
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x80(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
call   1040 <exp@plt>
cvtsi2sd %eax,%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    122b <W+0xfb>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1040 <exp@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1040 <exp@plt>
movsd  -0xb8(%rbp),%xmm1
ff
movsd  -0xb0(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
call   1040 <exp@plt>
cvtsi2sd %eax,%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  0xc8e(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1040 <exp@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1040 <exp@plt>
movsd  -0xa8(%rbp),%xmm1
ff
movsd  -0xa0(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
call   1040 <exp@plt>
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x90(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc11(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<W>:
push   %rbx
sub    $0x50,%rsp
movsd  0xec3(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    115a <W+0x2a>
movapd %xmm1,%xmm0
call   1030 <K0@plt>
add    %eax,%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
jmp    13b8 <W+0x288>
xorpd  %xmm2,%xmm2
ucomisd 0xea2(%rip),%xmm0
ja     13b8 <W+0x288>
movsd  %xmm1,0x10(%rsp)
call   1050 <log@plt>
movapd %xmm0,%xmm1
movsd  0xe8d(%rip),%xmm0
subsd  %xmm1,%xmm0
divsd  0xe89(%rip),%xmm0
movsd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm2
mulsd  0xe7f(%rip),%xmm2
movsd  %xmm2,0x10(%rsp)
movapd %xmm0,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,0x48(%rsp)
movapd %xmm1,%xmm2
movsd  %xmm0,0x40(%rsp)
addsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
mov    $0xa,%ebx
movsd  %xmm1,0x38(%rsp)
movsd  %xmm1,0x30(%rsp)
xorpd  %xmm0,%xmm0
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <exp@plt>
neg    %eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0x28(%rsp),%xmm0
subsd  %xmm1,%xmm0
call   1040 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
sub    $0x1,%ebx
jb     12de <W+0x1ae>
movsd  0x48(%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x30(%rsp),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x30(%rsp)
call   1040 <exp@plt>
neg    %eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x30(%rsp),%xmm0
call   1040 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0x28(%rsp),%xmm0
subsd  %xmm1,%xmm0
call   1040 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x18(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0x20(%rsp),%xmm0
jmp    11f0 <W+0xc0>
movsd  0x38(%rsp),%xmm0
call   1040 <exp@plt>
neg    %eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x38(%rsp),%xmm0
call   1040 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
call   1040 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  0xcf0(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0x18(%rsp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0xcb8(%rip),%xmm0
call   1040 <exp@plt>
neg    %eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xc9c(%rip),%xmm0
call   1040 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
call   1040 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0x18(%rsp),%xmm0
movsd  0x40(%rsp),%xmm2
mulsd  %xmm0,%xmm2
divsd  0xc78(%rip),%xmm2
movapd %xmm2,%xmm0
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @W(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca i32
store double %0, double* %4
store double %1, double* %5
%16 = load double, double* %4
%17 = fcmp olt double %16, 0x3BC79CA10C924223
br i1 %17, label %18, label %23
18: ; preds = %2
%19 = load double, double* %5
%20 = call i32 @K0(double %19)
%21 = mul nsw i32 2, %20
%22 = sitofp i32 %21 to double
store double %22, double* %3
br label %118
23: ; preds = %2
%24 = load double, double* %4
%25 = fcmp ogt double %24, 2.000000e+03
br i1 %25, label %26, label %27
26: ; preds = %23
store double 0.000000e+00, double* %3
br label %118
27: ; preds = %23
%28 = load double, double* %4
%29 = call double @log(double %28)
store double %29, double* %6
store double 1.000000e+01, double* %7
%30 = load double, double* %7
%31 = load double, double* %6
%32 = fsub double %30, %31
%33 = fdiv double %32, 2.400000e+01
store double %33, double* %8
%34 = load double, double* %5
%35 = load double, double* %5
%36 = fmul double %34, %35
%37 = fdiv double %36, 4.000000e+00
store double %37, double* %9
%38 = load double, double* %8
%39 = fmul double %38, 2.000000e+00
store double %39, double* %10
%40 = load double, double* %6
%41 = load double, double* %8
%42 = fadd double %40, %41
store double %42, double* %12
%43 = load double, double* %6
store double %43, double* %11
store double 0.000000e+00, double* %13
store double 0.000000e+00, double* %14
store i32 0, i32* %15
br label %44
44: ; preds = %27, %65
%45 = load double, double* %12
%46 = call i32 @exp(double %45)
%47 = sub nsw i32 0, %46
%48 = sitofp i32 %47 to double
%49 = load double, double* %9
%50 = load double, double* %12
%51 = call i32 @exp(double %50)
%52 = sitofp i32 %51 to double
%53 = fdiv double %49, %52
%54 = fsub double %48, %53
%55 = call i32 @exp(double %54)
%56 = sitofp i32 %55 to double
%57 = load double, double* %14
%58 = fadd double %57, %56
store double %58, double* %14
%59 = load double, double* %10
%60 = load double, double* %12
%61 = fadd double %60, %59
store double %61, double* %12
%62 = load i32, i32* %15
%63 = icmp eq i32 %62, 10
br i1 %63, label %64, label %65
64: ; preds = %44
br label %85
65: ; preds = %44
%66 = load double, double* %10
%67 = load double, double* %11
%68 = fadd double %67, %66
store double %68, double* %11
%69 = load double, double* %11
%70 = call i32 @exp(double %69)
%71 = sub nsw i32 0, %70
%72 = sitofp i32 %71 to double
%73 = load double, double* %9
%74 = load double, double* %11
%75 = call i32 @exp(double %74)
%76 = sitofp i32 %75 to double
%77 = fdiv double %73, %76
%78 = fsub double %72, %77
%79 = call i32 @exp(double %78)
%80 = sitofp i32 %79 to double
%81 = load double, double* %13
%82 = fadd double %81, %80
store double %82, double* %13
%83 = load i32, i32* %15
%84 = add nsw i32 %83, 1
store i32 %84, i32* %15
br label %44
85: ; preds = %64
%86 = load double, double* %8
%87 = load double, double* %6
%88 = call i32 @exp(double %87)
%89 = sub nsw i32 0, %88
%90 = sitofp i32 %89 to double
%91 = load double, double* %9
%92 = load double, double* %6
%93 = call i32 @exp(double %92)
%94 = sitofp i32 %93 to double
%95 = fdiv double %91, %94
%96 = fsub double %90, %95
%97 = call i32 @exp(double %96)
%98 = sitofp i32 %97 to double
%99 = load double, double* %14
%100 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %99, double %98)
%101 = load double, double* %13
%102 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %101, double %100)
%103 = load double, double* %7
%104 = call i32 @exp(double %103)
%105 = sub nsw i32 0, %104
%106 = sitofp i32 %105 to double
%107 = load double, double* %9
%108 = load double, double* %7
%109 = call i32 @exp(double %108)
%110 = sitofp i32 %109 to double
%111 = fdiv double %107, %110
%112 = fsub double %106, %111
%113 = call i32 @exp(double %112)
%114 = sitofp i32 %113 to double
%115 = fadd double %102, %114
%116 = fmul double %86, %115
%117 = fdiv double %116, 3.000000e+00
store double %117, double* %3
br label %118
118: ; preds = %85, %26, %18
%119 = load double, double* %3
ret double %119
}

LLVM IR (-O2):
define double @W(double %0, double %1) {
%3 = fcmp olt double %0, 0x3BC79CA10C924223
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 @K0(double %1)
%6 = shl nsw i32 %5, 1
%7 = sitofp i32 %6 to double
br label %73
8: ; preds = %2
%9 = fcmp ogt double %0, 2.000000e+03
br i1 %9, label %73, label %10
10: ; preds = %8
%11 = tail call double @log(double %0)
%12 = fsub double 1.000000e+01, %11
%13 = fdiv double %12, 2.400000e+01
%14 = fmul double %1, %1
%15 = fmul double %14, 2.500000e-01
%16 = fmul double %13, 2.000000e+00
%17 = fadd double %11, %13
br label %18
18: ; preds = %35, %10
%19 = phi double [ %11, %10 ], [ %37, %35 ]
%20 = phi double [ %17, %10 ], [ %36, %35 ]
%21 = phi double [ 0.000000e+00, %10 ], [ %47, %35 ]
%22 = phi double [ 0.000000e+00, %10 ], [ %33, %35 ]
%23 = phi i32 [ 0, %10 ], [ %48, %35 ]
%24 = tail call i32 @exp(double %20)
%25 = sub nsw i32 0, %24
%26 = sitofp i32 %25 to double
%27 = tail call i32 @exp(double %20)
%28 = sitofp i32 %27 to double
%29 = fdiv double %15, %28
%30 = fsub double %26, %29
%31 = tail call i32 @exp(double %30)
%32 = sitofp i32 %31 to double
%33 = fadd double %22, %32
%34 = icmp eq i32 %23, 10
br i1 %34, label %49, label %35
35: ; preds = %18
%36 = fadd double %16, %20
%37 = fadd double %16, %19
%38 = tail call i32 @exp(double %37)
%39 = sub nsw i32 0, %38
%40 = sitofp i32 %39 to double
%41 = tail call i32 @exp(double %37)
%42 = sitofp i32 %41 to double
%43 = fdiv double %15, %42
%44 = fsub double %40, %43
%45 = tail call i32 @exp(double %44)
%46 = sitofp i32 %45 to double
%47 = fadd double %21, %46
%48 = add nuw nsw i32 %23, 1
br label %18
49: ; preds = %18
%50 = tail call i32 @exp(double %11)
%51 = sub nsw i32 0, %50
%52 = sitofp i32 %51 to double
%53 = tail call i32 @exp(double %11)
%54 = sitofp i32 %53 to double
%55 = fdiv double %15, %54
%56 = fsub double %52, %55
%57 = tail call i32 @exp(double %56)
%58 = sitofp i32 %57 to double
%59 = tail call double @llvm.fmuladd.f64(double %33, double 4.000000e+00, double %58)
%60 = tail call double @llvm.fmuladd.f64(double %21, double 2.000000e+00, double %59)
%61 = tail call i32 @exp(double 1.000000e+01)
%62 = sub nsw i32 0, %61
%63 = sitofp i32 %62 to double
%64 = tail call i32 @exp(double 1.000000e+01)
%65 = sitofp i32 %64 to double
%66 = fdiv double %15, %65
%67 = fsub double %63, %66
%68 = tail call i32 @exp(double %67)
%69 = sitofp i32 %68 to double
%70 = fadd double %60, %69
%71 = fmul double %13, %70
%72 = fdiv double %71, 3.000000e+00
br label %73
73: ; preds = %8, %49, %4
%74 = phi double [ %7, %4 ], [ %72, %49 ], [ 0.000000e+00, %8 ]
ret double %74
}