// File: /workspace/github_c_makefile_star2_O3/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, %xmm2
mulsd %xmm0, %xmm2
cvtsi2sd %edi, %xmm1
mulsd %xmm1, %xmm2
ucomisd 0x86b53(%rip), %xmm2    # 0xa7d70
ja 0x21236
cmpl $0x64, %edi
jl 0x212ba
ucomisd 0x86b48(%rip), %xmm2    # 0xa7d78
jbe 0x212ba
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0x21249
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0x21268
movapd %xmm1, %xmm0
movapd %xmm1, 0x20(%rsp)
movsd %xmm2, (%rsp)
callq 0x4300
movsd (%rsp), %xmm2
movapd 0x20(%rsp), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movapd 0x8682c(%rip), %xmm0    # 0xa7aa0
divpd %xmm1, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd 0x86af8(%rip), %xmm1    # 0xa7d80
addsd %xmm0, %xmm1
xorpd 0x84f3c(%rip), %xmm1    # 0xa61d0
mulsd %xmm1, %xmm2
movapd %xmm2, %xmm0
callq 0x4060
addsd %xmm0, %xmm0
movsd 0x84273(%rip), %xmm1    # 0xa5520
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
jmp 0x2156a
movl %edi, 0x14(%rsp)
movapd %xmm1, 0x20(%rsp)
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %ebx
leal 0x1(%rbx), %eax
leal 0x2(%rbx,%rbx), %ecx
movl %ecx, 0xc(%rsp)
leal 0x1(%rbx,%rbx), %ebp
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movl %ebp, %edi
movl %ebp, %esi
callq 0x3d79d
movsd (%rsp), %xmm10
movq %rax, 0x30(%rsp)
movq %rdx, %r15
movl %ebp, 0x10(%rsp)
movl %ebp, %r12d
movq %rbx, 0x18(%rsp)
testl %ebx, %ebx
js 0x2146d
movl 0xc(%rsp), %r13d
leaq -0x1(%r12), %rax
movq %rax, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movq $-0x1, %rax
xorl %ecx, %ecx
movdqa 0x85105(%rip), %xmm1    # 0xa6440
movdqa 0x8510d(%rip), %xmm2    # 0xa6450
pxor %xmm2, %xmm0
movq 0x841d1(%rip), %xmm3    # 0xa5520
pcmpeqd %xmm4, %xmm4
movdqa 0x85135(%rip), %xmm5    # 0xa6490
movq 0x18(%rsp), %r9
movq (%r15,%rcx,8), %rdx
movq %rax, %rsi
xorl %edi, %edi
movdqa %xmm1, %xmm6
movdqa %xmm6, %xmm7
pxor %xmm2, %xmm7
movdqa %xmm7, %xmm8
pcmpgtd %xmm0, %xmm8
pcmpeqd %xmm0, %xmm7
pshufd $0xf5, %xmm7, %xmm9     # xmm9 = xmm7[1,1,3,3]
pand %xmm8, %xmm9
pshufd $0xf5, %xmm8, %xmm7     # xmm7 = xmm8[1,1,3,3]
por %xmm9, %xmm7
movd %xmm7, %r8d
notl %r8d
testb $0x1, %r8b
je 0x213c1
leaq 0x1(%rsi), %r8
pxor %xmm8, %xmm8
cmpq $-0x1, %r8
jl 0x213bb
movdqa %xmm3, %xmm8
movq %xmm8, (%rdx,%rdi,8)
pxor %xmm4, %xmm7
pextrw $0x4, %xmm7, %r8d
testb $0x1, %r8b
je 0x213e5
pxor %xmm7, %xmm7
cmpq $-0x1, %rsi
jl 0x213df
movdqa %xmm3, %xmm7
movq %xmm7, 0x8(%rdx,%rdi,8)
addq $0x2, %rdi
paddq %xmm5, %xmm6
addq $-0x2, %rsi
cmpq %rdi, %r13
jne 0x2136d
incq %rcx
incq %rax
cmpq %r12, %rcx
jne 0x21360
testl %r9d, %r9d
js 0x2146d
xorl %r14d, %r14d
movq %r12, %rbp
leaq 0x1(%r14), %rbx
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
movapd %xmm10, %xmm0
callq 0x42f0
movq (%r15,%r14,8), %rax
movsd (%rax), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rax)
xorps %xmm1, %xmm1
cvtsi2sd %ebp, %xmm1
movsd (%rsp), %xmm0
callq 0x42f0
movsd (%rsp), %xmm10
movq -0x10(%r15,%r13,8), %rax
movsd (%rax,%r14,8), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rax,%r14,8)
movq %rbx, %r14
decq %rbp
jne 0x21414
addsd %xmm10, %xmm10
addsd 0x8492d(%rip), %xmm10   # 0xa5da8
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm10
jbe 0x21499
movapd %xmm10, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x10(%rsp), %xmm1
callq 0x42f0
movslq 0xc(%rsp), %rax
movq -0x10(%r15,%rax,8), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq 0x18(%rsp), %rbp
testl %ebp, %ebp
movl 0x14(%rsp), %ebx
movq 0x30(%rsp), %r14
js 0x21505
xorl %eax, %eax
movsd 0x84059(%rip), %xmm0    # 0xa5520
xorl %ecx, %ecx
movq %rax, %rdx
subq %rcx, %rdx
js 0x214f5
movq (%r15,%rax,8), %rsi
movsd (%rsi,%rcx,8), %xmm1
xorl %edi, %edi
movapd %xmm0, %xmm2
divsd %xmm2, %xmm1
addsd %xmm0, %xmm2
incq %rdi
cmpq %rdi, %rdx
jae 0x214e0
movsd %xmm1, (%rsi,%rcx,8)
incq %rcx
cmpq %r12, %rcx
jne 0x214c9
incq %rax
cmpq %r12, %rax
jne 0x214c7
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x3fbcd
movq %rax, %r12
movq %rdx, %r13
movslq %ebp, %rax
movq (%rdx,%rax,8), %rcx
movsd (%rcx,%rax,8), %xmm3
testl %ebx, %ebx
jle 0x2154a
movsd 0x83ff0(%rip), %xmm0    # 0xa5520
movapd %xmm0, %xmm1
movapd 0x20(%rsp), %xmm2
mulsd %xmm1, %xmm3
divsd %xmm2, %xmm3
addsd %xmm0, %xmm1
decl %ebx
jne 0x2153a
movsd %xmm3, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ed51
movq %r12, %rdi
movq %r13, %rsi
callq 0x3ed51
movsd (%rsp), %xmm0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)