#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 M_PI;
int Q(double);
int Z(double);
double pow(double, double);
double sqrt(double);
int sum(int, double);
double significance(double chi2, int dof) {
  double signif;
  if (dof > 100) {
    signif = 1 - Q(sqrt(2.0 * chi2) - sqrt(2.0 * dof - 1.0));
  } else if (dof > 30) {
    signif = 1 - Q((pow(chi2 / dof, 1.0 / 3.0) - (1.0 - 2.0 / (9 * dof))) /
                   sqrt(2.0 / (9 * dof)));
  } else if (dof % 2 == 0) {
    signif = sqrt(2 * M_PI) * Z(sqrt(chi2)) * (1.0 + sum(dof, sqrt(chi2)));
  } else {
    signif = 2 * Z(sqrt(chi2)) * sum(dof, sqrt(chi2)) + 2 * Q(sqrt(chi2));
  }
  return signif;
}


x86 assembly (clang, -O0):
<significance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jle    11c3 <significance+0x73>
movsd  0xe96(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xe86(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
call   1050 <Q@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1340 <significance+0x1f0>
cmpl   $0x1e,-0xc(%rbp)
jle    1252 <significance+0x102>
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe2d(%rip),%xmm1
call   1060 <pow@plt>
imul   $0x9,-0xc(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xe10(%rip),%xmm2
divsd  %xmm1,%xmm2
movsd  0xdfc(%rip),%xmm1
subsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
imul   $0x9,-0xc(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xde7(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
call   1050 <Q@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    133b <significance+0x1eb>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12dc <significance+0x18c>
mov    0x2d7b(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
call   1030 <Z@plt>
movsd  -0x40(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x34(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
mov    -0x34(%rbp),%edi
call   1040 <sum@plt>
movsd  -0x30(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
movsd  0xd36(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1336 <significance+0x1e6>
movsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
call   1030 <Z@plt>
shl    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
mov    -0x4c(%rbp),%edi
call   1040 <sum@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x44(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
call   1050 <Q@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
shl    $0x1,%ecx
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    133b <significance+0x1eb>
jmp    1340 <significance+0x1f0>
movsd  -0x18(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<significance>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
movapd %xmm0,%xmm2
cmp    $0x65,%edi
jl     1175 <significance+0x25>
addsd  %xmm2,%xmm2
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm2
jb     11db <significance+0x8b>
sqrtsd %xmm2,%xmm1
jmp    11ec <significance+0x9c>
cmp    $0x1f,%ebx
jl     120b <significance+0xbb>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  %xmm0,%xmm2
movsd  0xe77(%rip),%xmm1
movapd %xmm2,%xmm0
call   1060 <pow@plt>
movapd %xmm0,%xmm2
lea    (%rbx,%rbx,8),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0xe60(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xe44(%rip),%xmm1
subsd  %xmm0,%xmm1
subsd  %xmm1,%xmm2
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1257 <significance+0x107>
sqrtsd %xmm0,%xmm0
jmp    1266 <significance+0x116>
movapd %xmm2,%xmm0
call   1070 <sqrt@plt>
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
addsd  %xmm0,%xmm0
addsd  0xe19(%rip),%xmm0
ucomisd %xmm3,%xmm0
jb     123e <significance+0xee>
sqrtsd %xmm0,%xmm0
jmp    124d <significance+0xfd>
test   $0x1,%bl
movsd  %xmm2,(%rsp)
jne    1288 <significance+0x138>
mov    0x2dcc(%rip),%rax
mov    (%rax),%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1314 <significance+0x1c4>
sqrtsd %xmm0,%xmm0
jmp    1322 <significance+0x1d2>
movsd  %xmm1,(%rsp)
call   1070 <sqrt@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    126e <significance+0x11e>
movsd  %xmm2,(%rsp)
call   1070 <sqrt@plt>
movsd  (%rsp),%xmm2
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
call   1050 <Q@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm2
movsd  %xmm0,0x8(%rsp)
jae    12a9 <significance+0x159>
movsd  (%rsp),%xmm0
call   1070 <sqrt@plt>
call   1030 <Z@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
ucomisd 0xd63(%rip),%xmm0
movsd  0x8(%rsp),%xmm0
jae    12cf <significance+0x17f>
movsd  (%rsp),%xmm0
call   1070 <sqrt@plt>
mov    %ebx,%edi
call   1040 <sum@plt>
mov    %eax,%ebx
imul   %ebp,%ebx
xorpd  %xmm0,%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
jae    12f9 <significance+0x1a9>
movapd %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <Q@plt>
add    %ebx,%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
jmp    1281 <significance+0x131>
call   1070 <sqrt@plt>
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm2
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
ucomisd %xmm1,%xmm2
movsd  %xmm0,0x10(%rsp)
jae    1345 <significance+0x1f5>
movsd  (%rsp),%xmm0
call   1070 <sqrt@plt>
call   1030 <Z@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
xorpd  %xmm0,%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  0x10(%rsp),%xmm1
jae    1383 <significance+0x233>
call   1070 <sqrt@plt>
movapd %xmm0,%xmm1
mov    %ebx,%edi
movapd %xmm1,%xmm0
call   1040 <sum@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xc63(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    1281 <significance+0x131>

LLVM IR (-O0):
@M_PI = global i32 0
define double @significance(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
store double %0, double* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 100
br i1 %7, label %8, label %20
8: ; preds = %2
%9 = load double, double* %3
%10 = fmul double 2.000000e+00, %9
%11 = call double @sqrt(double %10)
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to double
%14 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %13, double -1.000000e+00)
%15 = call double @sqrt(double %14)
%16 = fsub double %11, %15
%17 = call i32 @Q(double %16)
%18 = sub nsw i32 1, %17
%19 = sitofp i32 %18 to double
store double %19, double* %5
br label %83
20: ; preds = %2
%21 = load i32, i32* %4
%22 = icmp sgt i32 %21, 30
br i1 %22, label %23, label %44
23: ; preds = %20
%24 = load double, double* %3
%25 = load i32, i32* %4
%26 = sitofp i32 %25 to double
%27 = fdiv double %24, %26
%28 = call double @pow(double %27, double 0x3FD5555555555555)
%29 = load i32, i32* %4
%30 = mul nsw i32 9, %29
%31 = sitofp i32 %30 to double
%32 = fdiv double 2.000000e+00, %31
%33 = fsub double 1.000000e+00, %32
%34 = fsub double %28, %33
%35 = load i32, i32* %4
%36 = mul nsw i32 9, %35
%37 = sitofp i32 %36 to double
%38 = fdiv double 2.000000e+00, %37
%39 = call double @sqrt(double %38)
%40 = fdiv double %34, %39
%41 = call i32 @Q(double %40)
%42 = sub nsw i32 1, %41
%43 = sitofp i32 %42 to double
store double %43, double* %5
br label %82
44: ; preds = %20
%45 = load i32, i32* %4
%46 = srem i32 %45, 2
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %65
48: ; preds = %44
%49 = load i32, i32* @M_PI
%50 = mul nsw i32 2, %49
%51 = sitofp i32 %50 to double
%52 = call double @sqrt(double %51)
%53 = load double, double* %3
%54 = call double @sqrt(double %53)
%55 = call i32 @Z(double %54)
%56 = sitofp i32 %55 to double
%57 = fmul double %52, %56
%58 = load i32, i32* %4
%59 = load double, double* %3
%60 = call double @sqrt(double %59)
%61 = call i32 @sum(i32 %58, double %60)
%62 = sitofp i32 %61 to double
%63 = fadd double 1.000000e+00, %62
%64 = fmul double %57, %63
store double %64, double* %5
br label %81
65: ; preds = %44
%66 = load double, double* %3
%67 = call double @sqrt(double %66)
%68 = call i32 @Z(double %67)
%69 = mul nsw i32 2, %68
%70 = load i32, i32* %4
%71 = load double, double* %3
%72 = call double @sqrt(double %71)
%73 = call i32 @sum(i32 %70, double %72)
%74 = mul nsw i32 %69, %73
%75 = load double, double* %3
%76 = call double @sqrt(double %75)
%77 = call i32 @Q(double %76)
%78 = mul nsw i32 2, %77
%79 = add nsw i32 %74, %78
%80 = sitofp i32 %79 to double
store double %80, double* %5
br label %81
81: ; preds = %65, %48
br label %82
82: ; preds = %81, %23
br label %83
83: ; preds = %82, %8
%84 = load double, double* %5
ret double %84
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @significance(double %0, i32 %1) {
%3 = icmp sgt i32 %1, 100
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = fmul double %0, 2.000000e+00
%6 = tail call double @sqrt(double %5)
%7 = sitofp i32 %1 to double
%8 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double -1.000000e+00)
%9 = tail call double @sqrt(double %8)
%10 = fsub double %6, %9
%11 = tail call i32 @Q(double %10)
%12 = sub nsw i32 1, %11
%13 = sitofp i32 %12 to double
br label %58
14: ; preds = %2
%15 = icmp sgt i32 %1, 30
br i1 %15, label %16, label %30
16: ; preds = %14
%17 = sitofp i32 %1 to double
%18 = fdiv double %0, %17
%19 = tail call double @pow(double %18, double 0x3FD5555555555555)
%20 = mul nuw nsw i32 %1, 9
%21 = sitofp i32 %20 to double
%22 = fdiv double 2.000000e+00, %21
%23 = fsub double 1.000000e+00, %22
%24 = fsub double %19, %23
%25 = tail call double @sqrt(double %22)
%26 = fdiv double %24, %25
%27 = tail call i32 @Q(double %26)
%28 = sub nsw i32 1, %27
%29 = sitofp i32 %28 to double
br label %58
30: ; preds = %14
%31 = and i32 %1, 1
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %47
33: ; preds = %30
%34 = load i32, i32* @M_PI
%35 = shl nsw i32 %34, 1
%36 = sitofp i32 %35 to double
%37 = tail call double @sqrt(double %36)
%38 = tail call double @sqrt(double %0)
%39 = tail call i32 @Z(double %38)
%40 = sitofp i32 %39 to double
%41 = fmul double %37, %40
%42 = tail call double @sqrt(double %0)
%43 = tail call i32 @sum(i32 %1, double %42)
%44 = sitofp i32 %43 to double
%45 = fadd double %44, 1.000000e+00
%46 = fmul double %41, %45
br label %58
47: ; preds = %30
%48 = tail call double @sqrt(double %0)
%49 = tail call i32 @Z(double %48)
%50 = tail call double @sqrt(double %0)
%51 = tail call i32 @sum(i32 %1, double %50)
%52 = mul i32 %51, %49
%53 = tail call double @sqrt(double %0)
%54 = tail call i32 @Q(double %53)
%55 = add i32 %54, %52
%56 = shl i32 %55, 1
%57 = sitofp i32 %56 to double
br label %58
58: ; preds = %16, %47, %33, %4
%59 = phi double [ %13, %4 ], [ %29, %16 ], [ %46, %33 ], [ %57, %47 ]
ret double %59
}