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

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ _IONBF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
size_t findChunk(scalar_t__, int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ *fopen(char *, char *);
size_t fread(scalar_t__ *, int, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(scalar_t__ *);
scalar_t__ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
size_t fwrite(scalar_t__ *, size_t, int, int /*<<< orphan*/ *);
scalar_t__ *malloc(int);
int /*<<< orphan*/ printf(char *, char *, ...);
scalar_t__ setvbuf(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                   int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  static uint32_t riffMark =
      ((('R') & 0xff) << 0 * 8) | ((('I') & 0xff) << 1 * 8) |
      ((('F') & 0xff) << 2 * 8) | ((('F') & 0xff) << 3 * 8);
  static uint32_t waveMark =
      ((('W') & 0xff) << 0 * 8) | ((('A') & 0xff) << 1 * 8) |
      ((('V') & 0xff) << 2 * 8) | ((('E') & 0xff) << 3 * 8);
  static uint32_t fmtMark =
      ((('f') & 0xff) << 0 * 8) | ((('m') & 0xff) << 1 * 8) |
      ((('t') & 0xff) << 2 * 8) | (((' ') & 0xff) << 3 * 8);
  static uint32_t dataMark =
      ((('d') & 0xff) << 0 * 8) | ((('a') & 0xff) << 1 * 8) |
      ((('t') & 0xff) << 2 * 8) | ((('a') & 0xff) << 3 * 8);
  if (argc < 2) {
    printf("Usage: %s FileName1 [FileName2...]\n"
           "Assumes provided files are Wwise IMA ADPCM wave files,\n"
           "changes CONTENTS of the provided files in a way\n"
           "that lets them be read by complete IMA ADPCM decoders (for "
           "example, SoX).\n"
           "Version r4\n",
           argv[0]);
    return -1;
  }
  static uint16_t waveId = 0x0011;
  for (size_t i = 1; i < (size_t)argc; ++i) {
    FILE *file = fopen(argv[i], "r+b");
    if (file == NULL) {
      printf("%s: Error opening file.\n", argv[i]);
      continue;
    }
    if (setvbuf(file, NULL, _IONBF, 0)) {
      printf("%s: Error using file?!\n", argv[i]);
      fclose(file);
      continue;
    }
    size_t ioStatus = 1;
    uint32_t riffLenght = 0;
    {
      uint32_t magick[3] = {0, 0, 0};
      ioStatus = fread(magick, 1, 4 * 3, file);
      if (ioStatus == 0) {
        printf("%s: Can't read file.\n", argv[i]);
        fclose(file);
        continue;
      }
      if (ioStatus < 4 * 3) {
        printf("%s: File is too small.\n", argv[i]);
        fclose(file);
        continue;
      }
      if (magick[0] != riffMark) {
        printf("%s: Wrong format. Expected \"RIFF\", got \"%.4s\"\n", argv[i],
               (char *)magick);
        fclose(file);
        continue;
      }
      riffLenght = magick[1];
      if (magick[2] != waveMark) {
        printf("%s: Can't recognize format. Got \"RIFF\", "
               "but no \"WAVE\". Got \"%.4s\" instead\n",
               argv[i], (char *)(magick + 2));
        fclose(file);
        continue;
      }
    }
    size_t fmtLength = findChunk(fmtMark, file, argv[i]);
    if (fmtLength == 0) {
      fclose(file);
      continue;
    }
    if (fmtLength != 24) {
      printf("%s: File has wrong format of data. "
             "fmt chunk is of unexpected size (%u bytes).\n",
             argv[i], fmtLength);
      fclose(file);
      continue;
    }
    long fmtOffset = ftell(file);
    if (fmtOffset < 0) {
      printf("%s: Error using file?!\n", argv[i]);
      fclose(file);
      continue;
    }
    static uint8_t fmtDescription[24];
    ioStatus = fread(fmtDescription, 1, 24, file);
    if (ioStatus < 24) {
      printf("%s: Can't read fmt chunk.\n", argv[i]);
      fclose(file);
      continue;
    }
    uint16_t channels = *(uint16_t *)(fmtDescription + 2),
             align = *(uint16_t *)(fmtDescription + 12);
    {
      uint16_t formatID = *(uint16_t *)fmtDescription,
               sampleBits = *(uint16_t *)(fmtDescription + 14),
               extraSize = *(uint16_t *)(fmtDescription + 16);
      if (!(formatID == 0x0002 && sampleBits == 4 && extraSize == 6)) {
        printf("%s: File doesn't seem to be (Wwise) IMA ADPCM wave."
               " It has format ID 0x%04x, bits per sample %u, "
               "%u bytes of extra format info.\n",
               argv[i], formatID, sampleBits, extraSize);
        fclose(file);
        continue;
      }
      *(uint16_t *)fmtDescription = waveId;
      *(uint16_t *)(fmtDescription + 18) =
          (align - 4 * channels) * 8 / (sampleBits * channels) + 1;
      if (fseek(file, fmtOffset, SEEK_SET)) {
        printf("%s: Error using file?!\n", argv[i]);
        fclose(file);
        continue;
      }
      ioStatus = fwrite(fmtDescription, 1, 24, file);
      if (ioStatus == 0) {
        printf("%s: Error writing to file.\nAborting.\n", argv[i]);
        fclose(file);
        return 1;
      }
    }
    if (ioStatus < 24) {
      printf("%s: Error writing to file.\nAborting.\n", argv[i]);
      fclose(file);
      return 1;
    }
    if (channels > 1) {
      if (fseek(file, 4 * 3, SEEK_SET)) {
        printf("%s: Error using file?!\n", argv[i]);
        fclose(file);
        continue;
      }
      size_t dataLength = findChunk(dataMark, file, argv[i]);
      if (dataLength == 0) {
        printf("%s: File has no usable data...\n", argv[i]);
        fclose(file);
        continue;
      }
      static uint8_t transformInData[4096], transformOutData[4096];
      uint8_t *transformIn = transformInData, *transformOut = transformOutData;
      size_t transformCount = 4096 / align;
      if (align > 4096) {
        transformIn = malloc(2 * align);
        transformOut = transformIn + align;
        transformCount = 1;
      }
      for (size_t blockCount = 0; blockCount * align < dataLength;) {
        long dataPoint = ftell(file);
        if (dataPoint < 0) {
          printf("%s: Error using file?!\n", argv[i]);
          break;
        }
        ioStatus = fread(transformIn, align, transformCount, file);
        if (ioStatus == 0) {
          printf("%s: Unexpected end of file.\n", argv[i]);
          break;
        }
        size_t blockAmount = ioStatus;
        blockCount += blockAmount;
        for (size_t block = 0; block < blockAmount; ++block)
          for (size_t n = 0; n < align / (channels * 4); ++n)
            for (size_t s = 0; s < channels; ++s) {
              ((uint32_t *)(transformOut + block * align))[n * channels + s] =
                  ((uint32_t *)(transformIn +
                                block * align))[s * align / (channels * 4) + n];
            }
        if (fseek(file, dataPoint, SEEK_SET)) {
          printf("%s: Error using file?!\n", argv[i]);
          break;
        }
        ioStatus = fwrite(transformOut, (blockAmount * align), 1, file);
        if (ioStatus == 0) {
          printf("%s: Error writing file.\nAborting.\n", argv[i]);
          fclose(file);
          return 1;
        }
      }
      if (align > 4096) {
        free(transformIn);
      }
    }
    fclose(file);
    printf("Finished processing %s\n", argv[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1204 <main+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1a8f <main+0x8cf>
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jae    1a88 <main+0x8c8>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xeb0(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1263 <main+0xa3>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1a77 <main+0x8b7>
mov    -0x20(%rbp),%rdi
mov    0x2d7a(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   10c0 <setvbuf@plt>
cmp    $0x0,%rax
je     12ad <main+0xed>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1a77 <main+0x8b7>
movq   $0x1,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1080 <memset@plt>
lea    -0x50(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0xc,%edx
call   1040 <fread@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    131b <main+0x15b>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1a77 <main+0x8b7>
cmpq   $0xc,-0x28(%rbp)
jae    134e <main+0x18e>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1a77 <main+0x8b7>
mov    -0x50(%rbp),%rax
cmp    0x2d27(%rip),%rax
je     138b <main+0x1cb>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    -0x50(%rbp),%rdx
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1a77 <main+0x8b7>
mov    -0x48(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x40(%rbp),%rax
cmp    0x2cea(%rip),%rax
je     13d4 <main+0x214>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    -0x50(%rbp),%rdx
add    $0x10,%rdx
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1a77 <main+0x8b7>
mov    0x2cb5(%rip),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
call   1070 <findChunk@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    140d <main+0x24d>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1a77 <main+0x8b7>
cmpq   $0x18,-0x58(%rbp)
je     1444 <main+0x284>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x58(%rbp),%rdx
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1a77 <main+0x8b7>
mov    -0x20(%rbp),%rdi
call   1090 <ftell@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jge    1484 <main+0x2c4>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc8e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1a77 <main+0x8b7>
mov    -0x20(%rbp),%rcx
lea    0x2c41(%rip),%rdi
mov    $0x1,%esi
mov    $0x18,%edx
call   1040 <fread@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x18,-0x28(%rbp)
jae    14d5 <main+0x315>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1a77 <main+0x8b7>
mov    0x2c05(%rip),%eax
mov    %eax,-0x64(%rbp)
mov    0x2c4c(%rip),%eax
mov    %eax,-0x68(%rbp)
mov    0x2be3(%rip),%eax
mov    %eax,-0x6c(%rbp)
mov    0x2c4a(%rip),%eax
mov    %eax,-0x70(%rbp)
mov    0x2c51(%rip),%eax
mov    %eax,-0x74(%rbp)
cmpl   $0x2,-0x6c(%rbp)
jne    1520 <main+0x360>
cmpl   $0x4,-0x70(%rbp)
jne    1520 <main+0x360>
cmpl   $0x6,-0x74(%rbp)
je     1552 <main+0x392>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x6c(%rbp),%edx
mov    -0x70(%rbp),%ecx
mov    -0x74(%rbp),%r8d
lea    0xceb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1a77 <main+0x8b7>
mov    0x2b48(%rip),%eax
mov    %eax,0x2b72(%rip)
mov    -0x68(%rbp),%eax
mov    -0x64(%rbp),%ecx
shl    $0x2,%ecx
sub    %ecx,%eax
shl    $0x3,%eax
mov    -0x70(%rbp),%ecx
imul   -0x64(%rbp),%ecx
cltd
idiv   %ecx
add    $0x1,%eax
mov    %eax,0x2be1(%rip)
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    0x2a4a(%rip),%rax
mov    (%rax),%edx
call   10b0 <fseek@plt>
cmp    $0x0,%rax
je     15c7 <main+0x407>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xb4b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1a77 <main+0x8b7>
mov    -0x20(%rbp),%rcx
lea    0x2afe(%rip),%rdi
mov    $0x1,%esi
mov    $0x18,%edx
call   10e0 <fwrite@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    161f <main+0x45f>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xca6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a8f <main+0x8cf>
cmpq   $0x18,-0x28(%rbp)
jae    1659 <main+0x499>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc6c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a8f <main+0x8cf>
cmpl   $0x1,-0x64(%rbp)
jle    1a54 <main+0x894>
mov    -0x20(%rbp),%rdi
mov    0x296a(%rip),%rax
mov    (%rax),%edx
mov    $0xc,%esi
call   10b0 <fseek@plt>
cmp    $0x0,%rax
je     16ac <main+0x4ec>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xa66(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1a77 <main+0x8b7>
mov    0x29e5(%rip),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
call   1070 <findChunk@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
jne    16ff <main+0x53f>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xbe5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1a77 <main+0x8b7>
lea    0x2a9a(%rip),%rax
mov    %rax,-0x88(%rbp)
lea    0xaa8c(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    $0x1000,%eax
cltd
idivl  -0x68(%rbp)
cltq
mov    %rax,-0x98(%rbp)
cmpl   $0x1000,-0x68(%rbp)
jle    1770 <main+0x5b0>
mov    -0x68(%rbp),%edi
shl    $0x1,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
movslq -0x68(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x90(%rbp)
movq   $0x1,-0x98(%rbp)
movq   $0x0,-0xa0(%rbp)
mov    -0xa0(%rbp),%rax
movslq -0x68(%rbp),%rcx
imul   %rcx,%rax
cmp    -0x80(%rbp),%rax
jae    1a36 <main+0x876>
mov    -0x20(%rbp),%rdi
call   1090 <ftell@plt>
mov    %rax,-0xa8(%rbp)
cmpq   $0x0,-0xa8(%rbp)
jge    17d1 <main+0x611>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0x938(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1a36 <main+0x876>
mov    -0x88(%rbp),%rdi
mov    -0x68(%rbp),%esi
mov    -0x98(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1040 <fread@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1819 <main+0x659>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xae2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1a36 <main+0x876>
mov    -0x28(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0xb0(%rbp),%rax
add    -0xa0(%rbp),%rax
mov    %rax,-0xa0(%rbp)
movq   $0x0,-0xb8(%rbp)
mov    -0xb8(%rbp),%rax
cmp    -0xb0(%rbp),%rax
jae    198d <main+0x7cd>
movq   $0x0,-0xc0(%rbp)
mov    -0xc0(%rbp),%rax
mov    %rax,-0xd0(%rbp)
mov    -0x68(%rbp),%eax
mov    -0x64(%rbp),%ecx
shl    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xd0(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
jae    1971 <main+0x7b1>
movq   $0x0,-0xc8(%rbp)
mov    -0xc8(%rbp),%rax
movslq -0x64(%rbp),%rcx
cmp    %rcx,%rax
jae    1955 <main+0x795>
mov    -0x88(%rbp),%rax
mov    -0xb8(%rbp),%rcx
movslq -0x68(%rbp),%rdx
imul   %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xd8(%rbp)
mov    -0xc8(%rbp),%rax
movslq -0x68(%rbp),%rcx
imul   %rcx,%rax
mov    -0x64(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,%rcx
mov    -0xd8(%rbp),%rax
add    -0xc0(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x90(%rbp),%rax
mov    -0xb8(%rbp),%rcx
movslq -0x68(%rbp),%rsi
imul   %rsi,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0xc0(%rbp),%rcx
movslq -0x64(%rbp),%rsi
imul   %rsi,%rcx
add    -0xc8(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xc8(%rbp)
jmp    189d <main+0x6dd>
jmp    195a <main+0x79a>
mov    -0xc0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xc0(%rbp)
jmp    1863 <main+0x6a3>
jmp    1976 <main+0x7b6>
mov    -0xb8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xb8(%rbp)
jmp    1844 <main+0x684>
mov    -0x20(%rbp),%rdi
mov    -0xa8(%rbp),%rsi
mov    0x2639(%rip),%rax
mov    (%rax),%edx
call   10b0 <fseek@plt>
cmp    $0x0,%rax
je     19cf <main+0x80f>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0x73a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1a36 <main+0x876>
mov    -0x90(%rbp),%rdi
mov    -0xb0(%rbp),%rsi
movslq -0x68(%rbp),%rax
imul   %rax,%rsi
mov    -0x20(%rbp),%rcx
mov    $0x1,%edx
call   10e0 <fwrite@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1a31 <main+0x871>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0x8f7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a8f <main+0x8cf>
jmp    177b <main+0x5bb>
cmpl   $0x1000,-0x68(%rbp)
jle    1a4f <main+0x88f>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
jmp    1a54 <main+0x894>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0x8bf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    120c <main+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jge    11e4 <main+0x34>
mov    (%rbx),%rsi
lea    0xe3d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%eax
jmp    17e9 <main+0x639>
mov    %edi,%r14d
mov    $0x1,%r13d
lea    0x70(%rsp),%r12
lea    0xef7(%rip),%r15
jmp    121f <main+0x6f>
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%r13,8),%rsi
lea    0xee9(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%r13
cmp    %r14,%r13
je     17e7 <main+0x637>
mov    (%rbx,%r13,8),%rdi
mov    %r15,%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1200 <main+0x50>
mov    %rax,%rbp
mov    0x2dae(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
xor    %esi,%esi
xor    %ecx,%ecx
call   10b0 <setvbuf@plt>
test   %rax,%rax
je     1270 <main+0xc0>
mov    (%rbx,%r13,8),%rsi
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
jmp    1212 <main+0x62>
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movq   $0x0,0x70(%rsp)
mov    $0xc,%edx
lea    0x60(%rsp),%rdi
mov    $0x1,%esi
mov    %rbp,%rcx
call   1040 <fread@plt>
test   %rax,%rax
je     12b0 <main+0x100>
cmp    $0xb,%rax
ja     12bd <main+0x10d>
mov    (%rbx,%r13,8),%rsi
lea    0xe8d(%rip),%rdi
jmp    1258 <main+0xa8>
mov    (%rbx,%r13,8),%rsi
lea    0xe6a(%rip),%rdi
jmp    1258 <main+0xa8>
cmpq   $0x46464952,0x60(%rsp)
46 46
jne    1303 <main+0x153>
cmpq   $0x45564157,0x70(%rsp)
56 45
jne    1315 <main+0x165>
mov    (%rbx,%r13,8),%rdx
mov    $0x20746d66,%edi
mov    %rbp,%rsi
call   1070 <findChunk@plt>
cmp    $0x18,%rax
je     132f <main+0x17f>
test   %rax,%rax
je     125f <main+0xaf>
mov    (%rbx,%r13,8),%rsi
lea    0xecf(%rip),%rdi
mov    %rax,%rdx
jmp    1323 <main+0x173>
mov    (%rbx,%r13,8),%rsi
lea    0xe45(%rip),%rdi
lea    0x60(%rsp),%rdx
jmp    1323 <main+0x173>
mov    (%rbx,%r13,8),%rsi
lea    0xe62(%rip),%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    125f <main+0xaf>
mov    %rbp,%rdi
call   1080 <ftell@plt>
test   %rax,%rax
js     124d <main+0x9d>
mov    %rax,0x30(%rsp)
mov    $0x18,%edx
lea    0x2d4f(%rip),%rdi
mov    $0x1,%esi
mov    %rbp,%rcx
call   1040 <fread@plt>
cmp    $0x17,%rax
ja     1374 <main+0x1c4>
mov    (%rbx,%r13,8),%rsi
lea    0xeae(%rip),%rdi
jmp    1258 <main+0xa8>
mov    0x2d26(%rip),%edx
mov    0x2d90(%rip),%ecx
mov    0x2d99(%rip),%r8d
cmp    $0x2,%edx
jne    1424 <main+0x274>
cmp    $0x4,%ecx
jne    1424 <main+0x274>
cmp    $0x6,%r8d
jne    1424 <main+0x274>
mov    0x2d07(%rip),%eax
mov    %rax,(%rsp)
movslq %eax,%r15
mov    0x2d4a(%rip),%eax
movl   $0x11,0x2ce0(%rip)
lea    0x0(,%r15,4),%ecx
mov    %rax,0x8(%rsp)
sub    %ecx,%eax
shl    $0x3,%eax
shl    $0x2,%r15
cltd
idiv   %r15d
add    $0x1,%eax
mov    %eax,0x2d4d(%rip)
mov    0x2bee(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
mov    0x30(%rsp),%rsi
call   10a0 <fseek@plt>
test   %rax,%rax
je     143b <main+0x28b>
mov    (%rbx,%r13,8),%rsi
lea    0xd04(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
lea    0xcd1(%rip),%r15
jmp    1212 <main+0x62>
mov    (%rbx,%r13,8),%rsi
lea    0xe09(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    125f <main+0xaf>
mov    $0x1,%esi
lea    0x2c59(%rip),%rdi
mov    $0x18,%edx
mov    %rbp,%rcx
call   10d0 <fwrite@plt>
test   %rax,%rax
je     17fb <main+0x64b>
cmp    $0x17,%rax
jbe    17fb <main+0x64b>
cmpl   $0x2,(%rsp)
jl     17c1 <main+0x611>
mov    0x2b60(%rip),%rax
mov    (%rax),%edx
mov    $0xc,%esi
mov    %rbp,%rdi
call   10a0 <fseek@plt>
mov    (%rbx,%r13,8),%rdx
test   %rax,%rax
je     149f <main+0x2ef>
lea    0xc76(%rip),%rdi
mov    %rdx,%rsi
jmp    1409 <main+0x259>
mov    $0x61746164,%edi
mov    %rbp,%rsi
call   1070 <findChunk@plt>
mov    %rax,0x90(%rsp)
test   %rax,%rax
je     14fc <main+0x34c>
mov    $0x1000,%eax
xor    %edx,%edx
mov    0x8(%rsp),%r12
idiv   %r12d
cmp    $0x1001,%r12d
mov    %rbx,0x18(%rsp)
mov    %r14,0x80(%rsp)
jl     150c <main+0x35c>
lea    (%r12,%r12,1),%edi
call   1090 <malloc@plt>
mov    %rax,0x10(%rsp)
lea    (%rax,%r12,8),%rcx
mov    $0x1,%eax
mov    %rax,0x40(%rsp)
jmp    1526 <main+0x376>
mov    (%rbx,%r13,8),%rsi
lea    0xdd8(%rip),%rdi
jmp    1409 <main+0x259>
cltq
mov    %rax,0x40(%rsp)
lea    0x2c56(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xac4a(%rip),%rcx
movslq %r12d,%r14
mov    (%rsp),%rax
mov    %eax,%r12d
and    $0xfffffffe,%r12d
lea    (%r14,%r14,1),%rbx
mov    %rcx,0x50(%rsp)
add    $0x8,%rcx
mov    %rcx,0x88(%rsp)
lea    0x0(,%r14,8),%rcx
mov    %rcx,0xa0(%rsp)
lea    0x0(,%rax,8),%rax
mov    %rax,0x30(%rsp)
xor    %ecx,%ecx
mov    %rcx,%rax
imul   %r14,%rax
cmp    0x90(%rsp),%rax
jae    179b <main+0x5eb>
mov    %rcx,0x48(%rsp)
mov    %rbp,%rdi
call   1080 <ftell@plt>
test   %rax,%rax
js     177b <main+0x5cb>
mov    %rax,0x98(%rsp)
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    0x40(%rsp),%rdx
mov    %rbp,%rcx
call   1040 <fread@plt>
mov    %rax,0x58(%rsp)
test   %rax,%rax
je     1784 <main+0x5d4>
mov    0x8(%rsp),%rax
cltd
idiv   %r15d
cmp    $0x2,%eax
mov    $0x1,%ecx
mov    %eax,0x3c(%rsp)
cmovae %eax,%ecx
movslq %ecx,%rdi
mov    0x88(%rsp),%rax
mov    %rax,0x28(%rsp)
xor    %eax,%eax
mov    %rax,0x20(%rsp)
jmp    161f <main+0x46f>
mov    0x20(%rsp),%rcx
add    $0x1,%rcx
mov    0x28(%rsp),%rax
add    0xa0(%rsp),%rax
mov    %rax,0x28(%rsp)
mov    %rcx,%rax
mov    %rcx,0x20(%rsp)
cmp    0x58(%rsp),%rcx
je     172a <main+0x57a>
cmpl   $0x0,0x3c(%rsp)
je     15f1 <main+0x441>
mov    0x20(%rsp),%rax
imul   %r14,%rax
mov    0x10(%rsp),%rcx
lea    (%rcx,%rax,8),%rcx
mov    0x50(%rsp),%rdx
lea    (%rdx,%rax,8),%r11
mov    (%rsp),%rax
mov    0x28(%rsp),%r9
xor    %r8d,%r8d
jmp    1679 <main+0x4c9>
nop
xor    %edx,%edx
div    %r15
add    %r8,%rax
mov    (%rcx,%rax,8),%rax
add    %rsi,%r10
mov    %rax,(%r11,%r10,8)
mov    (%rsp),%rax
add    $0x1,%r8
add    0x30(%rsp),%r9
cmp    %rdi,%r8
je     15f1 <main+0x441>
mov    $0x0,%r10d
mov    $0x0,%esi
cmp    $0x1,%eax
jne    16dc <main+0x52c>
mov    (%rsp),%rax
test   $0x1,%al
je     1667 <main+0x4b7>
mov    %r8,%rsi
imul   %rax,%rsi
mov    %r10,%rax
imul   %r14,%rax
mov    %rax,%rdx
or     %r15,%rdx
shr    $0x20,%rdx
jne    1650 <main+0x4a0>
xor    %edx,%edx
div    %r15d
jmp    1655 <main+0x4a5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edx,%edx
div    %r15
add    %r8,%rax
mov    (%rcx,%rax,8),%rax
mov    %rax,(%r9,%r10,8)
add    $0x2,%r10
add    %rbx,%rsi
cmp    %r10,%r12
je     1689 <main+0x4d9>
mov    %rsi,%rax
or     %r15,%rax
shr    $0x20,%rax
je     1700 <main+0x550>
mov    %rsi,%rax
xor    %edx,%edx
div    %r15
jmp    1707 <main+0x557>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %esi,%eax
xor    %edx,%edx
div    %r15d
add    %r8,%rax
mov    (%rcx,%rax,8),%rax
mov    %rax,-0x8(%r9,%r10,8)
lea    (%r14,%rsi,1),%rax
mov    %rax,%rdx
or     %r15,%rdx
shr    $0x20,%rdx
jne    16c0 <main+0x510>
xor    %edx,%edx
div    %r15d
jmp    16c5 <main+0x515>
mov    0x28a7(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
mov    0x98(%rsp),%rsi
call   10a0 <fseek@plt>
test   %rax,%rax
jne    177b <main+0x5cb>
mov    0x58(%rsp),%rsi
add    %rsi,0x48(%rsp)
imul   %r14,%rsi
mov    0x50(%rsp),%rdi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10d0 <fwrite@plt>
mov    0x48(%rsp),%rcx
test   %rax,%rax
jne    1568 <main+0x3b8>
jmp    1808 <main+0x658>
lea    0x98b(%rip),%rdi
jmp    178b <main+0x5db>
lea    0xb74(%rip),%rdi
mov    0x18(%rsp),%rax
mov    (%rax,%r13,8),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0x1001,0x8(%rsp)
mov    0x18(%rsp),%rbx
mov    0x80(%rsp),%r14
lea    0x70(%rsp),%r12
jl     17c1 <main+0x611>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    (%rbx,%r13,8),%rsi
lea    0xb6b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x90e(%rip),%r15
jmp    1212 <main+0x62>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx,%r13,8),%rsi
lea    0xab3(%rip),%rdi
jmp    1818 <main+0x668>
mov    0x18(%rsp),%rax
mov    (%rax,%r13,8),%rsi
lea    0xb04(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    $0x1,%eax
jmp    17e9 <main+0x639>

LLVM IR (-O0):
@main.riffMark = internal global i64 1179011410
@main.waveMark = internal global i64 1163280727
@main.fmtMark = internal global i64 544501094
@main.dataMark = internal global i64 1635017060
@.str = [224 x i8] c"Usage: %s FileName1 [FileName2...]\0AAssumes provided files are Wwise IMA ADPCM wave files,\0Achanges CONTENTS of the provided files in a way\0Athat lets them be read by complete IMA ADPCM decoders (for example, SoX).\0AVersion r4\0A\00"
@main.waveId = internal global i32 17
@.str.1 = [4 x i8] c"r+b\00"
@.str.2 = [25 x i8] c"%s: Error opening file.\0A\00"
@_IONBF = global i32 0
@.str.3 = [24 x i8] c"%s: Error using file?!\0A\00"
@.str.4 = [22 x i8] c"%s: Can't read file.\0A\00"
@.str.5 = [24 x i8] c"%s: File is too small.\0A\00"
@.str.6 = [47 x i8] c"%s: Wrong format. Expected \22RIFF\22, got \22%.4s\22\0A\00"
@.str.7 = [75 x i8] c"%s: Can't recognize format. Got \22RIFF\22, but no \22WAVE\22. Got \22%.4s\22 instead\0A\00"
@.str.8 = [80 x i8] c"%s: File has wrong format of data. fmt chunk is of unexpected size (%u bytes).\0A\00"
@main.fmtDescription = internal global [24 x i64] zeroinitializer
@.str.9 = [27 x i8] c"%s: Can't read fmt chunk.\0A\00"
@.str.10 = [129 x i8] c"%s: File doesn't seem to be (Wwise) IMA ADPCM wave. It has format ID 0x%04x, bits per sample %u, %u bytes of extra format info.\0A\00"
@SEEK_SET = global i32 0
@.str.11 = [38 x i8] c"%s: Error writing to file.\0AAborting.\0A\00"
@.str.12 = [32 x i8] c"%s: File has no usable data...\0A\00"
@main.transformInData = internal global [4096 x i64] zeroinitializer
@main.transformOutData = internal global [4096 x i64] zeroinitializer
@.str.13 = [29 x i8] c"%s: Unexpected end of file.\0A\00"
@.str.14 = [35 x i8] c"%s: Error writing file.\0AAborting.\0A\00"
@.str.15 = [24 x i8] c"Finished processing %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32*
%8 = alloca i64
%9 = alloca i64
%10 = alloca [3 x i64]
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i64
%19 = alloca i64*
%20 = alloca i64*
%21 = alloca i64
%22 = alloca i64
%23 = alloca i64
%24 = alloca i64
%25 = alloca i64
%26 = alloca i64
%27 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%28 = load i32, i32* %4
%29 = icmp slt i32 %28, 2
br i1 %29, label %30, label %35
30: ; preds = %2
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([224 x i8], [224 x i8]* @.str, i64 0, i64 0), i8* %33)
store i32 -1, i32* %3
br label %450
35: ; preds = %2
store i64 1, i64* %6
br label %36
36: ; preds = %446, %35
%37 = load i64, i64* %6
%38 = load i32, i32* %4
%39 = sext i32 %38 to i64
%40 = icmp ult i64 %37, %39
br i1 %40, label %41, label %449
41: ; preds = %36
%42 = load i8**, i8*** %5
%43 = load i64, i64* %6
%44 = getelementptr inbounds i8*, i8** %42, i64 %43
%45 = load i8*, i8** %44
%46 = call i32* @fopen(i8* %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %46, i32** %7
%47 = load i32*, i32** %7
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %55
49: ; preds = %41
%50 = load i8**, i8*** %5
%51 = load i64, i64* %6
%52 = getelementptr inbounds i8*, i8** %50, i64 %51
%53 = load i8*, i8** %52
%54 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %53)
br label %446
55: ; preds = %41
%56 = load i32*, i32** %7
%57 = load i32, i32* @_IONBF
%58 = call i64 @setvbuf(i32* %56, i32* null, i32 %57, i32 0)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %68
60: ; preds = %55
%61 = load i8**, i8*** %5
%62 = load i64, i64* %6
%63 = getelementptr inbounds i8*, i8** %61, i64 %62
%64 = load i8*, i8** %63
%65 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %64)
%66 = load i32*, i32** %7
%67 = call i32 @fclose(i32* %66)
br label %446
68: ; preds = %55
store i64 1, i64* %8
store i64 0, i64* %9
%69 = bitcast [3 x i64]* %10 to i8*
%70 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 0
%71 = load i32*, i32** %7
%72 = call i64 @fread(i64* %70, i32 1, i64 12, i32* %71)
store i64 %72, i64* %8
%73 = load i64, i64* %8
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %83
75: ; preds = %68
%76 = load i8**, i8*** %5
%77 = load i64, i64* %6
%78 = getelementptr inbounds i8*, i8** %76, i64 %77
%79 = load i8*, i8** %78
%80 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %79)
%81 = load i32*, i32** %7
%82 = call i32 @fclose(i32* %81)
br label %446
83: ; preds = %68
%84 = load i64, i64* %8
%85 = icmp ult i64 %84, 12
br i1 %85, label %86, label %94
86: ; preds = %83
%87 = load i8**, i8*** %5
%88 = load i64, i64* %6
%89 = getelementptr inbounds i8*, i8** %87, i64 %88
%90 = load i8*, i8** %89
%91 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %90)
%92 = load i32*, i32** %7
%93 = call i32 @fclose(i32* %92)
br label %446
94: ; preds = %83
%95 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 0
%96 = load i64, i64* %95
%97 = load i64, i64* @main.riffMark
%98 = icmp ne i64 %96, %97
br i1 %98, label %99, label %109
99: ; preds = %94
%100 = load i8**, i8*** %5
%101 = load i64, i64* %6
%102 = getelementptr inbounds i8*, i8** %100, i64 %101
%103 = load i8*, i8** %102
%104 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 0
%105 = bitcast i64* %104 to i8*
%106 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i8* %103, i8* %105)
%107 = load i32*, i32** %7
%108 = call i32 @fclose(i32* %107)
br label %446
109: ; preds = %94
%110 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 1
%111 = load i64, i64* %110
store i64 %111, i64* %9
%112 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 2
%113 = load i64, i64* %112
%114 = load i64, i64* @main.waveMark
%115 = icmp ne i64 %113, %114
br i1 %115, label %116, label %127
116: ; preds = %109
%117 = load i8**, i8*** %5
%118 = load i64, i64* %6
%119 = getelementptr inbounds i8*, i8** %117, i64 %118
%120 = load i8*, i8** %119
%121 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 0
%122 = getelementptr inbounds i64, i64* %121, i64 2
%123 = bitcast i64* %122 to i8*
%124 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.7, i64 0, i64 0), i8* %120, i8* %123)
%125 = load i32*, i32** %7
%126 = call i32 @fclose(i32* %125)
br label %446
127: ; preds = %109
%128 = load i64, i64* @main.fmtMark
%129 = load i32*, i32** %7
%130 = load i8**, i8*** %5
%131 = load i64, i64* %6
%132 = getelementptr inbounds i8*, i8** %130, i64 %131
%133 = load i8*, i8** %132
%134 = call i64 @findChunk(i64 %128, i32* %129, i8* %133)
store i64 %134, i64* %11
%135 = load i64, i64* %11
%136 = icmp eq i64 %135, 0
br i1 %136, label %137, label %140
137: ; preds = %127
%138 = load i32*, i32** %7
%139 = call i32 @fclose(i32* %138)
br label %446
140: ; preds = %127
%141 = load i64, i64* %11
%142 = icmp ne i64 %141, 24
br i1 %142, label %143, label %152
143: ; preds = %140
%144 = load i8**, i8*** %5
%145 = load i64, i64* %6
%146 = getelementptr inbounds i8*, i8** %144, i64 %145
%147 = load i8*, i8** %146
%148 = load i64, i64* %11
%149 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.8, i64 0, i64 0), i8* %147, i64 %148)
%150 = load i32*, i32** %7
%151 = call i32 @fclose(i32* %150)
br label %446
152: ; preds = %140
%153 = load i32*, i32** %7
%154 = call i64 @ftell(i32* %153)
store i64 %154, i64* %12
%155 = load i64, i64* %12
%156 = icmp slt i64 %155, 0
br i1 %156, label %157, label %165
157: ; preds = %152
%158 = load i8**, i8*** %5
%159 = load i64, i64* %6
%160 = getelementptr inbounds i8*, i8** %158, i64 %159
%161 = load i8*, i8** %160
%162 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %161)
%163 = load i32*, i32** %7
%164 = call i32 @fclose(i32* %163)
br label %446
165: ; preds = %152
%166 = load i32*, i32** %7
%167 = call i64 @fread(i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 0), i32 1, i64 24, i32* %166)
store i64 %167, i64* %8
%168 = load i64, i64* %8
%169 = icmp ult i64 %168, 24
br i1 %169, label %170, label %178
170: ; preds = %165
%171 = load i8**, i8*** %5
%172 = load i64, i64* %6
%173 = getelementptr inbounds i8*, i8** %171, i64 %172
%174 = load i8*, i8** %173
%175 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i8* %174)
%176 = load i32*, i32** %7
%177 = call i32 @fclose(i32* %176)
br label %446
178: ; preds = %165
%179 = load i32, i32* bitcast (i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 2) to i32*)
store i32 %179, i32* %13
%180 = load i32, i32* bitcast (i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 12) to i32*)
store i32 %180, i32* %14
%181 = load i32, i32* bitcast ([24 x i64]* @main.fmtDescription to i32*)
store i32 %181, i32* %15
%182 = load i32, i32* bitcast (i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 14) to i32*)
store i32 %182, i32* %16
%183 = load i32, i32* bitcast (i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 16) to i32*)
store i32 %183, i32* %17
%184 = load i32, i32* %15
%185 = icmp eq i32 %184, 2
br i1 %185, label %186, label %192
186: ; preds = %178
%187 = load i32, i32* %16
%188 = icmp eq i32 %187, 4
br i1 %188, label %189, label %192
189: ; preds = %186
%190 = load i32, i32* %17
%191 = icmp eq i32 %190, 6
br i1 %191, label %203, label %192
192: ; preds = %189, %186, %178
%193 = load i8**, i8*** %5
%194 = load i64, i64* %6
%195 = getelementptr inbounds i8*, i8** %193, i64 %194
%196 = load i8*, i8** %195
%197 = load i32, i32* %15
%198 = load i32, i32* %16
%199 = load i32, i32* %17
%200 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str.10, i64 0, i64 0), i8* %196, i32 %197, i32 %198, i32 %199)
%201 = load i32*, i32** %7
%202 = call i32 @fclose(i32* %201)
br label %446
203: ; preds = %189
%204 = load i32, i32* @main.waveId
store i32 %204, i32* bitcast ([24 x i64]* @main.fmtDescription to i32*)
%205 = load i32, i32* %14
%206 = load i32, i32* %13
%207 = mul nsw i32 4, %206
%208 = sub nsw i32 %205, %207
%209 = mul nsw i32 %208, 8
%210 = load i32, i32* %16
%211 = load i32, i32* %13
%212 = mul nsw i32 %210, %211
%213 = sdiv i32 %209, %212
%214 = add nsw i32 %213, 1
store i32 %214, i32* bitcast (i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 18) to i32*)
%215 = load i32*, i32** %7
%216 = load i64, i64* %12
%217 = load i32, i32* @SEEK_SET
%218 = call i64 @fseek(i32* %215, i64 %216, i32 %217)
%219 = icmp ne i64 %218, 0
br i1 %219, label %220, label %228
220: ; preds = %203
%221 = load i8**, i8*** %5
%222 = load i64, i64* %6
%223 = getelementptr inbounds i8*, i8** %221, i64 %222
%224 = load i8*, i8** %223
%225 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %224)
%226 = load i32*, i32** %7
%227 = call i32 @fclose(i32* %226)
br label %446
228: ; preds = %203
%229 = load i32*, i32** %7
%230 = call i64 @fwrite(i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 0), i64 1, i32 24, i32* %229)
store i64 %230, i64* %8
%231 = load i64, i64* %8
%232 = icmp eq i64 %231, 0
br i1 %232, label %233, label %241
233: ; preds = %228
%234 = load i8**, i8*** %5
%235 = load i64, i64* %6
%236 = getelementptr inbounds i8*, i8** %234, i64 %235
%237 = load i8*, i8** %236
%238 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i8* %237)
%239 = load i32*, i32** %7
%240 = call i32 @fclose(i32* %239)
store i32 1, i32* %3
br label %450
241: ; preds = %228
%242 = load i64, i64* %8
%243 = icmp ult i64 %242, 24
br i1 %243, label %244, label %252
244: ; preds = %241
%245 = load i8**, i8*** %5
%246 = load i64, i64* %6
%247 = getelementptr inbounds i8*, i8** %245, i64 %246
%248 = load i8*, i8** %247
%249 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i8* %248)
%250 = load i32*, i32** %7
%251 = call i32 @fclose(i32* %250)
store i32 1, i32* %3
br label %450
252: ; preds = %241
%253 = load i32, i32* %13
%254 = icmp sgt i32 %253, 1
br i1 %254, label %255, label %438
255: ; preds = %252
%256 = load i32*, i32** %7
%257 = load i32, i32* @SEEK_SET
%258 = call i64 @fseek(i32* %256, i64 12, i32 %257)
%259 = icmp ne i64 %258, 0
br i1 %259, label %260, label %268
260: ; preds = %255
%261 = load i8**, i8*** %5
%262 = load i64, i64* %6
%263 = getelementptr inbounds i8*, i8** %261, i64 %262
%264 = load i8*, i8** %263
%265 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %264)
%266 = load i32*, i32** %7
%267 = call i32 @fclose(i32* %266)
br label %446
268: ; preds = %255
%269 = load i64, i64* @main.dataMark
%270 = load i32*, i32** %7
%271 = load i8**, i8*** %5
%272 = load i64, i64* %6
%273 = getelementptr inbounds i8*, i8** %271, i64 %272
%274 = load i8*, i8** %273
%275 = call i64 @findChunk(i64 %269, i32* %270, i8* %274)
store i64 %275, i64* %18
%276 = load i64, i64* %18
%277 = icmp eq i64 %276, 0
br i1 %277, label %278, label %286
278: ; preds = %268
%279 = load i8**, i8*** %5
%280 = load i64, i64* %6
%281 = getelementptr inbounds i8*, i8** %279, i64 %280
%282 = load i8*, i8** %281
%283 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), i8* %282)
%284 = load i32*, i32** %7
%285 = call i32 @fclose(i32* %284)
br label %446
286: ; preds = %268
store i64* getelementptr inbounds ([4096 x i64], [4096 x i64]* @main.transformInData, i64 0, i64 0), i64** %19
store i64* getelementptr inbounds ([4096 x i64], [4096 x i64]* @main.transformOutData, i64 0, i64 0), i64** %20
%287 = load i32, i32* %14
%288 = sdiv i32 4096, %287
%289 = sext i32 %288 to i64
store i64 %289, i64* %21
%290 = load i32, i32* %14
%291 = icmp sgt i32 %290, 4096
br i1 %291, label %292, label %300
292: ; preds = %286
%293 = load i32, i32* %14
%294 = mul nsw i32 2, %293
%295 = call i64* @malloc(i32 %294)
store i64* %295, i64** %19
%296 = load i64*, i64** %19
%297 = load i32, i32* %14
%298 = sext i32 %297 to i64
%299 = getelementptr inbounds i64, i64* %296, i64 %298
store i64* %299, i64** %20
store i64 1, i64* %21
br label %300
300: ; preds = %292, %286
store i64 0, i64* %22
br label %301
301: ; preds = %430, %300
%302 = load i64, i64* %22
%303 = load i32, i32* %14
%304 = sext i32 %303 to i64
%305 = mul i64 %302, %304
%306 = load i64, i64* %18
%307 = icmp ult i64 %305, %306
br i1 %307, label %308, label %431
308: ; preds = %301
%309 = load i32*, i32** %7
%310 = call i64 @ftell(i32* %309)
store i64 %310, i64* %23
%311 = load i64, i64* %23
%312 = icmp slt i64 %311, 0
br i1 %312, label %313, label %319
313: ; preds = %308
%314 = load i8**, i8*** %5
%315 = load i64, i64* %6
%316 = getelementptr inbounds i8*, i8** %314, i64 %315
%317 = load i8*, i8** %316
%318 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %317)
br label %431
319: ; preds = %308
%320 = load i64*, i64** %19
%321 = load i32, i32* %14
%322 = load i64, i64* %21
%323 = load i32*, i32** %7
%324 = call i64 @fread(i64* %320, i32 %321, i64 %322, i32* %323)
store i64 %324, i64* %8
%325 = load i64, i64* %8
%326 = icmp eq i64 %325, 0
br i1 %326, label %327, label %333
327: ; preds = %319
%328 = load i8**, i8*** %5
%329 = load i64, i64* %6
%330 = getelementptr inbounds i8*, i8** %328, i64 %329
%331 = load i8*, i8** %330
%332 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i8* %331)
br label %431
333: ; preds = %319
%334 = load i64, i64* %8
store i64 %334, i64* %24
%335 = load i64, i64* %24
%336 = load i64, i64* %22
%337 = add i64 %336, %335
store i64 %337, i64* %22
store i64 0, i64* %25
br label %338
338: ; preds = %397, %333
%339 = load i64, i64* %25
%340 = load i64, i64* %24
%341 = icmp ult i64 %339, %340
br i1 %341, label %342, label %400
342: ; preds = %338
store i64 0, i64* %26
br label %343
343: ; preds = %393, %342
%344 = load i64, i64* %26
%345 = load i32, i32* %14
%346 = load i32, i32* %13
%347 = mul nsw i32 %346, 4
%348 = sdiv i32 %345, %347
%349 = sext i32 %348 to i64
%350 = icmp ult i64 %344, %349
br i1 %350, label %351, label %396
351: ; preds = %343
store i64 0, i64* %27
br label %352
352: ; preds = %389, %351
%353 = load i64, i64* %27
%354 = load i32, i32* %13
%355 = sext i32 %354 to i64
%356 = icmp ult i64 %353, %355
br i1 %356, label %357, label %392
357: ; preds = %352
%358 = load i64*, i64** %19
%359 = load i64, i64* %25
%360 = load i32, i32* %14
%361 = sext i32 %360 to i64
%362 = mul i64 %359, %361
%363 = getelementptr inbounds i64, i64* %358, i64 %362
%364 = load i64, i64* %27
%365 = load i32, i32* %14
%366 = sext i32 %365 to i64
%367 = mul i64 %364, %366
%368 = load i32, i32* %13
%369 = mul nsw i32 %368, 4
%370 = sext i32 %369 to i64
%371 = udiv i64 %367, %370
%372 = load i64, i64* %26
%373 = add i64 %371, %372
%374 = getelementptr inbounds i64, i64* %363, i64 %373
%375 = load i64, i64* %374
%376 = load i64*, i64** %20
%377 = load i64, i64* %25
%378 = load i32, i32* %14
%379 = sext i32 %378 to i64
%380 = mul i64 %377, %379
%381 = getelementptr inbounds i64, i64* %376, i64 %380
%382 = load i64, i64* %26
%383 = load i32, i32* %13
%384 = sext i32 %383 to i64
%385 = mul i64 %382, %384
%386 = load i64, i64* %27
%387 = add i64 %385, %386
%388 = getelementptr inbounds i64, i64* %381, i64 %387
store i64 %375, i64* %388
br label %389
389: ; preds = %357
%390 = load i64, i64* %27
%391 = add i64 %390, 1
store i64 %391, i64* %27
br label %352
392: ; preds = %352
br label %393
393: ; preds = %392
%394 = load i64, i64* %26
%395 = add i64 %394, 1
store i64 %395, i64* %26
br label %343
396: ; preds = %343
br label %397
397: ; preds = %396
%398 = load i64, i64* %25
%399 = add i64 %398, 1
store i64 %399, i64* %25
br label %338
400: ; preds = %338
%401 = load i32*, i32** %7
%402 = load i64, i64* %23
%403 = load i32, i32* @SEEK_SET
%404 = call i64 @fseek(i32* %401, i64 %402, i32 %403)
%405 = icmp ne i64 %404, 0
br i1 %405, label %406, label %412
406: ; preds = %400
%407 = load i8**, i8*** %5
%408 = load i64, i64* %6
%409 = getelementptr inbounds i8*, i8** %407, i64 %408
%410 = load i8*, i8** %409
%411 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %410)
br label %431
412: ; preds = %400
%413 = load i64*, i64** %20
%414 = load i64, i64* %24
%415 = load i32, i32* %14
%416 = sext i32 %415 to i64
%417 = mul i64 %414, %416
%418 = load i32*, i32** %7
%419 = call i64 @fwrite(i64* %413, i64 %417, i32 1, i32* %418)
store i64 %419, i64* %8
%420 = load i64, i64* %8
%421 = icmp eq i64 %420, 0
br i1 %421, label %422, label %430
422: ; preds = %412
%423 = load i8**, i8*** %5
%424 = load i64, i64* %6
%425 = getelementptr inbounds i8*, i8** %423, i64 %424
%426 = load i8*, i8** %425
%427 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.14, i64 0, i64 0), i8* %426)
%428 = load i32*, i32** %7
%429 = call i32 @fclose(i32* %428)
store i32 1, i32* %3
br label %450
430: ; preds = %412
br label %301
431: ; preds = %406, %327, %313, %301
%432 = load i32, i32* %14
%433 = icmp sgt i32 %432, 4096
br i1 %433, label %434, label %437
434: ; preds = %431
%435 = load i64*, i64** %19
%436 = call i32 @free(i64* %435)
br label %437
437: ; preds = %434, %431
br label %438
438: ; preds = %437, %252
%439 = load i32*, i32** %7
%440 = call i32 @fclose(i32* %439)
%441 = load i8**, i8*** %5
%442 = load i64, i64* %6
%443 = getelementptr inbounds i8*, i8** %441, i64 %442
%444 = load i8*, i8** %443
%445 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), i8* %444)
br label %446
446: ; preds = %438, %278, %260, %220, %192, %170, %157, %143, %137, %116, %99, %86, %75, %60, %49
%447 = load i64, i64* %6
%448 = add i64 %447, 1
store i64 %448, i64* %6
br label %36
449: ; preds = %36
store i32 0, i32* %3
br label %450
450: ; preds = %449, %422, %244, %233, %30
%451 = load i32, i32* %3
ret i32 %451
}

