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

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(int *, int, int, int /*<<< orphan*/ *);
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, int *);
int main(int argc, char *argv[]) {
  FILE *infile, *outfile;
  uint8_t *inbuf, *outbuf;
  uint8_t tmp;
  int i, j, k, n;
  uint32_t channels, samplerate;
  int64_t samplecount;
  uint8_t chunkname[5] = {0};
  uint32_t tmp32;
  uint64_t tmp64;
  if (argc != 3) {
    printf("Usage: %s input.dsf output.pcm\n", argv[0]);
    return 1;
  }
  infile = fopen(argv[1], "r");
  if (infile == NULL) {
    printf("cannot open input\n");
    return 1;
  }
  outfile = fopen(argv[2], "w");
  if (outfile == NULL) {
    printf("cannot open output\n");
    return 1;
  }
  fread(chunkname, 1, 4, infile);
  if (strcmp("DSD ", chunkname)) {
    printf("not a DSF file\n");
    return 1;
  }
  fseek(infile, 28, SEEK_SET);
  fread(chunkname, 1, 4, infile);
  if (strcmp("fmt ", chunkname)) {
    printf("fmt chunk not found\n");
    return 1;
  }
  fread(&tmp64, 1, 8, infile);
  if (tmp64 != 52) {
    printf("fmt chunk size is not 52\n");
    return 1;
  }
  fread(&tmp32, 1, 4, infile);
  if (tmp32 != 1) {
    printf("fmt chunk version is not 1\n");
    return 1;
  }
  fread(&tmp32, 1, 4, infile);
  if (tmp32 != 0) {
    printf("format ID is not 0\n");
    return 1;
  }
  fseek(infile, 4, SEEK_CUR);
  fread(&channels, 1, 4, infile);
  printf("channels: %d\n", channels);
  fread(&samplerate, 1, 4, infile);
  printf("samplerate: %d\n", samplerate);
  fread(&tmp32, 1, 4, infile);
  if (tmp32 != 1) {
    printf("bits per sample is not 1\n");
    return 1;
  }
  fread(&samplecount, 1, 8, infile);
  printf("sample count: %ld\n", samplecount);
  fread(&tmp32, 1, 4, infile);
  if (tmp32 != 4096) {
    printf("block size per channel %d is not %d\n", tmp32, 4096);
    return 1;
  }
  fseek(infile, 92, SEEK_SET);
  inbuf = malloc(channels * 4096 * 8 / 8);
  outbuf = malloc(channels * 4096 * 8);
  while (samplecount > 0) {
    n = fread(inbuf, 1, channels * 4096 * 8 / 8, infile);
    if (n < channels * 4096 * 8 / 8) {
      break;
    }
    for (i = 0; i < channels; i++) {
      for (j = 0; j < 4096 * 8 / 8; j++) {
        tmp = inbuf[i * 4096 * 8 / 8 + j];
        for (k = 0; k < 8; k++) {
          outbuf[i + j * channels * 8 + k * channels] =
              ((tmp & 0x01) << 7) | 0x40;
          tmp = tmp >> 1;
        }
      }
    }
    fwrite(outbuf, 1, n * 8, outfile);
    samplecount -= 4096 * 8;
  }
  fclose(infile);
  fclose(outfile);
  printf("DONE!\n");
  printf("When you load the pcm file, set channels = %d and sample format = "
         "8bit unsigned/signed (doesn't matter for this program's output)\n",
         channels);
  printf("Set sample rate to %d if possible. If not, set it to anything you "
         "like and take this into account when reading timestamps and spectral "
         "displays\n",
         samplerate);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1060 <memset@plt>
cmpl   $0x3,-0x8(%rbp)
je     11e4 <main+0x54>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16b1 <main+0x521>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe2d(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1221 <main+0x91>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16b1 <main+0x521>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe05(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    125e <main+0xce>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16b1 <main+0x521>
lea    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
lea    -0x70(%rbp),%rsi
lea    0xdcb(%rip),%rdi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     12a9 <main+0x119>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16b1 <main+0x521>
mov    -0x18(%rbp),%rdi
mov    0x2d24(%rip),%rax
mov    (%rax),%edx
mov    $0x1c,%esi
call   1090 <fseek@plt>
lea    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
lea    -0x70(%rbp),%rsi
lea    0xd7e(%rip),%rdi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     130b <main+0x17b>
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16b1 <main+0x521>
mov    -0x18(%rbp),%rcx
lea    -0x78(%rbp),%rdi
mov    $0x1,%esi
mov    $0x8,%edx
call   1030 <fread@plt>
cmpl   $0x34,-0x78(%rbp)
je     1346 <main+0x1b6>
lea    0xd47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16b1 <main+0x521>
mov    -0x18(%rbp),%rcx
lea    -0x74(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
cmpl   $0x1,-0x74(%rbp)
je     1381 <main+0x1f1>
lea    0xd26(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16b1 <main+0x521>
mov    -0x18(%rbp),%rcx
lea    -0x74(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
cmpl   $0x0,-0x74(%rbp)
je     13bc <main+0x22c>
lea    0xd07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16b1 <main+0x521>
mov    -0x18(%rbp),%rdi
mov    0x2c21(%rip),%rax
mov    (%rax),%edx
mov    $0x4,%esi
call   1090 <fseek@plt>
mov    -0x18(%rbp),%rcx
lea    -0x48(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
mov    -0x48(%rbp),%esi
lea    0xcd0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rcx
lea    -0x4c(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
mov    -0x4c(%rbp),%esi
lea    0xcb6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rcx
lea    -0x74(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
cmpl   $0x1,-0x74(%rbp)
je     145e <main+0x2ce>
lea    0xc97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16b1 <main+0x521>
mov    -0x18(%rbp),%rcx
lea    -0x50(%rbp),%rdi
mov    $0x1,%esi
mov    $0x8,%edx
call   1030 <fread@plt>
mov    -0x50(%rbp),%esi
lea    0xc7d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rcx
lea    -0x74(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
cmpl   $0x1000,-0x74(%rbp)
je     14cc <main+0x33c>
mov    -0x74(%rbp),%esi
lea    0xc5b(%rip),%rdi
mov    $0x1000,%edx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16b1 <main+0x521>
mov    -0x18(%rbp),%rdi
mov    0x2b01(%rip),%rax
mov    (%rax),%edx
mov    $0x5c,%esi
call   1090 <fseek@plt>
mov    -0x48(%rbp),%eax
shl    $0xc,%eax
shl    $0x3,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x48(%rbp),%edi
shl    $0xc,%edi
shl    $0x3,%edi
call   1080 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpl   $0x0,-0x50(%rbp)
jle    1668 <main+0x4d8>
mov    -0x28(%rbp),%rdi
mov    -0x48(%rbp),%eax
shl    $0xc,%eax
shl    $0x3,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x48(%rbp),%eax
shl    $0xc,%eax
shl    $0x3,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x7c(%rbp),%eax
cmp    %ecx,%eax
jge    156c <main+0x3dc>
jmp    1668 <main+0x4d8>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    1640 <main+0x4b0>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x1000,-0x3c(%rbp)
jge    162d <main+0x49d>
mov    -0x28(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x38(%rbp),%eax
shl    $0xc,%eax
shl    $0x3,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x88(%rbp),%rax
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x34(%rbp)
movl   $0x0,-0x40(%rbp)
cmpl   $0x8,-0x40(%rbp)
jge    161a <main+0x48a>
mov    -0x34(%rbp),%edx
and    $0x1,%edx
shl    $0x7,%edx
or     $0x40,%edx
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    -0x3c(%rbp),%esi
imul   -0x48(%rbp),%esi
shl    $0x3,%esi
add    %esi,%ecx
mov    -0x40(%rbp),%esi
imul   -0x48(%rbp),%esi
add    %esi,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x34(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    15cb <main+0x43b>
jmp    161f <main+0x48f>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1586 <main+0x3f6>
jmp    1632 <main+0x4a2>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1573 <main+0x3e3>
mov    -0x30(%rbp),%rdi
mov    -0x44(%rbp),%edx
shl    $0x3,%edx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   10b0 <fwrite@plt>
mov    -0x50(%rbp),%eax
sub    $0x8000,%eax
mov    %eax,-0x50(%rbp)
jmp    1511 <main+0x381>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xab3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x48(%rbp),%esi
lea    0xaa9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4c(%rbp),%esi
lea    0xb1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movl   $0x0,0x80(%rsp)
cmp    $0x3,%edi
jne    122d <main+0x9d>
mov    0x8(%rbx),%rdi
lea    0xe59(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1240 <main+0xb0>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xe43(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1249 <main+0xb9>
mov    %rax,%r15
lea    0x70(%rsp),%rbx
mov    $0x1,%ebp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
lea    0xe12(%rip),%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     126e <main+0xde>
lea    0xfec(%rip),%rdi
call   1030 <puts@plt>
jmp    125a <main+0xca>
mov    (%rbx),%rsi
lea    0xdc9(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1255 <main+0xc5>
lea    0xfed(%rip),%rdi
jmp    1250 <main+0xc0>
lea    0xfd1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d63(%rip),%r12
mov    (%r12),%edx
mov    %r14,%rdi
mov    $0x1c,%esi
call   1090 <fseek@plt>
lea    0x70(%rsp),%rbx
mov    $0x1,%ebp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
lea    0xd7d(%rip),%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12c7 <main+0x137>
lea    0xf3e(%rip),%rdi
call   1030 <puts@plt>
jmp    125a <main+0xca>
lea    0x2c(%rsp),%rdi
mov    $0x1,%ebp
mov    $0x1,%esi
mov    $0x8,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmpl   $0x34,0x2c(%rsp)
jne    133b <main+0x1ab>
mov    %rsp,%rdi
mov    $0x1,%ebp
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmpl   $0x1,(%rsp)
jne    134c <main+0x1bc>
mov    %rsp,%rdi
mov    $0x1,%ebp
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmpl   $0x0,(%rsp)
je     135d <main+0x1cd>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
jmp    125a <main+0xca>
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
jmp    125a <main+0xca>
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
jmp    125a <main+0xca>
mov    0x2c84(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0x4,%esi
call   1090 <fseek@plt>
lea    0x34(%rsp),%rdi
mov    $0x1,%ebp
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
mov    0x34(%rsp),%esi
lea    0xc94(%rip),%rdi
mov    %rsi,0x8(%rsp)
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
mov    0x30(%rsp),%ebx
lea    0xc74(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmpl   $0x1,(%rsp)
jne    163f <main+0x4af>
lea    0x4(%rsp),%rdi
mov    $0x1,%ebp
mov    $0x1,%esi
mov    $0x8,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
mov    0x4(%rsp),%r13d
lea    0xc34(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
mov    (%rsp),%esi
cmp    $0x1000,%esi
jne    1650 <main+0x4c0>
mov    %ebx,0x1c(%rsp)
mov    %r15,0x38(%rsp)
mov    (%r12),%edx
mov    %r14,0x40(%rsp)
mov    %r14,%rdi
mov    $0x5c,%esi
call   1090 <fseek@plt>
mov    0x8(%rsp),%rbx
mov    %ebx,%edi
shl    $0xc,%edi
mov    %edi,0x24(%rsp)
call   1080 <malloc@plt>
mov    %rax,0x48(%rsp)
mov    %ebx,%edi
shl    $0xf,%edi
call   1080 <malloc@plt>
test   %r13d,%r13d
jle    1668 <main+0x4d8>
mov    %rax,%r12
mov    %r13,0x10(%rsp)
lea    0x0(,%rbx,8),%eax
mov    %eax,0x20(%rsp)
sub    %ebx,%eax
mov    %rax,0x50(%rsp)
lea    (%rbx,%rbx,1),%ebp
lea    0x0(%rbp,%rbp,2),%eax
mov    %rax,0x58(%rsp)
lea    (%rbx,%rbx,4),%r14d
lea    0x0(,%rbx,4),%r15d
lea    (%rbx,%rbx,2),%r13d
mov    %rbp,0x60(%rsp)
jmp    1504 <main+0x374>
mov    0x28(%rsp),%edx
shl    $0x3,%edx
mov    %r12,%rdi
mov    $0x1,%esi
mov    0x38(%rsp),%rcx
call   10b0 <fwrite@plt>
mov    0x10(%rsp),%rcx
lea    -0x8000(%rcx),%eax
cmp    $0x8000,%ecx
mov    %eax,%ecx
mov    %rcx,0x10(%rsp)
jle    1672 <main+0x4e2>
mov    0x48(%rsp),%rdi
mov    $0x1,%esi
mov    0x24(%rsp),%ebx
mov    %ebx,%edx
mov    0x40(%rsp),%rcx
call   1040 <fread@plt>
cmp    %ebx,%eax
jl     166d <main+0x4dd>
mov    %eax,0x28(%rsp)
mov    0x8(%rsp),%r9
test   %r9d,%r9d
mov    0x20(%rsp),%r10d
mov    0x50(%rsp),%r11
jle    14cd <main+0x33d>
mov    0x48(%rsp),%rcx
xor    %esi,%esi
mov    %rsi,0x68(%rsp)
xor    %edi,%edi
mov    0x60(%rsp),%r8
mov    0x58(%rsp),%rax
cs nopw 0x0(%rax,%rax,1)
mov    (%rcx,%rdi,4),%ebx
mov    %ebx,%edx
shl    $0x7,%edx
or     $0x40,%edx
movzbl %dl,%edx
movslq %esi,%rsi
mov    %edx,(%r12,%rsi,4)
mov    %ebx,%edx
shl    $0x6,%edx
or     $0x40,%edx
movzbl %dl,%edx
lea    (%r9,%rsi,1),%ebp
movslq %ebp,%rbp
mov    %edx,(%r12,%rbp,4)
mov    %ebx,%edx
and    $0x4,%edx
shl    $0x5,%edx
or     $0x40,%edx
lea    (%r8,%rsi,1),%ebp
movslq %ebp,%rbp
mov    %edx,(%r12,%rbp,4)
mov    %ebx,%edx
and    $0x8,%edx
shl    $0x4,%edx
or     $0x40,%edx
lea    (%rsi,%r13,1),%ebp
movslq %ebp,%rbp
mov    %edx,(%r12,%rbp,4)
mov    %ebx,%edx
and    $0x10,%edx
lea    0x40(,%rdx,8),%edx
lea    (%r15,%rsi,1),%ebp
movslq %ebp,%rbp
mov    %edx,(%r12,%rbp,4)
mov    %ebx,%edx
and    $0x20,%edx
lea    0x40(,%rdx,4),%edx
lea    (%r14,%rsi,1),%ebp
movslq %ebp,%rbp
mov    %edx,(%r12,%rbp,4)
mov    %ebx,%edx
and    $0x40,%edx
add    %edx,%edx
add    $0x40,%edx
lea    (%rax,%rsi,1),%ebp
movslq %ebp,%rbp
mov    %edx,(%r12,%rbp,4)
and    $0x80,%ebx
or     $0x40,%ebx
lea    (%r11,%rsi,1),%edx
movslq %edx,%rdx
mov    %ebx,(%r12,%rdx,4)
add    $0x1,%rdi
add    %r10d,%esi
cmp    $0x1000,%rdi
jne    1560 <main+0x3d0>
mov    0x68(%rsp),%rsi
add    $0x1,%rsi
add    $0x4000,%rcx
cmp    %r9,%rsi
jne    1545 <main+0x3b5>
jmp    14cd <main+0x33d>
lea    0xb58(%rip),%rdi
call   1030 <puts@plt>
jmp    125a <main+0xca>
lea    0xa08(%rip),%rdi
mov    $0x1000,%edx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    125a <main+0xca>
mov    %r13d,%eax
jmp    1672 <main+0x4e2>
mov    0x10(%rsp),%rax
mov    %eax,0x4(%rsp)
mov    0x40(%rsp),%rdi
call   1050 <fclose@plt>
mov    0x38(%rsp),%rdi
call   1050 <fclose@plt>
lea    0xb07(%rip),%rdi
call   1030 <puts@plt>
lea    0x9e7(%rip),%rdi
xor    %ebp,%ebp
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xa55(%rip),%rdi
mov    0x1c(%rsp),%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    125a <main+0xca>

LLVM IR (-O0):
@.str = [32 x i8] c"Usage: %s input.dsf output.pcm\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"cannot open input\0A\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [20 x i8] c"cannot open output\0A\00"
@.str.5 = [5 x i8] c"DSD \00"
@.str.6 = [16 x i8] c"not a DSF file\0A\00"
@SEEK_SET = global i32 0
@.str.7 = [5 x i8] c"fmt \00"
@.str.8 = [21 x i8] c"fmt chunk not found\0A\00"
@.str.9 = [26 x i8] c"fmt chunk size is not 52\0A\00"
@.str.10 = [28 x i8] c"fmt chunk version is not 1\0A\00"
@.str.11 = [20 x i8] c"format ID is not 0\0A\00"
@SEEK_CUR = global i32 0
@.str.12 = [14 x i8] c"channels: %d\0A\00"
@.str.13 = [16 x i8] c"samplerate: %d\0A\00"
@.str.14 = [26 x i8] c"bits per sample is not 1\0A\00"
@.str.15 = [19 x i8] c"sample count: %ld\0A\00"
@.str.16 = [37 x i8] c"block size per channel %d is not %d\0A\00"
@.str.17 = [7 x i8] c"DONE!\0A\00"
@.str.18 = [131 x i8] c"When you load the pcm file, set channels = %d and sample format = 8bit unsigned/signed (doesn't matter for this program's output)\0A\00"
@.str.19 = [145 x i8] c"Set sample rate to %d if possible. If not, set it to anything you like and take this into account when reading timestamps and spectral displays\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca [5 x i32]
%19 = alloca i32
%20 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%21 = bitcast [5 x i32]* %18 to i8*
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 3
br i1 %23, label %24, label %29
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %27)
store i32 1, i32* %3
br label %222
29: ; preds = %2
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %33, i32** %6
%34 = load i32*, i32** %6
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %38
36: ; preds = %29
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %222
38: ; preds = %29
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %42, i32** %7
%43 = load i32*, i32** %7
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %47
45: ; preds = %38
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %222
47: ; preds = %38
%48 = getelementptr inbounds [5 x i32], [5 x i32]* %18, i64 0, i64 0
%49 = load i32*, i32** %6
%50 = call i32 @fread(i32* %48, i32 1, i32 4, i32* %49)
%51 = getelementptr inbounds [5 x i32], [5 x i32]* %18, i64 0, i64 0
%52 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32* %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %47
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %222
56: ; preds = %47
%57 = load i32*, i32** %6
%58 = load i32, i32* @SEEK_SET
%59 = call i32 @fseek(i32* %57, i32 28, i32 %58)
%60 = getelementptr inbounds [5 x i32], [5 x i32]* %18, i64 0, i64 0
%61 = load i32*, i32** %6
%62 = call i32 @fread(i32* %60, i32 1, i32 4, i32* %61)
%63 = getelementptr inbounds [5 x i32], [5 x i32]* %18, i64 0, i64 0
%64 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32* %63)
%65 = icmp ne i64 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %56
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %222
68: ; preds = %56
%69 = load i32*, i32** %6
%70 = call i32 @fread(i32* %20, i32 1, i32 8, i32* %69)
%71 = load i32, i32* %20
%72 = icmp ne i32 %71, 52
br i1 %72, label %73, label %75
73: ; preds = %68
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %3
br label %222
75: ; preds = %68
%76 = load i32*, i32** %6
%77 = call i32 @fread(i32* %19, i32 1, i32 4, i32* %76)
%78 = load i32, i32* %19
%79 = icmp ne i32 %78, 1
br i1 %79, label %80, label %82
80: ; preds = %75
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %3
br label %222
82: ; preds = %75
%83 = load i32*, i32** %6
%84 = call i32 @fread(i32* %19, i32 1, i32 4, i32* %83)
%85 = load i32, i32* %19
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %89
87: ; preds = %82
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %3
br label %222
89: ; preds = %82
%90 = load i32*, i32** %6
%91 = load i32, i32* @SEEK_CUR
%92 = call i32 @fseek(i32* %90, i32 4, i32 %91)
%93 = load i32*, i32** %6
%94 = call i32 @fread(i32* %15, i32 1, i32 4, i32* %93)
%95 = load i32, i32* %15
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i32 %95)
%97 = load i32*, i32** %6
%98 = call i32 @fread(i32* %16, i32 1, i32 4, i32* %97)
%99 = load i32, i32* %16
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i32 %99)
%101 = load i32*, i32** %6
%102 = call i32 @fread(i32* %19, i32 1, i32 4, i32* %101)
%103 = load i32, i32* %19
%104 = icmp ne i32 %103, 1
br i1 %104, label %105, label %107
105: ; preds = %89
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.14, i64 0, i64 0))
store i32 1, i32* %3
br label %222
107: ; preds = %89
%108 = load i32*, i32** %6
%109 = call i32 @fread(i32* %17, i32 1, i32 8, i32* %108)
%110 = load i32, i32* %17
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0), i32 %110)
%112 = load i32*, i32** %6
%113 = call i32 @fread(i32* %19, i32 1, i32 4, i32* %112)
%114 = load i32, i32* %19
%115 = icmp ne i32 %114, 4096
br i1 %115, label %116, label %119
116: ; preds = %107
%117 = load i32, i32* %19
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.16, i64 0, i64 0), i32 %117, i32 4096)
store i32 1, i32* %3
br label %222
119: ; preds = %107
%120 = load i32*, i32** %6
%121 = load i32, i32* @SEEK_SET
%122 = call i32 @fseek(i32* %120, i32 92, i32 %121)
%123 = load i32, i32* %15
%124 = mul nsw i32 %123, 4096
%125 = mul nsw i32 %124, 8
%126 = sdiv i32 %125, 8
%127 = call i32* @malloc(i32 %126)
store i32* %127, i32** %8
%128 = load i32, i32* %15
%129 = mul nsw i32 %128, 4096
%130 = mul nsw i32 %129, 8
%131 = call i32* @malloc(i32 %130)
store i32* %131, i32** %9
br label %132
132: ; preds = %204, %119
%133 = load i32, i32* %17
%134 = icmp sgt i32 %133, 0
br i1 %134, label %135, label %212
135: ; preds = %132
%136 = load i32*, i32** %8
%137 = load i32, i32* %15
%138 = mul nsw i32 %137, 4096
%139 = mul nsw i32 %138, 8
%140 = sdiv i32 %139, 8
%141 = load i32*, i32** %6
%142 = call i32 @fread(i32* %136, i32 1, i32 %140, i32* %141)
store i32 %142, i32* %14
%143 = load i32, i32* %14
%144 = load i32, i32* %15
%145 = mul nsw i32 %144, 4096
%146 = mul nsw i32 %145, 8
%147 = sdiv i32 %146, 8
%148 = icmp slt i32 %143, %147
br i1 %148, label %149, label %150
149: ; preds = %135
br label %212
150: ; preds = %135
store i32 0, i32* %11
br label %151
151: ; preds = %201, %150
%152 = load i32, i32* %11
%153 = load i32, i32* %15
%154 = icmp slt i32 %152, %153
br i1 %154, label %155, label %204
155: ; preds = %151
store i32 0, i32* %12
br label %156
156: ; preds = %197, %155
%157 = load i32, i32* %12
%158 = icmp slt i32 %157, 4096
br i1 %158, label %159, label %200
159: ; preds = %156
%160 = load i32*, i32** %8
%161 = load i32, i32* %11
%162 = mul nsw i32 %161, 4096
%163 = mul nsw i32 %162, 8
%164 = sdiv i32 %163, 8
%165 = load i32, i32* %12
%166 = add nsw i32 %164, %165
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds i32, i32* %160, i64 %167
%169 = load i32, i32* %168
store i32 %169, i32* %10
store i32 0, i32* %13
br label %170
170: ; preds = %193, %159
%171 = load i32, i32* %13
%172 = icmp slt i32 %171, 8
br i1 %172, label %173, label %196
173: ; preds = %170
%174 = load i32, i32* %10
%175 = and i32 %174, 1
%176 = shl i32 %175, 7
%177 = or i32 %176, 64
%178 = load i32*, i32** %9
%179 = load i32, i32* %11
%180 = load i32, i32* %12
%181 = load i32, i32* %15
%182 = mul nsw i32 %180, %181
%183 = mul nsw i32 %182, 8
%184 = add nsw i32 %179, %183
%185 = load i32, i32* %13
%186 = load i32, i32* %15
%187 = mul nsw i32 %185, %186
%188 = add nsw i32 %184, %187
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds i32, i32* %178, i64 %189
store i32 %177, i32* %190
%191 = load i32, i32* %10
%192 = ashr i32 %191, 1
store i32 %192, i32* %10
br label %193
193: ; preds = %173
%194 = load i32, i32* %13
%195 = add nsw i32 %194, 1
store i32 %195, i32* %13
br label %170
196: ; preds = %170
br label %197
197: ; preds = %196
%198 = load i32, i32* %12
%199 = add nsw i32 %198, 1
store i32 %199, i32* %12
br label %156
200: ; preds = %156
br label %201
201: ; preds = %200
%202 = load i32, i32* %11
%203 = add nsw i32 %202, 1
store i32 %203, i32* %11
br label %151
204: ; preds = %151
%205 = load i32*, i32** %9
%206 = load i32, i32* %14
%207 = mul nsw i32 %206, 8
%208 = load i32*, i32** %7
%209 = call i32 @fwrite(i32* %205, i32 1, i32 %207, i32* %208)
%210 = load i32, i32* %17
%211 = sub nsw i32 %210, 32768
store i32 %211, i32* %17
br label %132
212: ; preds = %149, %132
%213 = load i32*, i32** %6
%214 = call i32 @fclose(i32* %213)
%215 = load i32*, i32** %7
%216 = call i32 @fclose(i32* %215)
%217 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0))
%218 = load i32, i32* %15
%219 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.18, i64 0, i64 0), i32 %218)
%220 = load i32, i32* %16
%221 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.19, i64 0, i64 0), i32 %220)
store i32 0, i32* %3
br label %222
222: ; preds = %212, %116, %105, %87, %80, %73, %66, %54, %45, %36, %24
%223 = load i32, i32* %3
ret i32 %223
}

LLVM IR (-O2):
@.str = [32 x i8] c"Usage: %s input.dsf output.pcm\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.3 = [2 x i8] c"w\00"
@.str.5 = [5 x i8] c"DSD \00"
@SEEK_SET = global i32 0
@.str.7 = [5 x i8] c"fmt \00"
@SEEK_CUR = global i32 0
@.str.12 = [14 x i8] c"channels: %d\0A\00"
@.str.13 = [16 x i8] c"samplerate: %d\0A\00"
@.str.15 = [19 x i8] c"sample count: %ld\0A\00"
@.str.16 = [37 x i8] c"block size per channel %d is not %d\0A\00"
@.str.18 = [131 x i8] c"When you load the pcm file, set channels = %d and sample format = 8bit unsigned/signed (doesn't matter for this program's output)\0A\00"
@.str.19 = [145 x i8] c"Set sample rate to %d if possible. If not, set it to anything you like and take this into account when reading timestamps and spectral displays\0A\00"
@str = [6 x i8] c"DONE!\00"
@str.20 = [25 x i8] c"bits per sample is not 1\00"
@str.21 = [19 x i8] c"format ID is not 0\00"
@str.22 = [27 x i8] c"fmt chunk version is not 1\00"
@str.23 = [25 x i8] c"fmt chunk size is not 52\00"
@str.24 = [20 x i8] c"fmt chunk not found\00"
@str.25 = [15 x i8] c"not a DSF file\00"
@str.26 = [19 x i8] c"cannot open output\00"
@str.27 = [18 x i8] c"cannot open input\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [5 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast [5 x i32]* %6 to i8*
%13 = bitcast i32* %7 to i8*
%14 = bitcast i32* %8 to i8*
%15 = icmp eq i32 %0, 3
br i1 %15, label %19, label %16
16: ; preds = %2
%17 = load i8*, i8** %1
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %202
19: ; preds = %2
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = tail call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.27, i64 0, i64 0))
br label %202
26: ; preds = %19
%27 = getelementptr inbounds i8*, i8** %1, i64 2
%28 = load i8*, i8** %27
%29 = tail call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.26, i64 0, i64 0))
br label %202
33: ; preds = %26
%34 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%35 = call i32 @fread(i32* %34, i32 1, i32 4, i32* %22)
%36 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32* %34)
%37 = icmp eq i64 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %33
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.25, i64 0, i64 0))
br label %202
40: ; preds = %33
%41 = load i32, i32* @SEEK_SET
%42 = call i32 @fseek(i32* %22, i32 28, i32 %41)
%43 = call i32 @fread(i32* %34, i32 1, i32 4, i32* %22)
%44 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32* %34)
%45 = icmp eq i64 %44, 0
br i1 %45, label %48, label %46
46: ; preds = %40
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.24, i64 0, i64 0))
br label %202
48: ; preds = %40
%49 = call i32 @fread(i32* %8, i32 1, i32 8, i32* %22)
%50 = load i32, i32* %8
%51 = icmp eq i32 %50, 52
br i1 %51, label %54, label %52
52: ; preds = %48
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.23, i64 0, i64 0))
br label %202
54: ; preds = %48
%55 = call i32 @fread(i32* %7, i32 1, i32 4, i32* %22)
%56 = load i32, i32* %7
%57 = icmp eq i32 %56, 1
br i1 %57, label %60, label %58
58: ; preds = %54
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.22, i64 0, i64 0))
br label %202
60: ; preds = %54
%61 = call i32 @fread(i32* %7, i32 1, i32 4, i32* %22)
%62 = load i32, i32* %7
%63 = icmp eq i32 %62, 0
br i1 %63, label %66, label %64
64: ; preds = %60
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.21, i64 0, i64 0))
br label %202
66: ; preds = %60
%67 = load i32, i32* @SEEK_CUR
%68 = call i32 @fseek(i32* %22, i32 4, i32 %67)
%69 = call i32 @fread(i32* %3, i32 1, i32 4, i32* %22)
%70 = load i32, i32* %3
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i32 %70)
%72 = call i32 @fread(i32* %4, i32 1, i32 4, i32* %22)
%73 = load i32, i32* %4
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i32 %73)
%75 = call i32 @fread(i32* %7, i32 1, i32 4, i32* %22)
%76 = load i32, i32* %7
%77 = icmp eq i32 %76, 1
br i1 %77, label %80, label %78
78: ; preds = %66
%79 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.20, i64 0, i64 0))
br label %202
80: ; preds = %66
%81 = call i32 @fread(i32* %5, i32 1, i32 8, i32* %22)
%82 = load i32, i32* %5
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0), i32 %82)
%84 = call i32 @fread(i32* %7, i32 1, i32 4, i32* %22)
%85 = load i32, i32* %7
%86 = icmp eq i32 %85, 4096
br i1 %86, label %89, label %87
87: ; preds = %80
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.16, i64 0, i64 0), i32 %85, i32 4096)
br label %202
89: ; preds = %80
%90 = load i32, i32* @SEEK_SET
%91 = call i32 @fseek(i32* %22, i32 92, i32 %90)
%92 = shl nsw i32 %70, 12
%93 = call i32* @malloc(i32 %92)
%94 = shl nsw i32 %70, 15
%95 = call i32* @malloc(i32 %94)
%96 = icmp sgt i32 %82, 0
br i1 %96, label %97, label %195
97: ; preds = %89
%98 = icmp sgt i32 %70, 0
%99 = zext i32 %70 to i64
br label %100
100: ; preds = %97, %190
%101 = phi i32 [ %82, %97 ], [ %193, %190 ]
%102 = call i32 @fread(i32* %93, i32 1, i32 %92, i32* %22)
%103 = icmp slt i32 %102, %92
br i1 %103, label %195, label %104
104: ; preds = %100
br i1 %98, label %105, label %190
105: ; preds = %104, %187
%106 = phi i64 [ %188, %187 ], [ 0, %104 ]
%107 = shl nsw i64 %106, 12
%108 = trunc i64 %106 to i32
br label %109
109: ; preds = %105, %109
%110 = phi i64 [ 0, %105 ], [ %185, %109 ]
%111 = add nuw nsw i64 %110, %107
%112 = getelementptr inbounds i32, i32* %93, i64 %111
%113 = load i32, i32* %112
%114 = shl i64 %110, 3
%115 = shl i32 %113, 7
%116 = and i32 %115, 128
%117 = or i32 %116, 64
%118 = trunc i64 %114 to i32
%119 = mul i32 %70, %118
%120 = add i32 %119, %108
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds i32, i32* %95, i64 %121
store i32 %117, i32* %122
%123 = shl i32 %113, 6
%124 = and i32 %123, 128
%125 = or i32 %124, 64
%126 = trunc i64 %114 to i32
%127 = or i32 %126, 1
%128 = mul i32 %127, %70
%129 = add i32 %128, %108
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i32, i32* %95, i64 %130
store i32 %125, i32* %131
%132 = shl i32 %113, 5
%133 = and i32 %132, 128
%134 = or i32 %133, 64
%135 = trunc i64 %114 to i32
%136 = or i32 %135, 2
%137 = mul i32 %136, %70
%138 = add i32 %137, %108
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds i32, i32* %95, i64 %139
store i32 %134, i32* %140
%141 = shl i32 %113, 4
%142 = and i32 %141, 128
%143 = or i32 %142, 64
%144 = trunc i64 %114 to i32
%145 = or i32 %144, 3
%146 = mul i32 %145, %70
%147 = add i32 %146, %108
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds i32, i32* %95, i64 %148
store i32 %143, i32* %149
%150 = shl i32 %113, 3
%151 = and i32 %150, 128
%152 = or i32 %151, 64
%153 = trunc i64 %114 to i32
%154 = or i32 %153, 4
%155 = mul i32 %154, %70
%156 = add i32 %155, %108
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i32, i32* %95, i64 %157
store i32 %152, i32* %158
%159 = shl i32 %113, 2
%160 = and i32 %159, 128
%161 = or i32 %160, 64
%162 = trunc i64 %114 to i32
%163 = or i32 %162, 5
%164 = mul i32 %163, %70
%165 = add i32 %164, %108
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds i32, i32* %95, i64 %166
store i32 %161, i32* %167
%168 = shl i32 %113, 1
%169 = and i32 %168, 128
%170 = or i32 %169, 64
%171 = trunc i64 %114 to i32
%172 = or i32 %171, 6
%173 = mul i32 %172, %70
%174 = add i32 %173, %108
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds i32, i32* %95, i64 %175
store i32 %170, i32* %176
%177 = and i32 %113, 128
%178 = or i32 %177, 64
%179 = trunc i64 %114 to i32
%180 = or i32 %179, 7
%181 = mul i32 %180, %70
%182 = add i32 %181, %108
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds i32, i32* %95, i64 %183
store i32 %178, i32* %184
%185 = add nuw nsw i64 %110, 1
%186 = icmp eq i64 %185, 4096
br i1 %186, label %187, label %109
187: ; preds = %109
%188 = add nuw nsw i64 %106, 1
%189 = icmp eq i64 %188, %99
br i1 %189, label %190, label %105
190: ; preds = %187, %104
%191 = shl nsw i32 %102, 3
%192 = call i32 @fwrite(i32* %95, i32 1, i32 %191, i32* %29)
%193 = add nsw i32 %101, -32768
%194 = icmp sgt i32 %101, 32768
br i1 %194, label %100, label %195
195: ; preds = %190, %100, %89
%196 = phi i32 [ %82, %89 ], [ %101, %100 ], [ %193, %190 ]
store i32 %196, i32* %5
%197 = call i32 @fclose(i32* %22)
%198 = call i32 @fclose(i32* %29)
%199 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%200 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([131 x i8], [131 x i8]* @.str.18, i64 0, i64 0), i32 %70)
%201 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([145 x i8], [145 x i8]* @.str.19, i64 0, i64 0), i32 %73)
br label %202
202: ; preds = %195, %87, %78, %64, %58, %52, %46, %38, %31, %24, %16
%203 = phi i32 [ 1, %16 ], [ 1, %24 ], [ 1, %31 ], [ 1, %38 ], [ 1, %46 ], [ 1, %52 ], [ 1, %58 ], [ 1, %64 ], [ 1, %78 ], [ 1, %87 ], [ 0, %195 ]
ret i32 %203
}