// File: /workspace/github_c_makefile_star2_O3/LenShustek[P]miditones/miditones.c
// Function: HandleOptions
int HandleOptions (int argc, char *argv[]) {
   /* returns the index of the first argument that is not an option,
   i.e. does not start with a dash or a slash */
   int i, firstnonoption = 0;
   for (i = 1; i < argc; i++) {
      if (argv[i][0] == '/' || argv[i][0] == '-') {
         int tempint;
         char *arg = argv[i] + 1;
         if (opt_key(arg, "h") || opt_key(arg, "?")) {
            SayUsage(argv[0]); exit(1); }
         else if (opt_key(arg, "b")) binaryoutput = true;
         else if (opt_int(arg, "c", &channel_mask, 1, 0xffff))
            printf("Channel (track) mask is %04X\n", channel_mask);
         else if (opt_key(arg, "d")) do_header = true;
         else if (opt_key(arg, "dp")) define_progmem = true;
         else if (opt_key(arg, "lg")) loggen = true;
         else if (opt_key(arg, "i")) instrumentoutput = true;
         else if (opt_int(arg, "k", &keyshift, -100, 100))
            printf("Using keyshift %d\n", keyshift);
         else if (opt_key(arg, "lp")) logparse = true;
         else if (opt_int(arg, "n", &outfile_maxitems, 1, INT_MAX));
         else if (opt_key(arg, "p")) parseonly = true;
         else if (opt_key(arg, "pi")) percussion_ignore = true;
         else if (opt_key(arg, "pt")) percussion_translate = true;
         else if (opt_key(arg, "r")) gen_restart = true;
         else if (opt_key(arg, "asm1802")) {
            asm_output = true; comment = ";"; byteop = "    db  "; hex = "$"; outfile_maxitems = 16; }
         else if (opt_key(arg, "asm6502")) {
            asm_output = true; comment = ";"; byteop = "    .byte  "; hex = "$"; outfile_maxitems = 16; }
         else if (opt_int(arg, "delaymin", &tempint, 1, 1000)) delaymin_usec = tempint * 1000;
         else if (opt_int(arg, "releasetime", &tempint, 0, INT_MAX)) releasetime_usec = tempint * 1000;
         else if (opt_int(arg, "notemin", &tempint, 0, INT_MAX)) notemin_usec = tempint * 1000;
         else if (opt_int(arg, "attacktime", &tempint, 0, INT_MAX)) {
            attacktime_usec = tempint * 1000;
            check_option(volume_output, "-attacktime only works with -v"); }
         else if (opt_int(arg, "attacknotemax", &tempint, 0, INT_MAX)) {
            attacknotemax_usec = tempint * 1000;
            check_option(volume_output, "-attacknotemax only works with -v"); }
         else if (opt_int(arg, "sustainlevel", &sustainlevel_pct, 1, 100))
            check_option(volume_output, "-sustainlevel only works with -v");
         else if (opt_key(arg, "s1")) strategy1 = true;
         else if (opt_key(arg, "s2")) strategy2 = true;
         else if (opt_key(arg, "scorename")) scorename = true;
         else if (opt_key(arg, "showskipped")) showskipped = true;
         else if (opt_key(arg, "noduplicates")) noduplicates = true;
         else if (opt_int(arg, "t", &num_tonegens, 1, MAX_TONEGENS))
            printf("Using %d tone generators\n", num_tonegens);
         else if (opt_key(arg, "v")) volume_output = true;
         /* add more  option switches here */
         else {
            fprintf(stderr, "\n*** bad option: %s\n\n", argv[i]);
            SayUsage(argv[0]);
            exit(4); } }
      else {
         firstnonoption = i;
         break; } }
   return firstnonoption; }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x2, %edi