LLVM IR (-O2):
@.str = [224 x i8] c"Usage: %s FileName1 [FileName2...]\0AAssumes provided files are Wwise IMA ADPCM wave files,\0Achanges CONTENTS of the provided files in a way\0Athat lets them be read by complete IMA ADPCM decoders (for example, SoX).\0AVersion r4\0A\00"
@.str.1 = [4 x i8] c"r+b\00"
@.str.2 = [25 x i8] c"%s: Error opening file.\0A\00"
@_IONBF = global i32 0
@.str.3 = [24 x i8] c"%s: Error using file?!\0A\00"
@.str.4 = [22 x i8] c"%s: Can't read file.\0A\00"
@.str.5 = [24 x i8] c"%s: File is too small.\0A\00"
@.str.6 = [47 x i8] c"%s: Wrong format. Expected \22RIFF\22, got \22%.4s\22\0A\00"
@.str.7 = [75 x i8] c"%s: Can't recognize format. Got \22RIFF\22, but no \22WAVE\22. Got \22%.4s\22 instead\0A\00"
@.str.8 = [80 x i8] c"%s: File has wrong format of data. fmt chunk is of unexpected size (%u bytes).\0A\00"
@main.fmtDescription = internal global [24 x i64] zeroinitializer
@.str.9 = [27 x i8] c"%s: Can't read fmt chunk.\0A\00"
@.str.10 = [129 x i8] c"%s: File doesn't seem to be (Wwise) IMA ADPCM wave. It has format ID 0x%04x, bits per sample %u, %u bytes of extra format info.\0A\00"
@SEEK_SET = global i32 0
@.str.11 = [38 x i8] c"%s: Error writing to file.\0AAborting.\0A\00"
@.str.12 = [32 x i8] c"%s: File has no usable data...\0A\00"
@main.transformInData = internal global [4096 x i64] zeroinitializer
@main.transformOutData = internal global [4096 x i64] zeroinitializer
@.str.13 = [29 x i8] c"%s: Unexpected end of file.\0A\00"
@.str.14 = [35 x i8] c"%s: Error writing file.\0AAborting.\0A\00"
@.str.15 = [24 x i8] c"Finished processing %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [3 x i64]
%4 = icmp slt i32 %0, 2
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = zext i32 %0 to i64
%7 = bitcast [3 x i64]* %3 to i8*
%8 = getelementptr inbounds [3 x i64], [3 x i64]* %3, i64 0, i64 0
%9 = getelementptr inbounds [3 x i64], [3 x i64]* %3, i64 0, i64 2
br label %13
10: ; preds = %2
%11 = load i8*, i8** %1
%12 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([224 x i8], [224 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %245
13: ; preds = %5, %242
%14 = phi i64 [ 1, %5 ], [ %243, %242 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = load i8*, i8** %15
%21 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %20)
br label %242
22: ; preds = %13
%23 = load i32, i32* @_IONBF
%24 = call i64 @setvbuf(i32* %17, i32* null, i32 %23, i32 0)
%25 = icmp eq i64 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %22
%27 = load i8*, i8** %15
%28 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %27)
%29 = call i32 @fclose(i32* %17)
br label %242
30: ; preds = %22
%31 = call i64 @fread(i64* %8, i32 1, i64 12, i32* %17)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i8*, i8** %15
%35 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %34)
br label %53
36: ; preds = %30
%37 = icmp ult i64 %31, 12
br i1 %37, label %38, label %41
38: ; preds = %36
%39 = load i8*, i8** %15
%40 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %39)
br label %53
41: ; preds = %36
%42 = load i64, i64* %8
%43 = icmp eq i64 %42, 1179011410
br i1 %43, label %47, label %44
44: ; preds = %41
%45 = load i8*, i8** %15
%46 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i8* %45, [3 x i64]* %3)
br label %53
47: ; preds = %41
%48 = load i64, i64* %9
%49 = icmp eq i64 %48, 1163280727
br i1 %49, label %55, label %50
50: ; preds = %47
%51 = load i8*, i8** %15
%52 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.7, i64 0, i64 0), i8* %51, i64* %9)
br label %53
53: ; preds = %50, %44, %38, %33
%54 = call i32 @fclose(i32* %17)
br label %242
55: ; preds = %47
%56 = load i8*, i8** %15
%57 = call i64 @findChunk(i64 544501094, i32* %17, i8* %56)
switch i64 %57, label %60 [
i64 0, label %58
i64 24, label %64
]
58: ; preds = %55
%59 = call i32 @fclose(i32* %17)
br label %242
60: ; preds = %55
%61 = load i8*, i8** %15
%62 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.8, i64 0, i64 0), i8* %61, i64 %57)
%63 = call i32 @fclose(i32* %17)
br label %242
64: ; preds = %55
%65 = call i64 @ftell(i32* %17)
%66 = icmp slt i64 %65, 0
br i1 %66, label %67, label %71
67: ; preds = %64
%68 = load i8*, i8** %15
%69 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %68)
%70 = call i32 @fclose(i32* %17)
br label %242
71: ; preds = %64
%72 = call i64 @fread(i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 0), i32 1, i64 24, i32* %17)
%73 = icmp ult i64 %72, 24
br i1 %73, label %74, label %78
74: ; preds = %71
%75 = load i8*, i8** %15
%76 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i8* %75)
%77 = call i32 @fclose(i32* %17)
br label %242
78: ; preds = %71
%79 = load i32, i32* bitcast (i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 2) to i32*)
%80 = load i32, i32* bitcast (i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 12) to i32*)
%81 = load i32, i32* bitcast ([24 x i64]* @main.fmtDescription to i32*)
%82 = load i32, i32* bitcast (i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 14) to i32*)
%83 = load i32, i32* bitcast (i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 16) to i32*)
%84 = icmp eq i32 %81, 2
%85 = icmp eq i32 %82, 4
%86 = select i1 %84, i1 %85, i1 false
%87 = icmp eq i32 %83, 6
%88 = select i1 %86, i1 %87, i1 false
br i1 %88, label %93, label %89
89: ; preds = %78
%90 = load i8*, i8** %15
%91 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str.10, i64 0, i64 0), i8* %90, i32 %81, i32 %82, i32 %83)
%92 = call i32 @fclose(i32* %17)
br label %242
93: ; preds = %78
store i32 17, i32* bitcast ([24 x i64]* @main.fmtDescription to i32*)
%94 = mul i32 %79, -4
%95 = add i32 %94, %80
%96 = shl nsw i32 %95, 3
%97 = shl nsw i32 %79, 2
%98 = sdiv i32 %96, %97
%99 = add nsw i32 %98, 1
store i32 %99, i32* bitcast (i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 18) to i32*)
%100 = load i32, i32* @SEEK_SET
%101 = call i64 @fseek(i32* %17, i64 %65, i32 %100)
%102 = icmp eq i64 %101, 0
br i1 %102, label %107, label %103
103: ; preds = %93
%104 = load i8*, i8** %15
%105 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %104)
%106 = call i32 @fclose(i32* %17)
br label %242
107: ; preds = %93
%108 = call i64 @fwrite(i64* getelementptr inbounds ([24 x i64], [24 x i64]* @main.fmtDescription, i64 0, i64 0), i64 1, i32 24, i32* %17)
%109 = icmp eq i64 %108, 0
br i1 %109, label %110, label %114
110: ; preds = %107
%111 = load i8*, i8** %15
%112 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i8* %111)
%113 = call i32 @fclose(i32* %17)
br label %245
114: ; preds = %107
%115 = icmp ult i64 %108, 24
br i1 %115, label %116, label %120
116: ; preds = %114
%117 = load i8*, i8** %15
%118 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i8* %117)
%119 = call i32 @fclose(i32* %17)
br label %245
120: ; preds = %114
%121 = icmp sgt i32 %79, 1
br i1 %121, label %122, label %238
122: ; preds = %120
%123 = load i32, i32* @SEEK_SET
%124 = call i64 @fseek(i32* %17, i64 12, i32 %123)
%125 = icmp eq i64 %124, 0
%126 = load i8*, i8** %15
br i1 %125, label %130, label %127
127: ; preds = %122
%128 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %126)
%129 = call i32 @fclose(i32* %17)
br label %242
130: ; preds = %122
%131 = call i64 @findChunk(i64 1635017060, i32* %17, i8* %126)
%132 = icmp eq i64 %131, 0
br i1 %132, label %133, label %137
133: ; preds = %130
%134 = load i8*, i8** %15
%135 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), i8* %134)
%136 = call i32 @fclose(i32* %17)
br label %242
137: ; preds = %130
%138 = sdiv i32 4096, %80
%139 = sext i32 %138 to i64
%140 = icmp sgt i32 %80, 4096
br i1 %140, label %141, label %146
141: ; preds = %137
%142 = shl nuw nsw i32 %80, 1
%143 = call i64* @malloc(i32 %142)
%144 = zext i32 %80 to i64
%145 = getelementptr inbounds i64, i64* %143, i64 %144
br label %146
146: ; preds = %141, %137
%147 = phi i64* [ %143, %141 ], [ getelementptr inbounds ([4096 x i64], [4096 x i64]* @main.transformInData, i64 0, i64 0), %137 ]
%148 = phi i64* [ %145, %141 ], [ getelementptr inbounds ([4096 x i64], [4096 x i64]* @main.transformOutData, i64 0, i64 0), %137 ]
%149 = phi i64 [ 1, %141 ], [ %139, %137 ]
%150 = sext i32 %80 to i64
%151 = zext i32 %79 to i64
%152 = sext i32 %97 to i64
%153 = and i64 %151, 1
%154 = icmp eq i32 %79, 1
%155 = and i64 %151, 4294967294
%156 = icmp eq i64 %153, 0
br label %157
157: ; preds = %222, %146
%158 = phi i64 [ 0, %146 ], [ %223, %222 ]
%159 = mul i64 %158, %150
%160 = icmp ult i64 %159, %131
br i1 %160, label %161, label %235
161: ; preds = %157
%162 = call i64 @ftell(i32* %17)
%163 = icmp slt i64 %162, 0
br i1 %163, label %231, label %164
164: ; preds = %161
%165 = call i64 @fread(i64* %147, i32 %80, i64 %149, i32* %17)
%166 = icmp eq i64 %165, 0
br i1 %166, label %231, label %167
167: ; preds = %164
%168 = sdiv i32 %80, %97
%169 = icmp eq i32 %168, 0
%170 = call i32 @llvm.umax.i32(i32 %168, i32 1)
%171 = sext i32 %170 to i64
br label %172
172: ; preds = %167, %185
%173 = phi i64 [ 0, %167 ], [ %186, %185 ]
br i1 %169, label %185, label %174
174: ; preds = %172
%175 = mul i64 %173, %150
%176 = getelementptr inbounds i64, i64* %147, i64 %175
%177 = getelementptr inbounds i64, i64* %148, i64 %175
br label %182
178: ; preds = %185
%179 = load i32, i32* @SEEK_SET
%180 = call i64 @fseek(i32* %17, i64 %162, i32 %179)
%181 = icmp eq i64 %180, 0
br i1 %181, label %222, label %231
182: ; preds = %174, %198
%183 = phi i64 [ 0, %174 ], [ %199, %198 ]
%184 = mul i64 %183, %151
br i1 %154, label %188, label %201
185: ; preds = %198, %172
%186 = add nuw i64 %173, 1
%187 = icmp eq i64 %186, %165
br i1 %187, label %178, label %172
188: ; preds = %201, %182
%189 = phi i64 [ 0, %182 ], [ %219, %201 ]
br i1 %156, label %198, label %190
190: ; preds = %188
%191 = mul i64 %189, %150
%192 = udiv i64 %191, %152
%193 = add i64 %192, %183
%194 = getelementptr inbounds i64, i64* %176, i64 %193
%195 = load i64, i64* %194
%196 = add i64 %189, %184
%197 = getelementptr inbounds i64, i64* %177, i64 %196
store i64 %195, i64* %197
br label %198
198: ; preds = %188, %190
%199 = add nuw i64 %183, 1
%200 = icmp eq i64 %199, %171
br i1 %200, label %185, label %182
201: ; preds = %182, %201
%202 = phi i64 [ %219, %201 ], [ 0, %182 ]
%203 = phi i64 [ %220, %201 ], [ 0, %182 ]
%204 = mul i64 %202, %150
%205 = udiv i64 %204, %152
%206 = add i64 %205, %183
%207 = getelementptr inbounds i64, i64* %176, i64 %206
%208 = load i64, i64* %207
%209 = add i64 %202, %184
%210 = getelementptr inbounds i64, i64* %177, i64 %209
store i64 %208, i64* %210
%211 = or i64 %202, 1
%212 = mul i64 %211, %150
%213 = udiv i64 %212, %152
%214 = add i64 %213, %183
%215 = getelementptr inbounds i64, i64* %176, i64 %214
%216 = load i64, i64* %215
%217 = add i64 %211, %184
%218 = getelementptr inbounds i64, i64* %177, i64 %217
store i64 %216, i64* %218
%219 = add nuw i64 %202, 2
%220 = add i64 %203, 2
%221 = icmp eq i64 %220, %155
br i1 %221, label %188, label %201
222: ; preds = %178
%223 = add i64 %165, %158
%224 = mul i64 %165, %150
%225 = call i64 @fwrite(i64* %148, i64 %224, i32 1, i32* %17)
%226 = icmp eq i64 %225, 0
br i1 %226, label %227, label %157
227: ; preds = %222
%228 = load i8*, i8** %15
%229 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.14, i64 0, i64 0), i8* %228)
%230 = call i32 @fclose(i32* %17)
br label %245
231: ; preds = %178, %164, %161
%232 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), %161 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), %164 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), %178 ]
%233 = load i8*, i8** %15
%234 = call i32 (i8*, i8*, ...) @printf(i8* %232, i8* %233)
br label %235
235: ; preds = %157, %231
br i1 %140, label %236, label %238
236: ; preds = %235
%237 = call i32 @free(i64* %147)
br label %238
238: ; preds = %235, %236, %120
%239 = call i32 @fclose(i32* %17)
%240 = load i8*, i8** %15
%241 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), i8* %240)
br label %242
242: ; preds = %103, %89, %133, %53, %238, %127, %74, %67, %60, %58, %26, %19
%243 = add nuw i64 %14, 1
%244 = icmp eq i64 %243, %6
br i1 %244, label %245, label %13
245: ; preds = %242, %116, %110, %227, %10
%246 = phi i32 [ -1, %10 ], [ 1, %227 ], [ 1, %110 ], [ 1, %116 ], [ 0, %242 ]
ret i32 %246
}