void ks_test(int n, double f[], double *pkp, double *pkm) {
  int *pn, k, i;
  double *pu, *pv, xn, sn, x, kp, km;
  if (n <= 0) {
    printf("Error in ks_test: argument out of range\n");
    printf("Program aborted\n\n");
    exit(0);
  }
  pn = malloc((n + 1) * sizeof(int));
  pu = malloc((n + 1) * sizeof(double));
  pv = malloc((n + 1) * sizeof(double));
  xn = (double)n;
  if (pn && pu && pv) {
    for (k = 0; k <= n; k++) {
      pn[k] = 0;
      pu[k] = xn;
      pv[k] = 0.0;
    }
  } else {
    printf("Error in ks_test: could not allocate auxiliary arrays\n");
    printf("Program aborted\n\n");
    exit(0);
  }
  for (i = 0; i < n; i++) {
    x = xn * f[i];
    if ((x < 0) || (x > xn)) {
      printf("Error in ks_test: argument out of range\n");
      printf("Program aborted\n\n");
      exit(0);
    }
    k = (int)x;
    pn[k] += 1;
    if (x < pu[k])
      pu[k] = x;
    if (x > pv[k])
      pv[k] = x;
  }
  sn = 0.0;
  kp = 0.0;
  km = 0.0;
  for (k = 0; k <= n; k++) {
    if (pn[k] > 0) {
      x = pu[k] - sn;
      if (x > km)
        km = x;
      sn += (double)pn[k];
      x = sn - pv[k];
      if (x > kp)
        kp = x;
    }
  }
  *pkp = kp / sqrt(xn);
  *pkm = km / sqrt(xn);
  free(pn);
  free(pu);
  free(pv);
}


