#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 *, long);
float atof(char *);
long atol(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
long fread(float *, int, long, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(float *, float *, long);
int /*<<< orphan*/ norm(float *, long, long);
int /*<<< orphan*/ printf(char *, ...);
long quantise(float *, float *, long, long, float, float *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ zero(float *, long);
int main(int argc, char *argv[]) {
  long k, m;
  float *vec;
  float *cb;
  float *cent;
  long *n;
  long J;
  long i, j;
  long ind;
  float se;
  float Dn, Dn_1;
  float delta;
  FILE *ftrain;
  FILE *fvq;
  float clip;
  if (argc != 6) {
    printf("usage: vqtrain TrainFile K M VQFile clip\n");
    exit(0);
  }
  ftrain = fopen(argv[1], "rb");
  if (ftrain == NULL) {
    printf("Error opening training database file: %s\n", argv[1]);
    exit(1);
  }
  k = atol(argv[2]);
  m = atol(argv[3]);
  clip = atof(argv[5]);
  printf("dimension K=%ld  number of entries M=%ld clip = %f\n", k, m, clip);
  vec = (float *)malloc(sizeof(float) * k);
  cb = (float *)malloc(sizeof(float) * k * m);
  cent = (float *)malloc(sizeof(float) * k * m);
  n = (long *)malloc(sizeof(long) * m);
  if (cb == NULL || cb == NULL || cent == NULL || vec == NULL) {
    printf("Error in malloc.\n");
    exit(1);
  }
  J = 0;
  while (fread(vec, sizeof(float), k, ftrain) == k)
    J++;
  printf("J=%ld entries in training set\n", J);
  rewind(ftrain);
  fread(cb, sizeof(float), k * m, ftrain);
  Dn = 1E32;
  j = 1;
  do {
    Dn_1 = Dn;
    for (i = 0; i < m; i++) {
      zero(&cent[i * k], k);
      n[i] = 0;
    }
    se = 0.0;
    rewind(ftrain);
    for (i = 0; i < J; i++) {
      fread(vec, sizeof(float), k, ftrain);
      ind = quantise(cb, vec, k, m, clip, &se);
      n[ind]++;
      acc(&cent[ind * k], vec, k);
    }
    Dn = se / J;
    delta = (Dn_1 - Dn) / Dn;
    printf("\r  Iteration %ld, Dn = %f, Delta = %e\n", j, Dn, delta);
    j++;
    if (delta > 0.001)
      for (i = 0; i < m; i++) {
        if (n[i] != 0) {
          norm(&cent[i * k], k, n[i]);
          memcpy(&cb[i * k], &cent[i * k], k * sizeof(float));
        }
      }
  } while (delta > 0.001);
  fvq = fopen(argv[4], "wt");
  if (fvq == NULL) {
    printf("Error opening VQ file: %s\n", argv[4]);
    exit(1);
  }
  fprintf(fvq, "%ld %ld\n", k, m);
  for (j = 0; j < m; j++) {
    for (i = 0; i < k; i++)
      fprintf(fvq, "%f  ", cb[j * k + i]);
    fprintf(fvq, "\n");
  }
  fclose(fvq);
  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   $0x6,-0x8(%rbp)
je     1228 <main+0x38>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %edi,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe03(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    126b <main+0x7b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10f0 <atol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10f0 <atol@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1040 <atof@plt>
movss  %xmm0,-0x84(%rbp)
ff
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
movss  -0x84(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xdaa(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x2,%rax
imul   -0x20(%rbp),%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x2,%rax
imul   -0x20(%rbp),%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1346 <main+0x156>
cmpq   $0x0,-0x30(%rbp)
je     1346 <main+0x156>
cmpq   $0x0,-0x38(%rbp)
je     1346 <main+0x156>
cmpq   $0x0,-0x28(%rbp)
jne    135e <main+0x16e>
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
movq   $0x0,-0x48(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x78(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
cmp    -0x18(%rbp),%rax
jne    1397 <main+0x1a7>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1366 <main+0x176>
mov    -0x48(%rbp),%rsi
lea    0xd0b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x78(%rbp),%rdi
call   1080 <rewind@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
imul   -0x20(%rbp),%rdx
mov    -0x78(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
movss  0xc2b(%rip),%xmm0
movss  %xmm0,-0x68(%rbp)
movq   $0x1,-0x58(%rbp)
movss  -0x68(%rbp),%xmm0
movss  %xmm0,-0x6c(%rbp)
movq   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1440 <main+0x250>
mov    -0x38(%rbp),%rdi
mov    -0x50(%rbp),%rax
imul   -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   10e0 <zero@plt>
mov    -0x40(%rbp),%rax
mov    -0x50(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    13f4 <main+0x204>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x64(%rbp)
mov    -0x78(%rbp),%rdi
call   1080 <rewind@plt>
movq   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
jge    14e8 <main+0x2f8>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x78(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
movss  -0x84(%rbp),%xmm0
ff
lea    -0x64(%rbp),%r8
call   1090 <quantise@plt>
mov    %rax,-0x60(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
add    $0x1,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x38(%rbp),%rdi
mov    -0x60(%rbp),%rax
imul   -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1060 <acc@plt>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    1459 <main+0x269>
movss  -0x64(%rbp),%xmm0
cvtsi2ssq -0x48(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x68(%rbp)
movss  -0x6c(%rbp),%xmm0
subss  -0x68(%rbp),%xmm0
divss  -0x68(%rbp),%xmm0
movss  %xmm0,-0x70(%rbp)
mov    -0x58(%rbp),%rsi
movss  -0x68(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x70(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xb9f(%rip),%rdi
mov    $0x2,%al
call   1070 <printf@plt>
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
movss  -0x70(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xab7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    15fd <main+0x40d>
movq   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    15f8 <main+0x408>
mov    -0x40(%rbp),%rax
mov    -0x50(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     15e2 <main+0x3f2>
mov    -0x38(%rbp),%rdi
mov    -0x50(%rbp),%rax
imul   -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x40(%rbp),%rax
mov    -0x50(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
call   10b0 <norm@plt>
mov    -0x30(%rbp),%rdi
mov    -0x50(%rbp),%rax
imul   -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x38(%rbp),%rsi
mov    -0x50(%rbp),%rax
imul   -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x18(%rbp),%rdx
shl    $0x2,%rdx
call   10c0 <memcpy@plt>
jmp    15e7 <main+0x3f7>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    1563 <main+0x373>
jmp    15fd <main+0x40d>
jmp    1602 <main+0x412>
movss  -0x70(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x9f5(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     13e2 <main+0x1f2>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xac7(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
jne    1660 <main+0x470>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
lea    0xaa7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xa9e(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movq   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1706 <main+0x516>
movq   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    16e3 <main+0x4f3>
mov    -0x80(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    -0x58(%rbp),%rcx
imul   -0x18(%rbp),%rcx
add    -0x50(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xa4f(%rip),%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    1698 <main+0x4a8>
mov    -0x80(%rbp),%rdi
lea    0x9bd(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    1682 <main+0x492>
mov    -0x80(%rbp),%rdi
call   1050 <fclose@plt>
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    $0x68,%rsp
cmp    $0x6,%edi
jne    15eb <main+0x3db>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xddb(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,0x20(%rsp)
test   %rax,%rax
je     15fe <main+0x3ee>
mov    0x10(%rbx),%rdi
call   1110 <atol@plt>
mov    %rax,%r13
mov    0x18(%rbx),%rdi
call   1110 <atol@plt>
mov    %rax,%r12
mov    %rbx,0x50(%rsp)
mov    0x28(%rbx),%rdi
call   1050 <atof@plt>
movss  %xmm0,0x34(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xdbe(%rip),%rdi
mov    %r13,%rsi
mov    %r12,%rdx
mov    $0x1,%al
call   1080 <printf@plt>
lea    0x0(,%r13,4),%rbx
mov    %ebx,%edi
call   10f0 <malloc@plt>
mov    %rax,%r14
mov    %r12d,%ebp
mov    %rbx,0x8(%rsp)
imul   %ebx,%ebp
mov    %ebp,%edi
call   10f0 <malloc@plt>
mov    %rax,(%rsp)
mov    %ebp,%edi
call   10f0 <malloc@plt>
mov    %rax,%rbx
lea    0x0(,%r12,8),%edi
call   10f0 <malloc@plt>
mov    (%rsp),%rcx
test   %rcx,%rcx
je     160b <main+0x3fb>
test   %rbx,%rbx
je     160b <main+0x3fb>
test   %r14,%r14
je     160b <main+0x3fb>
mov    %rax,%r15
mov    %rbx,0x28(%rsp)
mov    $0xffffffffffffffff,%rbp
mov    0x20(%rsp),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
mov    $0x4,%esi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1040 <fread@plt>
add    $0x1,%rbp
cmp    %r13,%rax
je     1300 <main+0xf0>
mov    %r14,0x60(%rsp)
lea    0xd49(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
call   1090 <rewind@plt>
mov    %r12,%rdx
imul   %r13,%rdx
mov    (%rsp),%rdi
mov    $0x4,%esi
mov    %rbx,%rcx
call   1040 <fread@plt>
mov    %rbp,0x38(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %rbp,%xmm0
movss  %xmm0,0x30(%rsp)
mov    $0x1,%eax
mov    %rax,0x40(%rsp)
movss  0xc89(%rip),%xmm0
mov    0x8(%rsp),%r14
mov    %r15,0x48(%rsp)
jmp    139c <main+0x18c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movapd %xmm1,%xmm0
mov    %rbx,%r12
mov    0x8(%rsp),%r14
movss  %xmm0,0x18(%rsp)
test   %r12,%r12
jle    13cf <main+0x1bf>
mov    0x28(%rsp),%rbp
xor    %ebx,%ebx
xchg   %ax,%ax
mov    %rbp,%rdi
mov    %r13,%rsi
call   1100 <zero@plt>
movq   $0x0,(%r15,%rbx,8)
add    $0x1,%rbx
add    %r14,%rbp
cmp    %rbx,%r12
jne    13b0 <main+0x1a0>
movl   $0x0,0x14(%rsp)
mov    0x20(%rsp),%rdi
call   1090 <rewind@plt>
cmpq   $0x0,0x38(%rsp)
mov    0x60(%rsp),%r14
mov    (%rsp),%rbx
je     1454 <main+0x244>
mov    0x38(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x4,%esi
mov    %r13,%rdx
mov    0x20(%rsp),%rcx
call   1040 <fread@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
movss  0x34(%rsp),%xmm0
lea    0x14(%rsp),%r8
call   10a0 <quantise@plt>
addq   $0x1,(%r15,%rax,8)
imul   %r13,%rax
mov    0x28(%rsp),%rcx
lea    (%rcx,%rax,4),%rdi
mov    %r14,%rsi
mov    %r13,%rdx
call   1070 <acc@plt>
add    $0xffffffffffffffff,%rbp
jne    1400 <main+0x1f0>
movss  0x14(%rsp),%xmm0
divss  0x30(%rsp),%xmm0
movss  0x18(%rsp),%xmm1
subss  %xmm0,%xmm1
divss  %xmm0,%xmm1
movss  %xmm0,0x10(%rsp)
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movsd  %xmm1,0x18(%rsp)
lea    0xc07(%rip),%rdi
mov    0x40(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x2,%al
call   1080 <printf@plt>
movsd  0x18(%rsp),%xmm0
ucomisd 0xb62(%rip),%xmm0
jbe    1527 <main+0x317>
add    $0x1,%rbx
mov    %rbx,0x40(%rsp)
movss  0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
test   %r12,%r12
mov    0x48(%rsp),%r15
mov    0x8(%rsp),%r14
jle    139c <main+0x18c>
mov    %r12,%rbx
mov    0x28(%rsp),%r12
mov    (%rsp),%r14
xor    %ebp,%ebp
jmp    14f8 <main+0x2e8>
xchg   %ax,%ax
add    $0x1,%rbp
add    %r15,%r14
add    %r15,%r12
cmp    %rbp,%rbx
mov    0x48(%rsp),%r15
je     1390 <main+0x180>
mov    (%r15,%rbp,8),%rdx
test   %rdx,%rdx
mov    0x8(%rsp),%r15
je     14e0 <main+0x2d0>
mov    %r12,%rdi
mov    %r13,%rsi
call   10d0 <norm@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   10e0 <memcpy@plt>
movss  0x10(%rsp),%xmm1
jmp    14e0 <main+0x2d0>
mov    0x50(%rsp),%r14
mov    0x20(%r14),%rdi
lea    0xb80(%rip),%rsi
call   1120 <fopen@plt>
test   %rax,%rax
je     1621 <main+0x411>
mov    %rax,%rbp
mov    %r12,%rbx
lea    0xb83(%rip),%rsi
mov    %rax,%rdi
mov    %r13,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   10c0 <fprintf@plt>
test   %r12,%r12
jle    15d2 <main+0x3c2>
xor    %r12d,%r12d
lea    0xb6d(%rip),%r15
mov    %rbx,0x58(%rsp)
jmp    15a4 <main+0x394>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %rbp,%rsi
call   10b0 <fputc@plt>
add    $0x1,%r12
add    0x8(%rsp),%r14
mov    %r14,(%rsp)
mov    0x58(%rsp),%rbx
cmp    %rbx,%r12
je     15d2 <main+0x3c2>
test   %r13,%r13
mov    (%rsp),%r14
jle    1580 <main+0x370>
xor    %ebx,%ebx
nop
movss  (%r14,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x1,%al
call   10c0 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    15b0 <main+0x3a0>
jmp    1580 <main+0x370>
mov    %rbp,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb02(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1130 <exit@plt>
mov    0x8(%rbx),%rsi
lea    0xa0a(%rip),%rdi
jmp    162c <main+0x41c>
lea    0xad1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    0x20(%r14),%rsi
lea    0xa8e(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"usage: vqtrain TrainFile K M VQFile clip\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 = [52 x i8] c"dimension K=%ld number of entries M=%ld clip = %f\0A\00"
@.str.4 = [18 x i8] c"Error in malloc.\0A\00"
@.str.5 = [31 x i8] c"J=%ld entries in training set\0A\00"
@.str.6 = [39 x i8] c"\0D Iteration %ld, Dn = %f, Delta = %e\0A\00"
@.str.7 = [3 x i8] c"wt\00"
@.str.8 = [27 x i8] c"Error opening VQ file: %s\0A\00"
@.str.9 = [9 x i8] c"%ld %ld\0A\00"
@.str.10 = [5 x i8] c"%f \00"
@.str.11 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca float*
%9 = alloca float*
%10 = alloca float*
%11 = alloca i64*
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%23 = load i32, i32* %4
%24 = icmp ne i32 %23, 6
br i1 %24, label %25, label %28
25: ; preds = %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @exit(i32 0)
unreachable
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %32, i32** %20
%33 = load i32*, i32** %20
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %41
35: ; preds = %28
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %38)
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %28
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 2
%44 = load i8*, i8** %43
%45 = call i64 @atol(i8* %44)
store i64 %45, i64* %6
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 3
%48 = load i8*, i8** %47
%49 = call i64 @atol(i8* %48)
store i64 %49, i64* %7
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 5
%52 = load i8*, i8** %51
%53 = call float @atof(i8* %52)
store float %53, float* %22
%54 = load i64, i64* %6
%55 = load i64, i64* %7
%56 = load float, float* %22
%57 = fpext float %56 to double
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i64 %54, i64 %55, double %57)
%59 = load i64, i64* %6
%60 = mul i64 4, %59
%61 = trunc i64 %60 to i32
%62 = call i64 @malloc(i32 %61)
%63 = inttoptr i64 %62 to float*
store float* %63, float** %8
%64 = load i64, i64* %6
%65 = mul i64 4, %64
%66 = load i64, i64* %7
%67 = mul i64 %65, %66
%68 = trunc i64 %67 to i32
%69 = call i64 @malloc(i32 %68)
%70 = inttoptr i64 %69 to float*
store float* %70, float** %9
%71 = load i64, i64* %6
%72 = mul i64 4, %71
%73 = load i64, i64* %7
%74 = mul i64 %72, %73
%75 = trunc i64 %74 to i32
%76 = call i64 @malloc(i32 %75)
%77 = inttoptr i64 %76 to float*
store float* %77, float** %10
%78 = load i64, i64* %7
%79 = mul i64 8, %78
%80 = trunc i64 %79 to i32
%81 = call i64 @malloc(i32 %80)
%82 = inttoptr i64 %81 to i64*
store i64* %82, i64** %11
%83 = load float*, float** %9
%84 = icmp eq float* %83, null
br i1 %84, label %94, label %85
85: ; preds = %41
%86 = load float*, float** %9
%87 = icmp eq float* %86, null
br i1 %87, label %94, label %88
88: ; preds = %85
%89 = load float*, float** %10
%90 = icmp eq float* %89, null
br i1 %90, label %94, label %91
91: ; preds = %88
%92 = load float*, float** %8
%93 = icmp eq float* %92, null
br i1 %93, label %94, label %97
94: ; preds = %91, %88, %85, %41
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%96 = call i32 @exit(i32 1)
unreachable
97: ; preds = %91
store i64 0, i64* %12
br label %98
98: ; preds = %105, %97
%99 = load float*, float** %8
%100 = load i64, i64* %6
%101 = load i32*, i32** %20
%102 = call i64 @fread(float* %99, i32 4, i64 %100, i32* %101)
%103 = load i64, i64* %6
%104 = icmp eq i64 %102, %103
br i1 %104, label %105, label %108
105: ; preds = %98
%106 = load i64, i64* %12
%107 = add nsw i64 %106, 1
store i64 %107, i64* %12
br label %98
108: ; preds = %98
%109 = load i64, i64* %12
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i64 %109)
%111 = load i32*, i32** %20
%112 = call i32 @rewind(i32* %111)
%113 = load float*, float** %9
%114 = load i64, i64* %6
%115 = load i64, i64* %7
%116 = mul nsw i64 %114, %115
%117 = load i32*, i32** %20
%118 = call i64 @fread(float* %113, i32 4, i64 %116, i32* %117)
store float 0x4693B8B5C0000000, float* %17
store i64 1, i64* %14
br label %119
119: ; preds = %236, %108
%120 = load float, float* %17
store float %120, float* %18
store i64 0, i64* %13
br label %121
121: ; preds = %136, %119
%122 = load i64, i64* %13
%123 = load i64, i64* %7
%124 = icmp slt i64 %122, %123
br i1 %124, label %125, label %139
125: ; preds = %121
%126 = load float*, float** %10
%127 = load i64, i64* %13
%128 = load i64, i64* %6
%129 = mul nsw i64 %127, %128
%130 = getelementptr inbounds float, float* %126, i64 %129
%131 = load i64, i64* %6
%132 = call i32 @zero(float* %130, i64 %131)
%133 = load i64*, i64** %11
%134 = load i64, i64* %13
%135 = getelementptr inbounds i64, i64* %133, i64 %134
store i64 0, i64* %135
br label %136
136: ; preds = %125
%137 = load i64, i64* %13
%138 = add nsw i64 %137, 1
store i64 %138, i64* %13
br label %121
139: ; preds = %121
store float 0.000000e+00, float* %16
%140 = load i32*, i32** %20
%141 = call i32 @rewind(i32* %140)
store i64 0, i64* %13
br label %142
142: ; preds = %170, %139
%143 = load i64, i64* %13
%144 = load i64, i64* %12
%145 = icmp slt i64 %143, %144
br i1 %145, label %146, label %173
146: ; preds = %142
%147 = load float*, float** %8
%148 = load i64, i64* %6
%149 = load i32*, i32** %20
%150 = call i64 @fread(float* %147, i32 4, i64 %148, i32* %149)
%151 = load float*, float** %9
%152 = load float*, float** %8
%153 = load i64, i64* %6
%154 = load i64, i64* %7
%155 = load float, float* %22
%156 = call i64 @quantise(float* %151, float* %152, i64 %153, i64 %154, float %155, float* %16)
store i64 %156, i64* %15
%157 = load i64*, i64** %11
%158 = load i64, i64* %15
%159 = getelementptr inbounds i64, i64* %157, i64 %158
%160 = load i64, i64* %159
%161 = add nsw i64 %160, 1
store i64 %161, i64* %159
%162 = load float*, float** %10
%163 = load i64, i64* %15
%164 = load i64, i64* %6
%165 = mul nsw i64 %163, %164
%166 = getelementptr inbounds float, float* %162, i64 %165
%167 = load float*, float** %8
%168 = load i64, i64* %6
%169 = call i32 @acc(float* %166, float* %167, i64 %168)
br label %170
170: ; preds = %146
%171 = load i64, i64* %13
%172 = add nsw i64 %171, 1
store i64 %172, i64* %13
br label %142
173: ; preds = %142
%174 = load float, float* %16
%175 = load i64, i64* %12
%176 = sitofp i64 %175 to float
%177 = fdiv float %174, %176
store float %177, float* %17
%178 = load float, float* %18
%179 = load float, float* %17
%180 = fsub float %178, %179
%181 = load float, float* %17
%182 = fdiv float %180, %181
store float %182, float* %19
%183 = load i64, i64* %14
%184 = load float, float* %17
%185 = fpext float %184 to double
%186 = load float, float* %19
%187 = fpext float %186 to double
%188 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i64 %183, double %185, double %187)
%189 = load i64, i64* %14
%190 = add nsw i64 %189, 1
store i64 %190, i64* %14
%191 = load float, float* %19
%192 = fpext float %191 to double
%193 = fcmp ogt double %192, 1.000000e-03
br i1 %193, label %194, label %235
194: ; preds = %173
store i64 0, i64* %13
br label %195
195: ; preds = %231, %194
%196 = load i64, i64* %13
%197 = load i64, i64* %7
%198 = icmp slt i64 %196, %197
br i1 %198, label %199, label %234
199: ; preds = %195
%200 = load i64*, i64** %11
%201 = load i64, i64* %13
%202 = getelementptr inbounds i64, i64* %200, i64 %201
%203 = load i64, i64* %202
%204 = icmp ne i64 %203, 0
br i1 %204, label %205, label %230
205: ; preds = %199
%206 = load float*, float** %10
%207 = load i64, i64* %13
%208 = load i64, i64* %6
%209 = mul nsw i64 %207, %208
%210 = getelementptr inbounds float, float* %206, i64 %209
%211 = load i64, i64* %6
%212 = load i64*, i64** %11
%213 = load i64, i64* %13
%214 = getelementptr inbounds i64, i64* %212, i64 %213
%215 = load i64, i64* %214
%216 = call i32 @norm(float* %210, i64 %211, i64 %215)
%217 = load float*, float** %9
%218 = load i64, i64* %13
%219 = load i64, i64* %6
%220 = mul nsw i64 %218, %219
%221 = getelementptr inbounds float, float* %217, i64 %220
%222 = load float*, float** %10
%223 = load i64, i64* %13
%224 = load i64, i64* %6
%225 = mul nsw i64 %223, %224
%226 = getelementptr inbounds float, float* %222, i64 %225
%227 = load i64, i64* %6
%228 = mul i64 %227, 4
%229 = call i32 @memcpy(float* %221, float* %226, i64 %228)
br label %230
230: ; preds = %205, %199
br label %231
231: ; preds = %230
%232 = load i64, i64* %13
%233 = add nsw i64 %232, 1
store i64 %233, i64* %13
br label %195
234: ; preds = %195
br label %235
235: ; preds = %234, %173
br label %236
236: ; preds = %235
%237 = load float, float* %19
%238 = fpext float %237 to double
%239 = fcmp ogt double %238, 1.000000e-03
br i1 %239, label %119, label %240
240: ; preds = %236
%241 = load i8**, i8*** %5
%242 = getelementptr inbounds i8*, i8** %241, i64 4
%243 = load i8*, i8** %242
%244 = call i32* @fopen(i8* %243, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
store i32* %244, i32** %21
%245 = load i32*, i32** %21
%246 = icmp eq i32* %245, null
br i1 %246, label %247, label %253
247: ; preds = %240
%248 = load i8**, i8*** %5
%249 = getelementptr inbounds i8*, i8** %248, i64 4
%250 = load i8*, i8** %249
%251 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* %250)
%252 = call i32 @exit(i32 1)
unreachable
253: ; preds = %240
%254 = load i32*, i32** %21
%255 = load i64, i64* %6
%256 = load i64, i64* %7
%257 = call i32 (i32*, i8*, ...) @fprintf(i32* %254, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i64 %255, i64 %256)
store i64 0, i64* %14
br label %258
258: ; preds = %285, %253
%259 = load i64, i64* %14
%260 = load i64, i64* %7
%261 = icmp slt i64 %259, %260
br i1 %261, label %262, label %288
262: ; preds = %258
store i64 0, i64* %13
br label %263
263: ; preds = %279, %262
%264 = load i64, i64* %13
%265 = load i64, i64* %6
%266 = icmp slt i64 %264, %265
br i1 %266, label %267, label %282
267: ; preds = %263
%268 = load i32*, i32** %21
%269 = load float*, float** %9
%270 = load i64, i64* %14
%271 = load i64, i64* %6
%272 = mul nsw i64 %270, %271
%273 = load i64, i64* %13
%274 = add nsw i64 %272, %273
%275 = getelementptr inbounds float, float* %269, i64 %274
%276 = load float, float* %275
%277 = fpext float %276 to double
%278 = call i32 (i32*, i8*, ...) @fprintf(i32* %268, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), double %277)
br label %279
279: ; preds = %267
%280 = load i64, i64* %13
%281 = add nsw i64 %280, 1
store i64 %281, i64* %13
br label %263
282: ; preds = %263
%283 = load i32*, i32** %21
%284 = call i32 (i32*, i8*, ...) @fprintf(i32* %283, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
br label %285
285: ; preds = %282
%286 = load i64, i64* %14
%287 = add nsw i64 %286, 1
store i64 %287, i64* %14
br label %258
288: ; preds = %258
%289 = load i32*, i32** %21
%290 = call i32 @fclose(i32* %289)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [42 x i8] c"Error opening training database file: %s\0A\00"
@.str.3 = [52 x i8] c"dimension K=%ld number of entries M=%ld clip = %f\0A\00"
@.str.5 = [31 x i8] c"J=%ld entries in training set\0A\00"
@.str.6 = [39 x i8] c"\0D Iteration %ld, Dn = %f, Delta = %e\0A\00"
@.str.7 = [3 x i8] c"wt\00"
@.str.8 = [27 x i8] c"Error opening VQ file: %s\0A\00"
@.str.9 = [9 x i8] c"%ld %ld\0A\00"
@.str.10 = [5 x i8] c"%f \00"
@str = [17 x i8] c"Error in malloc.\00"
@str.12 = [41 x i8] c"usage: vqtrain TrainFile K M VQFile clip\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca float
%4 = bitcast float* %3 to i8*
%5 = icmp eq i32 %0, 6
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.12, i64 0, i64 0))
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i8*, i8** %10
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %9
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i64 @atol(i8* %20)
%22 = getelementptr inbounds i8*, i8** %1, i64 3
%23 = load i8*, i8** %22
%24 = tail call i64 @atol(i8* %23)
%25 = getelementptr inbounds i8*, i8** %1, i64 5
%26 = load i8*, i8** %25
%27 = tail call float @atof(i8* %26)
%28 = fpext float %27 to double
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i64 %21, i64 %24, double %28)
%30 = shl i64 %21, 2
%31 = trunc i64 %30 to i32
%32 = tail call i64 @malloc(i32 %31)
%33 = inttoptr i64 %32 to float*
%34 = mul i64 %24, %30
%35 = trunc i64 %34 to i32
%36 = tail call i64 @malloc(i32 %35)
%37 = inttoptr i64 %36 to float*
%38 = tail call i64 @malloc(i32 %35)
%39 = inttoptr i64 %38 to float*
%40 = trunc i64 %24 to i32
%41 = shl i32 %40, 3
%42 = tail call i64 @malloc(i32 %41)
%43 = inttoptr i64 %42 to i64*
%44 = icmp eq i64 %36, 0
%45 = icmp eq i64 %38, 0
%46 = select i1 %44, i1 true, i1 %45
%47 = icmp eq i64 %32, 0
%48 = select i1 %46, i1 true, i1 %47
br i1 %48, label %49, label %52
49: ; preds = %18
%50 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%51 = tail call i32 @exit(i32 1)
unreachable
52: ; preds = %18, %52
%53 = phi i64 [ %56, %52 ], [ 0, %18 ]
%54 = tail call i64 @fread(float* %33, i32 4, i64 %21, i32* %12)
%55 = icmp eq i64 %54, %21
%56 = add nuw nsw i64 %53, 1
br i1 %55, label %52, label %57
57: ; preds = %52
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i64 %53)
%59 = tail call i32 @rewind(i32* %12)
%60 = mul nsw i64 %24, %21
%61 = tail call i64 @fread(float* %37, i32 4, i64 %60, i32* %12)
%62 = icmp sgt i64 %24, 0
%63 = icmp eq i64 %53, 0
%64 = sitofp i64 %53 to float
br label %65
65: ; preds = %101, %57
%66 = phi float [ 0x4693B8B5C0000000, %57 ], [ %92, %101 ]
%67 = phi i64 [ 1, %57 ], [ %98, %101 ]
br i1 %62, label %68, label %76
68: ; preds = %65, %68
%69 = phi i64 [ %74, %68 ], [ 0, %65 ]
%70 = mul nsw i64 %69, %21
%71 = getelementptr inbounds float, float* %39, i64 %70
%72 = call i32 @zero(float* %71, i64 %21)
%73 = getelementptr inbounds i64, i64* %43, i64 %69
store i64 0, i64* %73
%74 = add nuw nsw i64 %69, 1
%75 = icmp eq i64 %74, %24
br i1 %75, label %76, label %68
76: ; preds = %68, %65
store float 0.000000e+00, float* %3
%77 = call i32 @rewind(i32* %12)
br i1 %63, label %90, label %78
78: ; preds = %76, %78
%79 = phi i64 [ %88, %78 ], [ 0, %76 ]
%80 = call i64 @fread(float* %33, i32 4, i64 %21, i32* %12)
%81 = call i64 @quantise(float* %37, float* %33, i64 %21, i64 %24, float %27, float* %3)
%82 = getelementptr inbounds i64, i64* %43, i64 %81
%83 = load i64, i64* %82
%84 = add nsw i64 %83, 1
store i64 %84, i64* %82
%85 = mul nsw i64 %81, %21
%86 = getelementptr inbounds float, float* %39, i64 %85
%87 = call i32 @acc(float* %86, float* %33, i64 %21)
%88 = add nuw nsw i64 %79, 1
%89 = icmp eq i64 %88, %53
br i1 %89, label %90, label %78
90: ; preds = %78, %76
%91 = load float, float* %3
%92 = fdiv float %91, %64
%93 = fsub float %66, %92
%94 = fdiv float %93, %92
%95 = fpext float %92 to double
%96 = fpext float %94 to double
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i64 %67, double %95, double %96)
%98 = add nuw nsw i64 %67, 1
%99 = fcmp ogt double %96, 1.000000e-03
br i1 %99, label %100, label %116
100: ; preds = %90
br i1 %62, label %102, label %101
101: ; preds = %113, %100
br label %65
102: ; preds = %100, %113
%103 = phi i64 [ %114, %113 ], [ 0, %100 ]
%104 = getelementptr inbounds i64, i64* %43, i64 %103
%105 = load i64, i64* %104
%106 = icmp eq i64 %105, 0
br i1 %106, label %113, label %107
107: ; preds = %102
%108 = mul nsw i64 %103, %21
%109 = getelementptr inbounds float, float* %39, i64 %108
%110 = call i32 @norm(float* %109, i64 %21, i64 %105)
%111 = getelementptr inbounds float, float* %37, i64 %108
%112 = call i32 @memcpy(float* %111, float* %109, i64 %30)
br label %113
113: ; preds = %102, %107
%114 = add nuw nsw i64 %103, 1
%115 = icmp eq i64 %114, %24
br i1 %115, label %101, label %102
116: ; preds = %90
%117 = getelementptr inbounds i8*, i8** %1, i64 4
%118 = load i8*, i8** %117
%119 = call i32* @fopen(i8* %118, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%120 = icmp eq i32* %119, null
br i1 %120, label %121, label %125
121: ; preds = %116
%122 = load i8*, i8** %117
%123 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* %122)
%124 = call i32 @exit(i32 1)
unreachable
125: ; preds = %116
%126 = call i32 (i32*, i8*, ...) @fprintf(i32* %119, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i64 %21, i64 %24)
br i1 %62, label %127, label %146
127: ; preds = %125
%128 = icmp sgt i64 %21, 0
br label %129
129: ; preds = %127, %142
%130 = phi i64 [ 0, %127 ], [ %144, %142 ]
br i1 %128, label %131, label %142
131: ; preds = %129
%132 = mul nsw i64 %130, %21
br label %133
133: ; preds = %131, %133
%134 = phi i64 [ 0, %131 ], [ %140, %133 ]
%135 = add nsw i64 %134, %132
%136 = getelementptr inbounds float, float* %37, i64 %135
%137 = load float, float* %136
%138 = fpext float %137 to double
%139 = call i32 (i32*, i8*, ...) @fprintf(i32* %119, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), double %138)
%140 = add nuw nsw i64 %134, 1
%141 = icmp eq i64 %140, %21
br i1 %141, label %142, label %133
142: ; preds = %133, %129
%143 = call i32 @fputc(i32 10, i32* %119)
%144 = add nuw nsw i64 %130, 1
%145 = icmp eq i64 %144, %24
br i1 %145, label %146, label %129
146: ; preds = %142, %125
%147 = call i32 @fclose(i32* %119)
ret i32 0
}