#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, norm;
  if (dof > 100) {
    norm = Q(sqrt(2.0 * chi2) - sqrt(2.0 * dof - 1.0));
  } else if (dof > 30) {
    norm = 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    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jle    11ba <significance+0x6a>
movsd  0xe96(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xe86(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
call   1050 <Q@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    132e <significance+0x1de>
cmpl   $0x1e,-0xc(%rbp)
jle    1240 <significance+0xf0>
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe36(%rip),%xmm1
call   1060 <pow@plt>
imul   $0x9,-0xc(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xe19(%rip),%xmm2
divsd  %xmm1,%xmm2
movsd  0xe05(%rip),%xmm1
subsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
imul   $0x9,-0xc(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xdf0(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
divsd  %xmm1,%xmm0
call   1050 <Q@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1329 <significance+0x1d9>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12ca <significance+0x17a>
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
call   1030 <Z@plt>
movsd  -0x48(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x3c(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
mov    -0x3c(%rbp),%edi
call   1040 <sum@plt>
movsd  -0x38(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
movsd  0xd48(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1324 <significance+0x1d4>
movsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
call   1030 <Z@plt>
shl    $0x1,%eax
mov    %eax,-0x50(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x54(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
mov    -0x54(%rbp),%edi
call   1040 <sum@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x4c(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
call   1050 <Q@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
shl    $0x1,%ecx
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1329 <significance+0x1d9>
jmp    132e <significance+0x1de>
movsd  -0x18(%rbp),%xmm0
add    $0x60,%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    127a <significance+0x12a>
mov    0x2dcc(%rip),%rax
mov    (%rax),%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1306 <significance+0x1b6>
sqrtsd %xmm0,%xmm0
jmp    1314 <significance+0x1c4>
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>
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    129b <significance+0x14b>
movsd  (%rsp),%xmm0
call   1070 <sqrt@plt>
call   1030 <Z@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
ucomisd 0xd71(%rip),%xmm0
movsd  0x8(%rsp),%xmm0
jae    12c1 <significance+0x171>
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    12eb <significance+0x19b>
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    1273 <significance+0x123>
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    1337 <significance+0x1e7>
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    1375 <significance+0x225>
call   1070 <sqrt@plt>
movapd %xmm0,%xmm1
mov    %ebx,%edi
movapd %xmm1,%xmm0
call   1040 <sum@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xc71(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    1273 <significance+0x123>

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

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 %12
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)
br label %54
12: ; preds = %2
%13 = icmp sgt i32 %1, 30
br i1 %13, label %14, label %26
14: ; preds = %12
%15 = sitofp i32 %1 to double
%16 = fdiv double %0, %15
%17 = tail call double @pow(double %16, double 0x3FD5555555555555)
%18 = mul nuw nsw i32 %1, 9
%19 = sitofp i32 %18 to double
%20 = fdiv double 2.000000e+00, %19
%21 = fsub double 1.000000e+00, %20
%22 = fsub double %17, %21
%23 = tail call double @sqrt(double %20)
%24 = fdiv double %22, %23
%25 = tail call i32 @Q(double %24)
br label %54
26: ; preds = %12
%27 = and i32 %1, 1
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %43
29: ; preds = %26
%30 = load i32, i32* @M_PI
%31 = shl nsw i32 %30, 1
%32 = sitofp i32 %31 to double
%33 = tail call double @sqrt(double %32)
%34 = tail call double @sqrt(double %0)
%35 = tail call i32 @Z(double %34)
%36 = sitofp i32 %35 to double
%37 = fmul double %33, %36
%38 = tail call double @sqrt(double %0)
%39 = tail call i32 @sum(i32 %1, double %38)
%40 = sitofp i32 %39 to double
%41 = fadd double %40, 1.000000e+00
%42 = fmul double %37, %41
br label %54
43: ; preds = %26
%44 = tail call double @sqrt(double %0)
%45 = tail call i32 @Z(double %44)
%46 = tail call double @sqrt(double %0)
%47 = tail call i32 @sum(i32 %1, double %46)
%48 = mul i32 %47, %45
%49 = tail call double @sqrt(double %0)
%50 = tail call i32 @Q(double %49)
%51 = add i32 %50, %48
%52 = shl i32 %51, 1
%53 = sitofp i32 %52 to double
br label %54
54: ; preds = %14, %43, %29, %4
%55 = phi double [ undef, %4 ], [ undef, %14 ], [ %42, %29 ], [ %53, %43 ]
ret double %55
}