#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ help();
int snd2nes(char const *, int, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ strcmp(char *, char const *);
int /*<<< orphan*/ strncmp(char *, char const *, int);
int strtol(char const *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ usage();
int /*<<< orphan*/ version();
int main(int argc, char *argv[]) {
  int verbose = 0;
  const char *input_filename = 0;
  const char *output_filename = 0;
  int note_delta = 3;
  int hz_delta = 48;
  int multi = 0;
  {
    char *p;
    while ((p = *(++argv))) {
      if (!strncmp("--", p, 2)) {
        const char *opt = &p[2];
        if (!strncmp("note-delta=", opt, 11)) {
          note_delta = strtol(&opt[11], 0, 0);
        } else if (!strncmp("hertz-delta=", opt, 12)) {
          hz_delta = strtol(&opt[12], 0, 0);
        } else if (!strncmp("multi", opt, 5)) {
          multi = 1;
        } else if (!strncmp("output=", opt, 7)) {
          output_filename = &opt[7];
        } else if (!strcmp("verbose", opt)) {
          verbose = 1;
        } else if (!strcmp("help", opt)) {
          help();
        } else if (!strcmp("usage", opt)) {
          usage();
        } else if (!strcmp("version", opt)) {
          version();
        } else {
          fprintf(stderr,
                  "snd2nes: unrecognized option `%s'\n"
                  "Try `snd2nes --help' or `snd2nes --usage' for more "
                  "information.\n",
                  p);
          return (-1);
        }
      } else {
        input_filename = p;
      }
    }
  }
  if (!input_filename) {
    fprintf(
        stderr,
        "snd2nes: no filename given\n"
        "Try `snd2nes --help' or `snd2nes --usage' for more information.\n");
    return (-1);
  }
  {
    int ret;
    FILE *out;
    if (!output_filename)
      out = stdout;
    else
      out = fopen(output_filename, "wt");
    if (!out) {
      fprintf(stderr, "snd2nes: failed to open `%s' for writing\n",
              output_filename);
      return (-1);
    }
    ret = snd2nes(input_filename, note_delta, hz_delta, multi, out);
    fclose(out);
    if (ret == 1) {
      fprintf(stderr, "snd2nes: failed to open `%s' for reading\n",
              input_filename);
      return (-1);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x3,-0x2c(%rbp)
movl   $0x30,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rax
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
je     13e4 <main+0x244>
mov    -0x40(%rbp),%rsi
lea    0xdf2(%rip),%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    13d7 <main+0x237>
mov    -0x40(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rsi
lea    0xdcb(%rip),%rdi
mov    $0xb,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1264 <main+0xc4>
mov    -0x48(%rbp),%rdi
add    $0xb,%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1080 <strtol@plt>
mov    %eax,-0x2c(%rbp)
jmp    13d2 <main+0x232>
mov    -0x48(%rbp),%rsi
lea    0xda0(%rip),%rdi
mov    $0xc,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    129b <main+0xfb>
mov    -0x48(%rbp),%rdi
add    $0xc,%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1080 <strtol@plt>
mov    %eax,-0x30(%rbp)
jmp    13cd <main+0x22d>
mov    -0x48(%rbp),%rsi
lea    0xd76(%rip),%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    12c5 <main+0x125>
movl   $0x1,-0x34(%rbp)
jmp    13c8 <main+0x228>
mov    -0x48(%rbp),%rsi
lea    0xd52(%rip),%rdi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    12f4 <main+0x154>
mov    -0x48(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x28(%rbp)
jmp    13c3 <main+0x223>
mov    -0x48(%rbp),%rsi
lea    0xd2b(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1319 <main+0x179>
movl   $0x1,-0x14(%rbp)
jmp    13be <main+0x21e>
mov    -0x48(%rbp),%rsi
lea    0xd0e(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    133e <main+0x19e>
mov    $0x0,%al
call   10c0 <help@plt>
jmp    13b9 <main+0x219>
mov    -0x48(%rbp),%rsi
lea    0xcee(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1363 <main+0x1c3>
mov    $0x0,%al
call   10a0 <usage@plt>
jmp    13b4 <main+0x214>
mov    -0x48(%rbp),%rsi
lea    0xccf(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1388 <main+0x1e8>
mov    $0x0,%al
call   1090 <version@plt>
jmp    13af <main+0x20f>
mov    0x2c51(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
lea    0xca9(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d0 <main+0x330>
jmp    13b4 <main+0x214>
jmp    13b9 <main+0x219>
jmp    13be <main+0x21e>
jmp    13c3 <main+0x223>
jmp    13c8 <main+0x228>
jmp    13cd <main+0x22d>
jmp    13d2 <main+0x232>
jmp    13df <main+0x23f>
mov    -0x40(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    11e2 <main+0x42>
cmpq   $0x0,-0x20(%rbp)
jne    1412 <main+0x272>
mov    0x2bea(%rip),%rax
mov    (%rax),%edi
lea    0xca9(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d0 <main+0x330>
cmpq   $0x0,-0x28(%rbp)
jne    1430 <main+0x290>
mov    0x2bb4(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
jmp    1444 <main+0x2a4>
mov    -0x28(%rbp),%rdi
lea    0xcc9(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    1476 <main+0x2d6>
mov    0x2b8a(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xca4(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d0 <main+0x330>
mov    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
mov    -0x34(%rbp),%ecx
mov    -0x58(%rbp),%r8
call   1060 <snd2nes@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x58(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x1,-0x4c(%rbp)
jne    14c9 <main+0x329>
mov    0x2b37(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xc7b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d0 <main+0x330>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x8(%rsi),%rbx
test   %rbx,%rbx
je     13c4 <main+0x224>
mov    %rsi,%rbp
add    $0x10,%rbp
movl   $0x3,0xc(%rsp)
movl   $0x30,0x8(%rsp)
lea    0xe27(%rip),%r15
lea    0xe23(%rip),%r12
movl   $0x0,0x4(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %r14d,%r14d
jmp    1214 <main+0x74>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%r14
mov    0x0(%rbp),%rbx
add    $0x8,%rbp
test   %rbx,%rbx
je     1361 <main+0x1c1>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    1200 <main+0x60>
lea    0x2(%rbx),%r13
mov    %r12,%rdi
mov    %r13,%rsi
mov    $0xb,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     12fc <main+0x15c>
lea    0xdc4(%rip),%rdi
mov    %r13,%rsi
mov    $0xc,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1315 <main+0x175>
lea    0xdb5(%rip),%rdi
mov    %r13,%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     132e <main+0x18e>
lea    0xd9f(%rip),%rdi
mov    %r13,%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     133b <main+0x19b>
lea    0xd8b(%rip),%rdi
mov    %r13,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1203 <main+0x63>
lea    0xd7c(%rip),%rdi
mov    %r13,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1349 <main+0x1a9>
lea    0xd6a(%rip),%rdi
mov    %r13,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1355 <main+0x1b5>
lea    0xd5d(%rip),%rdi
mov    %r13,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    141a <main+0x27a>
xor    %eax,%eax
call   1090 <version@plt>
jmp    1203 <main+0x63>
add    $0xd,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    %eax,0xc(%rsp)
jmp    1203 <main+0x63>
add    $0xe,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    %eax,0x8(%rsp)
jmp    1203 <main+0x63>
movl   $0x1,0x4(%rsp)
jmp    1203 <main+0x63>
add    $0x9,%rbx
mov    %rbx,0x10(%rsp)
jmp    1203 <main+0x63>
xor    %eax,%eax
call   10c0 <help@plt>
jmp    1203 <main+0x63>
xor    %eax,%eax
call   10a0 <usage@plt>
jmp    1203 <main+0x63>
test   %r14,%r14
je     13c4 <main+0x224>
mov    0x10(%rsp),%rbp
test   %rbp,%rbp
je     13dd <main+0x23d>
lea    0xd8d(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <fopen@plt>
mov    %rax,%rbx
test   %rbx,%rbx
je     13ec <main+0x24c>
mov    %r14,%rdi
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0x4(%rsp),%ecx
mov    %rbx,%r8
call   1060 <snd2nes@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
cmp    $0x1,%ebp
jne    140b <main+0x26b>
mov    0x2c2a(%rip),%rax
mov    (%rax),%edi
lea    0xd72(%rip),%rsi
mov    %r14,%rdx
jmp    13ff <main+0x25f>
mov    0x2c15(%rip),%rax
mov    (%rax),%edi
lea    0xcd4(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    1406 <main+0x266>
mov    0x2bf4(%rip),%rax
mov    (%rax),%rbx
test   %rbx,%rbx
jne    1387 <main+0x1e7>
mov    0x2bed(%rip),%rax
mov    (%rax),%edi
lea    0xd0b(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bbf(%rip),%rax
mov    (%rax),%edi
lea    0xc1b(%rip),%rsi
mov    %rbx,%rdx
jmp    13ff <main+0x25f>

LLVM IR (-O0):
@.str = [3 x i8] c"--\00"
@.str.1 = [12 x i8] c"note-delta=\00"
@.str.2 = [13 x i8] c"hertz-delta=\00"
@.str.3 = [6 x i8] c"multi\00"
@.str.4 = [8 x i8] c"output=\00"
@.str.5 = [8 x i8] c"verbose\00"
@.str.6 = [5 x i8] c"help\00"
@.str.7 = [6 x i8] c"usage\00"
@.str.8 = [8 x i8] c"version\00"
@stderr = global i32 0
@.str.9 = [99 x i8] c"snd2nes: unrecognized option `%s'\0ATry `snd2nes --help' or `snd2nes --usage' for more information.\0A\00"
@.str.10 = [92 x i8] c"snd2nes: no filename given\0ATry `snd2nes --help' or `snd2nes --usage' for more information.\0A\00"
@stdout = global i32* null
@.str.11 = [3 x i8] c"wt\00"
@.str.12 = [42 x i8] c"snd2nes: failed to open `%s' for writing\0A\00"
@.str.13 = [42 x i8] c"snd2nes: failed to open `%s' for reading\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i8* null, i8** %7
store i8* null, i8** %8
store i32 3, i32* %9
store i32 48, i32* %10
store i32 0, i32* %11
br label %16
16: ; preds = %92, %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i32 1
store i8** %18, i8*** %5
%19 = load i8*, i8** %18
store i8* %19, i8** %12
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %93
21: ; preds = %16
%22 = load i8*, i8** %12
%23 = call i32 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %22, i32 2)
%24 = icmp ne i32 %23, 0
br i1 %24, label %90, label %25
25: ; preds = %21
%26 = load i8*, i8** %12
%27 = getelementptr inbounds i8, i8* %26, i64 2
store i8* %27, i8** %13
%28 = load i8*, i8** %13
%29 = call i32 @strncmp(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %28, i32 11)
%30 = icmp ne i32 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %25
%32 = load i8*, i8** %13
%33 = getelementptr inbounds i8, i8* %32, i64 11
%34 = call i32 @strtol(i8* %33, i32 0, i32 0)
store i32 %34, i32* %9
br label %89
35: ; preds = %25
%36 = load i8*, i8** %13
%37 = call i32 @strncmp(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %36, i32 12)
%38 = icmp ne i32 %37, 0
br i1 %38, label %43, label %39
39: ; preds = %35
%40 = load i8*, i8** %13
%41 = getelementptr inbounds i8, i8* %40, i64 12
%42 = call i32 @strtol(i8* %41, i32 0, i32 0)
store i32 %42, i32* %10
br label %88
43: ; preds = %35
%44 = load i8*, i8** %13
%45 = call i32 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %44, i32 5)
%46 = icmp ne i32 %45, 0
br i1 %46, label %48, label %47
47: ; preds = %43
store i32 1, i32* %11
br label %87
48: ; preds = %43
%49 = load i8*, i8** %13
%50 = call i32 @strncmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %49, i32 7)
%51 = icmp ne i32 %50, 0
br i1 %51, label %55, label %52
52: ; preds = %48
%53 = load i8*, i8** %13
%54 = getelementptr inbounds i8, i8* %53, i64 7
store i8* %54, i8** %8
br label %86
55: ; preds = %48
%56 = load i8*, i8** %13
%57 = call i32 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %56)
%58 = icmp ne i32 %57, 0
br i1 %58, label %60, label %59
59: ; preds = %55
store i32 1, i32* %6
br label %85
60: ; preds = %55
%61 = load i8*, i8** %13
%62 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %61)
%63 = icmp ne i32 %62, 0
br i1 %63, label %66, label %64
64: ; preds = %60
%65 = call i32 (...) @help()
br label %84
66: ; preds = %60
%67 = load i8*, i8** %13
%68 = call i32 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %67)
%69 = icmp ne i32 %68, 0
br i1 %69, label %72, label %70
70: ; preds = %66
%71 = call i32 (...) @usage()
br label %83
72: ; preds = %66
%73 = load i8*, i8** %13
%74 = call i32 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* %73)
%75 = icmp ne i32 %74, 0
br i1 %75, label %78, label %76
76: ; preds = %72
%77 = call i32 (...) @version()
br label %82
78: ; preds = %72
%79 = load i32, i32* @stderr
%80 = load i8*, i8** %12
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.9, i64 0, i64 0), i8* %80)
store i32 -1, i32* %3
br label %130
82: ; preds = %76
br label %83
83: ; preds = %82, %70
br label %84
84: ; preds = %83, %64
br label %85
85: ; preds = %84, %59
br label %86
86: ; preds = %85, %52
br label %87
87: ; preds = %86, %47
br label %88
88: ; preds = %87, %39
br label %89
89: ; preds = %88, %31
br label %92
90: ; preds = %21
%91 = load i8*, i8** %12
store i8* %91, i8** %7
br label %92
92: ; preds = %90, %89
br label %16
93: ; preds = %16
%94 = load i8*, i8** %7
%95 = icmp ne i8* %94, null
br i1 %95, label %99, label %96
96: ; preds = %93
%97 = load i32, i32* @stderr
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.10, i64 0, i64 0))
store i32 -1, i32* %3
br label %130
99: ; preds = %93
%100 = load i8*, i8** %8
%101 = icmp ne i8* %100, null
br i1 %101, label %104, label %102
102: ; preds = %99
%103 = load i32*, i32** @stdout
store i32* %103, i32** %15
br label %107
104: ; preds = %99
%105 = load i8*, i8** %8
%106 = call i32* @fopen(i8* %105, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
store i32* %106, i32** %15
br label %107
107: ; preds = %104, %102
%108 = load i32*, i32** %15
%109 = icmp ne i32* %108, null
br i1 %109, label %114, label %110
110: ; preds = %107
%111 = load i32, i32* @stderr
%112 = load i8*, i8** %8
%113 = call i32 (i32, i8*, ...) @fprintf(i32 %111, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0), i8* %112)
store i32 -1, i32* %3
br label %130
114: ; preds = %107
%115 = load i8*, i8** %7
%116 = load i32, i32* %9
%117 = load i32, i32* %10
%118 = load i32, i32* %11
%119 = load i32*, i32** %15
%120 = call i32 @snd2nes(i8* %115, i32 %116, i32 %117, i32 %118, i32* %119)
store i32 %120, i32* %14
%121 = load i32*, i32** %15
%122 = call i32 @fclose(i32* %121)
%123 = load i32, i32* %14
%124 = icmp eq i32 %123, 1
br i1 %124, label %125, label %129
125: ; preds = %114
%126 = load i32, i32* @stderr
%127 = load i8*, i8** %7
%128 = call i32 (i32, i8*, ...) @fprintf(i32 %126, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0), i8* %127)
store i32 -1, i32* %3
br label %130
129: ; preds = %114
store i32 0, i32* %3
br label %130
130: ; preds = %129, %125, %110, %96, %78
%131 = load i32, i32* %3
ret i32 %131
}

LLVM IR (-O2):
@.str = [3 x i8] c"--\00"
@.str.1 = [12 x i8] c"note-delta=\00"
@.str.2 = [13 x i8] c"hertz-delta=\00"
@.str.3 = [6 x i8] c"multi\00"
@.str.4 = [8 x i8] c"output=\00"
@.str.5 = [8 x i8] c"verbose\00"
@.str.6 = [5 x i8] c"help\00"
@.str.7 = [6 x i8] c"usage\00"
@.str.8 = [8 x i8] c"version\00"
@stderr = global i32 0
@.str.9 = [99 x i8] c"snd2nes: unrecognized option `%s'\0ATry `snd2nes --help' or `snd2nes --usage' for more information.\0A\00"
@.str.10 = [92 x i8] c"snd2nes: no filename given\0ATry `snd2nes --help' or `snd2nes --usage' for more information.\0A\00"
@stdout = global i32* null
@.str.11 = [3 x i8] c"wt\00"
@.str.12 = [42 x i8] c"snd2nes: failed to open `%s' for writing\0A\00"
@.str.13 = [42 x i8] c"snd2nes: failed to open `%s' for reading\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %69, label %6
6: ; preds = %2, %55
%7 = phi i8* [ %62, %55 ], [ %4, %2 ]
%8 = phi i8** [ %61, %55 ], [ %3, %2 ]
%9 = phi i32 [ %60, %55 ], [ 0, %2 ]
%10 = phi i32 [ %59, %55 ], [ 48, %2 ]
%11 = phi i32 [ %58, %55 ], [ 3, %2 ]
%12 = phi i8* [ %57, %55 ], [ null, %2 ]
%13 = phi i8* [ %56, %55 ], [ null, %2 ]
%14 = tail call i32 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7, i32 2)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %55
16: ; preds = %6
%17 = getelementptr inbounds i8, i8* %7, i64 2
%18 = tail call i32 @strncmp(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %17, i32 11)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = getelementptr inbounds i8, i8* %7, i64 13
%22 = tail call i32 @strtol(i8* %21, i32 0, i32 0)
br label %55
23: ; preds = %16
%24 = tail call i32 @strncmp(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %17, i32 12)
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = getelementptr inbounds i8, i8* %7, i64 14
%28 = tail call i32 @strtol(i8* %27, i32 0, i32 0)
br label %55
29: ; preds = %23
%30 = tail call i32 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %17, i32 5)
%31 = icmp eq i32 %30, 0
br i1 %31, label %55, label %32
32: ; preds = %29
%33 = tail call i32 @strncmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %17, i32 7)
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = getelementptr inbounds i8, i8* %7, i64 9
br label %55
37: ; preds = %32
%38 = tail call i32 @strcmp(i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %17)
%39 = icmp eq i32 %38, 0
br i1 %39, label %55, label %40
40: ; preds = %37
%41 = tail call i32 @strcmp(i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %17)
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = tail call i32 (...) @help()
br label %55
45: ; preds = %40
%46 = tail call i32 @strcmp(i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %17)
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = tail call i32 (...) @usage()
br label %55
50: ; preds = %45
%51 = tail call i32 @strcmp(i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* %17)
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %64
53: ; preds = %50
%54 = tail call i32 (...) @version()
br label %55
55: ; preds = %20, %48, %53, %43, %35, %26, %29, %37, %6
%56 = phi i8* [ %7, %6 ], [ %13, %37 ], [ %13, %29 ], [ %13, %26 ], [ %13, %35 ], [ %13, %43 ], [ %13, %53 ], [ %13, %48 ], [ %13, %20 ]
%57 = phi i8* [ %12, %6 ], [ %12, %37 ], [ %12, %29 ], [ %12, %26 ], [ %36, %35 ], [ %12, %43 ], [ %12, %53 ], [ %12, %48 ], [ %12, %20 ]
%58 = phi i32 [ %11, %6 ], [ %11, %37 ], [ %11, %29 ], [ %11, %26 ], [ %11, %35 ], [ %11, %43 ], [ %11, %53 ], [ %11, %48 ], [ %22, %20 ]
%59 = phi i32 [ %10, %6 ], [ %10, %37 ], [ %10, %29 ], [ %28, %26 ], [ %10, %35 ], [ %10, %43 ], [ %10, %53 ], [ %10, %48 ], [ %10, %20 ]
%60 = phi i32 [ %9, %6 ], [ %9, %37 ], [ 1, %29 ], [ %9, %26 ], [ %9, %35 ], [ %9, %43 ], [ %9, %53 ], [ %9, %48 ], [ %9, %20 ]
%61 = getelementptr inbounds i8*, i8** %8, i64 1
%62 = load i8*, i8** %61
%63 = icmp eq i8* %62, null
br i1 %63, label %67, label %6
64: ; preds = %50
%65 = load i32, i32* @stderr
%66 = tail call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.9, i64 0, i64 0), i8* %7)
br label %91
67: ; preds = %55
%68 = icmp eq i8* %56, null
br i1 %68, label %69, label %72
69: ; preds = %2, %67
%70 = load i32, i32* @stderr
%71 = tail call i32 (i32, i8*, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.10, i64 0, i64 0))
br label %91
72: ; preds = %67
%73 = icmp eq i8* %57, null
br i1 %73, label %74, label %76
74: ; preds = %72
%75 = load i32*, i32** @stdout
br label %78
76: ; preds = %72
%77 = tail call i32* @fopen(i8* %57, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
br label %78
78: ; preds = %76, %74
%79 = phi i32* [ %77, %76 ], [ %75, %74 ]
%80 = icmp eq i32* %79, null
br i1 %80, label %81, label %84
81: ; preds = %78
%82 = load i32, i32* @stderr
%83 = tail call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0), i8* %57)
br label %91
84: ; preds = %78
%85 = tail call i32 @snd2nes(i8* %56, i32 %58, i32 %59, i32 %60, i32* %79)
%86 = tail call i32 @fclose(i32* %79)
%87 = icmp eq i32 %85, 1
br i1 %87, label %88, label %91
88: ; preds = %84
%89 = load i32, i32* @stderr
%90 = tail call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0), i8* %56)
br label %91
91: ; preds = %81, %88, %84, %64, %69
%92 = phi i32 [ -1, %69 ], [ -1, %64 ], [ 0, %84 ], [ -1, %88 ], [ -1, %81 ]
ret i32 %92
}