#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ acc(float *, float *, int);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
size_t fread(float *, int, int, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(float *, float *, int);
int /*<<< orphan*/ norm(float *, int, int *);
int /*<<< orphan*/ printf(char *, ...);
int quantise(float *, float *, int, int, float *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ split(float *, int, int);
float sqrt(float);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ zero(float *, int);
int main(int argc, char *argv[]) {
  int d, e;
  float *vec;
  float *cb;
  float *cent;
  int *n;
  int J;
  int ind;
  float se;
  float var;
  float var_1;
  float delta;
  FILE *ftrain;
  FILE *fvq;
  int ret;
  int i, j, finished, iterations;
  float sd;
  int var_n, bits, b, levels;
  if (argc < 5) {
    printf("usage: %s TrainFile D(dimension) B(number of bits) VQFile "
           "[error.txt file]\n",
           argv[0]);
    exit(1);
  }
  ftrain = fopen(argv[1], "rb");
  if (ftrain == NULL) {
    printf("Error opening training database file: %s\n", argv[1]);
    exit(1);
  }
  d = atoi(argv[2]);
  bits = atoi(argv[3]);
  e = 1 << bits;
  printf("\n");
  printf("dimension D=%d  number of bits B=%d entries E=%d\n", d, bits, e);
  vec = (float *)malloc(sizeof(float) * d);
  cb = (float *)malloc(sizeof(float) * d * e);
  cent = (float *)malloc(sizeof(float) * d * e);
  n = (int *)malloc(sizeof(int) * d * e);
  if (cb == NULL || cb == NULL || cent == NULL || vec == NULL) {
    printf("Error in malloc.\n");
    exit(1);
  }
  J = 0;
  var_n = 0;
  while (fread(vec, sizeof(float), d, ftrain) == (size_t)d) {
    for (j = 0; j < d; j++)
      if (vec[j] != 0.0)
        var_n++;
    J++;
  }
  printf("J=%d sparse vectors in training set, %d non-zero values\n", J, var_n);
  zero(cent, d);
  for (j = 0; j < d; j++)
    n[j] = 0;
  rewind(ftrain);
  for (i = 0; i < J; i++) {
    ret = fread(vec, sizeof(float), d, ftrain);
    acc(cent, vec, d);
    for (j = 0; j < d; j++)
      if (vec[j] != 0.0)
        n[j]++;
  }
  norm(cent, d, n);
  memcpy(cb, cent, d * sizeof(float));
  printf("\n");
  printf("bits  Iteration  delta  var     std dev\n");
  printf("---------------------------------------\n");
  for (b = 1; b <= bits; b++) {
    levels = 1 << b;
    iterations = 0;
    finished = 0;
    delta = 0;
    var_1 = 0.0;
    split(cb, d, levels / 2);
    do {
      for (i = 0; i < levels; i++) {
        zero(&cent[i * d], d);
        for (j = 0; j < d; j++)
          n[i * d + j] = 0;
      }
      se = 0.0;
      rewind(ftrain);
      for (i = 0; i < J; i++) {
        ret = fread(vec, sizeof(float), d, ftrain);
        ind = quantise(cb, vec, d, levels, &se);
        acc(&cent[ind * d], vec, d);
        for (j = 0; j < d; j++)
          if (vec[j] != 0.0)
            n[ind * d + j]++;
      }
      var = se / var_n;
      sd = sqrt(var);
      iterations++;
      if (iterations > 1) {
        if (var > 0.0) {
          delta = (var_1 - var) / var;
        } else
          delta = 0;
        if (delta < 0.01)
          finished = 1;
      }
      if (!finished) {
        for (i = 0; i < levels; i++) {
          norm(&cent[i * d], d, &n[i * d]);
          memcpy(&cb[i * d], &cent[i * d], d * sizeof(float));
        }
      }
      printf("%2d    %2d         %4.3f  %6.3f  %4.3f\r", b, iterations, delta,
             var, sd);
      fflush(stdout);
      var_1 = var;
    } while (!finished);
    printf("\n");
  }
  fvq = fopen(argv[4], "wt");
  if (fvq == NULL) {
    printf("Error opening VQ file: %s\n", argv[4]);
    exit(1);
  }
  fprintf(fvq, "%d %d\n", d, e);
  for (j = 0; j < e; j++) {
    for (i = 0; i < d; i++)
      fprintf(fvq, "% 7.3f ", cb[j * d + i]);
    fprintf(fvq, "\n");
  }
  fclose(fvq);
  if (argc == 6) {
    FILE *ferr = fopen(argv[5], "wt");
    assert(ferr != NULL);
    rewind(ftrain);
    for (i = 0; i < J; i++) {
      ret = fread(vec, sizeof(float), d, ftrain);
      ind = quantise(cb, vec, d, levels, &se);
      for (j = 0; j < d; j++) {
        if (vec[j] != 0.0)
          vec[j] -= cb[ind * d + j];
        fprintf(ferr, "%f ", vec[j]);
      }
      fprintf(ferr, "\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1262 <main+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xde3(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    12a5 <main+0x85>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1120 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1120 <atoi@plt>
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x18(%rbp)
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x80(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10e0 <malloc@plt>
mov    %rax,-0x20(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
movslq -0x18(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   10e0 <malloc@plt>
mov    %rax,-0x28(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
movslq -0x18(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   10e0 <malloc@plt>
mov    %rax,-0x30(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
movslq -0x18(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   10e0 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1387 <main+0x167>
cmpq   $0x0,-0x28(%rbp)
je     1387 <main+0x167>
cmpq   $0x0,-0x30(%rbp)
je     1387 <main+0x167>
cmpq   $0x0,-0x20(%rbp)
jne    139f <main+0x17f>
lea    0xd25(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x58(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jne    1435 <main+0x215>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1427 <main+0x207>
mov    -0x20(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    140b <main+0x1eb>
jp     140b <main+0x1eb>
jmp    1414 <main+0x1f4>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1419 <main+0x1f9>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    13d6 <main+0x1b6>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    13ad <main+0x18d>
mov    -0x3c(%rbp),%esi
mov    -0x7c(%rbp),%edx
lea    0xc83(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1100 <zero@plt>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1485 <main+0x265>
mov    -0x38(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    145c <main+0x23c>
mov    -0x58(%rbp),%rdi
call   1070 <rewind@plt>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    153c <main+0x31c>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x58(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
mov    %eax,-0x64(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <acc@plt>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1529 <main+0x309>
mov    -0x20(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1505 <main+0x2e5>
jp     1505 <main+0x2e5>
jmp    1516 <main+0x2f6>
mov    -0x38(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    151b <main+0x2fb>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    14d0 <main+0x2b0>
jmp    152e <main+0x30e>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1495 <main+0x275>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x38(%rbp),%rdx
call   10c0 <norm@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   10d0 <memcpy@plt>
lea    0xbe4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xb86(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xba1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x80(%rbp),%eax
jg     1910 <main+0x6f0>
mov    -0x84(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x88(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x88(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1090 <split@plt>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x88(%rbp),%eax
jge    1671 <main+0x451>
mov    -0x30(%rbp),%rdi
mov    -0x68(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x14(%rbp),%esi
call   1100 <zero@plt>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    165e <main+0x43e>
mov    -0x38(%rbp),%rax
mov    -0x68(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x6c(%rbp),%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    162c <main+0x40c>
jmp    1663 <main+0x443>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    15fa <main+0x3da>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x58(%rbp),%rdi
call   1070 <rewind@plt>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1766 <main+0x546>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x58(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
mov    %eax,-0x64(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x88(%rbp),%ecx
lea    -0x44(%rbp),%r8
call   1080 <quantise@plt>
mov    %eax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <acc@plt>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1753 <main+0x533>
mov    -0x20(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1726 <main+0x506>
jp     1726 <main+0x506>
jmp    1740 <main+0x520>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x6c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    1745 <main+0x525>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    16f1 <main+0x4d1>
jmp    1758 <main+0x538>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1689 <main+0x469>
movss  -0x44(%rbp),%xmm0
cvtsi2ssl -0x7c(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x48(%rbp),%xmm0
call   1130 <sqrt@plt>
movss  %xmm0,-0x78(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
cmpl   $0x1,-0x74(%rbp)
jle    17f9 <main+0x5d9>
movss  -0x48(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    17ca <main+0x5aa>
movss  -0x4c(%rbp),%xmm0
subss  -0x48(%rbp),%xmm0
divss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x50(%rbp)
jmp    17d2 <main+0x5b2>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x50(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0x81d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    17f4 <main+0x5d4>
movl   $0x1,-0x70(%rbp)
jmp    17f9 <main+0x5d9>
cmpl   $0x0,-0x70(%rbp)
jne    1893 <main+0x673>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x88(%rbp),%eax
jge    188e <main+0x66e>
mov    -0x30(%rbp),%rdi
mov    -0x68(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x14(%rbp),%esi
mov    -0x38(%rbp),%rdx
mov    -0x68(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdx
call   10c0 <norm@plt>
mov    -0x28(%rbp),%rdi
mov    -0x68(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x30(%rbp),%rsi
mov    -0x68(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   10d0 <memcpy@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    180a <main+0x5ea>
jmp    1893 <main+0x673>
mov    -0x84(%rbp),%esi
mov    -0x74(%rbp),%edx
movss  -0x50(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x48(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x78(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0x892(%rip),%rdi
mov    $0x3,%al
call   1060 <printf@plt>
mov    0x2714(%rip),%rax
mov    (%rax),%edi
call   10f0 <fflush@plt>
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
cmpl   $0x0,-0x70(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    15f3 <main+0x3d3>
lea    0x859(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1597 <main+0x377>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0x859(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    1953 <main+0x733>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
lea    0x839(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    -0x60(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0x832(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    19eb <main+0x7cb>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    19cb <main+0x7ab>
mov    -0x60(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    -0x6c(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x68(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0x7e7(%rip),%rsi
mov    $0x1,%al
call   10b0 <fprintf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1985 <main+0x765>
mov    -0x60(%rbp),%rdi
lea    0x778(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1972 <main+0x752>
mov    -0x60(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x6,-0x8(%rbp)
jne    1b43 <main+0x923>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0x76b(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x90(%rbp)
cmpq   $0x0,-0x90(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    -0x58(%rbp),%rdi
call   1070 <rewind@plt>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1b3e <main+0x91e>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x58(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
mov    %eax,-0x64(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x88(%rbp),%ecx
lea    -0x44(%rbp),%r8
call   1080 <quantise@plt>
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1b1b <main+0x8fb>
mov    -0x20(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1abb <main+0x89b>
jp     1abb <main+0x89b>
jmp    1ae7 <main+0x8c7>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x6c(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x90(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0x69f(%rip),%rsi
mov    $0x1,%al
call   10b0 <fprintf@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1a86 <main+0x866>
mov    -0x90(%rbp),%rdi
lea    0x625(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1a3e <main+0x81e>
jmp    1b43 <main+0x923>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %rsi,%rbx
cmp    $0x4,%edi
jle    1c32 <main+0x9d2>
mov    %edi,%ebp
mov    0x8(%rbx),%rdi
lea    0xdce(%rip),%rsi
call   1150 <fopen@plt>
test   %rax,%rax
je     1c3e <main+0x9de>
mov    %rax,%r12
mov    %ebp,0x7c(%rsp)
mov    0x10(%rbx),%rdi
call   1160 <atoi@plt>
mov    %eax,%ebp
mov    %rbx,0x68(%rsp)
mov    0x18(%rbx),%rdi
call   1160 <atoi@plt>
mov    %eax,%r15d
mov    $0x1,%ebx
mov    %r15d,%ecx
shl    %cl,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdaf(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,0x78(%rsp)
mov    %ebx,%ecx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbp,(%rsp)
lea    0x0(,%rbp,4),%ebp
mov    %ebp,%edi
call   1120 <malloc@plt>
mov    %rax,%r14
mov    %ebp,0x54(%rsp)
mov    %r15d,0x34(%rsp)
mov    %r15d,%ecx
shl    %cl,%ebp
mov    %ebp,%edi
call   1120 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1120 <malloc@plt>
mov    %rax,0x8(%rsp)
mov    %ebp,%edi
call   1120 <malloc@plt>
mov    %rax,0x40(%rsp)
mov    %rbx,0x28(%rsp)
test   %rbx,%rbx
je     1c4b <main+0x9eb>
cmpq   $0x0,0x8(%rsp)
je     1c4b <main+0x9eb>
test   %r14,%r14
je     1c4b <main+0x9eb>
mov    (%rsp),%r15
movslq %r15d,%rbx
mov    %r14,%rdi
mov    $0x4,%esi
mov    %r15d,%edx
mov    %r12,0x48(%rsp)
mov    %r12,%rcx
call   1050 <fread@plt>
xor    %ebp,%ebp
mov    $0x0,%ecx
mov    %rcx,0x10(%rsp)
mov    %rbx,%rcx
mov    %rbx,0x58(%rsp)
cmp    %rbx,%rax
jne    14fd <main+0x29d>
mov    %r15d,%ebx
mov    %r15d,%r12d
and    $0xfffffff8,%r12d
lea    -0x8(%r12),%r13
mov    %r13,0x60(%rsp)
shr    $0x3,%r13
add    $0x1,%r13
mov    %r13,%rax
and    $0xfffffffffffffffe,%rax
mov    %rax,0x20(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xorps  %xmm6,%xmm6
xorps  %xmm7,%xmm7
xor    %ebp,%ebp
jmp    1403 <main+0x1a3>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x10(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x10(%rsp)
mov    %r14,%rdi
mov    $0x4,%esi
mov    %r15d,%edx
mov    0x48(%rsp),%rcx
call   1050 <fread@plt>
xorps  %xmm6,%xmm6
cmp    0x58(%rsp),%rax
xorps  %xmm7,%xmm7
jne    14fd <main+0x29d>
test   %r15d,%r15d
jle    13d0 <main+0x170>
cmp    $0x8,%r15d
jae    1420 <main+0x1c0>
xor    %eax,%eax
jmp    14d0 <main+0x270>
cs nopw 0x0(%rax,%rax,1)
nop
movd   %ebp,%xmm0
cmpq   $0x0,0x60(%rsp)
je     14ef <main+0x28f>
pxor   %xmm1,%xmm1
mov    0x20(%rsp),%rcx
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movups (%r14,%rax,4),%xmm2
movups 0x10(%r14,%rax,4),%xmm3
movups 0x20(%r14,%rax,4),%xmm4
movups 0x30(%r14,%rax,4),%xmm5
cmpneqps %xmm7,%xmm2
psubd  %xmm2,%xmm0
cmpneqps %xmm7,%xmm3
psubd  %xmm3,%xmm1
cmpneqps %xmm7,%xmm4
psubd  %xmm4,%xmm0
cmpneqps %xmm7,%xmm5
psubd  %xmm5,%xmm1
add    $0x10,%rax
add    $0xfffffffffffffffe,%rcx
jne    1440 <main+0x1e0>
test   $0x1,%r13b
je     14a2 <main+0x242>
movups (%r14,%rax,4),%xmm2
movups 0x10(%r14,%rax,4),%xmm3
cmpneqps %xmm7,%xmm2
psubd  %xmm2,%xmm0
cmpneqps %xmm7,%xmm3
psubd  %xmm3,%xmm1
paddd  %xmm1,%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%ebp
mov    %r12,%rax
cmp    %rbx,%r12
je     13d0 <main+0x170>
nopl   0x0(%rax,%rax,1)
movss  (%r14,%rax,4),%xmm0
cmpneqss %xmm6,%xmm0
movd   %xmm0,%ecx
sub    %ecx,%ebp
add    $0x1,%rax
cmp    %rax,%rbx
jne    14d0 <main+0x270>
jmp    13d0 <main+0x170>
pxor   %xmm1,%xmm1
xor    %eax,%eax
test   $0x1,%r13b
jne    1487 <main+0x227>
jmp    14a2 <main+0x242>
lea    0xbb3(%rip),%rdi
mov    0x10(%rsp),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%rsp),%rdi
mov    %r15d,%esi
call   1140 <zero@plt>
test   %r15d,%r15d
jle    1537 <main+0x2d7>
mov    %r15d,%edx
shl    $0x2,%rdx
mov    0x40(%rsp),%rdi
xor    %esi,%esi
call   10b0 <memset@plt>
mov    0x48(%rsp),%r13
mov    %r13,%rdi
call   1090 <rewind@plt>
cmpl   $0x0,0x10(%rsp)
mov    %r15,%rsi
je     15ff <main+0x39f>
mov    %esi,%ebx
mov    %esi,%r15d
and    $0xfffffffe,%r15d
xor    %r12d,%r12d
jmp    156f <main+0x30f>
add    $0x1,%r12d
cmp    0x10(%rsp),%r12d
je     15ff <main+0x39f>
mov    %r14,%rdi
mov    $0x4,%esi
mov    (%rsp),%rdx
mov    %r13,%rcx
call   1050 <fread@plt>
mov    0x8(%rsp),%rdi
mov    %r14,%rsi
mov    (%rsp),%rdx
call   1070 <acc@plt>
pxor   %xmm1,%xmm1
mov    (%rsp),%rsi
test   %esi,%esi
mov    0x40(%rsp),%rcx
jle    1560 <main+0x300>
xor    %eax,%eax
cmp    $0x1,%esi
jne    15d9 <main+0x379>
test   $0x1,%bl
je     1560 <main+0x300>
movss  (%r14,%rax,4),%xmm0
ucomiss %xmm1,%xmm0
jne    15be <main+0x35e>
jnp    1560 <main+0x300>
addl   $0x1,(%rcx,%rax,4)
jmp    1560 <main+0x300>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x2,%rax
cmp    %rax,%r15
je     15ac <main+0x34c>
movss  (%r14,%rax,4),%xmm0
ucomiss %xmm1,%xmm0
jne    15e6 <main+0x386>
jnp    15ea <main+0x38a>
addl   $0x1,(%rcx,%rax,4)
movss  0x4(%r14,%rax,4),%xmm0
ucomiss %xmm1,%xmm0
jne    15f8 <main+0x398>
jnp    15d0 <main+0x370>
addl   $0x1,0x4(%rcx,%rax,4)
jmp    15d0 <main+0x370>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    %rsi,%r15
mov    0x40(%rsp),%r12
mov    %r12,%rdx
call   1100 <norm@plt>
mov    0x28(%rsp),%rdi
mov    %rbx,%rsi
mov    0x54(%rsp),%edx
call   1110 <memcpy@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xb10(%rip),%rdi
call   1040 <puts@plt>
lea    0xb2c(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x34(%rsp)
jle    1a31 <main+0x7d1>
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movss  %xmm0,0x80(%rsp)
mov    %r15d,%eax
mov    %rax,0xb0(%rsp)
lea    0x0(,%rax,4),%rax
mov    %rax,0xa8(%rsp)
and    $0xfffffffe,%r15d
mov    0x58(%rsp),%rax
lea    0x0(,%rax,4),%rbx
lea    0x4(%r12),%rax
mov    %rax,0xa0(%rsp)
mov    $0x1,%ebp
mov    %rbx,0x20(%rsp)
mov    %r14,0x98(%rsp)
mov    %r15,0x90(%rsp)
jmp    1705 <main+0x4a5>
nopw   0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm3,%xmm2
lea    0xa1b(%rip),%rdi
mov    %ebp,%esi
mov    $0x3,%al
call   1080 <printf@plt>
mov    0x28fb(%rip),%rax
mov    (%rax),%edi
call   1130 <fflush@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbp),%eax
cmp    0x34(%rsp),%ebp
mov    %eax,%ebp
je     1a31 <main+0x7d1>
mov    $0x1,%ebx
mov    %ebp,%ecx
shl    %cl,%ebx
mov    %ebx,%edx
shr    $0x1f,%edx
add    %ebx,%edx
sar    %edx
mov    0x28(%rsp),%rdi
mov    (%rsp),%rsi
call   10d0 <split@plt>
cmp    $0x2,%ebx
mov    $0x1,%eax
mov    %ebx,0x60(%rsp)
cmovge %ebx,%eax
mov    %rax,0x88(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0x50(%rsp)
xor    %r12d,%r12d
xorps  %xmm0,%xmm0
movss  %xmm0,0x1c(%rsp)
mov    %rbp,0x70(%rsp)
jmp    17ce <main+0x56e>
nopl   0x0(%rax,%rax,1)
movss  0x50(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x38(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x84(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0x968(%rip),%rdi
mov    0x70(%rsp),%rbp
mov    %ebp,%esi
mov    0x1c(%rsp),%ebx
mov    %ebx,%edx
mov    $0x3,%al
call   1080 <printf@plt>
mov    0x283d(%rip),%rax
mov    (%rax),%edi
call   1130 <fflush@plt>
mov    %ebx,%r12d
movss  0x38(%rsp),%xmm0
movss  %xmm0,0x1c(%rsp)
mov    0x48(%rsp),%r13
mov    0x98(%rsp),%r14
mov    0x90(%rsp),%r15
cmp    $0x1f,%ebp
mov    (%rsp),%rsi
jne    1910 <main+0x6b0>
movl   $0x0,0x3c(%rsp)
mov    %r13,%rdi
call   1090 <rewind@plt>
cmpl   $0x0,0x10(%rsp)
je     18e0 <main+0x680>
xor    %ebp,%ebp
jmp    180d <main+0x5ad>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    0x10(%rsp),%ebp
je     18e0 <main+0x680>
mov    %r14,%rdi
mov    $0x4,%esi
mov    (%rsp),%rdx
mov    %r13,%rcx
call   1050 <fread@plt>
mov    0x28(%rsp),%rdi
mov    %r14,%rsi
mov    (%rsp),%rdx
mov    0x60(%rsp),%ecx
lea    0x3c(%rsp),%r8
call   10a0 <quantise@plt>
imul   (%rsp),%eax
movslq %eax,%rbx
mov    0x8(%rsp),%rax
lea    (%rax,%rbx,4),%rdi
mov    %r14,%rsi
mov    (%rsp),%rdx
call   1070 <acc@plt>
mov    (%rsp),%rax
test   %eax,%eax
pxor   %xmm1,%xmm1
jle    1800 <main+0x5a0>
cmp    $0x1,%eax
jne    18a0 <main+0x640>
xor    %eax,%eax
testb  $0x1,0xb0(%rsp)
01
je     1800 <main+0x5a0>
movss  (%r14,%rax,4),%xmm0
ucomiss %xmm1,%xmm0
jne    1885 <main+0x625>
jnp    1800 <main+0x5a0>
add    %rbx,%rax
mov    0x40(%rsp),%rcx
addl   $0x1,(%rcx,%rax,4)
jmp    1800 <main+0x5a0>
cs nopw 0x0(%rax,%rax,1)
mov    0xa0(%rsp),%rax
lea    (%rax,%rbx,4),%rcx
xor    %eax,%eax
jmp    18b9 <main+0x659>
add    $0x2,%rax
cmp    %rax,%r15
je     186a <main+0x60a>
movss  (%r14,%rax,4),%xmm0
ucomiss %xmm1,%xmm0
jne    18c6 <main+0x666>
jnp    18cb <main+0x66b>
addl   $0x1,-0x4(%rcx,%rax,4)
movss  0x4(%r14,%rax,4),%xmm0
ucomiss %xmm1,%xmm0
jne    18d9 <main+0x679>
jnp    18b0 <main+0x650>
addl   $0x1,(%rcx,%rax,4)
jmp    18b0 <main+0x650>
nop
movss  0x3c(%rsp),%xmm2
divss  0x80(%rsp),%xmm2
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
movss  %xmm2,0x38(%rsp)
jb     1970 <main+0x710>
xorps  %xmm3,%xmm3
sqrtss %xmm2,%xmm3
jmp    1981 <main+0x721>
cs nopw 0x0(%rax,%rax,1)
mov    0x88(%rsp),%rbx
xor    %ebp,%ebp
jmp    192f <main+0x6cf>
nopl   0x0(%rax)
add    0x20(%rsp),%rbp
add    $0xffffffffffffffff,%rbx
je     17db <main+0x57b>
mov    0x8(%rsp),%rax
lea    (%rax,%rbp,1),%rdi
call   1140 <zero@plt>
mov    (%rsp),%rsi
test   %esi,%esi
jle    1920 <main+0x6c0>
mov    0x40(%rsp),%rax
lea    (%rax,%rbp,1),%rdi
xor    %esi,%esi
mov    0xa8(%rsp),%rdx
call   10b0 <memset@plt>
mov    (%rsp),%rsi
jmp    1920 <main+0x6c0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movaps %xmm2,%xmm0
call   1170 <sqrt@plt>
movss  0x38(%rsp),%xmm2
movaps %xmm0,%xmm3
mov    0x20(%rsp),%rbx
mov    0x70(%rsp),%rbp
lea    0x1(%r12),%edx
test   %r12d,%r12d
je     19c7 <main+0x767>
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
jbe    19ab <main+0x74b>
movss  0x1c(%rsp),%xmm0
subss  %xmm2,%xmm0
divss  %xmm2,%xmm0
movss  %xmm0,0x50(%rsp)
cvtss2sd %xmm0,%xmm0
movsd  0x643(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     16c0 <main+0x460>
movss  %xmm3,0x84(%rsp)
mov    %edx,0x1c(%rsp)
cmp    $0x1f,%ebp
mov    (%rsp),%r15
je     1760 <main+0x500>
mov    %rbx,%r14
mov    0x88(%rsp),%rbx
mov    0x28(%rsp),%r12
mov    0x40(%rsp),%rbp
mov    0x8(%rsp),%r13
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r15d,%esi
mov    %rbp,%rdx
call   1100 <norm@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    0x54(%rsp),%edx
call   1110 <memcpy@plt>
add    %r14,%r13
add    %r14,%rbp
add    %r14,%r12
add    $0xffffffffffffffff,%rbx
jne    1a00 <main+0x7a0>
jmp    1760 <main+0x500>
mov    0x68(%rsp),%rax
mov    0x20(%rax),%rdi
lea    0x6d7(%rip),%rsi
call   1150 <fopen@plt>
test   %rax,%rax
je     1c61 <main+0xa01>
mov    %rax,%rbp
lea    0x6dd(%rip),%rsi
mov    %rax,%rdi
mov    (%rsp),%rdx
mov    0x78(%rsp),%ebx
mov    %ebx,%ecx
xor    %eax,%eax
call   10f0 <fprintf@plt>
cmpl   $0x1f,0x34(%rsp)
jne    1ba1 <main+0x941>
mov    %rbp,%rdi
call   1060 <fclose@plt>
cmpl   $0x6,0x7c(%rsp)
jne    1b8d <main+0x92d>
mov    0x68(%rsp),%rax
mov    0x28(%rax),%rdi
lea    0x67d(%rip),%rsi
call   1150 <fopen@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   10e0 <assert@plt>
mov    0x48(%rsp),%rdi
call   1090 <rewind@plt>
cmpl   $0x0,0x10(%rsp)
je     1b8d <main+0x92d>
mov    (%rsp),%ebp
xor    %eax,%eax
lea    0x673(%rip),%r13
jmp    1aff <main+0x89f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
mov    %rbx,%rsi
call   10c0 <fputc@plt>
mov    0x8(%rsp),%rax
add    $0x1,%eax
cmp    0x10(%rsp),%eax
je     1b8d <main+0x92d>
mov    %rax,0x8(%rsp)
mov    %r14,%rdi
mov    $0x4,%esi
mov    (%rsp),%r15
mov    %r15d,%edx
mov    0x48(%rsp),%rcx
call   1050 <fread@plt>
mov    0x28(%rsp),%rdi
mov    %r14,%rsi
mov    %r15d,%edx
mov    0x60(%rsp),%ecx
lea    0x3c(%rsp),%r8
call   10a0 <quantise@plt>
test   %r15d,%r15d
jle    1ae0 <main+0x880>
imul   %r15d,%eax
cltq
mov    0x28(%rsp),%rcx
lea    (%rcx,%rax,4),%r12
xor    %r15d,%r15d
jmp    1b6e <main+0x90e>
nop
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0x1,%al
call   10f0 <fprintf@plt>
add    $0x1,%r15
cmp    %r15,%rbp
je     1ae0 <main+0x880>
movss  (%r14,%r15,4),%xmm0
ucomiss 0x48d(%rip),%xmm0
jne    1b7f <main+0x91f>
jnp    1b50 <main+0x8f0>
subss  (%r12,%r15,4),%xmm0
movss  %xmm0,(%r14,%r15,4)
jmp    1b50 <main+0x8f0>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x2,%ebx
mov    $0x1,%eax
cmovge %ebx,%eax
mov    %rax,0x20(%rsp)
mov    (%rsp),%ebx
shlq   $0x2,0x58(%rsp)
xor    %eax,%eax
lea    0x57a(%rip),%r12
mov    0x28(%rsp),%r15
jmp    1bf6 <main+0x996>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %rbp,%rsi
call   10c0 <fputc@plt>
mov    0x8(%rsp),%rax
add    $0x1,%rax
add    0x58(%rsp),%r15
cmp    0x20(%rsp),%rax
je     1a78 <main+0x818>
mov    %rax,0x8(%rsp)
cmpl   $0x0,(%rsp)
jle    1bd0 <main+0x970>
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movss  (%r15,%r13,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
mov    %r12,%rsi
mov    $0x1,%al
call   10f0 <fprintf@plt>
add    $0x1,%r13
cmp    %r13,%rbx
jne    1c10 <main+0x9b0>
jmp    1bd0 <main+0x970>
mov    (%rbx),%rsi
lea    0x3d0(%rip),%rdi
jmp    1c71 <main+0xa11>
mov    0x8(%rbx),%rsi
lea    0x412(%rip),%rdi
jmp    1c71 <main+0xa11>
lea    0x547(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    0x68(%rsp),%rax
mov    0x20(%rax),%rsi
lea    0x4aa(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>

LLVM IR (-O0):
@.str = [76 x i8] c"usage: %s TrainFile D(dimension) B(number of bits) VQFile [error.txt file]\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [42 x i8] c"Error opening training database file: %s\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [50 x i8] c"dimension D=%d number of bits B=%d entries E=%d\0A\00"
@.str.5 = [18 x i8] c"Error in malloc.\0A\00"
@.str.6 = [57 x i8] c"J=%d sparse vectors in training set, %d non-zero values\0A\00"
@.str.7 = [41 x i8] c"bits Iteration delta var std dev\0A\00"
@.str.8 = [41 x i8] c"---------------------------------------\0A\00"
@.str.9 = [40 x i8] c"%2d %2d %4.3f %6.3f %4.3f\0D\00"
@stdout = global i32 0
@.str.10 = [3 x i8] c"wt\00"
@.str.11 = [27 x i8] c"Error opening VQ file: %s\0A\00"
@.str.12 = [7 x i8] c"%d %d\0A\00"
@.str.13 = [8 x i8] c"% 7.3f \00"
@.str.14 = [4 x i8] c"%f \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca float*
%9 = alloca float*
%10 = alloca float*
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca float
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 5
br i1 %32, label %33, label %39
33: ; preds = %2
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* %36)
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %2
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32* @fopen(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %43, i32** %18
%44 = load i32*, i32** %18
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %52
46: ; preds = %39
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %49)
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %39
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 2
%55 = load i8*, i8** %54
%56 = call i32 @atoi(i8* %55)
store i32 %56, i32* %6
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 3
%59 = load i8*, i8** %58
%60 = call i32 @atoi(i8* %59)
store i32 %60, i32* %27
%61 = load i32, i32* %27
%62 = shl i32 1, %61
store i32 %62, i32* %7
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%64 = load i32, i32* %6
%65 = load i32, i32* %27
%66 = load i32, i32* %7
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0), i32 %64, i32 %65, i32 %66)
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = mul i64 4, %69
%71 = trunc i64 %70 to i32
%72 = call i64 @malloc(i32 %71)
%73 = inttoptr i64 %72 to float*
store float* %73, float** %8
%74 = load i32, i32* %6
%75 = sext i32 %74 to i64
%76 = mul i64 4, %75
%77 = load i32, i32* %7
%78 = sext i32 %77 to i64
%79 = mul i64 %76, %78
%80 = trunc i64 %79 to i32
%81 = call i64 @malloc(i32 %80)
%82 = inttoptr i64 %81 to float*
store float* %82, float** %9
%83 = load i32, i32* %6
%84 = sext i32 %83 to i64
%85 = mul i64 4, %84
%86 = load i32, i32* %7
%87 = sext i32 %86 to i64
%88 = mul i64 %85, %87
%89 = trunc i64 %88 to i32
%90 = call i64 @malloc(i32 %89)
%91 = inttoptr i64 %90 to float*
store float* %91, float** %10
%92 = load i32, i32* %6
%93 = sext i32 %92 to i64
%94 = mul i64 4, %93
%95 = load i32, i32* %7
%96 = sext i32 %95 to i64
%97 = mul i64 %94, %96
%98 = trunc i64 %97 to i32
%99 = call i64 @malloc(i32 %98)
%100 = inttoptr i64 %99 to i32*
store i32* %100, i32** %11
%101 = load float*, float** %9
%102 = icmp eq float* %101, null
br i1 %102, label %112, label %103
103: ; preds = %52
%104 = load float*, float** %9
%105 = icmp eq float* %104, null
br i1 %105, label %112, label %106
106: ; preds = %103
%107 = load float*, float** %10
%108 = icmp eq float* %107, null
br i1 %108, label %112, label %109
109: ; preds = %106
%110 = load float*, float** %8
%111 = icmp eq float* %110, null
br i1 %111, label %112, label %115
112: ; preds = %109, %106, %103, %52
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%114 = call i32 @exit(i32 1)
unreachable
115: ; preds = %109
store i32 0, i32* %12
store i32 0, i32* %26
br label %116
116: ; preds = %144, %115
%117 = load float*, float** %8
%118 = load i32, i32* %6
%119 = load i32*, i32** %18
%120 = call i64 @fread(float* %117, i32 4, i32 %118, i32* %119)
%121 = load i32, i32* %6
%122 = sext i32 %121 to i64
%123 = icmp eq i64 %120, %122
br i1 %123, label %124, label %147
124: ; preds = %116
store i32 0, i32* %22
br label %125
125: ; preds = %141, %124
%126 = load i32, i32* %22
%127 = load i32, i32* %6
%128 = icmp slt i32 %126, %127
br i1 %128, label %129, label %144
129: ; preds = %125
%130 = load float*, float** %8
%131 = load i32, i32* %22
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds float, float* %130, i64 %132
%134 = load float, float* %133
%135 = fpext float %134 to double
%136 = fcmp une double %135, 0.000000e+00
br i1 %136, label %137, label %140
137: ; preds = %129
%138 = load i32, i32* %26
%139 = add nsw i32 %138, 1
store i32 %139, i32* %26
br label %140
140: ; preds = %137, %129
br label %141
141: ; preds = %140
%142 = load i32, i32* %22
%143 = add nsw i32 %142, 1
store i32 %143, i32* %22
br label %125
144: ; preds = %125
%145 = load i32, i32* %12
%146 = add nsw i32 %145, 1
store i32 %146, i32* %12
br label %116
147: ; preds = %116
%148 = load i32, i32* %12
%149 = load i32, i32* %26
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i32 %148, i32 %149)
%151 = load float*, float** %10
%152 = load i32, i32* %6
%153 = call i32 @zero(float* %151, i32 %152)
store i32 0, i32* %22
br label %154
154: ; preds = %163, %147
%155 = load i32, i32* %22
%156 = load i32, i32* %6
%157 = icmp slt i32 %155, %156
br i1 %157, label %158, label %166
158: ; preds = %154
%159 = load i32*, i32** %11
%160 = load i32, i32* %22
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds i32, i32* %159, i64 %161
store i32 0, i32* %162
br label %163
163: ; preds = %158
%164 = load i32, i32* %22
%165 = add nsw i32 %164, 1
store i32 %165, i32* %22
br label %154
166: ; preds = %154
%167 = load i32*, i32** %18
%168 = call i32 @rewind(i32* %167)
store i32 0, i32* %21
br label %169
169: ; preds = %207, %166
%170 = load i32, i32* %21
%171 = load i32, i32* %12
%172 = icmp slt i32 %170, %171
br i1 %172, label %173, label %210
173: ; preds = %169
%174 = load float*, float** %8
%175 = load i32, i32* %6
%176 = load i32*, i32** %18
%177 = call i64 @fread(float* %174, i32 4, i32 %175, i32* %176)
%178 = trunc i64 %177 to i32
store i32 %178, i32* %20
%179 = load float*, float** %10
%180 = load float*, float** %8
%181 = load i32, i32* %6
%182 = call i32 @acc(float* %179, float* %180, i32 %181)
store i32 0, i32* %22
br label %183
183: ; preds = %203, %173
%184 = load i32, i32* %22
%185 = load i32, i32* %6
%186 = icmp slt i32 %184, %185
br i1 %186, label %187, label %206
187: ; preds = %183
%188 = load float*, float** %8
%189 = load i32, i32* %22
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds float, float* %188, i64 %190
%192 = load float, float* %191
%193 = fpext float %192 to double
%194 = fcmp une double %193, 0.000000e+00
br i1 %194, label %195, label %202
195: ; preds = %187
%196 = load i32*, i32** %11
%197 = load i32, i32* %22
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds i32, i32* %196, i64 %198
%200 = load i32, i32* %199
%201 = add nsw i32 %200, 1
store i32 %201, i32* %199
br label %202
202: ; preds = %195, %187
br label %203
203: ; preds = %202
%204 = load i32, i32* %22
%205 = add nsw i32 %204, 1
store i32 %205, i32* %22
br label %183
206: ; preds = %183
br label %207
207: ; preds = %206
%208 = load i32, i32* %21
%209 = add nsw i32 %208, 1
store i32 %209, i32* %21
br label %169
210: ; preds = %169
%211 = load float*, float** %10
%212 = load i32, i32* %6
%213 = load i32*, i32** %11
%214 = call i32 @norm(float* %211, i32 %212, i32* %213)
%215 = load float*, float** %9
%216 = load float*, float** %10
%217 = load i32, i32* %6
%218 = sext i32 %217 to i64
%219 = mul i64 %218, 4
%220 = trunc i64 %219 to i32
%221 = call i32 @memcpy(float* %215, float* %216, i32 %220)
%222 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%223 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%224 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %28
br label %225
225: ; preds = %420, %210
%226 = load i32, i32* %28
%227 = load i32, i32* %27
%228 = icmp sle i32 %226, %227
br i1 %228, label %229, label %423
229: ; preds = %225
%230 = load i32, i32* %28
%231 = shl i32 1, %230
store i32 %231, i32* %29
store i32 0, i32* %24
store i32 0, i32* %23
store float 0.000000e+00, float* %17
store float 0.000000e+00, float* %16
%232 = load float*, float** %9
%233 = load i32, i32* %6
%234 = load i32, i32* %29
%235 = sdiv i32 %234, 2
%236 = call i32 @split(float* %232, i32 %233, i32 %235)
br label %237
237: ; preds = %414, %229
store i32 0, i32* %21
br label %238
238: ; preds = %268, %237
%239 = load i32, i32* %21
%240 = load i32, i32* %29
%241 = icmp slt i32 %239, %240
br i1 %241, label %242, label %271
242: ; preds = %238
%243 = load float*, float** %10
%244 = load i32, i32* %21
%245 = load i32, i32* %6
%246 = mul nsw i32 %244, %245
%247 = sext i32 %246 to i64
%248 = getelementptr inbounds float, float* %243, i64 %247
%249 = load i32, i32* %6
%250 = call i32 @zero(float* %248, i32 %249)
store i32 0, i32* %22
br label %251
251: ; preds = %264, %242
%252 = load i32, i32* %22
%253 = load i32, i32* %6
%254 = icmp slt i32 %252, %253
br i1 %254, label %255, label %267
255: ; preds = %251
%256 = load i32*, i32** %11
%257 = load i32, i32* %21
%258 = load i32, i32* %6
%259 = mul nsw i32 %257, %258
%260 = load i32, i32* %22
%261 = add nsw i32 %259, %260
%262 = sext i32 %261 to i64
%263 = getelementptr inbounds i32, i32* %256, i64 %262
store i32 0, i32* %263
br label %264
264: ; preds = %255
%265 = load i32, i32* %22
%266 = add nsw i32 %265, 1
store i32 %266, i32* %22
br label %251
267: ; preds = %251
br label %268
268: ; preds = %267
%269 = load i32, i32* %21
%270 = add nsw i32 %269, 1
store i32 %270, i32* %21
br label %238
271: ; preds = %238
store float 0.000000e+00, float* %14
%272 = load i32*, i32** %18
%273 = call i32 @rewind(i32* %272)
store i32 0, i32* %21
br label %274
274: ; preds = %326, %271
%275 = load i32, i32* %21
%276 = load i32, i32* %12
%277 = icmp slt i32 %275, %276
br i1 %277, label %278, label %329
278: ; preds = %274
%279 = load float*, float** %8
%280 = load i32, i32* %6
%281 = load i32*, i32** %18
%282 = call i64 @fread(float* %279, i32 4, i32 %280, i32* %281)
%283 = trunc i64 %282 to i32
store i32 %283, i32* %20
%284 = load float*, float** %9
%285 = load float*, float** %8
%286 = load i32, i32* %6
%287 = load i32, i32* %29
%288 = call i32 @quantise(float* %284, float* %285, i32 %286, i32 %287, float* %14)
store i32 %288, i32* %13
%289 = load float*, float** %10
%290 = load i32, i32* %13
%291 = load i32, i32* %6
%292 = mul nsw i32 %290, %291
%293 = sext i32 %292 to i64
%294 = getelementptr inbounds float, float* %289, i64 %293
%295 = load float*, float** %8
%296 = load i32, i32* %6
%297 = call i32 @acc(float* %294, float* %295, i32 %296)
store i32 0, i32* %22
br label %298
298: ; preds = %322, %278
%299 = load i32, i32* %22
%300 = load i32, i32* %6
%301 = icmp slt i32 %299, %300
br i1 %301, label %302, label %325
302: ; preds = %298
%303 = load float*, float** %8
%304 = load i32, i32* %22
%305 = sext i32 %304 to i64
%306 = getelementptr inbounds float, float* %303, i64 %305
%307 = load float, float* %306
%308 = fpext float %307 to double
%309 = fcmp une double %308, 0.000000e+00
br i1 %309, label %310, label %321
310: ; preds = %302
%311 = load i32*, i32** %11
%312 = load i32, i32* %13
%313 = load i32, i32* %6
%314 = mul nsw i32 %312, %313
%315 = load i32, i32* %22
%316 = add nsw i32 %314, %315
%317 = sext i32 %316 to i64
%318 = getelementptr inbounds i32, i32* %311, i64 %317
%319 = load i32, i32* %318
%320 = add nsw i32 %319, 1
store i32 %320, i32* %318
br label %321
321: ; preds = %310, %302
br label %322
322: ; preds = %321
%323 = load i32, i32* %22
%324 = add nsw i32 %323, 1
store i32 %324, i32* %22
br label %298
325: ; preds = %298
br label %326
326: ; preds = %325
%327 = load i32, i32* %21
%328 = add nsw i32 %327, 1
store i32 %328, i32* %21
br label %274
329: ; preds = %274
%330 = load float, float* %14
%331 = load i32, i32* %26
%332 = sitofp i32 %331 to float
%333 = fdiv float %330, %332
store float %333, float* %15
%334 = load float, float* %15
%335 = call float @sqrt(float %334)
store float %335, float* %25
%336 = load i32, i32* %24
%337 = add nsw i32 %336, 1
store i32 %337, i32* %24
%338 = load i32, i32* %24
%339 = icmp sgt i32 %338, 1
br i1 %339, label %340, label %357
340: ; preds = %329
%341 = load float, float* %15
%342 = fpext float %341 to double
%343 = fcmp ogt double %342, 0.000000e+00
br i1 %343, label %344, label %350
344: ; preds = %340
%345 = load float, float* %16
%346 = load float, float* %15
%347 = fsub float %345, %346
%348 = load float, float* %15
%349 = fdiv float %347, %348
store float %349, float* %17
br label %351
350: ; preds = %340
store float 0.000000e+00, float* %17
br label %351
351: ; preds = %350, %344
%352 = load float, float* %17
%353 = fpext float %352 to double
%354 = fcmp olt double %353, 1.000000e-02
br i1 %354, label %355, label %356
355: ; preds = %351
store i32 1, i32* %23
br label %356
356: ; preds = %355, %351
br label %357
357: ; preds = %356, %329
%358 = load i32, i32* %23
%359 = icmp ne i32 %358, 0
br i1 %359, label %401, label %360
360: ; preds = %357
store i32 0, i32* %21
br label %361
361: ; preds = %397, %360
%362 = load i32, i32* %21
%363 = load i32, i32* %29
%364 = icmp slt i32 %362, %363
br i1 %364, label %365, label %400
365: ; preds = %361
%366 = load float*, float** %10
%367 = load i32, i32* %21
%368 = load i32, i32* %6
%369 = mul nsw i32 %367, %368
%370 = sext i32 %369 to i64
%371 = getelementptr inbounds float, float* %366, i64 %370
%372 = load i32, i32* %6
%373 = load i32*, i32** %11
%374 = load i32, i32* %21
%375 = load i32, i32* %6
%376 = mul nsw i32 %374, %375
%377 = sext i32 %376 to i64
%378 = getelementptr inbounds i32, i32* %373, i64 %377
%379 = call i32 @norm(float* %371, i32 %372, i32* %378)
%380 = load float*, float** %9
%381 = load i32, i32* %21
%382 = load i32, i32* %6
%383 = mul nsw i32 %381, %382
%384 = sext i32 %383 to i64
%385 = getelementptr inbounds float, float* %380, i64 %384
%386 = load float*, float** %10
%387 = load i32, i32* %21
%388 = load i32, i32* %6
%389 = mul nsw i32 %387, %388
%390 = sext i32 %389 to i64
%391 = getelementptr inbounds float, float* %386, i64 %390
%392 = load i32, i32* %6
%393 = sext i32 %392 to i64
%394 = mul i64 %393, 4
%395 = trunc i64 %394 to i32
%396 = call i32 @memcpy(float* %385, float* %391, i32 %395)
br label %397
397: ; preds = %365
%398 = load i32, i32* %21
%399 = add nsw i32 %398, 1
store i32 %399, i32* %21
br label %361
400: ; preds = %361
br label %401
401: ; preds = %400, %357
%402 = load i32, i32* %28
%403 = load i32, i32* %24
%404 = load float, float* %17
%405 = fpext float %404 to double
%406 = load float, float* %15
%407 = fpext float %406 to double
%408 = load float, float* %25
%409 = fpext float %408 to double
%410 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i32 %402, i32 %403, double %405, double %407, double %409)
%411 = load i32, i32* @stdout
%412 = call i32 @fflush(i32 %411)
%413 = load float, float* %15
store float %413, float* %16
br label %414
414: ; preds = %401
%415 = load i32, i32* %23
%416 = icmp ne i32 %415, 0
%417 = xor i1 %416, true
br i1 %417, label %237, label %418
418: ; preds = %414
%419 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %420
420: ; preds = %418
%421 = load i32, i32* %28
%422 = add nsw i32 %421, 1
store i32 %422, i32* %28
br label %225
423: ; preds = %225
%424 = load i8**, i8*** %5
%425 = getelementptr inbounds i8*, i8** %424, i64 4
%426 = load i8*, i8** %425
%427 = call i32* @fopen(i8* %426, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
store i32* %427, i32** %19
%428 = load i32*, i32** %19
%429 = icmp eq i32* %428, null
br i1 %429, label %430, label %436
430: ; preds = %423
%431 = load i8**, i8*** %5
%432 = getelementptr inbounds i8*, i8** %431, i64 4
%433 = load i8*, i8** %432
%434 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i8* %433)
%435 = call i32 @exit(i32 1)
unreachable
436: ; preds = %423
%437 = load i32*, i32** %19
%438 = load i32, i32* %6
%439 = load i32, i32* %7
%440 = call i32 (i32*, i8*, ...) @fprintf(i32* %437, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %438, i32 %439)
store i32 0, i32* %22
br label %441
441: ; preds = %469, %436
%442 = load i32, i32* %22
%443 = load i32, i32* %7
%444 = icmp slt i32 %442, %443
br i1 %444, label %445, label %472
445: ; preds = %441
store i32 0, i32* %21
br label %446
446: ; preds = %463, %445
%447 = load i32, i32* %21
%448 = load i32, i32* %6
%449 = icmp slt i32 %447, %448
br i1 %449, label %450, label %466
450: ; preds = %446
%451 = load i32*, i32** %19
%452 = load float*, float** %9
%453 = load i32, i32* %22
%454 = load i32, i32* %6
%455 = mul nsw i32 %453, %454
%456 = load i32, i32* %21
%457 = add nsw i32 %455, %456
%458 = sext i32 %457 to i64
%459 = getelementptr inbounds float, float* %452, i64 %458
%460 = load float, float* %459
%461 = fpext float %460 to double
%462 = call i32 (i32*, i8*, ...) @fprintf(i32* %451, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), double %461)
br label %463
463: ; preds = %450
%464 = load i32, i32* %21
%465 = add nsw i32 %464, 1
store i32 %465, i32* %21
br label %446
466: ; preds = %446
%467 = load i32*, i32** %19
%468 = call i32 (i32*, i8*, ...) @fprintf(i32* %467, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %469
469: ; preds = %466
%470 = load i32, i32* %22
%471 = add nsw i32 %470, 1
store i32 %471, i32* %22
br label %441
472: ; preds = %441
%473 = load i32*, i32** %19
%474 = call i32 @fclose(i32* %473)
%475 = load i32, i32* %4
%476 = icmp eq i32 %475, 6
br i1 %476, label %477, label %550
477: ; preds = %472
%478 = load i8**, i8*** %5
%479 = getelementptr inbounds i8*, i8** %478, i64 5
%480 = load i8*, i8** %479
%481 = call i32* @fopen(i8* %480, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
store i32* %481, i32** %30
%482 = load i32*, i32** %30
%483 = icmp ne i32* %482, null
%484 = zext i1 %483 to i32
%485 = call i32 @assert(i32 %484)
%486 = load i32*, i32** %18
%487 = call i32 @rewind(i32* %486)
store i32 0, i32* %21
br label %488
488: ; preds = %546, %477
%489 = load i32, i32* %21
%490 = load i32, i32* %12
%491 = icmp slt i32 %489, %490
br i1 %491, label %492, label %549
492: ; preds = %488
%493 = load float*, float** %8
%494 = load i32, i32* %6
%495 = load i32*, i32** %18
%496 = call i64 @fread(float* %493, i32 4, i32 %494, i32* %495)
%497 = trunc i64 %496 to i32
store i32 %497, i32* %20
%498 = load float*, float** %9
%499 = load float*, float** %8
%500 = load i32, i32* %6
%501 = load i32, i32* %29
%502 = call i32 @quantise(float* %498, float* %499, i32 %500, i32 %501, float* %14)
store i32 %502, i32* %13
store i32 0, i32* %22
br label %503
503: ; preds = %540, %492
%504 = load i32, i32* %22
%505 = load i32, i32* %6
%506 = icmp slt i32 %504, %505
br i1 %506, label %507, label %543
507: ; preds = %503
%508 = load float*, float** %8
%509 = load i32, i32* %22
%510 = sext i32 %509 to i64
%511 = getelementptr inbounds float, float* %508, i64 %510
%512 = load float, float* %511
%513 = fpext float %512 to double
%514 = fcmp une double %513, 0.000000e+00
br i1 %514, label %515, label %531
515: ; preds = %507
%516 = load float*, float** %9
%517 = load i32, i32* %13
%518 = load i32, i32* %6
%519 = mul nsw i32 %517, %518
%520 = load i32, i32* %22
%521 = add nsw i32 %519, %520
%522 = sext i32 %521 to i64
%523 = getelementptr inbounds float, float* %516, i64 %522
%524 = load float, float* %523
%525 = load float*, float** %8
%526 = load i32, i32* %22
%527 = sext i32 %526 to i64
%528 = getelementptr inbounds float, float* %525, i64 %527
%529 = load float, float* %528
%530 = fsub float %529, %524
store float %530, float* %528
br label %531
531: ; preds = %515, %507
%532 = load i32*, i32** %30
%533 = load float*, float** %8
%534 = load i32, i32* %22
%535 = sext i32 %534 to i64
%536 = getelementptr inbounds float, float* %533, i64 %535
%537 = load float, float* %536
%538 = fpext float %537 to double
%539 = call i32 (i32*, i8*, ...) @fprintf(i32* %532, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), double %538)
br label %540
540: ; preds = %531
%541 = load i32, i32* %22
%542 = add nsw i32 %541, 1
store i32 %542, i32* %22
br label %503
543: ; preds = %503
%544 = load i32*, i32** %30
%545 = call i32 (i32*, i8*, ...) @fprintf(i32* %544, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %546
546: ; preds = %543
%547 = load i32, i32* %21
%548 = add nsw i32 %547, 1
store i32 %548, i32* %21
br label %488
549: ; preds = %488
br label %550
550: ; preds = %549, %472
ret i32 0
}

LLVM IR (-O2):
@.str = [76 x i8] c"usage: %s TrainFile D(dimension) B(number of bits) VQFile [error.txt file]\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [42 x i8] c"Error opening training database file: %s\0A\00"
@.str.4 = [50 x i8] c"dimension D=%d number of bits B=%d entries E=%d\0A\00"
@.str.6 = [57 x i8] c"J=%d sparse vectors in training set, %d non-zero values\0A\00"
@.str.9 = [40 x i8] c"%2d %2d %4.3f %6.3f %4.3f\0D\00"
@stdout = global i32 0
@.str.10 = [3 x i8] c"wt\00"
@.str.11 = [27 x i8] c"Error opening VQ file: %s\0A\00"
@.str.12 = [7 x i8] c"%d %d\0A\00"
@.str.13 = [8 x i8] c"% 7.3f \00"
@.str.14 = [4 x i8] c"%f \00"
@str = [40 x i8] c"bits Iteration delta var std dev\00"
@str.15 = [40 x i8] c"---------------------------------------\00"
@str.16 = [17 x i8] c"Error in malloc.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca float
%4 = bitcast float* %3 to i8*
%5 = icmp slt i32 %0, 5
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %19
15: ; preds = %10
%16 = load i8*, i8** %11
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %10
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = tail call i32 @atoi(i8* %21)
%23 = getelementptr inbounds i8*, i8** %1, i64 3
%24 = load i8*, i8** %23
%25 = tail call i32 @atoi(i8* %24)
%26 = shl nuw i32 1, %25
%27 = tail call i32 @putchar(i32 10)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0), i32 %22, i32 %25, i32 %26)
%29 = sext i32 %22 to i64
%30 = shl i32 %22, 2
%31 = tail call i64 @malloc(i32 %30)
%32 = inttoptr i64 %31 to float*
%33 = shl i32 %30, %25
%34 = tail call i64 @malloc(i32 %33)
%35 = inttoptr i64 %34 to float*
%36 = tail call i64 @malloc(i32 %33)
%37 = inttoptr i64 %36 to float*
%38 = tail call i64 @malloc(i32 %33)
%39 = inttoptr i64 %38 to i32*
%40 = inttoptr i64 %38 to i8*
%41 = icmp eq i64 %34, 0
%42 = icmp eq i64 %36, 0
%43 = select i1 %41, i1 true, i1 %42
%44 = icmp eq i64 %31, 0
%45 = select i1 %43, i1 true, i1 %44
br i1 %45, label %63, label %46
46: ; preds = %19
%47 = tail call i64 @fread(float* %32, i32 4, i32 %22, i32* %13)
%48 = icmp eq i64 %47, %29
br i1 %48, label %49, label %147
49: ; preds = %46
%50 = icmp sgt i32 %22, 0
%51 = zext i32 %22 to i64
%52 = and i64 %51, 4294967288
%53 = add nsw i64 %52, -8
%54 = lshr exact i64 %53, 3
%55 = add nuw nsw i64 %54, 1
%56 = icmp ult i32 %22, 8
%57 = and i64 %51, 4294967288
%58 = and i64 %55, 1
%59 = icmp eq i64 %53, 0
%60 = and i64 %55, 4611686018427387902
%61 = icmp eq i64 %58, 0
%62 = icmp eq i64 %57, %51
br label %66
63: ; preds = %19
%64 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.16, i64 0, i64 0))
%65 = tail call i32 @exit(i32 1)
unreachable
66: ; preds = %49, %142
%67 = phi i32 [ 0, %49 ], [ %144, %142 ]
%68 = phi i32 [ 0, %49 ], [ %143, %142 ]
br i1 %50, label %69, label %142
69: ; preds = %66
br i1 %56, label %129, label %70
70: ; preds = %69
%71 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %68, i64 0
br i1 %59, label %105, label %72
72: ; preds = %70, %72
%73 = phi i64 [ %102, %72 ], [ 0, %70 ]
%74 = phi <4 x i32> [ %100, %72 ], [ %71, %70 ]
%75 = phi <4 x i32> [ %101, %72 ], [ zeroinitializer, %70 ]
%76 = phi i64 [ %103, %72 ], [ 0, %70 ]
%77 = getelementptr inbounds float, float* %32, i64 %73
%78 = bitcast float* %77 to <4 x float>*
%79 = load <4 x float>, <4 x float>* %78
%80 = getelementptr inbounds float, float* %77, i64 4
%81 = bitcast float* %80 to <4 x float>*
%82 = load <4 x float>, <4 x float>* %81
%83 = fcmp une <4 x float> %79, zeroinitializer
%84 = fcmp une <4 x float> %82, zeroinitializer
%85 = zext <4 x i1> %83 to <4 x i32>
%86 = zext <4 x i1> %84 to <4 x i32>
%87 = add <4 x i32> %74, %85
%88 = add <4 x i32> %75, %86
%89 = or i64 %73, 8
%90 = getelementptr inbounds float, float* %32, i64 %89
%91 = bitcast float* %90 to <4 x float>*
%92 = load <4 x float>, <4 x float>* %91
%93 = getelementptr inbounds float, float* %90, i64 4
%94 = bitcast float* %93 to <4 x float>*
%95 = load <4 x float>, <4 x float>* %94
%96 = fcmp une <4 x float> %92, zeroinitializer
%97 = fcmp une <4 x float> %95, zeroinitializer
%98 = zext <4 x i1> %96 to <4 x i32>
%99 = zext <4 x i1> %97 to <4 x i32>
%100 = add <4 x i32> %87, %98
%101 = add <4 x i32> %88, %99
%102 = add nuw i64 %73, 16
%103 = add i64 %76, 2
%104 = icmp eq i64 %103, %60
br i1 %104, label %105, label %72
105: ; preds = %72, %70
%106 = phi <4 x i32> [ undef, %70 ], [ %100, %72 ]
%107 = phi <4 x i32> [ undef, %70 ], [ %101, %72 ]
%108 = phi i64 [ 0, %70 ], [ %102, %72 ]
%109 = phi <4 x i32> [ %71, %70 ], [ %100, %72 ]
%110 = phi <4 x i32> [ zeroinitializer, %70 ], [ %101, %72 ]
br i1 %61, label %124, label %111
111: ; preds = %105
%112 = getelementptr inbounds float, float* %32, i64 %108
%113 = bitcast float* %112 to <4 x float>*
%114 = load <4 x float>, <4 x float>* %113
%115 = getelementptr inbounds float, float* %112, i64 4
%116 = bitcast float* %115 to <4 x float>*
%117 = load <4 x float>, <4 x float>* %116
%118 = fcmp une <4 x float> %114, zeroinitializer
%119 = fcmp une <4 x float> %117, zeroinitializer
%120 = zext <4 x i1> %118 to <4 x i32>
%121 = zext <4 x i1> %119 to <4 x i32>
%122 = add <4 x i32> %109, %120
%123 = add <4 x i32> %110, %121
br label %124
124: ; preds = %105, %111
%125 = phi <4 x i32> [ %106, %105 ], [ %122, %111 ]
%126 = phi <4 x i32> [ %107, %105 ], [ %123, %111 ]
%127 = add <4 x i32> %126, %125
%128 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %127)
br i1 %62, label %142, label %129
129: ; preds = %69, %124
%130 = phi i64 [ 0, %69 ], [ %57, %124 ]
%131 = phi i32 [ %68, %69 ], [ %128, %124 ]
br label %132
132: ; preds = %129, %132
%133 = phi i64 [ %140, %132 ], [ %130, %129 ]
%134 = phi i32 [ %139, %132 ], [ %131, %129 ]
%135 = getelementptr inbounds float, float* %32, i64 %133
%136 = load float, float* %135
%137 = fcmp une float %136, 0.000000e+00
%138 = zext i1 %137 to i32
%139 = add nsw i32 %134, %138
%140 = add nuw nsw i64 %133, 1
%141 = icmp eq i64 %140, %51
br i1 %141, label %142, label %132
142: ; preds = %132, %124, %66
%143 = phi i32 [ %68, %66 ], [ %128, %124 ], [ %139, %132 ]
%144 = add nuw nsw i32 %67, 1
%145 = tail call i64 @fread(float* %32, i32 4, i32 %22, i32* %13)
%146 = icmp eq i64 %145, %29
br i1 %146, label %66, label %147
147: ; preds = %142, %46
%148 = phi i32 [ 0, %46 ], [ %143, %142 ]
%149 = phi i32 [ 0, %46 ], [ %144, %142 ]
%150 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i32 %149, i32 %148)
%151 = tail call i32 @zero(float* %37, i32 %22)
%152 = icmp sgt i32 %22, 0
br i1 %152, label %153, label %156
153: ; preds = %147
%154 = zext i32 %22 to i64
%155 = shl nuw nsw i64 %154, 2
br label %156
156: ; preds = %153, %147
%157 = tail call i32 @rewind(i32* %13)
%158 = icmp eq i32 %149, 0
br i1 %158, label %206, label %159
159: ; preds = %156
%160 = zext i32 %22 to i64
%161 = and i64 %160, 1
%162 = icmp eq i32 %22, 1
%163 = and i64 %160, 4294967294
%164 = icmp eq i64 %161, 0
br label %165
165: ; preds = %159, %203
%166 = phi i32 [ 0, %159 ], [ %204, %203 ]
%167 = tail call i64 @fread(float* %32, i32 4, i32 %22, i32* %13)
%168 = tail call i32 @acc(float* %37, float* %32, i32 %22)
br i1 %152, label %169, label %203
169: ; preds = %165
br i1 %162, label %193, label %170
170: ; preds = %169, %189
%171 = phi i64 [ %190, %189 ], [ 0, %169 ]
%172 = phi i64 [ %191, %189 ], [ 0, %169 ]
%173 = getelementptr inbounds float, float* %32, i64 %171
%174 = load float, float* %173
%175 = fcmp une float %174, 0.000000e+00
br i1 %175, label %176, label %180
176: ; preds = %170
%177 = getelementptr inbounds i32, i32* %39, i64 %171
%178 = load i32, i32* %177
%179 = add nsw i32 %178, 1
store i32 %179, i32* %177
br label %180
180: ; preds = %170, %176
%181 = or i64 %171, 1
%182 = getelementptr inbounds float, float* %32, i64 %181
%183 = load float, float* %182
%184 = fcmp une float %183, 0.000000e+00
br i1 %184, label %185, label %189
185: ; preds = %180
%186 = getelementptr inbounds i32, i32* %39, i64 %181
%187 = load i32, i32* %186
%188 = add nsw i32 %187, 1
store i32 %188, i32* %186
br label %189
189: ; preds = %185, %180
%190 = add nuw nsw i64 %171, 2
%191 = add i64 %172, 2
%192 = icmp eq i64 %191, %163
br i1 %192, label %193, label %170
193: ; preds = %189, %169
%194 = phi i64 [ 0, %169 ], [ %190, %189 ]
br i1 %164, label %203, label %195
195: ; preds = %193
%196 = getelementptr inbounds float, float* %32, i64 %194
%197 = load float, float* %196
%198 = fcmp une float %197, 0.000000e+00
br i1 %198, label %199, label %203
199: ; preds = %195
%200 = getelementptr inbounds i32, i32* %39, i64 %194
%201 = load i32, i32* %200
%202 = add nsw i32 %201, 1
store i32 %202, i32* %200
br label %203
203: ; preds = %193, %199, %195, %165
%204 = add nuw i32 %166, 1
%205 = icmp eq i32 %204, %149
br i1 %205, label %206, label %165
206: ; preds = %203, %156
%207 = tail call i32 @norm(float* %37, i32 %22, i32* %39)
%208 = tail call i32 @memcpy(float* %35, float* %37, i32 %30)
%209 = tail call i32 @putchar(i32 10)
%210 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%211 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.15, i64 0, i64 0))
%212 = icmp slt i32 %25, 1
br i1 %212, label %338, label %213
213: ; preds = %206
%214 = sitofp i32 %148 to float
%215 = zext i32 %22 to i64
%216 = shl nuw nsw i64 %215, 2
%217 = and i64 %215, 1
%218 = icmp eq i32 %22, 1
%219 = and i64 %215, 4294967294
%220 = icmp eq i64 %217, 0
br label %221
221: ; preds = %213, %329
%222 = phi i32 [ 1, %213 ], [ %336, %329 ]
%223 = shl nuw i32 1, %222
%224 = sdiv i32 %223, 2
%225 = call i32 @split(float* %35, i32 %22, i32 %224)
%226 = icmp eq i32 %222, 31
%227 = call i32 @llvm.smax.i32(i32 %223, i32 1)
%228 = zext i32 %227 to i64
%229 = zext i32 %227 to i64
br label %230
230: ; preds = %322, %221
%231 = phi float [ 0.000000e+00, %221 ], [ %311, %322 ]
%232 = phi i32 [ 0, %221 ], [ %299, %322 ]
%233 = phi float [ 0.000000e+00, %221 ], [ %297, %322 ]
br i1 %226, label %245, label %234
234: ; preds = %230, %242
%235 = phi i64 [ %243, %242 ], [ 0, %230 ]
%236 = mul nsw i64 %235, %29
%237 = getelementptr inbounds float, float* %37, i64 %236
%238 = call i32 @zero(float* %237, i32 %22)
br i1 %152, label %239, label %242
239: ; preds = %234
%240 = getelementptr i32, i32* %39, i64 %236
%241 = bitcast i32* %240 to i8*
br label %242
242: ; preds = %239, %234
%243 = add nuw nsw i64 %235, 1
%244 = icmp eq i64 %243, %228
br i1 %244, label %245, label %234
245: ; preds = %242, %230
store float 0.000000e+00, float* %3
%246 = call i32 @rewind(i32* %13)
br i1 %158, label %295, label %247
247: ; preds = %245, %292
%248 = phi i32 [ %293, %292 ], [ 0, %245 ]
%249 = call i64 @fread(float* %32, i32 4, i32 %22, i32* %13)
%250 = call i32 @quantise(float* %35, float* %32, i32 %22, i32 %223, float* %3)
%251 = mul nsw i32 %250, %22
%252 = sext i32 %251 to i64
%253 = getelementptr inbounds float, float* %37, i64 %252
%254 = call i32 @acc(float* %253, float* %32, i32 %22)
br i1 %152, label %255, label %292
255: ; preds = %247
br i1 %218, label %281, label %256
256: ; preds = %255, %277
%257 = phi i64 [ %278, %277 ], [ 0, %255 ]
%258 = phi i64 [ %279, %277 ], [ 0, %255 ]
%259 = getelementptr inbounds float, float* %32, i64 %257
%260 = load float, float* %259
%261 = fcmp une float %260, 0.000000e+00
br i1 %261, label %262, label %267
262: ; preds = %256
%263 = add nsw i64 %257, %252
%264 = getelementptr inbounds i32, i32* %39, i64 %263
%265 = load i32, i32* %264
%266 = add nsw i32 %265, 1
store i32 %266, i32* %264
br label %267
267: ; preds = %256, %262
%268 = or i64 %257, 1
%269 = getelementptr inbounds float, float* %32, i64 %268
%270 = load float, float* %269
%271 = fcmp une float %270, 0.000000e+00
br i1 %271, label %272, label %277
272: ; preds = %267
%273 = add nsw i64 %268, %252
%274 = getelementptr inbounds i32, i32* %39, i64 %273
%275 = load i32, i32* %274
%276 = add nsw i32 %275, 1
store i32 %276, i32* %274
br label %277
277: ; preds = %272, %267
%278 = add nuw nsw i64 %257, 2
%279 = add i64 %258, 2
%280 = icmp eq i64 %279, %219
br i1 %280, label %281, label %256
281: ; preds = %277, %255
%282 = phi i64 [ 0, %255 ], [ %278, %277 ]
br i1 %220, label %292, label %283
283: ; preds = %281
%284 = getelementptr inbounds float, float* %32, i64 %282
%285 = load float, float* %284
%286 = fcmp une float %285, 0.000000e+00
br i1 %286, label %287, label %292
287: ; preds = %283
%288 = add nsw i64 %282, %252
%289 = getelementptr inbounds i32, i32* %39, i64 %288
%290 = load i32, i32* %289
%291 = add nsw i32 %290, 1
store i32 %291, i32* %289
br label %292
292: ; preds = %281, %287, %283, %247
%293 = add nuw i32 %248, 1
%294 = icmp eq i32 %293, %149
br i1 %294, label %295, label %247
295: ; preds = %292, %245
%296 = load float, float* %3
%297 = fdiv float %296, %214
%298 = call float @sqrt(float %297)
%299 = add nuw nsw i32 %232, 1
%300 = icmp eq i32 %232, 0
br i1 %300, label %310, label %301
301: ; preds = %295
%302 = fcmp ogt float %297, 0.000000e+00
br i1 %302, label %303, label %306
303: ; preds = %301
%304 = fsub float %233, %297
%305 = fdiv float %304, %297
br label %306
306: ; preds = %301, %303
%307 = phi float [ %305, %303 ], [ 0.000000e+00, %301 ]
%308 = fpext float %307 to double
%309 = fcmp olt double %308, 1.000000e-02
br i1 %309, label %329, label %310
310: ; preds = %306, %295
%311 = phi float [ %307, %306 ], [ %231, %295 ]
br i1 %226, label %322, label %312
312: ; preds = %310, %312
%313 = phi i64 [ %320, %312 ], [ 0, %310 ]
%314 = mul nsw i64 %313, %29
%315 = getelementptr inbounds float, float* %37, i64 %314
%316 = getelementptr inbounds i32, i32* %39, i64 %314
%317 = call i32 @norm(float* %315, i32 %22, i32* %316)
%318 = getelementptr inbounds float, float* %35, i64 %314
%319 = call i32 @memcpy(float* %318, float* %315, i32 %30)
%320 = add nuw nsw i64 %313, 1
%321 = icmp eq i64 %320, %229
br i1 %321, label %322, label %312
322: ; preds = %312, %310
%323 = fpext float %311 to double
%324 = fpext float %297 to double
%325 = fpext float %298 to double
%326 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i32 %222, i32 %299, double %323, double %324, double %325)
%327 = load i32, i32* @stdout
%328 = call i32 @fflush(i32 %327)
br label %230
329: ; preds = %306
%330 = fpext float %297 to double
%331 = fpext float %298 to double
%332 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i32 %222, i32 %299, double %308, double %330, double %331)
%333 = load i32, i32* @stdout
%334 = call i32 @fflush(i32 %333)
%335 = call i32 @putchar(i32 10)
%336 = add nuw i32 %222, 1
%337 = icmp eq i32 %222, %25
br i1 %337, label %338, label %221
338: ; preds = %329, %206
%339 = phi i32 [ undef, %206 ], [ %223, %329 ]
%340 = getelementptr inbounds i8*, i8** %1, i64 4
%341 = load i8*, i8** %340
%342 = call i32* @fopen(i8* %341, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%343 = icmp eq i32* %342, null
br i1 %343, label %344, label %348
344: ; preds = %338
%345 = load i8*, i8** %340
%346 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i8* %345)
%347 = call i32 @exit(i32 1)
unreachable
348: ; preds = %338
%349 = call i32 (i32*, i8*, ...) @fprintf(i32* %342, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %22, i32 %26)
%350 = icmp eq i32 %25, 31
br i1 %350, label %372, label %351
351: ; preds = %348
%352 = call i32 @llvm.smax.i32(i32 %26, i32 1)
%353 = zext i32 %352 to i64
%354 = zext i32 %22 to i64
br label %355
355: ; preds = %351, %368
%356 = phi i64 [ 0, %351 ], [ %370, %368 ]
br i1 %152, label %357, label %368
357: ; preds = %355
%358 = mul nsw i64 %356, %29
br label %359
359: ; preds = %357, %359
%360 = phi i64 [ 0, %357 ], [ %366, %359 ]
%361 = add nsw i64 %360, %358
%362 = getelementptr inbounds float, float* %35, i64 %361
%363 = load float, float* %362
%364 = fpext float %363 to double
%365 = call i32 (i32*, i8*, ...) @fprintf(i32* %342, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), double %364)
%366 = add nuw nsw i64 %360, 1
%367 = icmp eq i64 %366, %354
br i1 %367, label %368, label %359
368: ; preds = %359, %355
%369 = call i32 @fputc(i32 10, i32* %342)
%370 = add nuw nsw i64 %356, 1
%371 = icmp eq i64 %370, %353
br i1 %371, label %372, label %355
372: ; preds = %368, %348
%373 = call i32 @fclose(i32* %342)
%374 = icmp eq i32 %0, 6
br i1 %374, label %375, label %412
375: ; preds = %372
%376 = getelementptr inbounds i8*, i8** %1, i64 5
%377 = load i8*, i8** %376
%378 = call i32* @fopen(i8* %377, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%379 = icmp ne i32* %378, null
%380 = zext i1 %379 to i32
%381 = call i32 @assert(i32 %380)
%382 = call i32 @rewind(i32* %13)
br i1 %158, label %412, label %383
383: ; preds = %375
%384 = zext i32 %22 to i64
br label %385
385: ; preds = %383, %408
%386 = phi i32 [ 0, %383 ], [ %410, %408 ]
%387 = call i64 @fread(float* %32, i32 4, i32 %22, i32* %13)
%388 = call i32 @quantise(float* %35, float* %32, i32 %22, i32 %339, float* %3)
br i1 %152, label %389, label %408
389: ; preds = %385
%390 = mul nsw i32 %388, %22
%391 = sext i32 %390 to i64
br label %392
392: ; preds = %389, %402
%393 = phi i64 [ 0, %389 ], [ %406, %402 ]
%394 = getelementptr inbounds float, float* %32, i64 %393
%395 = load float, float* %394
%396 = fcmp une float %395, 0.000000e+00
br i1 %396, label %397, label %402
397: ; preds = %392
%398 = add nsw i64 %393, %391
%399 = getelementptr inbounds float, float* %35, i64 %398
%400 = load float, float* %399
%401 = fsub float %395, %400
store float %401, float* %394
br label %402
402: ; preds = %397, %392
%403 = phi float [ %401, %397 ], [ %395, %392 ]
%404 = fpext float %403 to double
%405 = call i32 (i32*, i8*, ...) @fprintf(i32* %378, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), double %404)
%406 = add nuw nsw i64 %393, 1
%407 = icmp eq i64 %406, %384
br i1 %407, label %408, label %392
408: ; preds = %402, %385
%409 = call i32 @fputc(i32 10, i32* %378)
%410 = add nuw i32 %386, 1
%411 = icmp eq i32 %410, %149
br i1 %411, label %412, label %385
412: ; preds = %408, %375, %372
ret i32 0
}