#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 */

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void SayUsage(char *programName) {
  static char *usage[] = {
      "Convert MIDI files to an Arduino PLAYTUNE bytestream,",
      "or a frequency/duration pairs stream suitable for ArduboyTones",
      "",
      "Use:  midi2tones <options> <basefilename>",
      "   input file will be <basefilename>.mid",
      "   output file will be <basefilename>.bin or .c",
      "   log file will be <basefilename>.log",
      "",
      "Commonly-used options:",
      "  -o1  generate Playtune output format (the default)",
      "  -o2  generate the frequency/duration pair output format",
      "  -v   include velocity data",
      "  -vn  for alternate format: n is the minimum velocity for high volume "
      "notes",
      "  -i   include instrument change commands",
      "  -pt  translate notes in the percussion track to notes 129 to 255",
      "  -d   include a self-describing file header",
      "  -b   generate binary file output instead of C source text",
      "  -tn  use at most n tone generators (default is 6, max is 16)",
      "",
      "  The best options for later Playtune music players are: -v -i -pt -d",
      "",
      "Lesser-used command-line options:",
      "  -p   parse only, don't generate bytestream",
      "  -lp  log input parsing",
      "  -lg  log output generation",
      "  -nx  put about x items on each line of the C file output",
      "  -s1  strategy 1: favor track 1",
      "  -s2  strategy 2: try to assign tracks to specific tone generators",
      "  -cn  mask for which tracks to process, e.g. -c3 for only 0 and 1",
      "  -kn  key shift in chromatic notes, positive or negative",
      "  -pi  ignore notes in the percussion track (9)",
      "  -fa  for alternate format: high volume notes as "
      "\"<freq>+TONE_HIGH_VOLUME\"",
      "  -fb  for alternate format: high volume notes as a single decimal "
      "value",
      "  -r   terminate output file with \"restart\" instead of \"stop\" "
      "command",
      "  -dp  define PROGMEM in output C code",
      NULL};
  int i = 0;
  while (usage[i] != NULL)
    fprintf(stderr, "%s\n", usage[i++]);
}


x86 assembly (clang, -O0):
<SayUsage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
lea    0x2f02(%rip),%rax
cmpq   $0x0,(%rax,%rcx,8)
je     116c <SayUsage+0x5c>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
movslq %eax,%rcx
lea    0x2ed9(%rip),%rax
mov    (%rax,%rcx,8),%rdx
lea    0x14dc(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1123 <SayUsage+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SayUsage>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0x2bcf(%rip),%r15
mov    0x2eb0(%rip),%r12
lea    0x150f(%rip),%r14
nop
mov    (%rbx,%r15,1),%rdx
mov    (%r12),%edi
mov    %r14,%rsi
call   1030 <fprintf@plt>
add    $0x8,%rbx
cmp    $0x118,%rbx
jne    1130 <SayUsage+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@SayUsage.usage = internal global [36 x i8*] [i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.31, i32 0, i32 0), i8* null]
@.str = [54 x i8] c"Convert MIDI files to an Arduino PLAYTUNE bytestream,\00"
@.str.1 = [63 x i8] c"or a frequency/duration pairs stream suitable for ArduboyTones\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [42 x i8] c"Use: midi2tones <options> <basefilename>\00"
@.str.4 = [41 x i8] c" input file will be <basefilename>.mid\00"
@.str.5 = [48 x i8] c" output file will be <basefilename>.bin or .c\00"
@.str.6 = [39 x i8] c" log file will be <basefilename>.log\00"
@.str.7 = [23 x i8] c"Commonly-used options:\00"
@.str.8 = [53 x i8] c" -o1 generate Playtune output format (the default)\00"
@.str.9 = [58 x i8] c" -o2 generate the frequency/duration pair output format\00"
@.str.10 = [29 x i8] c" -v include velocity data\00"
@.str.11 = [77 x i8] c" -vn for alternate format: n is the minimum velocity for high volume notes\00"
@.str.12 = [42 x i8] c" -i include instrument change commands\00"
@.str.13 = [67 x i8] c" -pt translate notes in the percussion track to notes 129 to 255\00"
@.str.14 = [45 x i8] c" -d include a self-describing file header\00"
@.str.15 = [60 x i8] c" -b generate binary file output instead of C source text\00"
@.str.16 = [63 x i8] c" -tn use at most n tone generators (default is 6, max is 16)\00"
@.str.17 = [70 x i8] c" The best options for later Playtune music players are: -v -i -pt -d\00"
@.str.18 = [34 x i8] c"Lesser-used command-line options:\00"
@.str.19 = [45 x i8] c" -p parse only, don't generate bytestream\00"
@.str.20 = [25 x i8] c" -lp log input parsing\00"
@.str.21 = [29 x i8] c" -lg log output generation\00"
@.str.22 = [59 x i8] c" -nx put about x items on each line of the C file output\00"
@.str.23 = [33 x i8] c" -s1 strategy 1: favor track 1\00"
@.str.24 = [68 x i8] c" -s2 strategy 2: try to assign tracks to specific tone generators\00"
@.str.25 = [67 x i8] c" -cn mask for which tracks to process, e.g. -c3 for only 0 and 1\00"
@.str.26 = [58 x i8] c" -kn key shift in chromatic notes, positive or negative\00"
@.str.27 = [48 x i8] c" -pi ignore notes in the percussion track (9)\00"
@.str.28 = [76 x i8] c" -fa for alternate format: high volume notes as \22<freq>+TONE_HIGH_VOLUME\22\00"
@.str.29 = [73 x i8] c" -fb for alternate format: high volume notes as a single decimal value\00"
@.str.30 = [70 x i8] c" -r terminate output file with \22restart\22 instead of \22stop\22 command\00"
@.str.31 = [39 x i8] c" -dp define PROGMEM in output C code\00"
@stderr = global i32 0
@.str.32 = [4 x i8] c"%s\0A\00"
define void @SayUsage(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32, i32* %3
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [36 x i8*], [36 x i8*]* @SayUsage.usage, i64 0, i64 %6
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %18
10: ; preds = %4
%11 = load i32, i32* @stderr
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = sext i32 %12 to i64
%15 = getelementptr inbounds [36 x i8*], [36 x i8*]* @SayUsage.usage, i64 0, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.32, i64 0, i64 0), i8* %16)
br label %4
18: ; preds = %4
ret void
}

