#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 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++) {
    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");
  levels = 0;
  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++) {
        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++) {
      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,-0x7c(%rbp)
mov    -0x7c(%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    -0x7c(%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,-0x78(%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,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1427 <main+0x207>
mov    -0x20(%rbp),%rax
movslq -0x68(%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    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1419 <main+0x1f9>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%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    -0x78(%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,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1485 <main+0x265>
mov    -0x38(%rbp),%rax
movslq -0x68(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    145c <main+0x23c>
mov    -0x58(%rbp),%rdi
call   1070 <rewind@plt>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1539 <main+0x319>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x58(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <acc@plt>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1526 <main+0x306>
mov    -0x20(%rbp),%rax
movslq -0x68(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1502 <main+0x2e2>
jp     1502 <main+0x2e2>
jmp    1513 <main+0x2f3>
mov    -0x38(%rbp),%rax
movslq -0x68(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    1518 <main+0x2f8>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    14cd <main+0x2ad>
jmp    152b <main+0x30b>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%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    0xbe7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xb89(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xba4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x84(%rbp)
movl   $0x1,-0x80(%rbp)
mov    -0x80(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jg     1902 <main+0x6e2>
mov    -0x80(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x84(%rbp)
movl   $0x0,-0x70(%rbp)
movl   $0x0,-0x6c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x84(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1090 <split@plt>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x84(%rbp),%eax
jge    166f <main+0x44f>
mov    -0x30(%rbp),%rdi
mov    -0x64(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x14(%rbp),%esi
call   1100 <zero@plt>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    165c <main+0x43c>
mov    -0x38(%rbp),%rax
mov    -0x64(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x68(%rbp),%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    162a <main+0x40a>
jmp    1661 <main+0x441>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    15f8 <main+0x3d8>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x58(%rbp),%rdi
call   1070 <rewind@plt>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1761 <main+0x541>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x58(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x84(%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,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    174e <main+0x52e>
mov    -0x20(%rbp),%rax
movslq -0x68(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1721 <main+0x501>
jp     1721 <main+0x501>
jmp    173b <main+0x51b>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x68(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    1740 <main+0x520>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    16ec <main+0x4cc>
jmp    1753 <main+0x533>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1687 <main+0x467>
movss  -0x44(%rbp),%xmm0
cvtsi2ssl -0x78(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x48(%rbp),%xmm0
call   1130 <sqrt@plt>
movss  %xmm0,-0x74(%rbp)
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
cmpl   $0x1,-0x70(%rbp)
jle    17f4 <main+0x5d4>
movss  -0x48(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    17c5 <main+0x5a5>
movss  -0x4c(%rbp),%xmm0
subss  -0x48(%rbp),%xmm0
divss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x50(%rbp)
jmp    17cd <main+0x5ad>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x50(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0x822(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    17ef <main+0x5cf>
movl   $0x1,-0x6c(%rbp)
jmp    17f4 <main+0x5d4>
cmpl   $0x0,-0x6c(%rbp)
jne    188e <main+0x66e>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x84(%rbp),%eax
jge    1889 <main+0x669>
mov    -0x30(%rbp),%rdi
mov    -0x64(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x14(%rbp),%esi
mov    -0x38(%rbp),%rdx
mov    -0x64(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdx
call   10c0 <norm@plt>
mov    -0x28(%rbp),%rdi
mov    -0x64(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x30(%rbp),%rsi
mov    -0x64(%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    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1805 <main+0x5e5>
jmp    188e <main+0x66e>
mov    -0x80(%rbp),%esi
mov    -0x70(%rbp),%edx
movss  -0x50(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x48(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x74(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0x89a(%rip),%rdi
mov    $0x3,%al
call   1060 <printf@plt>
mov    0x271c(%rip),%rax
mov    (%rax),%edi
call   10f0 <fflush@plt>
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
cmpl   $0x0,-0x6c(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    15f1 <main+0x3d1>
lea    0x861(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    159b <main+0x37b>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0x867(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    1945 <main+0x725>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
lea    0x847(%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    0x840(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    19dd <main+0x7bd>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    19bd <main+0x79d>
mov    -0x60(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    -0x68(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x64(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0x7f5(%rip),%rsi
mov    $0x1,%al
call   10b0 <fprintf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1977 <main+0x757>
mov    -0x60(%rbp),%rdi
lea    0x786(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1964 <main+0x744>
mov    -0x60(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x6,-0x8(%rbp)
jne    1b32 <main+0x912>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0x779(%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,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1b2d <main+0x90d>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x58(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x84(%rbp),%ecx
lea    -0x44(%rbp),%r8
call   1080 <quantise@plt>
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1b0a <main+0x8ea>
mov    -0x20(%rbp),%rax
movslq -0x68(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1aaa <main+0x88a>
jp     1aaa <main+0x88a>
jmp    1ad6 <main+0x8b6>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x68(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x68(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x90(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x68(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0x6b0(%rip),%rsi
mov    $0x1,%al
call   10b0 <fprintf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1a75 <main+0x855>
mov    -0x90(%rbp),%rdi
lea    0x636(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1a30 <main+0x810>
jmp    1b32 <main+0x912>
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,0x5c(%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,0x60(%rsp)
cmp    %rbx,%rax
jne    14fd <main+0x29d>
mov    %r15d,%ebx
mov    %r15d,%r12d
and    $0xfffffff8,%r12d
lea    -0x8(%r12),%r13
mov    %r13,0x50(%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    0x60(%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,0x50(%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    0x5c(%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    0x60(%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     1a39 <main+0x7d9>
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,0x50(%rsp)
cmovge %ebx,%eax
mov    %rax,0x88(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0x58(%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  0x58(%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    0x50(%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,0x58(%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    0x5c(%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>
movl   $0x0,0x50(%rsp)
mov    0x68(%rsp),%rax
mov    0x20(%rax),%rdi
lea    0x6cf(%rip),%rsi
call   1150 <fopen@plt>
test   %rax,%rax
je     1c61 <main+0xa01>
mov    %rax,%rbp
lea    0x6d5(%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    0x675(%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    0x66b(%rip),%r13
jmp    1aff <main+0x89f>
nopl   0x0(%rax)
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    0x50(%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,0x60(%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    0x60(%rsp),%r15
cmp    0x28(%rsp),%rax
je     1a80 <main+0x820>
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 float
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%30 = load i32, i32* %4
%31 = icmp slt i32 %30, 5
br i1 %31, label %32, label %38
32: ; preds = %2
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 0
%35 = load i8*, i8** %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* %35)
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %2
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %42, i32** %18
%43 = load i32*, i32** %18
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %51
45: ; preds = %38
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 1
%48 = load i8*, i8** %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %48)
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %38
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 2
%54 = load i8*, i8** %53
%55 = call i32 @atoi(i8* %54)
store i32 %55, i32* %6
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 3
%58 = load i8*, i8** %57
%59 = call i32 @atoi(i8* %58)
store i32 %59, i32* %26
%60 = load i32, i32* %26
%61 = shl i32 1, %60
store i32 %61, i32* %7
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%63 = load i32, i32* %6
%64 = load i32, i32* %26
%65 = load i32, i32* %7
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0), i32 %63, i32 %64, i32 %65)
%67 = load i32, i32* %6
%68 = sext i32 %67 to i64
%69 = mul i64 4, %68
%70 = trunc i64 %69 to i32
%71 = call i64 @malloc(i32 %70)
%72 = inttoptr i64 %71 to float*
store float* %72, float** %8
%73 = load i32, i32* %6
%74 = sext i32 %73 to i64
%75 = mul i64 4, %74
%76 = load i32, i32* %7
%77 = sext i32 %76 to i64
%78 = mul i64 %75, %77
%79 = trunc i64 %78 to i32
%80 = call i64 @malloc(i32 %79)
%81 = inttoptr i64 %80 to float*
store float* %81, float** %9
%82 = load i32, i32* %6
%83 = sext i32 %82 to i64
%84 = mul i64 4, %83
%85 = load i32, i32* %7
%86 = sext i32 %85 to i64
%87 = mul i64 %84, %86
%88 = trunc i64 %87 to i32
%89 = call i64 @malloc(i32 %88)
%90 = inttoptr i64 %89 to float*
store float* %90, float** %10
%91 = load i32, i32* %6
%92 = sext i32 %91 to i64
%93 = mul i64 4, %92
%94 = load i32, i32* %7
%95 = sext i32 %94 to i64
%96 = mul i64 %93, %95
%97 = trunc i64 %96 to i32
%98 = call i64 @malloc(i32 %97)
%99 = inttoptr i64 %98 to i32*
store i32* %99, i32** %11
%100 = load float*, float** %8
%101 = icmp eq float* %100, null
br i1 %101, label %111, label %102
102: ; preds = %51
%103 = load float*, float** %9
%104 = icmp eq float* %103, null
br i1 %104, label %111, label %105
105: ; preds = %102
%106 = load float*, float** %10
%107 = icmp eq float* %106, null
br i1 %107, label %111, label %108
108: ; preds = %105
%109 = load i32*, i32** %11
%110 = icmp eq i32* %109, null
br i1 %110, label %111, label %114
111: ; preds = %108, %105, %102, %51
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%113 = call i32 @exit(i32 1)
unreachable
114: ; preds = %108
store i32 0, i32* %12
store i32 0, i32* %25
br label %115
115: ; preds = %143, %114
%116 = load float*, float** %8
%117 = load i32, i32* %6
%118 = load i32*, i32** %18
%119 = call i64 @fread(float* %116, i32 4, i32 %117, i32* %118)
%120 = load i32, i32* %6
%121 = sext i32 %120 to i64
%122 = icmp eq i64 %119, %121
br i1 %122, label %123, label %146
123: ; preds = %115
store i32 0, i32* %21
br label %124
124: ; preds = %140, %123
%125 = load i32, i32* %21
%126 = load i32, i32* %6
%127 = icmp slt i32 %125, %126
br i1 %127, label %128, label %143
128: ; preds = %124
%129 = load float*, float** %8
%130 = load i32, i32* %21
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds float, float* %129, i64 %131
%133 = load float, float* %132
%134 = fpext float %133 to double
%135 = fcmp une double %134, 0.000000e+00
br i1 %135, label %136, label %139
136: ; preds = %128
%137 = load i32, i32* %25
%138 = add nsw i32 %137, 1
store i32 %138, i32* %25
br label %139
139: ; preds = %136, %128
br label %140
140: ; preds = %139
%141 = load i32, i32* %21
%142 = add nsw i32 %141, 1
store i32 %142, i32* %21
br label %124
143: ; preds = %124
%144 = load i32, i32* %12
%145 = add nsw i32 %144, 1
store i32 %145, i32* %12
br label %115
146: ; preds = %115
%147 = load i32, i32* %12
%148 = load i32, i32* %25
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i32 %147, i32 %148)
%150 = load float*, float** %10
%151 = load i32, i32* %6
%152 = call i32 @zero(float* %150, i32 %151)
store i32 0, i32* %21
br label %153
153: ; preds = %162, %146
%154 = load i32, i32* %21
%155 = load i32, i32* %6
%156 = icmp slt i32 %154, %155
br i1 %156, label %157, label %165
157: ; preds = %153
%158 = load i32*, i32** %11
%159 = load i32, i32* %21
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i32, i32* %158, i64 %160
store i32 0, i32* %161
br label %162
162: ; preds = %157
%163 = load i32, i32* %21
%164 = add nsw i32 %163, 1
store i32 %164, i32* %21
br label %153
165: ; preds = %153
%166 = load i32*, i32** %18
%167 = call i32 @rewind(i32* %166)
store i32 0, i32* %20
br label %168
168: ; preds = %205, %165
%169 = load i32, i32* %20
%170 = load i32, i32* %12
%171 = icmp slt i32 %169, %170
br i1 %171, label %172, label %208
172: ; preds = %168
%173 = load float*, float** %8
%174 = load i32, i32* %6
%175 = load i32*, i32** %18
%176 = call i64 @fread(float* %173, i32 4, i32 %174, i32* %175)
%177 = load float*, float** %10
%178 = load float*, float** %8
%179 = load i32, i32* %6
%180 = call i32 @acc(float* %177, float* %178, i32 %179)
store i32 0, i32* %21
br label %181
181: ; preds = %201, %172
%182 = load i32, i32* %21
%183 = load i32, i32* %6
%184 = icmp slt i32 %182, %183
br i1 %184, label %185, label %204
185: ; preds = %181
%186 = load float*, float** %8
%187 = load i32, i32* %21
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds float, float* %186, i64 %188
%190 = load float, float* %189
%191 = fpext float %190 to double
%192 = fcmp une double %191, 0.000000e+00
br i1 %192, label %193, label %200
193: ; preds = %185
%194 = load i32*, i32** %11
%195 = load i32, i32* %21
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds i32, i32* %194, i64 %196
%198 = load i32, i32* %197
%199 = add nsw i32 %198, 1
store i32 %199, i32* %197
br label %200
200: ; preds = %193, %185
br label %201
201: ; preds = %200
%202 = load i32, i32* %21
%203 = add nsw i32 %202, 1
store i32 %203, i32* %21
br label %181
204: ; preds = %181
br label %205
205: ; preds = %204
%206 = load i32, i32* %20
%207 = add nsw i32 %206, 1
store i32 %207, i32* %20
br label %168
208: ; preds = %168
%209 = load float*, float** %10
%210 = load i32, i32* %6
%211 = load i32*, i32** %11
%212 = call i32 @norm(float* %209, i32 %210, i32* %211)
%213 = load float*, float** %9
%214 = load float*, float** %10
%215 = load i32, i32* %6
%216 = sext i32 %215 to i64
%217 = mul i64 %216, 4
%218 = trunc i64 %217 to i32
%219 = call i32 @memcpy(float* %213, float* %214, i32 %218)
%220 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%221 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%222 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %28
store i32 1, i32* %27
br label %223
223: ; preds = %417, %208
%224 = load i32, i32* %27
%225 = load i32, i32* %26
%226 = icmp sle i32 %224, %225
br i1 %226, label %227, label %420
227: ; preds = %223
%228 = load i32, i32* %27
%229 = shl i32 1, %228
store i32 %229, i32* %28
store i32 0, i32* %23
store i32 0, i32* %22
store float 0.000000e+00, float* %17
store float 0.000000e+00, float* %16
%230 = load float*, float** %9
%231 = load i32, i32* %6
%232 = load i32, i32* %28
%233 = sdiv i32 %232, 2
%234 = call i32 @split(float* %230, i32 %231, i32 %233)
br label %235
235: ; preds = %411, %227
store i32 0, i32* %20
br label %236
236: ; preds = %266, %235
%237 = load i32, i32* %20
%238 = load i32, i32* %28
%239 = icmp slt i32 %237, %238
br i1 %239, label %240, label %269
240: ; preds = %236
%241 = load float*, float** %10
%242 = load i32, i32* %20
%243 = load i32, i32* %6
%244 = mul nsw i32 %242, %243
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds float, float* %241, i64 %245
%247 = load i32, i32* %6
%248 = call i32 @zero(float* %246, i32 %247)
store i32 0, i32* %21
br label %249
249: ; preds = %262, %240
%250 = load i32, i32* %21
%251 = load i32, i32* %6
%252 = icmp slt i32 %250, %251
br i1 %252, label %253, label %265
253: ; preds = %249
%254 = load i32*, i32** %11
%255 = load i32, i32* %20
%256 = load i32, i32* %6
%257 = mul nsw i32 %255, %256
%258 = load i32, i32* %21
%259 = add nsw i32 %257, %258
%260 = sext i32 %259 to i64
%261 = getelementptr inbounds i32, i32* %254, i64 %260
store i32 0, i32* %261
br label %262
262: ; preds = %253
%263 = load i32, i32* %21
%264 = add nsw i32 %263, 1
store i32 %264, i32* %21
br label %249
265: ; preds = %249
br label %266
266: ; preds = %265
%267 = load i32, i32* %20
%268 = add nsw i32 %267, 1
store i32 %268, i32* %20
br label %236
269: ; preds = %236
store float 0.000000e+00, float* %14
%270 = load i32*, i32** %18
%271 = call i32 @rewind(i32* %270)
store i32 0, i32* %20
br label %272
272: ; preds = %323, %269
%273 = load i32, i32* %20
%274 = load i32, i32* %12
%275 = icmp slt i32 %273, %274
br i1 %275, label %276, label %326
276: ; preds = %272
%277 = load float*, float** %8
%278 = load i32, i32* %6
%279 = load i32*, i32** %18
%280 = call i64 @fread(float* %277, i32 4, i32 %278, i32* %279)
%281 = load float*, float** %9
%282 = load float*, float** %8
%283 = load i32, i32* %6
%284 = load i32, i32* %28
%285 = call i32 @quantise(float* %281, float* %282, i32 %283, i32 %284, float* %14)
store i32 %285, i32* %13
%286 = load float*, float** %10
%287 = load i32, i32* %13
%288 = load i32, i32* %6
%289 = mul nsw i32 %287, %288
%290 = sext i32 %289 to i64
%291 = getelementptr inbounds float, float* %286, i64 %290
%292 = load float*, float** %8
%293 = load i32, i32* %6
%294 = call i32 @acc(float* %291, float* %292, i32 %293)
store i32 0, i32* %21
br label %295
295: ; preds = %319, %276
%296 = load i32, i32* %21
%297 = load i32, i32* %6
%298 = icmp slt i32 %296, %297
br i1 %298, label %299, label %322
299: ; preds = %295
%300 = load float*, float** %8
%301 = load i32, i32* %21
%302 = sext i32 %301 to i64
%303 = getelementptr inbounds float, float* %300, i64 %302
%304 = load float, float* %303
%305 = fpext float %304 to double
%306 = fcmp une double %305, 0.000000e+00
br i1 %306, label %307, label %318
307: ; preds = %299
%308 = load i32*, i32** %11
%309 = load i32, i32* %13
%310 = load i32, i32* %6
%311 = mul nsw i32 %309, %310
%312 = load i32, i32* %21
%313 = add nsw i32 %311, %312
%314 = sext i32 %313 to i64
%315 = getelementptr inbounds i32, i32* %308, i64 %314
%316 = load i32, i32* %315
%317 = add nsw i32 %316, 1
store i32 %317, i32* %315
br label %318
318: ; preds = %307, %299
br label %319
319: ; preds = %318
%320 = load i32, i32* %21
%321 = add nsw i32 %320, 1
store i32 %321, i32* %21
br label %295
322: ; preds = %295
br label %323
323: ; preds = %322
%324 = load i32, i32* %20
%325 = add nsw i32 %324, 1
store i32 %325, i32* %20
br label %272
326: ; preds = %272
%327 = load float, float* %14
%328 = load i32, i32* %25
%329 = sitofp i32 %328 to float
%330 = fdiv float %327, %329
store float %330, float* %15
%331 = load float, float* %15
%332 = call float @sqrt(float %331)
store float %332, float* %24
%333 = load i32, i32* %23
%334 = add nsw i32 %333, 1
store i32 %334, i32* %23
%335 = load i32, i32* %23
%336 = icmp sgt i32 %335, 1
br i1 %336, label %337, label %354
337: ; preds = %326
%338 = load float, float* %15
%339 = fpext float %338 to double
%340 = fcmp ogt double %339, 0.000000e+00
br i1 %340, label %341, label %347
341: ; preds = %337
%342 = load float, float* %16
%343 = load float, float* %15
%344 = fsub float %342, %343
%345 = load float, float* %15
%346 = fdiv float %344, %345
store float %346, float* %17
br label %348
347: ; preds = %337
store float 0.000000e+00, float* %17
br label %348
348: ; preds = %347, %341
%349 = load float, float* %17
%350 = fpext float %349 to double
%351 = fcmp olt double %350, 1.000000e-02
br i1 %351, label %352, label %353
352: ; preds = %348
store i32 1, i32* %22
br label %353
353: ; preds = %352, %348
br label %354
354: ; preds = %353, %326
%355 = load i32, i32* %22
%356 = icmp ne i32 %355, 0
br i1 %356, label %398, label %357
357: ; preds = %354
store i32 0, i32* %20
br label %358
358: ; preds = %394, %357
%359 = load i32, i32* %20
%360 = load i32, i32* %28
%361 = icmp slt i32 %359, %360
br i1 %361, label %362, label %397
362: ; preds = %358
%363 = load float*, float** %10
%364 = load i32, i32* %20
%365 = load i32, i32* %6
%366 = mul nsw i32 %364, %365
%367 = sext i32 %366 to i64
%368 = getelementptr inbounds float, float* %363, i64 %367
%369 = load i32, i32* %6
%370 = load i32*, i32** %11
%371 = load i32, i32* %20
%372 = load i32, i32* %6
%373 = mul nsw i32 %371, %372
%374 = sext i32 %373 to i64
%375 = getelementptr inbounds i32, i32* %370, i64 %374
%376 = call i32 @norm(float* %368, i32 %369, i32* %375)
%377 = load float*, float** %9
%378 = load i32, i32* %20
%379 = load i32, i32* %6
%380 = mul nsw i32 %378, %379
%381 = sext i32 %380 to i64
%382 = getelementptr inbounds float, float* %377, i64 %381
%383 = load float*, float** %10
%384 = load i32, i32* %20
%385 = load i32, i32* %6
%386 = mul nsw i32 %384, %385
%387 = sext i32 %386 to i64
%388 = getelementptr inbounds float, float* %383, i64 %387
%389 = load i32, i32* %6
%390 = sext i32 %389 to i64
%391 = mul i64 %390, 4
%392 = trunc i64 %391 to i32
%393 = call i32 @memcpy(float* %382, float* %388, i32 %392)
br label %394
394: ; preds = %362
%395 = load i32, i32* %20
%396 = add nsw i32 %395, 1
store i32 %396, i32* %20
br label %358
397: ; preds = %358
br label %398
398: ; preds = %397, %354
%399 = load i32, i32* %27
%400 = load i32, i32* %23
%401 = load float, float* %17
%402 = fpext float %401 to double
%403 = load float, float* %15
%404 = fpext float %403 to double
%405 = load float, float* %24
%406 = fpext float %405 to double
%407 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i32 %399, i32 %400, double %402, double %404, double %406)
%408 = load i32, i32* @stdout
%409 = call i32 @fflush(i32 %408)
%410 = load float, float* %15
store float %410, float* %16
br label %411
411: ; preds = %398
%412 = load i32, i32* %22
%413 = icmp ne i32 %412, 0
%414 = xor i1 %413, true
br i1 %414, label %235, label %415
415: ; preds = %411
%416 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %417
417: ; preds = %415
%418 = load i32, i32* %27
%419 = add nsw i32 %418, 1
store i32 %419, i32* %27
br label %223
420: ; preds = %223
%421 = load i8**, i8*** %5
%422 = getelementptr inbounds i8*, i8** %421, i64 4
%423 = load i8*, i8** %422
%424 = call i32* @fopen(i8* %423, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
store i32* %424, i32** %19
%425 = load i32*, i32** %19
%426 = icmp eq i32* %425, null
br i1 %426, label %427, label %433
427: ; preds = %420
%428 = load i8**, i8*** %5
%429 = getelementptr inbounds i8*, i8** %428, i64 4
%430 = load i8*, i8** %429
%431 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i8* %430)
%432 = call i32 @exit(i32 1)
unreachable
433: ; preds = %420
%434 = load i32*, i32** %19
%435 = load i32, i32* %6
%436 = load i32, i32* %7
%437 = call i32 (i32*, i8*, ...) @fprintf(i32* %434, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %435, i32 %436)
store i32 0, i32* %21
br label %438
438: ; preds = %466, %433
%439 = load i32, i32* %21
%440 = load i32, i32* %7
%441 = icmp slt i32 %439, %440
br i1 %441, label %442, label %469
442: ; preds = %438
store i32 0, i32* %20
br label %443
443: ; preds = %460, %442
%444 = load i32, i32* %20
%445 = load i32, i32* %6
%446 = icmp slt i32 %444, %445
br i1 %446, label %447, label %463
447: ; preds = %443
%448 = load i32*, i32** %19
%449 = load float*, float** %9
%450 = load i32, i32* %21
%451 = load i32, i32* %6
%452 = mul nsw i32 %450, %451
%453 = load i32, i32* %20
%454 = add nsw i32 %452, %453
%455 = sext i32 %454 to i64
%456 = getelementptr inbounds float, float* %449, i64 %455
%457 = load float, float* %456
%458 = fpext float %457 to double
%459 = call i32 (i32*, i8*, ...) @fprintf(i32* %448, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), double %458)
br label %460
460: ; preds = %447
%461 = load i32, i32* %20
%462 = add nsw i32 %461, 1
store i32 %462, i32* %20
br label %443
463: ; preds = %443
%464 = load i32*, i32** %19
%465 = call i32 (i32*, i8*, ...) @fprintf(i32* %464, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %466
466: ; preds = %463
%467 = load i32, i32* %21
%468 = add nsw i32 %467, 1
store i32 %468, i32* %21
br label %438
469: ; preds = %438
%470 = load i32*, i32** %19
%471 = call i32 @fclose(i32* %470)
%472 = load i32, i32* %4
%473 = icmp eq i32 %472, 6
br i1 %473, label %474, label %546
474: ; preds = %469
%475 = load i8**, i8*** %5
%476 = getelementptr inbounds i8*, i8** %475, i64 5
%477 = load i8*, i8** %476
%478 = call i32* @fopen(i8* %477, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
store i32* %478, i32** %29
%479 = load i32*, i32** %29
%480 = icmp ne i32* %479, null
%481 = zext i1 %480 to i32
%482 = call i32 @assert(i32 %481)
%483 = load i32*, i32** %18
%484 = call i32 @rewind(i32* %483)
store i32 0, i32* %20
br label %485
485: ; preds = %542, %474
%486 = load i32, i32* %20
%487 = load i32, i32* %12
%488 = icmp slt i32 %486, %487
br i1 %488, label %489, label %545
489: ; preds = %485
%490 = load float*, float** %8
%491 = load i32, i32* %6
%492 = load i32*, i32** %18
%493 = call i64 @fread(float* %490, i32 4, i32 %491, i32* %492)
%494 = load float*, float** %9
%495 = load float*, float** %8
%496 = load i32, i32* %6
%497 = load i32, i32* %28
%498 = call i32 @quantise(float* %494, float* %495, i32 %496, i32 %497, float* %14)
store i32 %498, i32* %13
store i32 0, i32* %21
br label %499
499: ; preds = %536, %489
%500 = load i32, i32* %21
%501 = load i32, i32* %6
%502 = icmp slt i32 %500, %501
br i1 %502, label %503, label %539
503: ; preds = %499
%504 = load float*, float** %8
%505 = load i32, i32* %21
%506 = sext i32 %505 to i64
%507 = getelementptr inbounds float, float* %504, i64 %506
%508 = load float, float* %507
%509 = fpext float %508 to double
%510 = fcmp une double %509, 0.000000e+00
br i1 %510, label %511, label %527
511: ; preds = %503
%512 = load float*, float** %9
%513 = load i32, i32* %13
%514 = load i32, i32* %6
%515 = mul nsw i32 %513, %514
%516 = load i32, i32* %21
%517 = add nsw i32 %515, %516
%518 = sext i32 %517 to i64
%519 = getelementptr inbounds float, float* %512, i64 %518
%520 = load float, float* %519
%521 = load float*, float** %8
%522 = load i32, i32* %21
%523 = sext i32 %522 to i64
%524 = getelementptr inbounds float, float* %521, i64 %523
%525 = load float, float* %524
%526 = fsub float %525, %520
store float %526, float* %524
br label %527
527: ; preds = %511, %503
%528 = load i32*, i32** %29
%529 = load float*, float** %8
%530 = load i32, i32* %21
%531 = sext i32 %530 to i64
%532 = getelementptr inbounds float, float* %529, i64 %531
%533 = load float, float* %532
%534 = fpext float %533 to double
%535 = call i32 (i32*, i8*, ...) @fprintf(i32* %528, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), double %534)
br label %536
536: ; preds = %527
%537 = load i32, i32* %21
%538 = add nsw i32 %537, 1
store i32 %538, i32* %21
br label %499
539: ; preds = %499
%540 = load i32*, i32** %29
%541 = call i32 (i32*, i8*, ...) @fprintf(i32* %540, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %542
542: ; preds = %539
%543 = load i32, i32* %20
%544 = add nsw i32 %543, 1
store i32 %544, i32* %20
br label %485
545: ; preds = %485
br label %546
546: ; preds = %545, %469
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 [ 0, %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
}