jl 0x1a66
movq %rsi, %r14
movl %edi, %r15d
movl $0x1, %ebx
leaq 0x5118(%rip), %r13      # 0x668c
leaq 0x4(%rsp), %r12
movq (%r14,%rbx,8), %rbp
movzbl (%rbp), %eax
orl $0x2, %eax
cmpl $0x2f, %eax
jne 0x1a68
incq %rbp
movq %rbp, %rdi
leaq 0x5165(%rip), %rsi      # 0x66ff
callq 0x13fa
testb %al, %al
jne 0x1a79
movq %rbp, %rdi
leaq 0x4999(%rip), %rsi      # 0x5f4a
callq 0x13fa
testb %al, %al
jne 0x1a79
movq %rbp, %rdi
movq %r13, %rsi
callq 0x13fa
testb %al, %al
je 0x15d9
movb $0x1, 0x7bec(%rip)      # 0x91c0
jmp 0x1682
movq %rbp, %rdi
leaq 0x511f(%rip), %rsi      # 0x6702
leaq 0x7b06(%rip), %rdx      # 0x90f0
movl $0x1, %ecx
movl $0xffff, %r8d           # imm = 0xFFFF
callq 0x143d
testb %al, %al
je 0x1614
movl 0x7aec(%rip), %esi      # 0x90f0
leaq 0x425e(%rip), %rdi      # 0x5869
xorl %eax, %eax
callq 0x1080
jmp 0x1682
movq %rbp, %rdi
leaq 0x4490(%rip), %rsi      # 0x5aae
callq 0x13fa
testb %al, %al
je 0x1630
movb $0x1, 0x7b93(%rip)      # 0x91c1
jmp 0x1682
movq %rbp, %rdi
leaq 0x424d(%rip), %rsi      # 0x5887
callq 0x13fa
testb %al, %al
je 0x164c
movb $0x1, 0x7b78(%rip)      # 0x91c2
jmp 0x1682
movq %rbp, %rdi
leaq 0x4234(%rip), %rsi      # 0x588a
callq 0x13fa
testb %al, %al
je 0x1668
movb $0x1, 0x7b5d(%rip)      # 0x91c3
jmp 0x1682
movq %rbp, %rdi
leaq 0x4232(%rip), %rsi      # 0x58a4
callq 0x13fa
testb %al, %al
je 0x1693
movb $0x1, 0x7b42(%rip)      # 0x91c4
incq %rbx
cmpq %rbx, %r15
jne 0x1579
jmp 0x1a66
movq %rbp, %rdi
leaq 0x498b(%rip), %rsi      # 0x6028
leaq 0x7ac8(%rip), %rdx      # 0x916c
movl $0xffffff9c, %ecx       # imm = 0xFFFFFF9C
movl $0x64, %r8d
callq 0x143d
testb %al, %al
je 0x16ca
movl 0x7aae(%rip), %esi      # 0x916c
leaq 0x41c8(%rip), %rdi      # 0x588d
jmp 0x160b
movq %rbp, %rdi
leaq 0x41cc(%rip), %rsi      # 0x58a0
callq 0x13fa
testb %al, %al
je 0x16e6
movb $0x1, 0x7ae1(%rip)      # 0x91c5
jmp 0x1682
movq %rbp, %rdi
leaq 0x3996(%rip), %rsi      # 0x5086
leaq 0x79f1(%rip), %rdx      # 0x90e8
movl $0x1, %ecx
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
callq 0x143d
testb %al, %al
jne 0x1682
movq %rbp, %rdi
leaq 0x416f(%rip), %rsi      # 0x5888
callq 0x13fa
testb %al, %al
je 0x172e
movb $0x1, 0x7a9d(%rip)      # 0x91c6
jmp 0x1682
movq %rbp, %rdi
leaq 0x416b(%rip), %rsi      # 0x58a3
callq 0x13fa
testb %al, %al
je 0x174d
movb $0x1, 0x7a7f(%rip)      # 0x91c7
jmp 0x1682
movq %rbp, %rdi
leaq 0x414f(%rip), %rsi      # 0x58a6
callq 0x13fa
testb %al, %al
je 0x176c
movb $0x1, 0x7a61(%rip)      # 0x91c8
jmp 0x1682
movq %rbp, %rdi
leaq 0x3acf(%rip), %rsi      # 0x5245
callq 0x13fa
testb %al, %al
je 0x178b
movb $0x1, 0x7a43(%rip)      # 0x91c9
jmp 0x1682
movq %rbp, %rdi
leaq 0x4114(%rip), %rsi      # 0x58a9
callq 0x13fa
testb %al, %al
je 0x17bc
movb $0x1, 0x7a25(%rip)      # 0x91ca
leaq 0x4d5e(%rip), %rax      # 0x650a
movq %rax, 0x791d(%rip)      # 0x90d0
leaq 0x40f7(%rip), %rax      # 0x58b1
jmp 0x17eb
movq %rbp, %rdi
leaq 0x40f6(%rip), %rsi      # 0x58bc
callq 0x13fa
testb %al, %al
je 0x180f
movb $0x1, 0x79f4(%rip)      # 0x91ca
leaq 0x4d2d(%rip), %rax      # 0x650a
movq %rax, 0x78ec(%rip)      # 0x90d0
leaq 0x40d9(%rip), %rax      # 0x58c4
movq %rax, 0x78ee(%rip)      # 0x90e0
leaq 0x40c1(%rip), %rax      # 0x58ba
movq %rax, 0x78d8(%rip)      # 0x90d8
movl $0x10, 0x78de(%rip)     # 0x90e8
jmp 0x1682
movq %rbp, %rdi
leaq 0x40b7(%rip), %rsi      # 0x58d0
movq %r12, %rdx
movl $0x1, %ecx
movl $0x3e8, %r8d            # imm = 0x3E8
callq 0x143d
testb %al, %al
je 0x1848
movslq 0x4(%rsp), %rax
imulq $0x3e8, %rax, %rax      # imm = 0x3E8
movq %rax, 0x792d(%rip)      # 0x9170
jmp 0x1682
movq %rbp, %rdi
leaq 0x4087(%rip), %rsi      # 0x58d9
leaq 0x4(%rsp), %rdx
xorl %ecx, %ecx
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
callq 0x143d
testb %al, %al
je 0x1880
movslq 0x4(%rsp), %rax
imulq $0x3e8, %rax, %rax      # imm = 0x3E8
movq %rax, 0x78fd(%rip)      # 0x9178
jmp 0x1682
movq %rbp, %rdi
leaq 0x405b(%rip), %rsi      # 0x58e5
movq %r12, %rdx
xorl %ecx, %ecx
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
callq 0x143d
testb %al, %al
je 0x18b6
movslq 0x4(%rsp), %rax
imulq $0x3e8, %rax, %rax      # imm = 0x3E8
movq %rax, 0x7847(%rip)      # 0x90f8
jmp 0x1682
movq %rbp, %rdi
leaq 0x402d(%rip), %rsi      # 0x58ed
movq %r12, %rdx
xorl %ecx, %ecx
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
callq 0x143d
testb %al, %al
je 0x18f7
movslq 0x4(%rsp), %rax
imulq $0x3e8, %rax, %rax      # imm = 0x3E8
movq %rax, 0x7899(%rip)      # 0x9180
movzbl 0x78dd(%rip), %edi      # 0x91cb
leaq 0x4003(%rip), %rsi      # 0x58f8
jmp 0x196b
movq %rbp, %rdi
leaq 0x4016(%rip), %rsi      # 0x5917
movq %r12, %rdx
xorl %ecx, %ecx
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
callq 0x143d
testb %al, %al
je 0x1938
movslq 0x4(%rsp), %rax
imulq $0x3e8, %rax, %rax      # imm = 0x3E8
movq %rax, 0x77d8(%rip)      # 0x9100
movzbl 0x789c(%rip), %edi      # 0x91cb
leaq 0x3fef(%rip), %rsi      # 0x5925
jmp 0x196b
movq %rbp, %rdi
leaq 0x4005(%rip), %rsi      # 0x5947
leaq 0x77bf(%rip), %rdx      # 0x9108
movl $0x1, %ecx
movl $0x64, %r8d
callq 0x143d
testb %al, %al
je 0x1975
movzbl 0x7867(%rip), %edi      # 0x91cb
leaq 0x3fe9(%rip), %rsi      # 0x5954
callq 0x13ec
jmp 0x1682
movq %rbp, %rdi
leaq 0x3ff6(%rip), %rsi      # 0x5975
callq 0x13fa
testb %al, %al
je 0x1994
movb $0x1, 0x783d(%rip)      # 0x91cc
jmp 0x1682
movq %rbp, %rdi
leaq 0x3fda(%rip), %rsi      # 0x5978
callq 0x13fa
testb %al, %al
je 0x19b3
movb $0x1, 0x781f(%rip)      # 0x91cd
jmp 0x1682
movq %rbp, %rdi
leaq 0x3fbe(%rip), %rsi      # 0x597b
callq 0x13fa
testb %al, %al
je 0x19d2
movb $0x1, 0x7801(%rip)      # 0x91ce
jmp 0x1682
movq %rbp, %rdi
leaq 0x3fa9(%rip), %rsi      # 0x5985
callq 0x13fa
testb %al, %al
je 0x19f1
movb $0x1, 0x77e3(%rip)      # 0x91cf
jmp 0x1682
movq %rbp, %rdi
leaq 0x3f96(%rip), %rsi      # 0x5991
callq 0x13fa
testb %al, %al
je 0x1a10
movb $0x1, 0x77c5(%rip)      # 0x91d0
jmp 0x1682
movq %rbp, %rdi
leaq 0x46a1(%rip), %rsi      # 0x60bb
leaq 0x76cb(%rip), %rdx      # 0x90ec
movl $0x1, %ecx
movl $0x10, %r8d
callq 0x143d
testb %al, %al
je 0x1a47
movl 0x76b1(%rip), %esi      # 0x90ec
leaq 0x3f5c(%rip), %rdi      # 0x599e
jmp 0x160b
movq %rbp, %rdi
leaq 0x3ec4(%rip), %rsi      # 0x5915
callq 0x13fa
testb %al, %al
je 0x1a7e
movb $0x1, 0x776a(%rip)      # 0x91cb
jmp 0x1682
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x122b
movq %r14, %rdi
movq %rbx, %rsi
callq 0x11fe