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