// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/distributions.c
// Function: kolmogorov_one_sample
double kolmogorov_one_sample(int n, double d) 
{ 
 int k, m, i, j, g;
 double h, s;
 matrix H, Q;
 s = d * d * n; 
 if (s > 7.24 || (s > 3.76 && n > 99)) 
   return 1 - 2 * exp(-(2.000071 + .331 / sqrt(n) + 1.409 / n) * s);
 k = (int)(n * d) + 1; 
 m = 2 * k - 1; 
 h = k - n * d; 
 H = matrix_alloc(m, m); 
 for (i = 0; i < m; i++) 
   for (j = 0; j < m; j++)
     if (i - j + 1 < 0) 
       H.values[i][j] = 0; 
     else 
       H.values[i][j] = 1; 
 for (i = 0; i < m; i++) 
  {
   H.values[i][0] -= pow(h, i + 1); 
   H.values[m - 1][i] -= pow(h, (m - i));
  } 
 H.values[m - 1][0] += (2 * h - 1 > 0 ? pow(2 * h - 1, m):0); 
 for (i = 0; i < m; i++) 
   for (j = 0; j < m; j++)
     if (i - j + 1 > 0) 
      for (g = 1; g <= i - j + 1; g++) 
        H.values[i][j] /= g; 
 Q = matrix_power(H, n); 
 s = Q.values[k - 1][k - 1]; 
 for (i = 1;i <= n; i++) 
   s = (s * i) / n; 
 matrix_free(H); 
 matrix_free(Q); 
 return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movapd %xmm0, %xmm3
mulsd %xmm0, %xmm3
cvtsi2sd %edi, %xmm2
mulsd %xmm2, %xmm3
ucomisd 0x84218(%rip), %xmm3    # 0xa4cc0
ja 0x20ac3
movl %edi, %ebx
cmpl $0x64, %edi
jl 0x20b49
ucomisd 0x8420b(%rip), %xmm3    # 0xa4cc8
jbe 0x20b49
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
jb 0x20ad6
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
jmp 0x20af7
movapd %xmm2, %xmm0
movsd %xmm2, 0x18(%rsp)
movsd %xmm3, 0x8(%rsp)
callq 0x4300
movsd 0x8(%rsp), %xmm3
movsd 0x18(%rsp), %xmm2
movsd 0x841d1(%rip), %xmm1    # 0xa4cd0
divsd %xmm0, %xmm1
addsd 0x841cd(%rip), %xmm1    # 0xa4cd8
movsd 0x841cd(%rip), %xmm0    # 0xa4ce0
divsd %xmm2, %xmm0
addsd %xmm1, %xmm0
xorpd 0x826ad(%rip), %xmm0    # 0xa31d0
mulsd %xmm0, %xmm3
movapd %xmm3, %xmm0
callq 0x4060
addsd %xmm0, %xmm0
movsd 0x819e4(%rip), %xmm1    # 0xa2520
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
jmp 0x20d87
movsd %xmm2, 0x18(%rsp)
mulsd %xmm2, %xmm0
movsd %xmm0, 0x20(%rsp)
cvttsd2si %xmm0, %r14d
leal 0x1(%r14), %eax
leal 0x1(%r14,%r14), %ebp
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x8(%rsp)
movl %ebp, %edi
movl %ebp, %esi
callq 0x3c6e5
movq %rdx, %r15
testl %r14d, %r14d
js 0x20bcb
cmpl $0x2, %ebp
movl $0x1, %r8d
cmovgel %ebp, %r8d
xorl %ecx, %ecx
movsd 0x81984(%rip), %xmm0    # 0xa2520
movq (%r15,%rcx,8), %rdx
movq %rcx, %rsi
xorl %edi, %edi
xorpd %xmm1, %xmm1
cmpq $-0x1, %rsi
jl 0x20bb3
movapd %xmm0, %xmm1
movsd %xmm1, (%rdx,%rdi,8)
incq %rdi
decq %rsi
cmpq %rdi, %r8
jne 0x20ba5
incq %rcx
cmpq %r8, %rcx
jne 0x20b9c
movl %ebp, 0x14(%rsp)
movq %rax, 0x30(%rsp)
leal 0x2(,%r14,2), %eax
movl %eax, 0x10(%rsp)
movsd 0x8(%rsp), %xmm2
subsd 0x20(%rsp), %xmm2
movq %r14, 0x28(%rsp)
testl %r14d, %r14d
js 0x20c7e
movl 0x10(%rsp), %eax
movq %rax, 0x20(%rsp)
movl 0x14(%rsp), %ebp
cmpl $0x2, %ebp
movl $0x1, %r12d
cmovgel %ebp, %r12d
xorl %r14d, %r14d
movsd %xmm2, 0x8(%rsp)
leaq 0x1(%r14), %r13
xorps %xmm1, %xmm1
cvtsi2sd %r13d, %xmm1
movapd %xmm2, %xmm0
callq 0x42f0
movq (%r15,%r14,8), %rax
movsd (%rax), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rax)
xorps %xmm1, %xmm1
cvtsi2sd %ebp, %xmm1
movsd 0x8(%rsp), %xmm0
callq 0x42f0
movsd 0x8(%rsp), %xmm2
movq 0x20(%rsp), %rax
movq -0x10(%r15,%rax,8), %rax
movsd (%rax,%r14,8), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rax,%r14,8)
decl %ebp
movq %r13, %r14
cmpq %r13, %r12
jne 0x20c1d
addsd %xmm2, %xmm2
addsd 0x8211e(%rip), %xmm2    # 0xa2da8
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
movl 0x14(%rsp), %r12d
jbe 0x20caa
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
movapd %xmm2, %xmm0
callq 0x42f0
movslq 0x10(%rsp), %rax
movq -0x10(%r15,%rax,8), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq 0x28(%rsp), %rbp
testl %ebp, %ebp
movq 0x30(%rsp), %r14
js 0x20d20
cmpl $0x2, %r12d
movl $0x1, %eax
cmovgel %r12d, %eax
xorl %ecx, %ecx
movsd 0x8183f(%rip), %xmm0    # 0xa2520
xorl %edx, %edx
movq %rcx, %rsi
subq %rdx, %rsi
js 0x20d10
movq (%r15,%rcx,8), %rdi
movsd (%rdi,%rdx,8), %xmm1
xorl %r8d, %r8d
movapd %xmm0, %xmm2
divsd %xmm2, %xmm1
addsd %xmm0, %xmm2
incq %r8
cmpq %r8, %rsi
jge 0x20cfb
movsd %xmm1, (%rdi,%rdx,8)
incq %rdx
cmpq %rax, %rdx
jne 0x20ce3
incq %rcx
cmpq %rax, %rcx
jne 0x20ce1
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x3e876
movq %rax, %r12
movq %rdx, %r13
movslq %ebp, %rax
movq (%rdx,%rax,8), %rcx
movsd (%rcx,%rax,8), %xmm3
testl %ebx, %ebx
jle 0x20d65
movsd 0x817d5(%rip), %xmm0    # 0xa2520
movapd %xmm0, %xmm1
movsd 0x18(%rsp), %xmm2
mulsd %xmm1, %xmm3
divsd %xmm2, %xmm3
addsd %xmm0, %xmm1
decl %ebx
jne 0x20d55
movsd %xmm3, 0x8(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x3dbad
movq %r12, %rdi
movq %r13, %rsi
callq 0x3dbad
movsd 0x8(%rsp), %xmm0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop