#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int get32bit(unsigned char *);
scalar_t__ memcmp(unsigned char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
char *strrchr(char *, char);
int main(int argc, char **argv) {
  FILE *infile, *outfile;
  int i, dspcount, j;
  int secoff[4], dataoff, datasize, headeroff;
  unsigned char buf[0x60];
  char *t, namebase[257], fname[257 + 4];
  printf("sfxtract 0.0\nextract gamecube DSPs from SFXs\n\n");
  if (argc != 2) {
    printf("usage: %s archive.sfx\n", argv[0]);
    return 1;
  }
  infile = fopen(argv[1], "rb");
  if (!infile) {
    printf("error opening %s\n", argv[1]);
    return 1;
  }
  t = strrchr(argv[1], '\\');
  if (!t)
    t = argv[1];
  else
    t++;
  for (i = 0; t < strrchr(argv[1], '.'); t++, i++)
    namebase[i] = *t;
  namebase[i] = '\0';
  fread(buf, 1, 0x40, infile);
  if (memcmp(buf, "MUSX", 4) || memcmp(buf + 0x10, "GC__", 4) ||
      memcmp(buf + 0x16, "\x05\x0a", 2)) {
    printf("unrecognized format\n");
    return 1;
  }
  secoff[0] = get32bit(buf + 0x20);
  secoff[1] = get32bit(buf + 0x28);
  secoff[2] = get32bit(buf + 0x30);
  secoff[3] = get32bit(buf + 0x38);
  fseek(infile, secoff[1], SEEK_SET);
  fread(buf, 1, 4, infile);
  dspcount = get32bit(buf);
  secoff[1] += 4;
  for (i = 0; i < dspcount; i++) {
    fread(buf, 1, 0x20, infile);
    dataoff = get32bit(buf + 0x04);
    datasize = get32bit(buf + 0x08);
    headeroff = get32bit(buf + 0x14);
    printf("DSP #%d\n\tData offset:\t%08x\n\tData size:\t%08x\n\tHeader "
           "offset:\t%08x\n",
           i, dataoff, datasize, headeroff);
    sprintf(fname, "%s%03d.dsp", namebase, i);
    outfile = fopen(fname, "wb");
    if (!outfile) {
      printf("error opening %s\n", fname);
      return 1;
    }
    fseek(infile, secoff[2] + headeroff, SEEK_SET);
    fread(buf, 1, 0x60, infile);
    fwrite(buf, 1, 0x60, outfile);
    fseek(infile, secoff[3] + dataoff, SEEK_SET);
    for (j = 0; j < datasize; j++) {
      fread(buf, 1, 1, infile);
      fwrite(buf, 1, 1, outfile);
    }
    fclose(outfile);
    secoff[1] += 0x20;
    fseek(infile, secoff[1], SEEK_SET);
  }
  fclose(infile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2e0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
je     11f2 <main+0x52>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    160c <main+0x46c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe45(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1237 <main+0x97>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    160c <main+0x46c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x5c,%esi
call   1070 <strrchr@plt>
mov    %rax,-0xb8(%rbp)
cmpq   $0x0,-0xb8(%rbp)
jne    1272 <main+0xd2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0xb8(%rbp)
jmp    1284 <main+0xe4>
mov    -0xb8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xb8(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0xb8(%rbp),%rax
mov    %rax,-0x2d8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x2e,%esi
call   1070 <strrchr@plt>
mov    %rax,%rcx
mov    -0x2d8(%rbp),%rax
cmp    %rcx,%rax
jae    12f2 <main+0x152>
mov    -0xb8(%rbp),%rax
mov    (%rax),%cl
movslq -0x24(%rbp),%rax
mov    %cl,-0x1c0(%rbp,%rax,1)
mov    -0xb8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xb8(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    128b <main+0xeb>
movslq -0x24(%rbp),%rax
movb   $0x0,-0x1c0(%rbp,%rax,1)
lea    -0xb0(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x40,%edx
call   1030 <fread@plt>
lea    -0xb0(%rbp),%rdi
lea    0xd35(%rip),%rsi
mov    $0x4,%edx
call   1080 <memcmp@plt>
cmp    $0x0,%rax
jne    1386 <main+0x1e6>
lea    -0xb0(%rbp),%rdi
add    $0x10,%rdi
lea    0xd14(%rip),%rsi
mov    $0x4,%edx
call   1080 <memcmp@plt>
cmp    $0x0,%rax
jne    1386 <main+0x1e6>
lea    -0xb0(%rbp),%rdi
add    $0x16,%rdi
lea    0xcf3(%rip),%rsi
mov    $0x2,%edx
call   1080 <memcmp@plt>
cmp    $0x0,%rax
je     13a0 <main+0x200>
lea    0xcdb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    160c <main+0x46c>
lea    -0xb0(%rbp),%rdi
add    $0x20,%rdi
call   1040 <get32bit@plt>
mov    %eax,-0x40(%rbp)
lea    -0xb0(%rbp),%rdi
add    $0x28,%rdi
call   1040 <get32bit@plt>
mov    %eax,-0x3c(%rbp)
lea    -0xb0(%rbp),%rdi
add    $0x30,%rdi
call   1040 <get32bit@plt>
mov    %eax,-0x38(%rbp)
lea    -0xb0(%rbp),%rdi
add    $0x38,%rdi
call   1040 <get32bit@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    0x2be6(%rip),%rax
mov    (%rax),%edx
call   1090 <fseek@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
lea    -0xb0(%rbp),%rdi
call   1040 <get32bit@plt>
mov    %eax,-0x28(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    15fc <main+0x45c>
lea    -0xb0(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x20,%edx
call   1030 <fread@plt>
lea    -0xb0(%rbp),%rdi
add    $0x4,%rdi
call   1040 <get32bit@plt>
mov    %eax,-0x44(%rbp)
lea    -0xb0(%rbp),%rdi
add    $0x8,%rdi
call   1040 <get32bit@plt>
mov    %eax,-0x48(%rbp)
lea    -0xb0(%rbp),%rdi
add    $0x14,%rdi
call   1040 <get32bit@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x44(%rbp),%edx
mov    -0x48(%rbp),%ecx
mov    -0x4c(%rbp),%r8d
lea    0xbd0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x2d0(%rbp),%rdi
lea    -0x1c0(%rbp),%rdx
mov    -0x24(%rbp),%ecx
lea    0xbf3(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x2d0(%rbp),%rdi
lea    0xbeb(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1514 <main+0x374>
lea    -0x2d0(%rbp),%rsi
lea    0xb48(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    160c <main+0x46c>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%esi
add    -0x4c(%rbp),%esi
mov    0x2abb(%rip),%rax
mov    (%rax),%edx
call   1090 <fseek@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x60,%edx
call   1030 <fread@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0x60,%edx
call   10c0 <fwrite@plt>
mov    -0x18(%rbp),%rdi
mov    -0x34(%rbp),%esi
add    -0x44(%rbp),%esi
mov    0x2a6f(%rip),%rax
mov    (%rax),%edx
call   1090 <fseek@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    15c7 <main+0x427>
lea    -0xb0(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   10c0 <fwrite@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    157f <main+0x3df>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x3c(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    0x29f9(%rip),%rax
mov    (%rax),%edx
call   1090 <fseek@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    143a <main+0x29a>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x298,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x2,%ebx
jne    12a4 <main+0xe4>
mov    0x8(%rbp),%rdi
lea    0xe21(%rip),%rsi
call   10c0 <fopen@plt>
mov    0x8(%rbp),%rbp
test   %rax,%rax
je     12b1 <main+0xf1>
mov    %rax,%r15
mov    %rbp,%rdi
mov    $0x5c,%esi
call   1080 <strrchr@plt>
lea    0x1(%rax),%rbx
test   %rax,%rax
cmove  %rbp,%rbx
mov    %rbp,%rdi
mov    $0x2e,%esi
call   1080 <strrchr@plt>
cmp    %rax,%rbx
jae    12cc <main+0x10c>
mov    %rax,%rcx
sub    %rbx,%rcx
cmp    $0x8,%rcx
jb     126e <main+0xae>
lea    (%rbx,%rcx,1),%rdx
lea    0x80(%rsp),%rsi
cmp    %rdx,%rsi
jae    1364 <main+0x1a4>
lea    (%rsp,%rcx,1),%rdx
add    $0x80,%rdx
cmp    %rdx,%rbx
jae    1364 <main+0x1a4>
xor    %edx,%edx
mov    %rbx,%rsi
lea    (%rsp,%rdx,1),%rdi
add    $0x80,%rdi
sub    %rdx,%rax
sub    %rbx,%rax
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
movzbl (%rsi,%rdx,1),%ebx
mov    %bl,(%rdi,%rdx,1)
add    $0x1,%rdx
cmp    %rdx,%rax
jne    1290 <main+0xd0>
mov    %ecx,%eax
jmp    12ce <main+0x10e>
mov    0x0(%rbp),%rsi
lea    0xd51(%rip),%rdi
jmp    12bb <main+0xfb>
lea    0xd62(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%ebp
jmp    1350 <main+0x190>
xor    %eax,%eax
movb   $0x0,0x80(%rsp,%rax,1)
lea    0x20(%rsp),%rbx
mov    $0x1,%ebp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x40,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
lea    0xd30(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   10a0 <memcmp@plt>
test   %rax,%rax
jne    1344 <main+0x184>
lea    0x30(%rsp),%rdi
lea    0xd17(%rip),%rsi
mov    $0x4,%edx
call   10a0 <memcmp@plt>
test   %rax,%rax
jne    1344 <main+0x184>
lea    0x36(%rsp),%rdi
lea    0xd01(%rip),%rsi
mov    $0x2,%edx
call   10a0 <memcmp@plt>
test   %rax,%rax
je     139f <main+0x1df>
lea    0xd6c(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
add    $0x298,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x20,%rcx
jae    1371 <main+0x1b1>
xor    %edx,%edx
jmp    166a <main+0x4aa>
mov    %rcx,%rdx
and    $0xffffffffffffffe0,%rdx
lea    -0x20(%rdx),%rsi
mov    %rsi,%rdi
shr    $0x5,%rdi
add    $0x1,%rdi
mov    %edi,%r8d
and    $0x3,%r8d
cmp    $0x60,%rsi
jae    159c <main+0x3dc>
xor    %ebp,%ebp
jmp    1621 <main+0x461>
lea    0x40(%rsp),%rdi
call   1050 <get32bit@plt>
lea    0x48(%rsp),%rdi
call   1050 <get32bit@plt>
mov    %eax,%ebx
lea    0x50(%rsp),%rdi
call   1050 <get32bit@plt>
mov    %eax,0x14(%rsp)
lea    0x58(%rsp),%rdi
call   1050 <get32bit@plt>
mov    %eax,0x10(%rsp)
mov    0x2c08(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   10b0 <fseek@plt>
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
mov    %rbp,%rdi
call   1050 <get32bit@plt>
mov    %eax,0xc(%rsp)
test   %eax,%eax
jle    158d <main+0x3cd>
add    $0x4,%ebx
lea    0x20(%rsp),%r13
xor    %ebp,%ebp
jmp    1451 <main+0x291>
mov    %rbp,%rdi
call   1060 <fclose@plt>
mov    0x1c(%rsp),%ebx
add    $0x20,%ebx
mov    0x2bac(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   10b0 <fseek@plt>
mov    0x18(%rsp),%ebp
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
je     158d <main+0x3cd>
mov    %ebx,0x1c(%rsp)
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x20,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
lea    0x24(%rsp),%rdi
call   1050 <get32bit@plt>
mov    %eax,%r12d
lea    0x28(%rsp),%rdi
call   1050 <get32bit@plt>
mov    %eax,%r14d
lea    0x34(%rsp),%rdi
call   1050 <get32bit@plt>
mov    %r15,%rbx
mov    %eax,%r15d
lea    0xb9e(%rip),%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r14d,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%ecx
lea    0x190(%rsp),%rbp
mov    %rbp,%rdi
lea    0xbba(%rip),%rsi
lea    0x80(%rsp),%rdx
mov    %ecx,0x18(%rsp)
call   10d0 <sprintf@plt>
mov    %rbp,%rdi
lea    0xbaa(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     16a3 <main+0x4e3>
mov    %rax,%rbp
add    0x14(%rsp),%r15d
mov    0x2ae7(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r15d,%esi
call   10b0 <fseek@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x60,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x60,%edx
mov    %rbp,%rcx
call   10e0 <fwrite@plt>
add    0x10(%rsp),%r12d
mov    0x2aa4(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r12d,%esi
call   10b0 <fseek@plt>
test   %r14d,%r14d
mov    %rbx,%r15
jle    141e <main+0x25e>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
movsbl 0x20(%rsp),%edi
mov    %rbp,%rsi
call   1090 <fputc@plt>
add    $0xffffffff,%r14d
jne    1560 <main+0x3a0>
jmp    141e <main+0x25e>
mov    %r15,%rdi
call   1060 <fclose@plt>
xor    %ebp,%ebp
jmp    1350 <main+0x190>
and    $0xfffffffffffffffc,%rdi
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movups (%rbx,%rbp,1),%xmm0
movups 0x10(%rbx,%rbp,1),%xmm1
movaps %xmm0,0x80(%rsp,%rbp,1)
movaps %xmm1,0x90(%rsp,%rbp,1)
movups 0x20(%rbx,%rbp,1),%xmm0
movups 0x30(%rbx,%rbp,1),%xmm1
movaps %xmm0,0xa0(%rsp,%rbp,1)
movaps %xmm1,0xb0(%rsp,%rbp,1)
movups 0x40(%rbx,%rbp,1),%xmm0
movups 0x50(%rbx,%rbp,1),%xmm1
movaps %xmm0,0xc0(%rsp,%rbp,1)
movaps %xmm1,0xd0(%rsp,%rbp,1)
movups 0x60(%rbx,%rbp,1),%xmm0
movups 0x70(%rbx,%rbp,1),%xmm1
movaps %xmm0,0xe0(%rsp,%rbp,1)
movaps %xmm1,0xf0(%rsp,%rbp,1)
sub    $0xffffffffffffff80,%rbp
add    $0xfffffffffffffffc,%rdi
jne    15b0 <main+0x3f0>
test   %r8,%r8
je     165c <main+0x49c>
lea    (%rsp,%rbp,1),%rdi
add    $0x90,%rdi
add    %rbx,%rbp
add    $0x10,%rbp
shl    $0x5,%r8
xor    %esi,%esi
xchg   %ax,%ax
movups -0x10(%rbp,%rsi,1),%xmm0
movups 0x0(%rbp,%rsi,1),%xmm1
movaps %xmm0,-0x10(%rdi,%rsi,1)
movaps %xmm1,(%rdi,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%r8
jne    1640 <main+0x480>
cmp    %rdx,%rcx
je     12a0 <main+0xe0>
test   $0x18,%cl
je     16b7 <main+0x4f7>
mov    %rdx,%rdi
mov    %rcx,%rdx
and    $0xfffffffffffffff8,%rdx
lea    (%rbx,%rdx,1),%rsi
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%rdi,1),%rbp
mov    %rbp,0x80(%rsp,%rdi,1)
add    $0x8,%rdi
cmp    %rdi,%rdx
jne    1680 <main+0x4c0>
cmp    %rdx,%rcx
jne    1273 <main+0xb3>
jmp    12a0 <main+0xe0>
lea    0x970(%rip),%rdi
lea    0x190(%rsp),%rsi
jmp    12bb <main+0xfb>
lea    (%rbx,%rdx,1),%rsi
jmp    1273 <main+0xb3>

LLVM IR (-O0):
@.str = [47 x i8] c"sfxtract 0.0\0Aextract gamecube DSPs from SFXs\0A\0A\00"
@.str.1 = [23 x i8] c"usage: %s archive.sfx\0A\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [18 x i8] c"error opening %s\0A\00"
@.str.4 = [5 x i8] c"MUSX\00"
@.str.5 = [5 x i8] c"GC__\00"
@.str.6 = [3 x i8] c"\05\0A\00"
@.str.7 = [21 x i8] c"unrecognized format\0A\00"
@SEEK_SET = global i32 0
@.str.8 = [66 x i8] c"DSP #%d\0A\09Data offset:\09%08x\0A\09Data size:\09%08x\0A\09Header offset:\09%08x\0A\00"
@.str.9 = [11 x i8] c"%s%03d.dsp\00"
@.str.10 = [3 x i8] c"wb\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 [4 x i32]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca [96 x i8]
%16 = alloca i8*
%17 = alloca [257 x i8]
%18 = alloca [261 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 2
br i1 %21, label %22, label %27
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %25)
store i32 1, i32* %3
br label %209
27: ; preds = %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %31, i32** %6
%32 = load i32*, i32** %6
%33 = icmp ne i32* %32, null
br i1 %33, label %39, label %34
34: ; preds = %27
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %37)
store i32 1, i32* %3
br label %209
39: ; preds = %27
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i8* @strrchr(i8* %42, i8 signext 92)
store i8* %43, i8** %16
%44 = load i8*, i8** %16
%45 = icmp ne i8* %44, null
br i1 %45, label %50, label %46
46: ; preds = %39
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
store i8* %49, i8** %16
br label %53
50: ; preds = %39
%51 = load i8*, i8** %16
%52 = getelementptr inbounds i8, i8* %51, i32 1
store i8* %52, i8** %16
br label %53
53: ; preds = %50, %46
store i32 0, i32* %8
br label %54
54: ; preds = %67, %53
%55 = load i8*, i8** %16
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 1
%58 = load i8*, i8** %57
%59 = call i8* @strrchr(i8* %58, i8 signext 46)
%60 = icmp ult i8* %55, %59
br i1 %60, label %61, label %72
61: ; preds = %54
%62 = load i8*, i8** %16
%63 = load i8, i8* %62
%64 = load i32, i32* %8
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [257 x i8], [257 x i8]* %17, i64 0, i64 %65
store i8 %63, i8* %66
br label %67
67: ; preds = %61
%68 = load i8*, i8** %16
%69 = getelementptr inbounds i8, i8* %68, i32 1
store i8* %69, i8** %16
%70 = load i32, i32* %8
%71 = add nsw i32 %70, 1
store i32 %71, i32* %8
br label %54
72: ; preds = %54
%73 = load i32, i32* %8
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [257 x i8], [257 x i8]* %17, i64 0, i64 %74
store i8 0, i8* %75
%76 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%77 = load i32*, i32** %6
%78 = call i32 @fread(i8* %76, i32 1, i32 64, i32* %77)
%79 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%80 = call i64 @memcmp(i8* %79, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%81 = icmp ne i64 %80, 0
br i1 %81, label %92, label %82
82: ; preds = %72
%83 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%84 = getelementptr inbounds i8, i8* %83, i64 16
%85 = call i64 @memcmp(i8* %84, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%86 = icmp ne i64 %85, 0
br i1 %86, label %92, label %87
87: ; preds = %82
%88 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%89 = getelementptr inbounds i8, i8* %88, i64 22
%90 = call i64 @memcmp(i8* %89, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%91 = icmp ne i64 %90, 0
br i1 %91, label %92, label %94
92: ; preds = %87, %82, %72
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %3
br label %209
94: ; preds = %87
%95 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%96 = getelementptr inbounds i8, i8* %95, i64 32
%97 = call i32 @get32bit(i8* %96)
%98 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 0
store i32 %97, i32* %98
%99 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%100 = getelementptr inbounds i8, i8* %99, i64 40
%101 = call i32 @get32bit(i8* %100)
%102 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 1
store i32 %101, i32* %102
%103 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%104 = getelementptr inbounds i8, i8* %103, i64 48
%105 = call i32 @get32bit(i8* %104)
%106 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 2
store i32 %105, i32* %106
%107 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%108 = getelementptr inbounds i8, i8* %107, i64 56
%109 = call i32 @get32bit(i8* %108)
%110 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 3
store i32 %109, i32* %110
%111 = load i32*, i32** %6
%112 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 1
%113 = load i32, i32* %112
%114 = load i32, i32* @SEEK_SET
%115 = call i32 @fseek(i32* %111, i32 %113, i32 %114)
%116 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%117 = load i32*, i32** %6
%118 = call i32 @fread(i8* %116, i32 1, i32 4, i32* %117)
%119 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%120 = call i32 @get32bit(i8* %119)
store i32 %120, i32* %9
%121 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 1
%122 = load i32, i32* %121
%123 = add nsw i32 %122, 4
store i32 %123, i32* %121
store i32 0, i32* %8
br label %124
124: ; preds = %203, %94
%125 = load i32, i32* %8
%126 = load i32, i32* %9
%127 = icmp slt i32 %125, %126
br i1 %127, label %128, label %206
128: ; preds = %124
%129 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%130 = load i32*, i32** %6
%131 = call i32 @fread(i8* %129, i32 1, i32 32, i32* %130)
%132 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%133 = getelementptr inbounds i8, i8* %132, i64 4
%134 = call i32 @get32bit(i8* %133)
store i32 %134, i32* %12
%135 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%136 = getelementptr inbounds i8, i8* %135, i64 8
%137 = call i32 @get32bit(i8* %136)
store i32 %137, i32* %13
%138 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%139 = getelementptr inbounds i8, i8* %138, i64 20
%140 = call i32 @get32bit(i8* %139)
store i32 %140, i32* %14
%141 = load i32, i32* %8
%142 = load i32, i32* %12
%143 = load i32, i32* %13
%144 = load i32, i32* %14
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0), i32 %141, i32 %142, i32 %143, i32 %144)
%146 = getelementptr inbounds [261 x i8], [261 x i8]* %18, i64 0, i64 0
%147 = getelementptr inbounds [257 x i8], [257 x i8]* %17, i64 0, i64 0
%148 = load i32, i32* %8
%149 = call i32 @sprintf(i8* %146, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i8* %147, i32 %148)
%150 = getelementptr inbounds [261 x i8], [261 x i8]* %18, i64 0, i64 0
%151 = call i32* @fopen(i8* %150, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
store i32* %151, i32** %7
%152 = load i32*, i32** %7
%153 = icmp ne i32* %152, null
br i1 %153, label %157, label %154
154: ; preds = %128
%155 = getelementptr inbounds [261 x i8], [261 x i8]* %18, i64 0, i64 0
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %155)
store i32 1, i32* %3
br label %209
157: ; preds = %128
%158 = load i32*, i32** %6
%159 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 2
%160 = load i32, i32* %159
%161 = load i32, i32* %14
%162 = add nsw i32 %160, %161
%163 = load i32, i32* @SEEK_SET
%164 = call i32 @fseek(i32* %158, i32 %162, i32 %163)
%165 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%166 = load i32*, i32** %6
%167 = call i32 @fread(i8* %165, i32 1, i32 96, i32* %166)
%168 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%169 = load i32*, i32** %7
%170 = call i32 @fwrite(i8* %168, i32 1, i32 96, i32* %169)
%171 = load i32*, i32** %6
%172 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 3
%173 = load i32, i32* %172
%174 = load i32, i32* %12
%175 = add nsw i32 %173, %174
%176 = load i32, i32* @SEEK_SET
%177 = call i32 @fseek(i32* %171, i32 %175, i32 %176)
store i32 0, i32* %10
br label %178
178: ; preds = %189, %157
%179 = load i32, i32* %10
%180 = load i32, i32* %13
%181 = icmp slt i32 %179, %180
br i1 %181, label %182, label %192
182: ; preds = %178
%183 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%184 = load i32*, i32** %6
%185 = call i32 @fread(i8* %183, i32 1, i32 1, i32* %184)
%186 = getelementptr inbounds [96 x i8], [96 x i8]* %15, i64 0, i64 0
%187 = load i32*, i32** %7
%188 = call i32 @fwrite(i8* %186, i32 1, i32 1, i32* %187)
br label %189
189: ; preds = %182
%190 = load i32, i32* %10
%191 = add nsw i32 %190, 1
store i32 %191, i32* %10
br label %178
192: ; preds = %178
%193 = load i32*, i32** %7
%194 = call i32 @fclose(i32* %193)
%195 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 1
%196 = load i32, i32* %195
%197 = add nsw i32 %196, 32
store i32 %197, i32* %195
%198 = load i32*, i32** %6
%199 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 1
%200 = load i32, i32* %199
%201 = load i32, i32* @SEEK_SET
%202 = call i32 @fseek(i32* %198, i32 %200, i32 %201)
br label %203
203: ; preds = %192
%204 = load i32, i32* %8
%205 = add nsw i32 %204, 1
store i32 %205, i32* %8
br label %124
206: ; preds = %124
%207 = load i32*, i32** %6
%208 = call i32 @fclose(i32* %207)
store i32 0, i32* %3
br label %209
209: ; preds = %206, %154, %92, %34, %22
%210 = load i32, i32* %3
ret i32 %210
}

LLVM IR (-O2):
@.str.1 = [23 x i8] c"usage: %s archive.sfx\0A\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [18 x i8] c"error opening %s\0A\00"
@.str.4 = [5 x i8] c"MUSX\00"
@.str.5 = [5 x i8] c"GC__\00"
@.str.6 = [3 x i8] c"\05\0A\00"
@SEEK_SET = global i32 0
@.str.8 = [66 x i8] c"DSP #%d\0A\09Data offset:\09%08x\0A\09Data size:\09%08x\0A\09Header offset:\09%08x\0A\00"
@.str.9 = [11 x i8] c"%s%03d.dsp\00"
@.str.10 = [3 x i8] c"wb\00"
@str = [46 x i8] c"sfxtract 0.0\0Aextract gamecube DSPs from SFXs\0A\00"
@str.11 = [20 x i8] c"unrecognized format\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [96 x i8]
%4 = alloca [257 x i8]
%5 = getelementptr inbounds [257 x i8], [257 x i8]* %4, i64 0, i64 0
%6 = alloca [261 x i8]
%7 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [257 x i8], [257 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [261 x i8], [261 x i8]* %6, i64 0, i64 0
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%11 = icmp eq i32 %0, 2
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = load i8*, i8** %1
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %229
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i32* %18, null
%20 = load i8*, i8** %16
br i1 %19, label %21, label %23
21: ; preds = %15
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %20)
br label %229
23: ; preds = %15
%24 = tail call i8* @strrchr(i8* dereferenceable(1) %20, i8 signext 92)
%25 = icmp eq i8* %24, null
%26 = getelementptr inbounds i8, i8* %24, i64 1
%27 = select i1 %25, i8* %20, i8* %26
%28 = tail call i8* @strrchr(i8* dereferenceable(1) %20, i8 signext 46)
%29 = icmp ult i8* %27, %28
br i1 %29, label %30, label %154
30: ; preds = %23
%31 = ptrtoint i8* %28 to i64
%32 = ptrtoint i8* %27 to i64
%33 = sub i64 %31, %32
%34 = icmp ult i64 %33, 8
br i1 %34, label %141, label %35
35: ; preds = %30
%36 = getelementptr [257 x i8], [257 x i8]* %4, i64 0, i64 %33
%37 = getelementptr i8, i8* %27, i64 %33
%38 = icmp ult i8* %5, %37
%39 = icmp ult i8* %27, %36
%40 = and i1 %38, %39
br i1 %40, label %141, label %41
41: ; preds = %35
%42 = icmp ult i64 %33, 32
br i1 %42, label %126, label %43
43: ; preds = %41
%44 = and i64 %33, -32
%45 = add i64 %44, -32
%46 = lshr exact i64 %45, 5
%47 = add nuw nsw i64 %46, 1
%48 = and i64 %47, 3
%49 = icmp ult i64 %45, 96
br i1 %49, label %101, label %50
50: ; preds = %43
%51 = and i64 %47, 1152921504606846972
br label %52
52: ; preds = %52, %50
%53 = phi i64 [ 0, %50 ], [ %98, %52 ]
%54 = phi i64 [ 0, %50 ], [ %99, %52 ]
%55 = getelementptr i8, i8* %27, i64 %53
%56 = bitcast i8* %55 to <16 x i8>*
%57 = load <16 x i8>, <16 x i8>* %56
%58 = getelementptr i8, i8* %55, i64 16
%59 = bitcast i8* %58 to <16 x i8>*
%60 = load <16 x i8>, <16 x i8>* %59
%61 = getelementptr inbounds [257 x i8], [257 x i8]* %4, i64 0, i64 %53
%62 = bitcast i8* %61 to <16 x i8>*
store <16 x i8> %57, <16 x i8>* %62
%63 = getelementptr inbounds i8, i8* %61, i64 16
%64 = bitcast i8* %63 to <16 x i8>*
store <16 x i8> %60, <16 x i8>* %64
%65 = or i64 %53, 32
%66 = getelementptr i8, i8* %27, i64 %65
%67 = bitcast i8* %66 to <16 x i8>*
%68 = load <16 x i8>, <16 x i8>* %67
%69 = getelementptr i8, i8* %66, i64 16
%70 = bitcast i8* %69 to <16 x i8>*
%71 = load <16 x i8>, <16 x i8>* %70
%72 = getelementptr inbounds [257 x i8], [257 x i8]* %4, i64 0, i64 %65
%73 = bitcast i8* %72 to <16 x i8>*
store <16 x i8> %68, <16 x i8>* %73
%74 = getelementptr inbounds i8, i8* %72, i64 16
%75 = bitcast i8* %74 to <16 x i8>*
store <16 x i8> %71, <16 x i8>* %75
%76 = or i64 %53, 64
%77 = getelementptr i8, i8* %27, i64 %76
%78 = bitcast i8* %77 to <16 x i8>*
%79 = load <16 x i8>, <16 x i8>* %78
%80 = getelementptr i8, i8* %77, i64 16
%81 = bitcast i8* %80 to <16 x i8>*
%82 = load <16 x i8>, <16 x i8>* %81
%83 = getelementptr inbounds [257 x i8], [257 x i8]* %4, i64 0, i64 %76
%84 = bitcast i8* %83 to <16 x i8>*
store <16 x i8> %79, <16 x i8>* %84
%85 = getelementptr inbounds i8, i8* %83, i64 16
%86 = bitcast i8* %85 to <16 x i8>*
store <16 x i8> %82, <16 x i8>* %86
%87 = or i64 %53, 96
%88 = getelementptr i8, i8* %27, i64 %87
%89 = bitcast i8* %88 to <16 x i8>*
%90 = load <16 x i8>, <16 x i8>* %89
%91 = getelementptr i8, i8* %88, i64 16
%92 = bitcast i8* %91 to <16 x i8>*
%93 = load <16 x i8>, <16 x i8>* %92
%94 = getelementptr inbounds [257 x i8], [257 x i8]* %4, i64 0, i64 %87
%95 = bitcast i8* %94 to <16 x i8>*
store <16 x i8> %90, <16 x i8>* %95
%96 = getelementptr inbounds i8, i8* %94, i64 16
%97 = bitcast i8* %96 to <16 x i8>*
store <16 x i8> %93, <16 x i8>* %97
%98 = add nuw i64 %53, 128
%99 = add i64 %54, 4
%100 = icmp eq i64 %99, %51
br i1 %100, label %101, label %52
101: ; preds = %52, %43
%102 = phi i64 [ 0, %43 ], [ %98, %52 ]
%103 = icmp eq i64 %48, 0
br i1 %103, label %120, label %104
104: ; preds = %101, %104
%105 = phi i64 [ %117, %104 ], [ %102, %101 ]
%106 = phi i64 [ %118, %104 ], [ 0, %101 ]
%107 = getelementptr i8, i8* %27, i64 %105
%108 = bitcast i8* %107 to <16 x i8>*
%109 = load <16 x i8>, <16 x i8>* %108
%110 = getelementptr i8, i8* %107, i64 16
%111 = bitcast i8* %110 to <16 x i8>*
%112 = load <16 x i8>, <16 x i8>* %111
%113 = getelementptr inbounds [257 x i8], [257 x i8]* %4, i64 0, i64 %105
%114 = bitcast i8* %113 to <16 x i8>*
store <16 x i8> %109, <16 x i8>* %114
%115 = getelementptr inbounds i8, i8* %113, i64 16
%116 = bitcast i8* %115 to <16 x i8>*
store <16 x i8> %112, <16 x i8>* %116
%117 = add nuw i64 %105, 32
%118 = add i64 %106, 1
%119 = icmp eq i64 %118, %48
br i1 %119, label %120, label %104
120: ; preds = %104, %101
%121 = icmp eq i64 %33, %44
br i1 %121, label %152, label %122
122: ; preds = %120
%123 = getelementptr i8, i8* %27, i64 %44
%124 = and i64 %33, 24
%125 = icmp eq i64 %124, 0
br i1 %125, label %141, label %126
126: ; preds = %41, %122
%127 = phi i64 [ %44, %122 ], [ 0, %41 ]
%128 = and i64 %33, -8
%129 = getelementptr i8, i8* %27, i64 %128
br label %130
130: ; preds = %130, %126
%131 = phi i64 [ %127, %126 ], [ %137, %130 ]
%132 = getelementptr i8, i8* %27, i64 %131
%133 = bitcast i8* %132 to <8 x i8>*
%134 = load <8 x i8>, <8 x i8>* %133
%135 = getelementptr inbounds [257 x i8], [257 x i8]* %4, i64 0, i64 %131
%136 = bitcast i8* %135 to <8 x i8>*
store <8 x i8> %134, <8 x i8>* %136
%137 = add nuw i64 %131, 8
%138 = icmp eq i64 %137, %128
br i1 %138, label %139, label %130
139: ; preds = %130
%140 = icmp eq i64 %33, %128
br i1 %140, label %152, label %141
141: ; preds = %35, %30, %122, %139
%142 = phi i64 [ 0, %30 ], [ 0, %35 ], [ %44, %122 ], [ %128, %139 ]
%143 = phi i8* [ %27, %30 ], [ %27, %35 ], [ %123, %122 ], [ %129, %139 ]
br label %144
144: ; preds = %141, %144
%145 = phi i64 [ %150, %144 ], [ %142, %141 ]
%146 = phi i8* [ %149, %144 ], [ %143, %141 ]
%147 = load i8, i8* %146
%148 = getelementptr inbounds [257 x i8], [257 x i8]* %4, i64 0, i64 %145
store i8 %147, i8* %148
%149 = getelementptr inbounds i8, i8* %146, i64 1
%150 = add nuw i64 %145, 1
%151 = icmp eq i64 %150, %33
br i1 %151, label %152, label %144
152: ; preds = %144, %139, %120
%153 = and i64 %33, 4294967295
br label %154
154: ; preds = %152, %23
%155 = phi i64 [ 0, %23 ], [ %153, %152 ]
%156 = getelementptr inbounds [257 x i8], [257 x i8]* %4, i64 0, i64 %155
store i8 0, i8* %156
%157 = call i32 @fread(i8* %7, i32 1, i32 64, i32* %18)
%158 = call i64 @memcmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%159 = icmp eq i64 %158, 0
br i1 %159, label %160, label %168
160: ; preds = %154
%161 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 16
%162 = call i64 @memcmp(i8* %161, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%163 = icmp eq i64 %162, 0
br i1 %163, label %164, label %168
164: ; preds = %160
%165 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 22
%166 = call i64 @memcmp(i8* %165, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%167 = icmp eq i64 %166, 0
br i1 %167, label %170, label %168
168: ; preds = %164, %160, %154
%169 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.11, i64 0, i64 0))
br label %229
170: ; preds = %164
%171 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 32
%172 = call i32 @get32bit(i8* %171)
%173 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 40
%174 = call i32 @get32bit(i8* %173)
%175 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 48
%176 = call i32 @get32bit(i8* %175)
%177 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 56
%178 = call i32 @get32bit(i8* %177)
%179 = load i32, i32* @SEEK_SET
%180 = call i32 @fseek(i32* %18, i32 %174, i32 %179)
%181 = call i32 @fread(i8* %7, i32 1, i32 4, i32* %18)
%182 = call i32 @get32bit(i8* %7)
%183 = icmp sgt i32 %182, 0
br i1 %183, label %184, label %227
184: ; preds = %170
%185 = add nsw i32 %174, 4
%186 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 4
%187 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 8
%188 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 20
br label %189
189: ; preds = %184, %220
%190 = phi i32 [ 0, %184 ], [ %225, %220 ]
%191 = phi i32 [ %185, %184 ], [ %222, %220 ]
%192 = call i32 @fread(i8* %7, i32 1, i32 32, i32* %18)
%193 = call i32 @get32bit(i8* %186)
%194 = call i32 @get32bit(i8* %187)
%195 = call i32 @get32bit(i8* %188)
%196 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0), i32 %190, i32 %193, i32 %194, i32 %195)
%197 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i8* %8, i32 %190)
%198 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%199 = icmp eq i32* %198, null
br i1 %199, label %200, label %202
200: ; preds = %189
%201 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %9)
br label %229
202: ; preds = %189
%203 = add nsw i32 %195, %176
%204 = load i32, i32* @SEEK_SET
%205 = call i32 @fseek(i32* %18, i32 %203, i32 %204)
%206 = call i32 @fread(i8* %7, i32 1, i32 96, i32* %18)
%207 = call i32 @fwrite(i8* %7, i32 1, i32 96, i32* %198)
%208 = add nsw i32 %193, %178
%209 = load i32, i32* @SEEK_SET
%210 = call i32 @fseek(i32* %18, i32 %208, i32 %209)
%211 = icmp sgt i32 %194, 0
br i1 %211, label %212, label %220
212: ; preds = %202, %212
%213 = phi i32 [ %218, %212 ], [ 0, %202 ]
%214 = call i32 @fread(i8* %7, i32 1, i32 1, i32* %18)
%215 = load i8, i8* %7
%216 = sext i8 %215 to i32
%217 = call i32 @fputc(i32 %216, i32* %198)
%218 = add nuw nsw i32 %213, 1
%219 = icmp eq i32 %218, %194
br i1 %219, label %220, label %212
220: ; preds = %212, %202
%221 = call i32 @fclose(i32* %198)
%222 = add nsw i32 %191, 32
%223 = load i32, i32* @SEEK_SET
%224 = call i32 @fseek(i32* %18, i32 %222, i32 %223)
%225 = add nuw nsw i32 %190, 1
%226 = icmp eq i32 %225, %182
br i1 %226, label %227, label %189
227: ; preds = %220, %170
%228 = call i32 @fclose(i32* %18)
br label %229
229: ; preds = %227, %200, %168, %21, %12
%230 = phi i32 [ 1, %12 ], [ 1, %168 ], [ 1, %200 ], [ 0, %227 ], [ 1, %21 ]
ret i32 %230
}