#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 uint32_t;
typedef int uint16_t;
typedef int /*<<< orphan*/ outfile;
typedef scalar_t__ int16_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
scalar_t__ memcmp(unsigned char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ saveVOCSample(char *, int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, int, int, int);
int /*<<< orphan*/ stderr;
char *strrchr(char const *, char);
int tuneToVOCFreqDiv(scalar_t__);
int parseMX(const char *filename) {
  char basename[256];
  const char *p;
  FILE *f;
  unsigned char buffer[64];
  int i;
  int count;
  uint16_t flags;
  uint16_t songs_number;
  uint16_t song;
  uint16_t samples_number;
  uint16_t sample;
  uint32_t line_count;
  int16_t tune;
  uint16_t octaveCount;
  uint16_t octave;
  uint32_t attackLen;
  uint32_t sustainLen;
  uint16_t attackCount;
  uint16_t releaseCount;
  f = fopen(filename, "rb");
  if (f == NULL) {
    return -1;
  }
  p = strrchr(filename, '/');
  if (p == NULL)
    p = filename;
  else
    p++;
  i = 0;
  while (*p != '\0') {
    basename[i] = (*p == '.') ? '_' : *p;
    i++;
    p++;
  }
  basename[i] = '\0';
  fread(buffer, 1, 4, f);
  if (memcmp(buffer, "MXTX", 4) != 0) {
    fprintf(stderr, "not a MXTX file\n");
    return -1;
  }
  printf("%.4s ", buffer);
  fread(buffer, 1, 2, f);
  count = buffer[0] << 8 | buffer[1];
  printf("count=%d", count);
  fread(buffer, 1, 2, f);
  flags = buffer[0] << 8 | buffer[1];
  printf(" flags=%04hx", flags);
  if (flags & 0x8000) {
    fseek(f, 256, SEEK_CUR);
  }
  fread(buffer, 1, 2, f);
  songs_number = buffer[0] << 8 | buffer[1];
  printf(" songs_number=%d\n", songs_number);
  for (song = 0; song < songs_number; song++) {
    fread(buffer, 1, 4, f);
    line_count = buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3];
    printf("song #%2d: line_count=%u\n", song, line_count);
    for (i = 0; i < (int)line_count; i++) {
      fread(buffer, 1, 6, f);
      printf("    line #%2d: %02X %02X %02X%02X %02X%02X\n", i, buffer[0],
             buffer[1], buffer[2], buffer[3], buffer[4], buffer[5]);
    }
  }
  fread(buffer, 1, 2, f);
  samples_number = buffer[0] << 8 | buffer[1];
  printf("%hu samples\n", samples_number);
  for (sample = 0; sample < samples_number; sample++) {
    fread(buffer, 1, 20, f);
    tune = (int16_t)(buffer[2] << 8 | buffer[3]);
    octaveCount = buffer[6] << 8 | buffer[7];
    attackLen =
        buffer[8] << 24 | buffer[9] << 16 | buffer[10] << 8 | buffer[11];
    sustainLen =
        buffer[12] << 24 | buffer[13] << 16 | buffer[14] << 8 | buffer[15];
    attackCount = buffer[16] << 8 | buffer[17];
    releaseCount = buffer[18] << 8 | buffer[19];
    printf("sample #%02d: %02X%02X %02X%02X %02X%02X"
           " %02X%02X %02X%02X%02X%02X"
           " %02X%02X%02X%02X %02X%02X"
           " %02X%02X\n",
           sample, buffer[0], buffer[1], buffer[2], buffer[3], buffer[4],
           buffer[5], buffer[6], buffer[7], buffer[8], buffer[9], buffer[10],
           buffer[11], buffer[12], buffer[13], buffer[14], buffer[15],
           buffer[16], buffer[17], buffer[18], buffer[19]);
    for (i = 0; i < attackCount; i++) {
      fread(buffer, 1, 4, f);
      printf("   attack  %02X%02X %02X%02X\n", buffer[0], buffer[1], buffer[2],
             buffer[3]);
    }
    for (i = 0; i < releaseCount; i++) {
      fread(buffer, 1, 4, f);
      printf("   release %02X%02X %02X%02X\n", buffer[0], buffer[1], buffer[2],
             buffer[3]);
    }
    for (octave = 0; octave < octaveCount; octave++) {
      int freq = tuneToVOCFreqDiv(tune);
      char outfile[1024];
      snprintf(outfile, sizeof(outfile), "%s_%02hx_%hd_%04hx.VOC", basename,
               sample, octave, (uint16_t)tune);
      if (saveVOCSample(outfile, f, (attackLen + sustainLen), freq) < 0) {
        fclose(f);
        return -1;
      }
      printf("%s saved.\n", outfile);
      attackLen *= 2;
      sustainLen *= 2;
    }
  }
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<parseMX>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x668,%rsp
mov    %rdi,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xe2d(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x150(%rbp)
cmpq   $0x0,-0x150(%rbp)
jne    11f9 <parseMX+0x49>
movl   $0xffffffff,-0x2c(%rbp)
jmp    1a35 <parseMX+0x885>
mov    -0x38(%rbp),%rdi
mov    $0x2f,%esi
call   1080 <strrchr@plt>
mov    %rax,-0x148(%rbp)
cmpq   $0x0,-0x148(%rbp)
jne    122c <parseMX+0x7c>
mov    -0x38(%rbp),%rax
mov    %rax,-0x148(%rbp)
jmp    123e <parseMX+0x8e>
mov    -0x148(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x148(%rbp)
movl   $0x0,-0x194(%rbp)
mov    -0x148(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     12ca <parseMX+0x11a>
mov    -0x148(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    127e <parseMX+0xce>
mov    $0x5f,%eax
mov    %eax,-0x5e4(%rbp)
jmp    128e <parseMX+0xde>
mov    -0x148(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x5e4(%rbp)
mov    -0x5e4(%rbp),%eax
mov    %al,%cl
movslq -0x194(%rbp),%rax
mov    %cl,-0x140(%rbp,%rax,1)
mov    -0x194(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x194(%rbp)
mov    -0x148(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x148(%rbp)
jmp    1248 <parseMX+0x98>
movslq -0x194(%rbp),%rax
movb   $0x0,-0x140(%rbp,%rax,1)
lea    -0x190(%rbp),%rdi
mov    -0x150(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
lea    -0x190(%rbp),%rdi
lea    0xcff(%rip),%rsi
mov    $0x4,%edx
call   1090 <memcmp@plt>
cmp    $0x0,%rax
je     1339 <parseMX+0x189>
mov    0x2cb9(%rip),%rax
mov    (%rax),%edi
lea    0xce0(%rip),%rsi
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x2c(%rbp)
jmp    1a35 <parseMX+0x885>
lea    -0x190(%rbp),%rsi
lea    0xcd2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x190(%rbp),%rdi
mov    -0x150(%rbp),%rcx
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <fread@plt>
movzbl -0x190(%rbp),%eax
shl    $0x8,%eax
movzbl -0x18f(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x198(%rbp)
mov    -0x198(%rbp),%esi
lea    0xc8e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x190(%rbp),%rdi
mov    -0x150(%rbp),%rcx
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <fread@plt>
movzbl -0x190(%rbp),%eax
shl    $0x8,%eax
movzbl -0x18f(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x19c(%rbp)
mov    -0x19c(%rbp),%esi
lea    0xc4d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x19c(%rbp),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
je     1410 <parseMX+0x260>
mov    -0x150(%rbp),%rdi
mov    0x2be4(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   10b0 <fseek@plt>
lea    -0x190(%rbp),%rdi
mov    -0x150(%rbp),%rcx
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <fread@plt>
movzbl -0x190(%rbp),%eax
shl    $0x8,%eax
movzbl -0x18f(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x1a0(%rbp)
mov    -0x1a0(%rbp),%esi
lea    0xbe2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x1a4(%rbp)
mov    -0x1a4(%rbp),%eax
cmp    -0x1a0(%rbp),%eax
jge    158d <parseMX+0x3dd>
lea    -0x190(%rbp),%rdi
mov    -0x150(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
movzbl -0x190(%rbp),%eax
shl    $0x18,%eax
movzbl -0x18f(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x18e(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x18d(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x1b0(%rbp)
mov    -0x1a4(%rbp),%esi
mov    -0x1b0(%rbp),%edx
lea    0xb70(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x194(%rbp)
mov    -0x194(%rbp),%eax
cmp    -0x1b0(%rbp),%eax
jge    1574 <parseMX+0x3c4>
lea    -0x190(%rbp),%rdi
mov    -0x150(%rbp),%rcx
mov    $0x1,%esi
mov    $0x6,%edx
call   1030 <fread@plt>
mov    -0x194(%rbp),%esi
movzbl -0x190(%rbp),%edx
movzbl -0x18f(%rbp),%ecx
movzbl -0x18e(%rbp),%r8d
ff
movzbl -0x18d(%rbp),%r9d
ff
movzbl -0x18c(%rbp),%r10d
ff
movzbl -0x18b(%rbp),%eax
lea    0xb10(%rip),%rdi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x194(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x194(%rbp)
jmp    14e8 <parseMX+0x338>
jmp    1579 <parseMX+0x3c9>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1464 <parseMX+0x2b4>
lea    -0x190(%rbp),%rdi
mov    -0x150(%rbp),%rcx
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <fread@plt>
movzbl -0x190(%rbp),%eax
shl    $0x8,%eax
movzbl -0x18f(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%esi
lea    0xabd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jge    1a22 <parseMX+0x872>
lea    -0x190(%rbp),%rdi
mov    -0x150(%rbp),%rcx
mov    $0x1,%esi
mov    $0x14,%edx
call   1030 <fread@plt>
movzbl -0x18e(%rbp),%eax
shl    $0x8,%eax
movzbl -0x18d(%rbp),%ecx
or     %ecx,%eax
cltq
mov    %rax,-0x1b8(%rbp)
movzbl -0x18a(%rbp),%eax
shl    $0x8,%eax
movzbl -0x189(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x1bc(%rbp)
movzbl -0x188(%rbp),%eax
shl    $0x18,%eax
movzbl -0x187(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x186(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x185(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x1c4(%rbp)
movzbl -0x184(%rbp),%eax
shl    $0x18,%eax
movzbl -0x183(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x182(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x181(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x1c8(%rbp)
movzbl -0x180(%rbp),%eax
shl    $0x8,%eax
movzbl -0x17f(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x1cc(%rbp)
movzbl -0x17e(%rbp),%eax
shl    $0x8,%eax
movzbl -0x17d(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x1d0(%rbp)
mov    -0x1ac(%rbp),%esi
movzbl -0x190(%rbp),%edx
movzbl -0x18f(%rbp),%ecx
movzbl -0x18e(%rbp),%r8d
ff
movzbl -0x18d(%rbp),%r9d
ff
movzbl -0x18c(%rbp),%eax
movzbl -0x18b(%rbp),%edi
mov    %edi,-0x604(%rbp)
movzbl -0x18a(%rbp),%edi
mov    %edi,-0x600(%rbp)
movzbl -0x189(%rbp),%edi
mov    %edi,-0x5fc(%rbp)
movzbl -0x188(%rbp),%edi
mov    %edi,-0x5f8(%rbp)
movzbl -0x187(%rbp),%edi
mov    %edi,-0x5f4(%rbp)
movzbl -0x186(%rbp),%edi
mov    %edi,-0x5f0(%rbp)
movzbl -0x185(%rbp),%edi
mov    %edi,-0x5ec(%rbp)
movzbl -0x184(%rbp),%r13d
ff
movzbl -0x183(%rbp),%r12d
ff
movzbl -0x182(%rbp),%r15d
ff
movzbl -0x181(%rbp),%r14d
ff
movzbl -0x180(%rbp),%ebx
movzbl -0x17f(%rbp),%r11d
ff
movzbl -0x17e(%rbp),%r10d
ff
movzbl -0x17d(%rbp),%edi
mov    %edi,-0x5e8(%rbp)
lea    0x8f0(%rip),%rdi
mov    %eax,(%rsp)
mov    -0x604(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0x600(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    -0x5fc(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    -0x5f8(%rbp),%eax
mov    %eax,0x20(%rsp)
mov    -0x5f4(%rbp),%eax
mov    %eax,0x28(%rsp)
mov    -0x5f0(%rbp),%eax
mov    %eax,0x30(%rsp)
mov    -0x5ec(%rbp),%eax
mov    %eax,0x38(%rsp)
mov    -0x5e8(%rbp),%eax
mov    %r13d,0x40(%rsp)
mov    %r12d,0x48(%rsp)
mov    %r15d,0x50(%rsp)
mov    %r14d,0x58(%rsp)
mov    %ebx,0x60(%rsp)
mov    %r11d,0x68(%rsp)
mov    %r10d,0x70(%rsp)
mov    %eax,0x78(%rsp)
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x194(%rbp)
mov    -0x194(%rbp),%eax
cmp    -0x1cc(%rbp),%eax
jge    189e <parseMX+0x6ee>
lea    -0x190(%rbp),%rdi
mov    -0x150(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
movzbl -0x190(%rbp),%esi
movzbl -0x18f(%rbp),%edx
movzbl -0x18e(%rbp),%ecx
movzbl -0x18d(%rbp),%r8d
ff
lea    0x87e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x194(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x194(%rbp)
jmp    1830 <parseMX+0x680>
movl   $0x0,-0x194(%rbp)
mov    -0x194(%rbp),%eax
cmp    -0x1d0(%rbp),%eax
jge    1916 <parseMX+0x766>
lea    -0x190(%rbp),%rdi
mov    -0x150(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
movzbl -0x190(%rbp),%esi
movzbl -0x18f(%rbp),%edx
movzbl -0x18e(%rbp),%ecx
movzbl -0x18d(%rbp),%r8d
ff
lea    0x824(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x194(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x194(%rbp)
jmp    18a8 <parseMX+0x6f8>
movl   $0x0,-0x1c0(%rbp)
mov    -0x1c0(%rbp),%eax
cmp    -0x1bc(%rbp),%eax
jge    1a09 <parseMX+0x859>
mov    -0x1b8(%rbp),%rdi
call   1040 <tuneToVOCFreqDiv@plt>
mov    %eax,-0x1d4(%rbp)
lea    -0x5e0(%rbp),%rdi
lea    -0x140(%rbp),%rcx
mov    -0x1ac(%rbp),%r8d
mov    -0x1c0(%rbp),%r9d
mov    -0x1b8(%rbp),%rax
mov    $0x400,%esi
lea    0x7ca(%rip),%rdx
mov    %eax,(%rsp)
call   1070 <snprintf@plt>
lea    -0x5e0(%rbp),%rdi
mov    -0x150(%rbp),%rsi
mov    -0x1c4(%rbp),%edx
add    -0x1c8(%rbp),%edx
mov    -0x1d4(%rbp),%ecx
call   10c0 <saveVOCSample@plt>
cmp    $0x0,%rax
jge    19c2 <parseMX+0x812>
mov    -0x150(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0xffffffff,-0x2c(%rbp)
jmp    1a35 <parseMX+0x885>
lea    -0x5e0(%rbp),%rsi
lea    0x784(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x1c4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x1c4(%rbp)
mov    -0x1c8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x1c8(%rbp)
mov    -0x1c0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c0(%rbp)
jmp    1920 <parseMX+0x770>
jmp    1a0e <parseMX+0x85e>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    15e1 <parseMX+0x431>
mov    -0x150(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x668,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseMX>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x5c8,%rsp
mov    %rdi,%rbx
lea    0xe35(%rip),%rsi
call   10d0 <fopen@plt>
mov    $0xffffffff,%r14d
test   %rax,%rax
je     1782 <parseMX+0x5d2>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1080 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
xor    %eax,%eax
jmp    120d <parseMX+0x5d>
xchg   %ax,%ax
mov    %edx,%ebx
mov    %bl,0xc0(%rsp,%rax,1)
add    $0x1,%rax
movzbl (%rcx,%rax,1),%edx
mov    $0x5f,%bl
cmp    $0x2e,%dl
je     1202 <parseMX+0x52>
test   %dl,%dl
jne    1200 <parseMX+0x50>
mov    %eax,%eax
movb   $0x0,0xc0(%rsp,%rax,1)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %rbp,%rcx
call   1030 <fread@plt>
lea    0xdbc(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1090 <memcmp@plt>
test   %rax,%rax
je     1273 <parseMX+0xc3>
mov    0x2d78(%rip),%rax
mov    (%rax),%edi
lea    0xd9f(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    1782 <parseMX+0x5d2>
lea    0xd9f(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    %rbp,%rcx
call   1030 <fread@plt>
movzwl 0x10(%rsp),%esi
shl    $0x10,%esi
bswap  %esi
lea    0xd70(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    %rbp,%rcx
call   1030 <fread@plt>
movzbl 0x10(%rsp),%ebx
mov    %ebx,%eax
shl    $0x8,%eax
movzbl 0x11(%rsp),%esi
or     %eax,%esi
lea    0xd45(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
test   $0x80,%bl
je     1305 <parseMX+0x155>
mov    0x2cf2(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
mov    $0x100,%esi
call   10b0 <fseek@plt>
lea    0x10(%rsp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    %rbp,0x8(%rsp)
mov    %rbp,%rcx
call   1030 <fread@plt>
movzwl 0x10(%rsp),%ebx
shl    $0x10,%ebx
bswap  %ebx
lea    0xd03(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebx,(%rsp)
test   %ebx,%ebx
je     140e <parseMX+0x25e>
lea    0x10(%rsp),%rbx
lea    0xd0f(%rip),%r12
xor    %ebp,%ebp
mov    0x8(%rsp),%r13
jmp    1370 <parseMX+0x1c0>
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%ebp
add    $0x1,%ebp
cmp    (%rsp),%ebp
je     140e <parseMX+0x25e>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r13,%rcx
call   1030 <fread@plt>
mov    0x10(%rsp),%r15d
bswap  %r15d
lea    0xcb3(%rip),%rdi
mov    %ebp,0x4(%rsp)
mov    %ebp,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
test   %r15d,%r15d
jle    1360 <parseMX+0x1b0>
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x6,%edx
mov    %r13,%rcx
call   1030 <fread@plt>
movzbl 0x10(%rsp),%edx
movzbl 0x11(%rsp),%ecx
movzbl 0x12(%rsp),%r8d
movzbl 0x13(%rsp),%r9d
movzbl 0x14(%rsp),%r10d
mov    %rbx,%rbp
movzbl 0x15(%rsp),%ebx
mov    %r12,%rdi
mov    %r14d,%esi
xor    %eax,%eax
push   %rbx
mov    %rbp,%rbx
push   %r10
call   1060 <printf@plt>
add    $0x10,%rsp
add    $0x1,%r14d
cmp    %r14d,%r15d
jne    13b0 <parseMX+0x200>
jmp    1360 <parseMX+0x1b0>
lea    0x10(%rsp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    0x8(%rsp),%rbp
mov    %rbp,%rcx
call   1030 <fread@plt>
movzwl 0x10(%rsp),%ebx
shl    $0x10,%ebx
bswap  %ebx
lea    0xc52(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebx,0x5c(%rsp)
test   %ebx,%ebx
je     1777 <parseMX+0x5c7>
lea    0x10(%rsp),%r15
xor    %eax,%eax
jmp    147b <parseMX+0x2cb>
nopl   0x0(%rax)
mov    0x4(%rsp),%eax
add    $0x1,%eax
cmp    0x5c(%rsp),%eax
lea    0x10(%rsp),%r15
mov    0x8(%rsp),%rbp
je     1777 <parseMX+0x5c7>
mov    %eax,0x4(%rsp)
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x14,%edx
mov    %rbp,%rcx
call   1030 <fread@plt>
movzbl 0x12(%rsp),%r8d
movzbl 0x13(%rsp),%r9d
movzbl 0x16(%rsp),%eax
mov    %rax,0xb0(%rsp)
shl    $0x8,%eax
mov    %eax,(%rsp)
movzbl 0x17(%rsp),%eax
mov    %rax,0x98(%rsp)
movzbl 0x18(%rsp),%eax
mov    %rax,0x68(%rsp)
movzbl 0x19(%rsp),%eax
mov    %rax,0x78(%rsp)
movzbl 0x1a(%rsp),%eax
mov    %rax,0x88(%rsp)
movzbl 0x1b(%rsp),%eax
mov    %rax,0x80(%rsp)
movzbl 0x1c(%rsp),%eax
mov    %rax,0x70(%rsp)
movzbl 0x20(%rsp),%eax
mov    %rax,0x50(%rsp)
mov    %eax,%r12d
shl    $0x8,%r12d
movzbl 0x22(%rsp),%r11d
mov    %r11d,%ebx
shl    $0x8,%ebx
movzbl 0x23(%rsp),%r10d
or     %r10d,%ebx
movzbl 0x1d(%rsp),%eax
mov    %rax,0x60(%rsp)
movzbl 0x1e(%rsp),%r14d
movzbl 0x1f(%rsp),%ebp
movzbl 0x21(%rsp),%r13d
movzbl 0x10(%rsp),%edx
movzbl 0x11(%rsp),%ecx
movzbl 0x14(%rsp),%eax
mov    %rax,0xa8(%rsp)
movzbl 0x15(%rsp),%eax
mov    %rax,0xa0(%rsp)
lea    0xb36(%rip),%rdi
mov    0x4(%rsp),%esi
mov    %r8,0xb8(%rsp)
mov    %r9,0x90(%rsp)
xor    %eax,%eax
push   %r10
push   %r11
push   %r13
push   0x68(%rsp)
mov    %rbp,0x70(%rsp)
push   %rbp
mov    0xc0(%rsp),%r10
push   %r14
push   0x90(%rsp)
push   0xa8(%rsp)
push   0xc0(%rsp)
push   0xd0(%rsp)
push   0xc8(%rsp)
push   0xc0(%rsp)
mov    %r10,%rbp
push   %r10
push   0x118(%rsp)
push   0x110(%rsp)
push   0x120(%rsp)
call   1060 <printf@plt>
add    $0x80,%rsp
or     %r13d,%r12d
lea    0xb13(%rip),%r13
je     162c <parseMX+0x47c>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    0x8(%rsp),%rcx
call   1030 <fread@plt>
movzbl 0x10(%rsp),%esi
movzbl 0x11(%rsp),%edx
movzbl 0x12(%rsp),%ecx
movzbl 0x13(%rsp),%r8d
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0xffffffff,%r12d
jne    15f0 <parseMX+0x440>
add    %ebp,(%rsp)
test   %ebx,%ebx
lea    0xae7(%rip),%r12
mov    0x8(%rsp),%rbp
je     1679 <parseMX+0x4c9>
nop
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %rbp,%rcx
call   1030 <fread@plt>
movzbl 0x10(%rsp),%esi
movzbl 0x11(%rsp),%edx
movzbl 0x12(%rsp),%ecx
movzbl 0x13(%rsp),%r8d
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0xffffffff,%ebx
jne    1640 <parseMX+0x490>
cmpl   $0x0,(%rsp)
lea    0x1c0(%rsp),%r13
mov    0xb8(%rsp),%r15
mov    0x88(%rsp),%rbp
je     1460 <parseMX+0x2b0>
mov    0x68(%rsp),%rcx
shl    $0x18,%ecx
mov    0x78(%rsp),%rax
shl    $0x10,%eax
or     %ecx,%eax
mov    0x70(%rsp),%rcx
shl    $0x18,%ecx
mov    0x60(%rsp),%rdx
shl    $0x10,%edx
or     %ecx,%edx
shl    $0x8,%r15
shl    $0x8,%ebp
or     %eax,%ebp
shl    $0x8,%r14d
or     %edx,%r14d
add    0x90(%rsp),%r15
add    0x80(%rsp),%ebp
add    0x50(%rsp),%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
call   1040 <tuneToVOCFreqDiv@plt>
mov    %eax,%r12d
sub    $0x8,%rsp
mov    %r13,%rdi
mov    $0x400,%esi
lea    0xa2f(%rip),%rdx
lea    0xc8(%rsp),%rcx
mov    0xc(%rsp),%r8d
mov    %ebx,%r9d
push   %r15
call   1070 <snprintf@plt>
add    $0x10,%rsp
lea    (%r14,%rbp,1),%edx
mov    %r13,%rdi
mov    0x8(%rsp),%rsi
mov    %r12d,%ecx
call   10c0 <saveVOCSample@plt>
test   %rax,%rax
js     1765 <parseMX+0x5b5>
lea    0xa0b(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
add    %ebp,%ebp
add    %r14d,%r14d
add    $0x1,%ebx
cmp    %ebx,(%rsp)
jne    16f0 <parseMX+0x540>
jmp    1460 <parseMX+0x2b0>
mov    0x8(%rsp),%rdi
call   1050 <fclose@plt>
mov    $0xffffffff,%r14d
jmp    1782 <parseMX+0x5d2>
mov    %rbp,%rdi
call   1050 <fclose@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x5c8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [5 x i8] c"MXTX\00"
@stderr = global i32 0
@.str.2 = [17 x i8] c"not a MXTX file\0A\00"
@.str.3 = [6 x i8] c"%.4s \00"
@.str.4 = [9 x i8] c"count=%d\00"
@.str.5 = [13 x i8] c" flags=%04hx\00"
@SEEK_CUR = global i32 0
@.str.6 = [18 x i8] c" songs_number=%d\0A\00"
@.str.7 = [26 x i8] c"song #%2d: line_count=%u\0A\00"
@.str.8 = [44 x i8] c" line #%2d: %02X %02X %02X%02X %02X%02X\0A\00"
@.str.9 = [13 x i8] c"%hu samples\0A\00"
@.str.10 = [103 x i8] c"sample #%02d: %02X%02X %02X%02X %02X%02X %02X%02X %02X%02X%02X%02X %02X%02X%02X%02X %02X%02X %02X%02X\0A\00"
@.str.11 = [30 x i8] c" attack %02X%02X %02X%02X\0A\00"
@.str.12 = [30 x i8] c" release %02X%02X %02X%02X\0A\00"
@.str.13 = [23 x i8] c"%s_%02hx_%hd_%04hx.VOC\00"
@.str.14 = [11 x i8] c"%s saved.\0A\00"
define i32 @parseMX(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [256 x i8]
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca [64 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i64
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca [1024 x i8]
store i8* %0, i8** %3
%25 = load i8*, i8** %3
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %26, i32** %6
%27 = load i32*, i32** %6
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %30
29: ; preds = %1
store i32 -1, i32* %2
br label %438
30: ; preds = %1
%31 = load i8*, i8** %3
%32 = call i8* @strrchr(i8* %31, i8 signext 47)
store i8* %32, i8** %5
%33 = load i8*, i8** %5
%34 = icmp eq i8* %33, null
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = load i8*, i8** %3
store i8* %36, i8** %5
br label %40
37: ; preds = %30
%38 = load i8*, i8** %5
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %5
br label %40
40: ; preds = %37, %35
store i32 0, i32* %8
br label %41
41: ; preds = %56, %40
%42 = load i8*, i8** %5
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %66
46: ; preds = %41
%47 = load i8*, i8** %5
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 46
br i1 %50, label %51, label %52
51: ; preds = %46
br label %56
52: ; preds = %46
%53 = load i8*, i8** %5
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
br label %56
56: ; preds = %52, %51
%57 = phi i32 [ 95, %51 ], [ %55, %52 ]
%58 = trunc i32 %57 to i8
%59 = load i32, i32* %8
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %60
store i8 %58, i8* %61
%62 = load i32, i32* %8
%63 = add nsw i32 %62, 1
store i32 %63, i32* %8
%64 = load i8*, i8** %5
%65 = getelementptr inbounds i8, i8* %64, i32 1
store i8* %65, i8** %5
br label %41
66: ; preds = %41
%67 = load i32, i32* %8
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %68
store i8 0, i8* %69
%70 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%71 = load i32*, i32** %6
%72 = call i32 @fread(i8* %70, i32 1, i32 4, i32* %71)
%73 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%74 = call i64 @memcmp(i8* %73, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%75 = icmp ne i64 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %66
%77 = load i32, i32* @stderr
%78 = call i32 @fprintf(i32 %77, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %2
br label %438
79: ; preds = %66
%80 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %80)
%82 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%83 = load i32*, i32** %6
%84 = call i32 @fread(i8* %82, i32 1, i32 2, i32* %83)
%85 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%86 = load i8, i8* %85
%87 = zext i8 %86 to i32
%88 = shl i32 %87, 8
%89 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 1
%90 = load i8, i8* %89
%91 = zext i8 %90 to i32
%92 = or i32 %88, %91
store i32 %92, i32* %9
%93 = load i32, i32* %9
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %93)
%95 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%96 = load i32*, i32** %6
%97 = call i32 @fread(i8* %95, i32 1, i32 2, i32* %96)
%98 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%99 = load i8, i8* %98
%100 = zext i8 %99 to i32
%101 = shl i32 %100, 8
%102 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 1
%103 = load i8, i8* %102
%104 = zext i8 %103 to i32
%105 = or i32 %101, %104
store i32 %105, i32* %10
%106 = load i32, i32* %10
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %106)
%108 = load i32, i32* %10
%109 = and i32 %108, 32768
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %115
111: ; preds = %79
%112 = load i32*, i32** %6
%113 = load i32, i32* @SEEK_CUR
%114 = call i32 @fseek(i32* %112, i32 256, i32 %113)
br label %115
115: ; preds = %111, %79
%116 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%117 = load i32*, i32** %6
%118 = call i32 @fread(i8* %116, i32 1, i32 2, i32* %117)
%119 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%120 = load i8, i8* %119
%121 = zext i8 %120 to i32
%122 = shl i32 %121, 8
%123 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 1
%124 = load i8, i8* %123
%125 = zext i8 %124 to i32
%126 = or i32 %122, %125
store i32 %126, i32* %11
%127 = load i32, i32* %11
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %127)
store i32 0, i32* %12
br label %129
129: ; preds = %190, %115
%130 = load i32, i32* %12
%131 = load i32, i32* %11
%132 = icmp slt i32 %130, %131
br i1 %132, label %133, label %193
133: ; preds = %129
%134 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%135 = load i32*, i32** %6
%136 = call i32 @fread(i8* %134, i32 1, i32 4, i32* %135)
%137 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%138 = load i8, i8* %137
%139 = zext i8 %138 to i32
%140 = shl i32 %139, 24
%141 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 1
%142 = load i8, i8* %141
%143 = zext i8 %142 to i32
%144 = shl i32 %143, 16
%145 = or i32 %140, %144
%146 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 2
%147 = load i8, i8* %146
%148 = zext i8 %147 to i32
%149 = shl i32 %148, 8
%150 = or i32 %145, %149
%151 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 3
%152 = load i8, i8* %151
%153 = zext i8 %152 to i32
%154 = or i32 %150, %153
store i32 %154, i32* %15
%155 = load i32, i32* %12
%156 = load i32, i32* %15
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %155, i32 %156)
store i32 0, i32* %8
br label %158
158: ; preds = %186, %133
%159 = load i32, i32* %8
%160 = load i32, i32* %15
%161 = icmp slt i32 %159, %160
br i1 %161, label %162, label %189
162: ; preds = %158
%163 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%164 = load i32*, i32** %6
%165 = call i32 @fread(i8* %163, i32 1, i32 6, i32* %164)
%166 = load i32, i32* %8
%167 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%168 = load i8, i8* %167
%169 = zext i8 %168 to i32
%170 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 1
%171 = load i8, i8* %170
%172 = zext i8 %171 to i32
%173 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 2
%174 = load i8, i8* %173
%175 = zext i8 %174 to i32
%176 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 3
%177 = load i8, i8* %176
%178 = zext i8 %177 to i32
%179 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 4
%180 = load i8, i8* %179
%181 = zext i8 %180 to i32
%182 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 5
%183 = load i8, i8* %182
%184 = zext i8 %183 to i32
%185 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i32 %166, i32 %169, i32 %172, i32 %175, i32 %178, i32 %181, i32 %184)
br label %186
186: ; preds = %162
%187 = load i32, i32* %8
%188 = add nsw i32 %187, 1
store i32 %188, i32* %8
br label %158
189: ; preds = %158
br label %190
190: ; preds = %189
%191 = load i32, i32* %12
%192 = add nsw i32 %191, 1
store i32 %192, i32* %12
br label %129
193: ; preds = %129
%194 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%195 = load i32*, i32** %6
%196 = call i32 @fread(i8* %194, i32 1, i32 2, i32* %195)
%197 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%198 = load i8, i8* %197
%199 = zext i8 %198 to i32
%200 = shl i32 %199, 8
%201 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 1
%202 = load i8, i8* %201
%203 = zext i8 %202 to i32
%204 = or i32 %200, %203
store i32 %204, i32* %13
%205 = load i32, i32* %13
%206 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %205)
store i32 0, i32* %14
br label %207
207: ; preds = %432, %193
%208 = load i32, i32* %14
%209 = load i32, i32* %13
%210 = icmp slt i32 %208, %209
br i1 %210, label %211, label %435
211: ; preds = %207
%212 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%213 = load i32*, i32** %6
%214 = call i32 @fread(i8* %212, i32 1, i32 20, i32* %213)
%215 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 2
%216 = load i8, i8* %215
%217 = zext i8 %216 to i32
%218 = shl i32 %217, 8
%219 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 3
%220 = load i8, i8* %219
%221 = zext i8 %220 to i32
%222 = or i32 %218, %221
%223 = sext i32 %222 to i64
store i64 %223, i64* %16
%224 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 6
%225 = load i8, i8* %224
%226 = zext i8 %225 to i32
%227 = shl i32 %226, 8
%228 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 7
%229 = load i8, i8* %228
%230 = zext i8 %229 to i32
%231 = or i32 %227, %230
store i32 %231, i32* %17
%232 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 8
%233 = load i8, i8* %232
%234 = zext i8 %233 to i32
%235 = shl i32 %234, 24
%236 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 9
%237 = load i8, i8* %236
%238 = zext i8 %237 to i32
%239 = shl i32 %238, 16
%240 = or i32 %235, %239
%241 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 10
%242 = load i8, i8* %241
%243 = zext i8 %242 to i32
%244 = shl i32 %243, 8
%245 = or i32 %240, %244
%246 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 11
%247 = load i8, i8* %246
%248 = zext i8 %247 to i32
%249 = or i32 %245, %248
store i32 %249, i32* %19
%250 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 12
%251 = load i8, i8* %250
%252 = zext i8 %251 to i32
%253 = shl i32 %252, 24
%254 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 13
%255 = load i8, i8* %254
%256 = zext i8 %255 to i32
%257 = shl i32 %256, 16
%258 = or i32 %253, %257
%259 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 14
%260 = load i8, i8* %259
%261 = zext i8 %260 to i32
%262 = shl i32 %261, 8
%263 = or i32 %258, %262
%264 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 15
%265 = load i8, i8* %264
%266 = zext i8 %265 to i32
%267 = or i32 %263, %266
store i32 %267, i32* %20
%268 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 16
%269 = load i8, i8* %268
%270 = zext i8 %269 to i32
%271 = shl i32 %270, 8
%272 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 17
%273 = load i8, i8* %272
%274 = zext i8 %273 to i32
%275 = or i32 %271, %274
store i32 %275, i32* %21
%276 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 18
%277 = load i8, i8* %276
%278 = zext i8 %277 to i32
%279 = shl i32 %278, 8
%280 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 19
%281 = load i8, i8* %280
%282 = zext i8 %281 to i32
%283 = or i32 %279, %282
store i32 %283, i32* %22
%284 = load i32, i32* %14
%285 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%286 = load i8, i8* %285
%287 = zext i8 %286 to i32
%288 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 1
%289 = load i8, i8* %288
%290 = zext i8 %289 to i32
%291 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 2
%292 = load i8, i8* %291
%293 = zext i8 %292 to i32
%294 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 3
%295 = load i8, i8* %294
%296 = zext i8 %295 to i32
%297 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 4
%298 = load i8, i8* %297
%299 = zext i8 %298 to i32
%300 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 5
%301 = load i8, i8* %300
%302 = zext i8 %301 to i32
%303 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 6
%304 = load i8, i8* %303
%305 = zext i8 %304 to i32
%306 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 7
%307 = load i8, i8* %306
%308 = zext i8 %307 to i32
%309 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 8
%310 = load i8, i8* %309
%311 = zext i8 %310 to i32
%312 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 9
%313 = load i8, i8* %312
%314 = zext i8 %313 to i32
%315 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 10
%316 = load i8, i8* %315
%317 = zext i8 %316 to i32
%318 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 11
%319 = load i8, i8* %318
%320 = zext i8 %319 to i32
%321 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 12
%322 = load i8, i8* %321
%323 = zext i8 %322 to i32
%324 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 13
%325 = load i8, i8* %324
%326 = zext i8 %325 to i32
%327 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 14
%328 = load i8, i8* %327
%329 = zext i8 %328 to i32
%330 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 15
%331 = load i8, i8* %330
%332 = zext i8 %331 to i32
%333 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 16
%334 = load i8, i8* %333
%335 = zext i8 %334 to i32
%336 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 17
%337 = load i8, i8* %336
%338 = zext i8 %337 to i32
%339 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 18
%340 = load i8, i8* %339
%341 = zext i8 %340 to i32
%342 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 19
%343 = load i8, i8* %342
%344 = zext i8 %343 to i32
%345 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str.10, i64 0, i64 0), i32 %284, i32 %287, i32 %290, i32 %293, i32 %296, i32 %299, i32 %302, i32 %305, i32 %308, i32 %311, i32 %314, i32 %317, i32 %320, i32 %323, i32 %326, i32 %329, i32 %332, i32 %335, i32 %338, i32 %341, i32 %344)
store i32 0, i32* %8
br label %346
346: ; preds = %367, %211
%347 = load i32, i32* %8
%348 = load i32, i32* %21
%349 = icmp slt i32 %347, %348
br i1 %349, label %350, label %370
350: ; preds = %346
%351 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%352 = load i32*, i32** %6
%353 = call i32 @fread(i8* %351, i32 1, i32 4, i32* %352)
%354 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%355 = load i8, i8* %354
%356 = zext i8 %355 to i32
%357 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 1
%358 = load i8, i8* %357
%359 = zext i8 %358 to i32
%360 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 2
%361 = load i8, i8* %360
%362 = zext i8 %361 to i32
%363 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 3
%364 = load i8, i8* %363
%365 = zext i8 %364 to i32
%366 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0), i32 %356, i32 %359, i32 %362, i32 %365)
br label %367
367: ; preds = %350
%368 = load i32, i32* %8
%369 = add nsw i32 %368, 1
store i32 %369, i32* %8
br label %346
370: ; preds = %346
store i32 0, i32* %8
br label %371
371: ; preds = %392, %370
%372 = load i32, i32* %8
%373 = load i32, i32* %22
%374 = icmp slt i32 %372, %373
br i1 %374, label %375, label %395
375: ; preds = %371
%376 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%377 = load i32*, i32** %6
%378 = call i32 @fread(i8* %376, i32 1, i32 4, i32* %377)
%379 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%380 = load i8, i8* %379
%381 = zext i8 %380 to i32
%382 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 1
%383 = load i8, i8* %382
%384 = zext i8 %383 to i32
%385 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 2
%386 = load i8, i8* %385
%387 = zext i8 %386 to i32
%388 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 3
%389 = load i8, i8* %388
%390 = zext i8 %389 to i32
%391 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0), i32 %381, i32 %384, i32 %387, i32 %390)
br label %392
392: ; preds = %375
%393 = load i32, i32* %8
%394 = add nsw i32 %393, 1
store i32 %394, i32* %8
br label %371
395: ; preds = %371
store i32 0, i32* %18
br label %396
396: ; preds = %428, %395
%397 = load i32, i32* %18
%398 = load i32, i32* %17
%399 = icmp slt i32 %397, %398
br i1 %399, label %400, label %431
400: ; preds = %396
%401 = load i64, i64* %16
%402 = call i32 @tuneToVOCFreqDiv(i64 %401)
store i32 %402, i32* %23
%403 = getelementptr inbounds [1024 x i8], [1024 x i8]* %24, i64 0, i64 0
%404 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%405 = load i32, i32* %14
%406 = load i32, i32* %18
%407 = load i64, i64* %16
%408 = trunc i64 %407 to i32
%409 = call i32 @snprintf(i8* %403, i32 1024, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), i8* %404, i32 %405, i32 %406, i32 %408)
%410 = getelementptr inbounds [1024 x i8], [1024 x i8]* %24, i64 0, i64 0
%411 = load i32*, i32** %6
%412 = load i32, i32* %19
%413 = load i32, i32* %20
%414 = add nsw i32 %412, %413
%415 = load i32, i32* %23
%416 = call i64 @saveVOCSample(i8* %410, i32* %411, i32 %414, i32 %415)
%417 = icmp slt i64 %416, 0
br i1 %417, label %418, label %421
418: ; preds = %400
%419 = load i32*, i32** %6
%420 = call i32 @fclose(i32* %419)
store i32 -1, i32* %2
br label %438
421: ; preds = %400
%422 = getelementptr inbounds [1024 x i8], [1024 x i8]* %24, i64 0, i64 0
%423 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i8* %422)
%424 = load i32, i32* %19
%425 = mul nsw i32 %424, 2
store i32 %425, i32* %19
%426 = load i32, i32* %20
%427 = mul nsw i32 %426, 2
store i32 %427, i32* %20
br label %428
428: ; preds = %421
%429 = load i32, i32* %18
%430 = add nsw i32 %429, 1
store i32 %430, i32* %18
br label %396
431: ; preds = %396
br label %432
432: ; preds = %431
%433 = load i32, i32* %14
%434 = add nsw i32 %433, 1
store i32 %434, i32* %14
br label %207
435: ; preds = %207
%436 = load i32*, i32** %6
%437 = call i32 @fclose(i32* %436)
store i32 0, i32* %2
br label %438
438: ; preds = %435, %418, %76, %29
%439 = load i32, i32* %2
ret i32 %439
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.1 = [5 x i8] c"MXTX\00"
@stderr = global i32 0
@.str.2 = [17 x i8] c"not a MXTX file\0A\00"
@.str.3 = [6 x i8] c"%.4s \00"
@.str.4 = [9 x i8] c"count=%d\00"
@.str.5 = [13 x i8] c" flags=%04hx\00"
@SEEK_CUR = global i32 0
@.str.6 = [18 x i8] c" songs_number=%d\0A\00"
@.str.7 = [26 x i8] c"song #%2d: line_count=%u\0A\00"
@.str.8 = [44 x i8] c" line #%2d: %02X %02X %02X%02X %02X%02X\0A\00"
@.str.9 = [13 x i8] c"%hu samples\0A\00"
@.str.10 = [103 x i8] c"sample #%02d: %02X%02X %02X%02X %02X%02X %02X%02X %02X%02X%02X%02X %02X%02X%02X%02X %02X%02X %02X%02X\0A\00"
@.str.11 = [30 x i8] c" attack %02X%02X %02X%02X\0A\00"
@.str.12 = [30 x i8] c" release %02X%02X %02X%02X\0A\00"
@.str.13 = [23 x i8] c"%s_%02hx_%hd_%04hx.VOC\00"
@.str.14 = [11 x i8] c"%s saved.\0A\00"
define i32 @parseMX(i8* %0) {
%2 = alloca [256 x i8]
%3 = alloca [64 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%7 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %262, label %9
9: ; preds = %1
%10 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%11 = icmp eq i8* %10, null
%12 = getelementptr inbounds i8, i8* %10, i64 1
%13 = select i1 %11, i8* %0, i8* %12
br label %14
14: ; preds = %19, %9
%15 = phi i64 [ %22, %19 ], [ 0, %9 ]
%16 = phi i8* [ %23, %19 ], [ %13, %9 ]
%17 = load i8, i8* %16
switch i8 %17, label %18 [
i8 0, label %24
i8 46, label %19
]
18: ; preds = %14
br label %19
19: ; preds = %14, %18
%20 = phi i8 [ %17, %18 ], [ 95, %14 ]
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %15
store i8 %20, i8* %21
%22 = add nuw i64 %15, 1
%23 = getelementptr inbounds i8, i8* %16, i64 1
br label %14
24: ; preds = %14
%25 = and i64 %15, 4294967295
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %25
store i8 0, i8* %26
%27 = call i32 @fread(i8* %6, i32 1, i32 4, i32* %7)
%28 = call i64 @memcmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%29 = icmp eq i64 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %24
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %262
33: ; preds = %24
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%35 = call i32 @fread(i8* %6, i32 1, i32 2, i32* %7)
%36 = load i8, i8* %6
%37 = zext i8 %36 to i32
%38 = shl nuw nsw i32 %37, 8
%39 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 1
%40 = load i8, i8* %39
%41 = zext i8 %40 to i32
%42 = or i32 %38, %41
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %42)
%44 = call i32 @fread(i8* %6, i32 1, i32 2, i32* %7)
%45 = load i8, i8* %6
%46 = zext i8 %45 to i32
%47 = shl nuw nsw i32 %46, 8
%48 = load i8, i8* %39
%49 = zext i8 %48 to i32
%50 = or i32 %47, %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %50)
%52 = and i32 %46, 128
%53 = icmp eq i32 %52, 0
br i1 %53, label %57, label %54
54: ; preds = %33
%55 = load i32, i32* @SEEK_CUR
%56 = call i32 @fseek(i32* %7, i32 256, i32 %55)
br label %57
57: ; preds = %54, %33
%58 = call i32 @fread(i8* %6, i32 1, i32 2, i32* %7)
%59 = load i8, i8* %6
%60 = zext i8 %59 to i32
%61 = shl nuw nsw i32 %60, 8
%62 = load i8, i8* %39
%63 = zext i8 %62 to i32
%64 = or i32 %61, %63
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %64)
%66 = icmp eq i32 %64, 0
br i1 %66, label %112, label %67
67: ; preds = %57
%68 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 2
%69 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 3
%70 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 4
%71 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 5
br label %72
72: ; preds = %67, %109
%73 = phi i32 [ 0, %67 ], [ %110, %109 ]
%74 = call i32 @fread(i8* %6, i32 1, i32 4, i32* %7)
%75 = load i8, i8* %6
%76 = zext i8 %75 to i32
%77 = shl nuw i32 %76, 24
%78 = load i8, i8* %39
%79 = zext i8 %78 to i32
%80 = shl nuw nsw i32 %79, 16
%81 = or i32 %80, %77
%82 = load i8, i8* %68
%83 = zext i8 %82 to i32
%84 = shl nuw nsw i32 %83, 8
%85 = or i32 %81, %84
%86 = load i8, i8* %69
%87 = zext i8 %86 to i32
%88 = or i32 %85, %87
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %73, i32 %88)
%90 = icmp sgt i32 %88, 0
br i1 %90, label %91, label %109
91: ; preds = %72, %91
%92 = phi i32 [ %107, %91 ], [ 0, %72 ]
%93 = call i32 @fread(i8* %6, i32 1, i32 6, i32* %7)
%94 = load i8, i8* %6
%95 = zext i8 %94 to i32
%96 = load i8, i8* %39
%97 = zext i8 %96 to i32
%98 = load i8, i8* %68
%99 = zext i8 %98 to i32
%100 = load i8, i8* %69
%101 = zext i8 %100 to i32
%102 = load i8, i8* %70
%103 = zext i8 %102 to i32
%104 = load i8, i8* %71
%105 = zext i8 %104 to i32
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i32 %92, i32 %95, i32 %97, i32 %99, i32 %101, i32 %103, i32 %105)
%107 = add nuw nsw i32 %92, 1
%108 = icmp eq i32 %107, %88
br i1 %108, label %109, label %91
109: ; preds = %91, %72
%110 = add nuw nsw i32 %73, 1
%111 = icmp eq i32 %110, %64
br i1 %111, label %112, label %72
112: ; preds = %109, %57
%113 = call i32 @fread(i8* %6, i32 1, i32 2, i32* %7)
%114 = load i8, i8* %6
%115 = zext i8 %114 to i32
%116 = shl nuw nsw i32 %115, 8
%117 = load i8, i8* %39
%118 = zext i8 %117 to i32
%119 = or i32 %116, %118
%120 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %119)
%121 = icmp eq i32 %119, 0
br i1 %121, label %260, label %122
122: ; preds = %112
%123 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 2
%124 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 3
%125 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 6
%126 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 7
%127 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 8
%128 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 9
%129 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 10
%130 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 11
%131 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 12
%132 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 13
%133 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 14
%134 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 15
%135 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 16
%136 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 17
%137 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 18
%138 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 19
%139 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 4
%140 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 5
%141 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
br label %142
142: ; preds = %122, %257
%143 = phi i32 [ 0, %122 ], [ %258, %257 ]
%144 = call i32 @fread(i8* %6, i32 1, i32 20, i32* %7)
%145 = load i8, i8* %123
%146 = zext i8 %145 to i32
%147 = shl nuw nsw i32 %146, 8
%148 = load i8, i8* %124
%149 = zext i8 %148 to i32
%150 = or i32 %147, %149
%151 = zext i32 %150 to i64
%152 = load i8, i8* %125
%153 = zext i8 %152 to i32
%154 = shl nuw nsw i32 %153, 8
%155 = load i8, i8* %126
%156 = zext i8 %155 to i32
%157 = or i32 %154, %156
%158 = load i8, i8* %127
%159 = zext i8 %158 to i32
%160 = shl nuw i32 %159, 24
%161 = load i8, i8* %128
%162 = zext i8 %161 to i32
%163 = shl nuw nsw i32 %162, 16
%164 = or i32 %163, %160
%165 = load i8, i8* %129
%166 = zext i8 %165 to i32
%167 = shl nuw nsw i32 %166, 8
%168 = or i32 %164, %167
%169 = load i8, i8* %130
%170 = zext i8 %169 to i32
%171 = or i32 %168, %170
%172 = load i8, i8* %131
%173 = zext i8 %172 to i32
%174 = shl nuw i32 %173, 24
%175 = load i8, i8* %132
%176 = zext i8 %175 to i32
%177 = shl nuw nsw i32 %176, 16
%178 = or i32 %177, %174
%179 = load i8, i8* %133
%180 = zext i8 %179 to i32
%181 = shl nuw nsw i32 %180, 8
%182 = or i32 %178, %181
%183 = load i8, i8* %134
%184 = zext i8 %183 to i32
%185 = or i32 %182, %184
%186 = load i8, i8* %135
%187 = zext i8 %186 to i32
%188 = shl nuw nsw i32 %187, 8
%189 = load i8, i8* %136
%190 = zext i8 %189 to i32
%191 = or i32 %188, %190
%192 = load i8, i8* %137
%193 = zext i8 %192 to i32
%194 = shl nuw nsw i32 %193, 8
%195 = load i8, i8* %138
%196 = zext i8 %195 to i32
%197 = or i32 %194, %196
%198 = load i8, i8* %6
%199 = zext i8 %198 to i32
%200 = load i8, i8* %39
%201 = zext i8 %200 to i32
%202 = load i8, i8* %139
%203 = zext i8 %202 to i32
%204 = load i8, i8* %140
%205 = zext i8 %204 to i32
%206 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 x i8]* @.str.10, i64 0, i64 0), i32 %143, i32 %199, i32 %201, i32 %146, i32 %149, i32 %203, i32 %205, i32 %153, i32 %156, i32 %159, i32 %162, i32 %166, i32 %170, i32 %173, i32 %176, i32 %180, i32 %184, i32 %187, i32 %190, i32 %193, i32 %196)
%207 = icmp eq i32 %191, 0
br i1 %207, label %208, label %210
208: ; preds = %210, %142
%209 = icmp eq i32 %197, 0
br i1 %209, label %224, label %226
210: ; preds = %142, %210
%211 = phi i32 [ %222, %210 ], [ 0, %142 ]
%212 = call i32 @fread(i8* %6, i32 1, i32 4, i32* %7)
%213 = load i8, i8* %6
%214 = zext i8 %213 to i32
%215 = load i8, i8* %39
%216 = zext i8 %215 to i32
%217 = load i8, i8* %123
%218 = zext i8 %217 to i32
%219 = load i8, i8* %124
%220 = zext i8 %219 to i32
%221 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0), i32 %214, i32 %216, i32 %218, i32 %220)
%222 = add nuw nsw i32 %211, 1
%223 = icmp eq i32 %222, %191
br i1 %223, label %208, label %210
224: ; preds = %226, %208
%225 = icmp eq i32 %157, 0
br i1 %225, label %257, label %240
226: ; preds = %208, %226
%227 = phi i32 [ %238, %226 ], [ 0, %208 ]
%228 = call i32 @fread(i8* %6, i32 1, i32 4, i32* %7)
%229 = load i8, i8* %6
%230 = zext i8 %229 to i32
%231 = load i8, i8* %39
%232 = zext i8 %231 to i32
%233 = load i8, i8* %123
%234 = zext i8 %233 to i32
%235 = load i8, i8* %124
%236 = zext i8 %235 to i32
%237 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0), i32 %230, i32 %232, i32 %234, i32 %236)
%238 = add nuw nsw i32 %227, 1
%239 = icmp eq i32 %238, %197
br i1 %239, label %224, label %226
240: ; preds = %224, %251
%241 = phi i32 [ %254, %251 ], [ %185, %224 ]
%242 = phi i32 [ %253, %251 ], [ %171, %224 ]
%243 = phi i32 [ %255, %251 ], [ 0, %224 ]
%244 = call i32 @tuneToVOCFreqDiv(i64 %151)
%245 = call i32 @snprintf(i8* %141, i32 1024, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), i8* %5, i32 %143, i32 %243, i32 %150)
%246 = add nsw i32 %241, %242
%247 = call i64 @saveVOCSample(i8* %141, i32* %7, i32 %246, i32 %244)
%248 = icmp slt i64 %247, 0
br i1 %248, label %249, label %251
249: ; preds = %240
%250 = call i32 @fclose(i32* %7)
br label %262
251: ; preds = %240
%252 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i8* %141)
%253 = shl nsw i32 %242, 1
%254 = shl nsw i32 %241, 1
%255 = add nuw nsw i32 %243, 1
%256 = icmp eq i32 %255, %157
br i1 %256, label %257, label %240
257: ; preds = %251, %224
%258 = add nuw nsw i32 %143, 1
%259 = icmp eq i32 %258, %119
br i1 %259, label %260, label %142
260: ; preds = %257, %112
%261 = call i32 @fclose(i32* %7)
br label %262
262: ; preds = %249, %1, %260, %30
%263 = phi i32 [ -1, %30 ], [ 0, %260 ], [ -1, %1 ], [ -1, %249 ]
ret i32 %263
}