x86 assembly (clang, -O0):
<ks_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1197 <ks_test+0x47>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x40(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     125b <ks_test+0x10b>
cmpq   $0x0,-0x38(%rbp)
je     125b <ks_test+0x10b>
cmpq   $0x0,-0x40(%rbp)
je     125b <ks_test+0x10b>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1256 <ks_test+0x106>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
movsd  -0x48(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
movslq -0x2c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    120b <ks_test+0xbb>
jmp    127e <ks_test+0x12e>
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    136d <ks_test+0x21d>
movsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x58(%rbp),%xmm0
ja     12c6 <ks_test+0x176>
movsd  -0x58(%rbp),%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    12e9 <ks_test+0x199>
lea    0xd33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
cvttsd2si -0x58(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
movsd  -0x58(%rbp),%xmm1
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1330 <ks_test+0x1e0>
movsd  -0x58(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x58(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x2c(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    135a <ks_test+0x20a>
movsd  -0x58(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    135f <ks_test+0x20f>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1285 <ks_test+0x135>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     143b <ks_test+0x2eb>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jle    1428 <ks_test+0x2d8>
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
ucomisd -0x68(%rbp),%xmm0
jbe    13db <ks_test+0x28b>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x2c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    1423 <ks_test+0x2d3>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    1428 <ks_test+0x2d8>
jmp    142d <ks_test+0x2dd>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    138c <ks_test+0x23c>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ks_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,0x8(%rsp)
test   %edi,%edi
jle    14ae <ks_test+0x34e>
mov    %rdx,0x28(%rsp)
mov    %rcx,0x30(%rsp)
mov    %edi,(%rsp)
mov    %edi,%r14d
lea    0x4(,%r14,4),%rdi
call   1060 <malloc@plt>
mov    %rax,%r15
lea    0x8(,%r14,8),%rbp
mov    %rbp,%rdi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1060 <malloc@plt>
test   %r15,%r15
je     14cd <ks_test+0x36d>
test   %rbx,%rbx
je     14cd <ks_test+0x36d>
mov    %rax,%r12
test   %rax,%rax
je     14cd <ks_test+0x36d>
lea    0x1(%r14),%r13
cvtsi2sdl (%rsp),%xmm0
movapd %xmm0,0x10(%rsp)
lea    0x4(,%r14,4),%rdx
xor    %ebp,%ebp
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
lea    0x8(,%r14,8),%rdx
mov    %r12,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    (%rsp),%edi
cmp    $0x3,%edi
jae    1221 <ks_test+0xc1>
movapd 0x10(%rsp),%xmm3
mov    0x8(%rsp),%rsi
jmp    1330 <ks_test+0x1d0>
mov    %r13d,%ebp
and    $0xfffffffc,%ebp
movapd 0x10(%rsp),%xmm3
movapd %xmm3,%xmm0
unpcklpd %xmm3,%xmm0
lea    -0x4(%rbp),%rdx
mov    %rdx,%rcx
shr    $0x2,%rcx
add    $0x1,%rcx
mov    %ecx,%eax
and    $0x7,%eax
cmp    $0x1c,%rdx
mov    0x8(%rsp),%rsi
jae    125b <ks_test+0xfb>
xor    %edx,%edx
jmp    12f5 <ks_test+0x195>
and    $0xfffffffffffffff8,%rcx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movupd %xmm0,(%rbx,%rdx,8)
movupd %xmm0,0x10(%rbx,%rdx,8)
movupd %xmm0,0x20(%rbx,%rdx,8)
movupd %xmm0,0x30(%rbx,%rdx,8)
movupd %xmm0,0x40(%rbx,%rdx,8)
movupd %xmm0,0x50(%rbx,%rdx,8)
movupd %xmm0,0x60(%rbx,%rdx,8)
movupd %xmm0,0x70(%rbx,%rdx,8)
movupd %xmm0,0x80(%rbx,%rdx,8)
movupd %xmm0,0x90(%rbx,%rdx,8)
movupd %xmm0,0xa0(%rbx,%rdx,8)
movupd %xmm0,0xb0(%rbx,%rdx,8)
movupd %xmm0,0xc0(%rbx,%rdx,8)
movupd %xmm0,0xd0(%rbx,%rdx,8)
movupd %xmm0,0xe0(%rbx,%rdx,8)
movupd %xmm0,0xf0(%rbx,%rdx,8)
add    $0x20,%rdx
add    $0xfffffffffffffff8,%rcx
jne    1270 <ks_test+0x110>
test   %rax,%rax
je     1324 <ks_test+0x1c4>
lea    (%rbx,%rdx,8),%rcx
add    $0x10,%rcx
shl    $0x5,%rax
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movupd %xmm0,-0x10(%rcx,%rdx,1)
movupd %xmm0,(%rcx,%rdx,1)
add    $0x20,%rdx
cmp    %rdx,%rax
jne    1310 <ks_test+0x1b0>
cmp    %r13,%rbp
je     133e <ks_test+0x1de>
nopl   0x0(%rax)
movsd  %xmm3,(%rbx,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1330 <ks_test+0x1d0>
test   %edi,%edi
jle    13a2 <ks_test+0x242>
xor    %eax,%eax
xorpd  %xmm0,%xmm0
jmp    1359 <ks_test+0x1f9>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rax
cmp    %rax,%r14
je     13a2 <ks_test+0x242>
movsd  (%rsi,%rax,8),%xmm1
mulsd  %xmm3,%xmm1
ucomisd %xmm1,%xmm0
ja     14ae <ks_test+0x34e>
ucomisd %xmm3,%xmm1
ja     14ae <ks_test+0x34e>
cvttsd2si %xmm1,%ecx
movslq %ecx,%rcx
addl   $0x1,(%r15,%rcx,4)
movsd  (%rbx,%rcx,8),%xmm2
ucomisd %xmm1,%xmm2
jbe    1392 <ks_test+0x232>
movsd  %xmm1,(%rbx,%rcx,8)
ucomisd (%r12,%rcx,8),%xmm1
jbe    1350 <ks_test+0x1f0>
movsd  %xmm1,(%r12,%rcx,8)
jmp    1350 <ks_test+0x1f0>
xorpd  %xmm4,%xmm4
xor    %eax,%eax
xorpd  %xmm5,%xmm5
xorpd  %xmm1,%xmm1
jmp    13d1 <ks_test+0x271>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movapd %xmm1,%xmm0
add    $0x1,%rax
movapd %xmm0,%xmm1
cmp    %rax,%r13
je     140b <ks_test+0x2ab>
mov    (%r15,%rax,4),%ecx
test   %ecx,%ecx
jle    13c0 <ks_test+0x260>
movsd  (%rbx,%rax,8),%xmm2
subsd  %xmm1,%xmm2
maxsd  %xmm4,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
addsd  %xmm1,%xmm0
movapd %xmm0,%xmm1
subsd  (%r12,%rax,8),%xmm1
ucomisd %xmm5,%xmm1
jbe    1405 <ks_test+0x2a5>
movapd %xmm1,%xmm5
movapd %xmm2,%xmm4
jmp    13c4 <ks_test+0x264>
xorps  %xmm1,%xmm1
sqrtsd %xmm3,%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm3
movapd %xmm1,%xmm0
movsd  %xmm4,(%rsp)
jae    1455 <ks_test+0x2f5>
movapd %xmm3,%xmm0
movsd  %xmm5,0x8(%rsp)
movsd  %xmm1,0x20(%rsp)
call   1070 <sqrt@plt>
xorpd  %xmm2,%xmm2
movsd  0x20(%rsp),%xmm1
movsd  0x8(%rsp),%xmm5
movsd  (%rsp),%xmm4
movapd 0x10(%rsp),%xmm3
divsd  %xmm0,%xmm5
mov    0x28(%rsp),%rax
movsd  %xmm5,(%rax)
ucomisd %xmm2,%xmm3
mov    0x30(%rsp),%rbp
jae    147f <ks_test+0x31f>
movapd %xmm3,%xmm0
call   1070 <sqrt@plt>
movsd  (%rsp),%xmm4
movapd %xmm0,%xmm1
divsd  %xmm1,%xmm4
movsd  %xmm4,0x0(%rbp)
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
lea    0xb81(%rip),%rdi
call   1040 <puts@plt>
lea    0xb9d(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <exit@plt>
lea    0xb2c(%rip),%rdi
jmp    14b5 <ks_test+0x355>

LLVM IR (-O0):
@.str = [41 x i8] c"Error in ks_test: argument out of range\0A\00"
@.str.1 = [18 x i8] c"Program aborted\0A\0A\00"
@.str.2 = [55 x i8] c"Error in ks_test: could not allocate auxiliary arrays\0A\00"
define void @ks_test(i32 %0, double* %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store i32 %0, i32* %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%19 = load i32, i32* %5
%20 = icmp sle i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %4
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
unreachable
24: ; preds = %4
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = mul i64 %27, 4
%29 = call i8* @malloc(i64 %28)
%30 = bitcast i8* %29 to i32*
store i32* %30, i32** %9
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = mul i64 %33, 8
%35 = call i8* @malloc(i64 %34)
%36 = bitcast i8* %35 to double*
store double* %36, double** %12
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = mul i64 %39, 8
%41 = call i8* @malloc(i64 %40)
%42 = bitcast i8* %41 to double*
store double* %42, double** %13
%43 = load i32, i32* %5
%44 = sitofp i32 %43 to double
store double %44, double* %14
%45 = load i32*, i32** %9
%46 = icmp ne i32* %45, null
br i1 %46, label %47, label %76
47: ; preds = %24
%48 = load double*, double** %12
%49 = icmp ne double* %48, null
br i1 %49, label %50, label %76
50: ; preds = %47
%51 = load double*, double** %13
%52 = icmp ne double* %51, null
br i1 %52, label %53, label %76
53: ; preds = %50
store i32 0, i32* %10
br label %54
54: ; preds = %72, %53
%55 = load i32, i32* %10
%56 = load i32, i32* %5
%57 = icmp sle i32 %55, %56
br i1 %57, label %58, label %75
58: ; preds = %54
%59 = load i32*, i32** %9
%60 = load i32, i32* %10
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %59, i64 %61
store i32 0, i32* %62
%63 = load double, double* %14
%64 = load double*, double** %12
%65 = load i32, i32* %10
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
store double %63, double* %67
%68 = load double*, double** %13
%69 = load i32, i32* %10
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %68, i64 %70
store double 0.000000e+00, double* %71
br label %72
72: ; preds = %58
%73 = load i32, i32* %10
%74 = add nsw i32 %73, 1
store i32 %74, i32* %10
br label %54
75: ; preds = %54
br label %79
76: ; preds = %50, %47, %24
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
unreachable
79: ; preds = %75
store i32 0, i32* %11
br label %80
80: ; preds = %138, %79
%81 = load i32, i32* %11
%82 = load i32, i32* %5
%83 = icmp slt i32 %81, %82
br i1 %83, label %84, label %141
84: ; preds = %80
%85 = load double, double* %14
%86 = load double*, double** %6
%87 = load i32, i32* %11
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double, double* %86, i64 %88
%90 = load double, double* %89
%91 = fmul double %85, %90
store double %91, double* %16
%92 = load double, double* %16
%93 = fcmp olt double %92, 0.000000e+00
br i1 %93, label %98, label %94
94: ; preds = %84
%95 = load double, double* %16
%96 = load double, double* %14
%97 = fcmp ogt double %95, %96
br i1 %97, label %98, label %101
98: ; preds = %94, %84
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
unreachable
101: ; preds = %94
%102 = load double, double* %16
%103 = fptosi double %102 to i32
store i32 %103, i32* %10
%104 = load i32*, i32** %9
%105 = load i32, i32* %10
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i32, i32* %104, i64 %106
%108 = load i32, i32* %107
%109 = add nsw i32 %108, 1
store i32 %109, i32* %107
%110 = load double, double* %16
%111 = load double*, double** %12
%112 = load i32, i32* %10
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %111, i64 %113
%115 = load double, double* %114
%116 = fcmp olt double %110, %115
br i1 %116, label %117, label %123
117: ; preds = %101
%118 = load double, double* %16
%119 = load double*, double** %12
%120 = load i32, i32* %10
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds double, double* %119, i64 %121
store double %118, double* %122
br label %123
123: ; preds = %117, %101
%124 = load double, double* %16
%125 = load double*, double** %13
%126 = load i32, i32* %10
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds double, double* %125, i64 %127
%129 = load double, double* %128
%130 = fcmp ogt double %124, %129
br i1 %130, label %131, label %137
131: ; preds = %123
%132 = load double, double* %16
%133 = load double*, double** %13
%134 = load i32, i32* %10
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds double, double* %133, i64 %135
store double %132, double* %136
br label %137
137: ; preds = %131, %123
br label %138
138: ; preds = %137
%139 = load i32, i32* %11
%140 = add nsw i32 %139, 1
store i32 %140, i32* %11
br label %80
141: ; preds = %80
store double 0.000000e+00, double* %15
store double 0.000000e+00, double* %17
store double 0.000000e+00, double* %18
store i32 0, i32* %10
br label %142
142: ; preds = %189, %141
%143 = load i32, i32* %10
%144 = load i32, i32* %5
%145 = icmp sle i32 %143, %144
br i1 %145, label %146, label %192
146: ; preds = %142
%147 = load i32*, i32** %9
%148 = load i32, i32* %10
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i32, i32* %147, i64 %149
%151 = load i32, i32* %150
%152 = icmp sgt i32 %151, 0
br i1 %152, label %153, label %188
153: ; preds = %146
%154 = load double*, double** %12
%155 = load i32, i32* %10
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds double, double* %154, i64 %156
%158 = load double, double* %157
%159 = load double, double* %15
%160 = fsub double %158, %159
store double %160, double* %16
%161 = load double, double* %16
%162 = load double, double* %18
%163 = fcmp ogt double %161, %162
br i1 %163, label %164, label %166
164: ; preds = %153
%165 = load double, double* %16
store double %165, double* %18
br label %166
166: ; preds = %164, %153
%167 = load i32*, i32** %9
%168 = load i32, i32* %10
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds i32, i32* %167, i64 %169
%171 = load i32, i32* %170
%172 = sitofp i32 %171 to double
%173 = load double, double* %15
%174 = fadd double %173, %172
store double %174, double* %15
%175 = load double, double* %15
%176 = load double*, double** %13
%177 = load i32, i32* %10
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds double, double* %176, i64 %178
%180 = load double, double* %179
%181 = fsub double %175, %180
store double %181, double* %16
%182 = load double, double* %16
%183 = load double, double* %17
%184 = fcmp ogt double %182, %183
br i1 %184, label %185, label %187
185: ; preds = %166
%186 = load double, double* %16
store double %186, double* %17
br label %187
187: ; preds = %185, %166
br label %188
188: ; preds = %187, %146
br label %189
189: ; preds = %188
%190 = load i32, i32* %10
%191 = add nsw i32 %190, 1
store i32 %191, i32* %10
br label %142
192: ; preds = %142
%193 = load double, double* %17
%194 = load double, double* %14
%195 = call double @sqrt(double %194)
%196 = fdiv double %193, %195
%197 = load double*, double** %7
store double %196, double* %197
%198 = load double, double* %18
%199 = load double, double* %14
%200 = call double @sqrt(double %199)
%201 = fdiv double %198, %200
%202 = load double*, double** %8
store double %201, double* %202
%203 = load i32*, i32** %9
%204 = bitcast i32* %203 to i8*
%205 = load double*, double** %12
%206 = bitcast double* %205 to i8*
%207 = load double*, double** %13
%208 = bitcast double* %207 to i8*
ret void
}

LLVM IR (-O2):
@str = [54 x i8] c"Error in ks_test: could not allocate auxiliary arrays\00"
@str.6 = [40 x i8] c"Error in ks_test: argument out of range\00"
@str.7 = [17 x i8] c"Program aborted\0A\00"
define void @ks_test(i32 %0, double* nocapture %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = icmp slt i32 %0, 1
br i1 %5, label %6, label %9
6: ; preds = %4
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.6, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
tail call void @exit(i32 0)
unreachable
9: ; preds = %4
%10 = add nuw i32 %0, 1
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = tail call i8* @malloc(i64 %12)
%14 = bitcast i8* %13 to i32*
%15 = shl nuw nsw i64 %11, 3
%16 = tail call i8* @malloc(i64 %15)
%17 = bitcast i8* %16 to double*
%18 = tail call i8* @malloc(i64 %15)
%19 = bitcast i8* %18 to double*
%20 = sitofp i32 %0 to double
%21 = icmp ne i8* %13, null
%22 = icmp ne i8* %16, null
%23 = and i1 %21, %22
%24 = icmp ne i8* %18, null
%25 = and i1 %23, %24
br i1 %25, label %26, label %117
26: ; preds = %9
%27 = zext i32 %0 to i64
%28 = shl nuw nsw i64 %27, 2
%29 = add nuw nsw i64 %28, 4
%30 = shl nuw nsw i64 %27, 3
%31 = add nuw nsw i64 %30, 8
%32 = icmp ult i32 %0, 3
br i1 %32, label %106, label %33
33: ; preds = %26
%34 = and i64 %11, 4294967292
%35 = insertelement <2 x double> poison, double %20, i64 0
%36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> zeroinitializer
%37 = insertelement <2 x double> poison, double %20, i64 0
%38 = shufflevector <2 x double> %37, <2 x double> poison, <2 x i32> zeroinitializer
%39 = add nsw i64 %34, -4
%40 = lshr exact i64 %39, 2
%41 = add nuw nsw i64 %40, 1
%42 = and i64 %41, 7
%43 = icmp ult i64 %39, 28
br i1 %43, label %91, label %44
44: ; preds = %33
%45 = and i64 %41, 9223372036854775800
br label %46
46: ; preds = %46, %44
%47 = phi i64 [ 0, %44 ], [ %88, %46 ]
%48 = phi i64 [ 0, %44 ], [ %89, %46 ]
%49 = getelementptr inbounds double, double* %17, i64 %47
%50 = bitcast double* %49 to <2 x double>*
store <2 x double> %36, <2 x double>* %50
%51 = getelementptr inbounds double, double* %49, i64 2
%52 = bitcast double* %51 to <2 x double>*
store <2 x double> %38, <2 x double>* %52
%53 = or i64 %47, 4
%54 = getelementptr inbounds double, double* %17, i64 %53
%55 = bitcast double* %54 to <2 x double>*
store <2 x double> %36, <2 x double>* %55
%56 = getelementptr inbounds double, double* %54, i64 2
%57 = bitcast double* %56 to <2 x double>*
store <2 x double> %38, <2 x double>* %57
%58 = or i64 %47, 8
%59 = getelementptr inbounds double, double* %17, i64 %58
%60 = bitcast double* %59 to <2 x double>*
store <2 x double> %36, <2 x double>* %60
%61 = getelementptr inbounds double, double* %59, i64 2
%62 = bitcast double* %61 to <2 x double>*
store <2 x double> %38, <2 x double>* %62
%63 = or i64 %47, 12
%64 = getelementptr inbounds double, double* %17, i64 %63
%65 = bitcast double* %64 to <2 x double>*
store <2 x double> %36, <2 x double>* %65
%66 = getelementptr inbounds double, double* %64, i64 2
%67 = bitcast double* %66 to <2 x double>*
store <2 x double> %38, <2 x double>* %67
%68 = or i64 %47, 16
%69 = getelementptr inbounds double, double* %17, i64 %68
%70 = bitcast double* %69 to <2 x double>*
store <2 x double> %36, <2 x double>* %70
%71 = getelementptr inbounds double, double* %69, i64 2
%72 = bitcast double* %71 to <2 x double>*
store <2 x double> %38, <2 x double>* %72
%73 = or i64 %47, 20
%74 = getelementptr inbounds double, double* %17, i64 %73
%75 = bitcast double* %74 to <2 x double>*
store <2 x double> %36, <2 x double>* %75
%76 = getelementptr inbounds double, double* %74, i64 2
%77 = bitcast double* %76 to <2 x double>*
store <2 x double> %38, <2 x double>* %77
%78 = or i64 %47, 24
%79 = getelementptr inbounds double, double* %17, i64 %78
%80 = bitcast double* %79 to <2 x double>*
store <2 x double> %36, <2 x double>* %80
%81 = getelementptr inbounds double, double* %79, i64 2
%82 = bitcast double* %81 to <2 x double>*
store <2 x double> %38, <2 x double>* %82
%83 = or i64 %47, 28
%84 = getelementptr inbounds double, double* %17, i64 %83
%85 = bitcast double* %84 to <2 x double>*
store <2 x double> %36, <2 x double>* %85
%86 = getelementptr inbounds double, double* %84, i64 2
%87 = bitcast double* %86 to <2 x double>*
store <2 x double> %38, <2 x double>* %87
%88 = add nuw i64 %47, 32
%89 = add i64 %48, 8
%90 = icmp eq i64 %89, %45
br i1 %90, label %91, label %46
91: ; preds = %46, %33
%92 = phi i64 [ 0, %33 ], [ %88, %46 ]
%93 = icmp eq i64 %42, 0
br i1 %93, label %104, label %94
94: ; preds = %91, %94
%95 = phi i64 [ %101, %94 ], [ %92, %91 ]
%96 = phi i64 [ %102, %94 ], [ 0, %91 ]
%97 = getelementptr inbounds double, double* %17, i64 %95
%98 = bitcast double* %97 to <2 x double>*
store <2 x double> %36, <2 x double>* %98
%99 = getelementptr inbounds double, double* %97, i64 2
%100 = bitcast double* %99 to <2 x double>*
store <2 x double> %38, <2 x double>* %100
%101 = add nuw i64 %95, 4
%102 = add i64 %96, 1
%103 = icmp eq i64 %102, %42
br i1 %103, label %104, label %94
104: ; preds = %94, %91
%105 = icmp eq i64 %34, %11
br i1 %105, label %108, label %106
106: ; preds = %26, %104
%107 = phi i64 [ 0, %26 ], [ %34, %104 ]
br label %112
108: ; preds = %112, %104
%109 = icmp sgt i32 %0, 0
br i1 %109, label %110, label %149
110: ; preds = %108
%111 = zext i32 %0 to i64
br label %120
112: ; preds = %106, %112
%113 = phi i64 [ %115, %112 ], [ %107, %106 ]
%114 = getelementptr inbounds double, double* %17, i64 %113
store double %20, double* %114
%115 = add nuw nsw i64 %113, 1
%116 = icmp eq i64 %115, %11
br i1 %116, label %108, label %112
117: ; preds = %9
%118 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%119 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
tail call void @exit(i32 0)
unreachable
120: ; preds = %110, %146
%121 = phi i64 [ 0, %110 ], [ %147, %146 ]
%122 = getelementptr inbounds double, double* %1, i64 %121
%123 = load double, double* %122
%124 = fmul double %123, %20
%125 = fcmp olt double %124, 0.000000e+00
%126 = fcmp ogt double %124, %20
%127 = or i1 %125, %126
br i1 %127, label %128, label %131
128: ; preds = %120
%129 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.6, i64 0, i64 0))
%130 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
tail call void @exit(i32 0)
unreachable
131: ; preds = %120
%132 = fptosi double %124 to i32
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds i32, i32* %14, i64 %133
%135 = load i32, i32* %134
%136 = add nsw i32 %135, 1
store i32 %136, i32* %134
%137 = getelementptr inbounds double, double* %17, i64 %133
%138 = load double, double* %137
%139 = fcmp olt double %124, %138
br i1 %139, label %140, label %141
140: ; preds = %131
store double %124, double* %137
br label %141
141: ; preds = %140, %131
%142 = getelementptr inbounds double, double* %19, i64 %133
%143 = load double, double* %142
%144 = fcmp ogt double %124, %143
br i1 %144, label %145, label %146
145: ; preds = %141
store double %124, double* %142
br label %146
146: ; preds = %141, %145
%147 = add nuw nsw i64 %121, 1
%148 = icmp eq i64 %147, %111
br i1 %148, label %149, label %120
149: ; preds = %146, %108
br label %150
150: ; preds = %149, %171
%151 = phi i64 [ %175, %171 ], [ 0, %149 ]
%152 = phi double [ %174, %171 ], [ 0.000000e+00, %149 ]
%153 = phi double [ %173, %171 ], [ 0.000000e+00, %149 ]
%154 = phi double [ %172, %171 ], [ 0.000000e+00, %149 ]
%155 = getelementptr inbounds i32, i32* %14, i64 %151
%156 = load i32, i32* %155
%157 = icmp sgt i32 %156, 0
br i1 %157, label %158, label %171
158: ; preds = %150
%159 = getelementptr inbounds double, double* %17, i64 %151
%160 = load double, double* %159
%161 = fsub double %160, %154
%162 = fcmp ogt double %161, %152
%163 = select i1 %162, double %161, double %152
%164 = sitofp i32 %156 to double
%165 = fadd double %154, %164
%166 = getelementptr inbounds double, double* %19, i64 %151
%167 = load double, double* %166
%168 = fsub double %165, %167
%169 = fcmp ogt double %168, %153
br i1 %169, label %170, label %171
170: ; preds = %158
br label %171
171: ; preds = %150, %170, %158
%172 = phi double [ %165, %170 ], [ %165, %158 ], [ %154, %150 ]
%173 = phi double [ %168, %170 ], [ %153, %158 ], [ %153, %150 ]
%174 = phi double [ %163, %170 ], [ %163, %158 ], [ %152, %150 ]
%175 = add nuw nsw i64 %151, 1
%176 = icmp eq i64 %175, %11
br i1 %176, label %177, label %150
177: ; preds = %171
%178 = tail call double @sqrt(double %20)
%179 = fdiv double %173, %178
store double %179, double* %2
%180 = tail call double @sqrt(double %20)
%181 = fdiv double %174, %180
store double %181, double* %3
tail call void @free(i8* %13)
tail call void @free(i8* %16)
tail call void @free(i8* %18)
ret void
}