LLVM IR (-O2):
@SayUsage.usage = internal unnamed_addr constant [36 x i8*] [i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.31, i32 0, i32 0), i8* null]
@.str = [54 x i8] c"Convert MIDI files to an Arduino PLAYTUNE bytestream,\00"
@.str.1 = [63 x i8] c"or a frequency/duration pairs stream suitable for ArduboyTones\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [42 x i8] c"Use: midi2tones <options> <basefilename>\00"
@.str.4 = [41 x i8] c" input file will be <basefilename>.mid\00"
@.str.5 = [48 x i8] c" output file will be <basefilename>.bin or .c\00"
@.str.6 = [39 x i8] c" log file will be <basefilename>.log\00"
@.str.7 = [23 x i8] c"Commonly-used options:\00"
@.str.8 = [53 x i8] c" -o1 generate Playtune output format (the default)\00"
@.str.9 = [58 x i8] c" -o2 generate the frequency/duration pair output format\00"
@.str.10 = [29 x i8] c" -v include velocity data\00"
@.str.11 = [77 x i8] c" -vn for alternate format: n is the minimum velocity for high volume notes\00"
@.str.12 = [42 x i8] c" -i include instrument change commands\00"
@.str.13 = [67 x i8] c" -pt translate notes in the percussion track to notes 129 to 255\00"
@.str.14 = [45 x i8] c" -d include a self-describing file header\00"
@.str.15 = [60 x i8] c" -b generate binary file output instead of C source text\00"
@.str.16 = [63 x i8] c" -tn use at most n tone generators (default is 6, max is 16)\00"
@.str.17 = [70 x i8] c" The best options for later Playtune music players are: -v -i -pt -d\00"
@.str.18 = [34 x i8] c"Lesser-used command-line options:\00"
@.str.19 = [45 x i8] c" -p parse only, don't generate bytestream\00"
@.str.20 = [25 x i8] c" -lp log input parsing\00"
@.str.21 = [29 x i8] c" -lg log output generation\00"
@.str.22 = [59 x i8] c" -nx put about x items on each line of the C file output\00"
@.str.23 = [33 x i8] c" -s1 strategy 1: favor track 1\00"
@.str.24 = [68 x i8] c" -s2 strategy 2: try to assign tracks to specific tone generators\00"
@.str.25 = [67 x i8] c" -cn mask for which tracks to process, e.g. -c3 for only 0 and 1\00"
@.str.26 = [58 x i8] c" -kn key shift in chromatic notes, positive or negative\00"
@.str.27 = [48 x i8] c" -pi ignore notes in the percussion track (9)\00"
@.str.28 = [76 x i8] c" -fa for alternate format: high volume notes as \22<freq>+TONE_HIGH_VOLUME\22\00"
@.str.29 = [73 x i8] c" -fb for alternate format: high volume notes as a single decimal value\00"
@.str.30 = [70 x i8] c" -r terminate output file with \22restart\22 instead of \22stop\22 command\00"
@.str.31 = [39 x i8] c" -dp define PROGMEM in output C code\00"
@stderr = global i32 0
@.str.32 = [4 x i8] c"%s\0A\00"
define void @SayUsage(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds [36 x i8*], [36 x i8*]* @SayUsage.usage, i64 0, i64 %3
%5 = load i8*, i8** %4
%6 = load i32, i32* @stderr
%7 = add nuw nsw i64 %3, 1
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.32, i64 0, i64 0), i8* %5)
%9 = icmp eq i64 %7, 35
br i1 %9, label %10, label %2
10: ; preds = %2
ret void
}