int parsekey(str)
char *str;
{
  char *s;
  char word[30];
  int parsed;
  int gotclef, gotkey, gotoctave, gottranspose;
  int foundmode;
  int transpose, octave;
  char clefstr[30];
  char modestr[30];
  char msg[80];
  char *moveon;
  int sf, minor;
  char modmap[7];
  int modmul[7];
  int i, j;
  static char *key = "FCGDAEB";
  static char *mode[10] = {"maj", "min", "m",   "aeo", "loc",
                           "ion", "dor", "phr", "lyd", "mix"};
  static int modeshift[10] = {0, -3, -3, -3, -5, 0, -2, -4, 1, -1};
  static int modeminor[10] = {0, 1, 1, 1, 0, 0, 0, 0, 0, 0};
  s = str;
  octave = 0;
  transpose = 0;
  gotkey = 0;
  gotclef = 0;
  gotoctave = 0;
  gottranspose = 0;
  for (i = 0; i < 7; i++) {
    modmap[i] = ' ';
    modmul[i] = 1;
  };
  while (*s != '\0') {
    skipspace(&s);
    s = readword(word, s);
    parsed = 0;
    if (casecmp(word, "clef") == 0) {
      skipspace(&s);
      if (*s != '=') {
        event_error("clef must be followed by '='");
      } else {
        s = s + 1;
        skipspace(&s);
        s = readword(clefstr, s);
        if (strlen(clefstr) > 0) {
          gotclef = 1;
        };
      };
      parsed = 1;
    };
    if ((parsed == 0) && (casecmp(word, "transpose") == 0)) {
      skipspace(&s);
      if (*s != '=') {
        event_error("transpose must be followed by '='");
      } else {
        s = s + 1;
        skipspace(&s);
        transpose = readsnump(&s);
        gottranspose = 1;
      };
      parsed = 1;
    };
    if ((parsed == 0) && (casecmp(word, "octave") == 0)) {
      skipspace(&s);
      if (*s != '=') {
        event_error("octave must be followed by '='");
      } else {
        s = s + 1;
        skipspace(&s);
        octave = readsnump(&s);
        gotoctave = 1;
      };
      parsed = 1;
    };
    if ((parsed == 0) && (isclef(word))) {
      gotclef = 1;
      strcpy(clefstr, word);
      parsed = 1;
    };
    if ((parsed == 0) && (casecmp(word, "Hp") == 0)) {
      sf = 2;
      minor = 0;
      gotkey = 1;
      parsed = 1;
    };
    if ((parsed == 0) && ((word[0] >= 'A') && (word[0] <= 'G'))) {
      gotkey = 1;
      parsed = 1;
      sf = (int)strchr(key, word[0]) - (int)&key[0] - 1;
      j = 1;
      if (word[1] == '#') {
        sf += 7;
        j = 2;
      } else {
        if (word[1] == 'b') {
          sf -= 7;
          j = 2;
        };
      }
      minor = 0;
      foundmode = 0;
      if (strlen(word) == j) {
        skipspace(&s);
        moveon = readword(modestr, s);
        lcase(modestr);
        for (i = 0; i < 10; i++) {
          if (strncmp(modestr, mode[i], 3) == 0) {
            foundmode = 1;
            sf = sf + modeshift[i];
            minor = modeminor[i];
          };
        };
        if (foundmode) {
          s = moveon;
        };
      } else {
        strcpy(modestr, &word[j]);
        lcase(modestr);
        for (i = 0; i < 10; i++) {
          if (strncmp(modestr, mode[i], 3) == 0) {
            foundmode = 1;
            sf = sf + modeshift[i];
            minor = modeminor[i];
          };
        };
        if (!foundmode) {
          sprintf(msg, "Unknown mode '%s'", &word[j]);
          event_error(msg);
        };
      };
    };
    if (gotkey) {
      if (sf > 7) {
        event_warning("Unusual key representation");
        sf = sf - 12;
      };
      if (sf < -7) {
        event_warning("Unusual key representation");
        sf = sf + 12;
      };
    };
    if ((word[0] == '^') || (word[0] == '_') || (word[0] == '=')) {
      if ((strlen(word) == 2) && (word[1] >= 'a') && (word[1] <= 'g')) {
        j = (int)word[1] - 'a';
        modmap[j] = word[0];
        modmul[j] = 1;
        parsed = 1;
      } else {
        if ((strlen(word) == 3) && (word[0] != '=') && (word[0] == word[1]) &&
            (word[2] >= 'a') && (word[2] <= 'g')) {
          j = (int)word[2] - 'a';
          modmap[j] = word[0];
          modmul[j] = 2;
          parsed = 1;
        };
      };
    };
    if ((parsed == 0) && (strlen(word) > 0)) {
      sprintf(msg, "Ignoring string '%s' in K: field", word);
      event_warning(msg);
    };
  };
  event_key(sf, str, minor, modmap, modmul, gotkey, gotclef, clefstr, octave,
            transpose, gotoctave, gottranspose);
  return (gotkey);
}


x86 assembly (clang, -O0):
<parsekey>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x168,%rsp
mov    %rdi,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x70(%rbp)
movl   $0x0,-0x6c(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x144(%rbp)
cmpl   $0x7,-0x144(%rbp)
jge    1272 <parsekey+0x92>
movslq -0x144(%rbp),%rax
movb   $0x20,-0x117(%rbp,%rax,1)
20
movslq -0x144(%rbp),%rax
movl   $0x1,-0x140(%rbp,%rax,4)
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    1230 <parsekey+0x50>
jmp    1277 <parsekey+0x97>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     196c <parsekey+0x78c>
lea    -0x28(%rbp),%rdi
mov    $0x0,%al
call   10e0 <skipspace@plt>
lea    -0x50(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1100 <readword@plt>
cltq
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xd71(%rip),%rsi
mov    $0x0,%al
call   1090 <casecmp@plt>
cmp    $0x0,%eax
jne    134f <parsekey+0x16f>
lea    -0x28(%rbp),%rdi
mov    $0x0,%al
call   10e0 <skipspace@plt>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
je     12f7 <parsekey+0x117>
lea    0xd44(%rip),%rdi
mov    $0x0,%al
call   1080 <event_error@plt>
jmp    1348 <parsekey+0x168>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
mov    $0x0,%al
call   10e0 <skipspace@plt>
lea    -0x90(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1100 <readword@plt>
cltq
mov    %rax,-0x28(%rbp)
lea    -0x90(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
jbe    1343 <parsekey+0x163>
movl   $0x1,-0x58(%rbp)
jmp    1348 <parsekey+0x168>
movl   $0x1,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jne    13d5 <parsekey+0x1f5>
lea    -0x50(%rbp),%rdi
lea    0xce8(%rip),%rsi
mov    $0x0,%al
call   1090 <casecmp@plt>
cmp    $0x0,%eax
jne    13d5 <parsekey+0x1f5>
lea    -0x28(%rbp),%rdi
mov    $0x0,%al
call   10e0 <skipspace@plt>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
je     13a2 <parsekey+0x1c2>
lea    0xcc0(%rip),%rdi
mov    $0x0,%al
call   1080 <event_error@plt>
jmp    13ce <parsekey+0x1ee>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
mov    $0x0,%al
call   10e0 <skipspace@plt>
lea    -0x28(%rbp),%rdi
mov    $0x0,%al
call   10d0 <readsnump@plt>
mov    %eax,-0x6c(%rbp)
movl   $0x1,-0x64(%rbp)
movl   $0x1,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jne    145b <parsekey+0x27b>
lea    -0x50(%rbp),%rdi
lea    0xc8e(%rip),%rsi
mov    $0x0,%al
call   1090 <casecmp@plt>
cmp    $0x0,%eax
jne    145b <parsekey+0x27b>
lea    -0x28(%rbp),%rdi
mov    $0x0,%al
call   10e0 <skipspace@plt>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
je     1428 <parsekey+0x248>
lea    0xc63(%rip),%rdi
mov    $0x0,%al
call   1080 <event_error@plt>
jmp    1454 <parsekey+0x274>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
mov    $0x0,%al
call   10e0 <skipspace@plt>
lea    -0x28(%rbp),%rdi
mov    $0x0,%al
call   10d0 <readsnump@plt>
mov    %eax,-0x70(%rbp)
movl   $0x1,-0x60(%rbp)
movl   $0x1,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jne    1497 <parsekey+0x2b7>
lea    -0x50(%rbp),%rdi
mov    $0x0,%al
call   10c0 <isclef@plt>
cmp    $0x0,%eax
je     1497 <parsekey+0x2b7>
movl   $0x1,-0x58(%rbp)
lea    -0x90(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <strcpy@plt>
movl   $0x1,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jne    14de <parsekey+0x2fe>
lea    -0x50(%rbp),%rdi
lea    0xbf2(%rip),%rsi
mov    $0x0,%al
call   1090 <casecmp@plt>
cmp    $0x0,%eax
jne    14de <parsekey+0x2fe>
movl   $0x2,-0x10c(%rbp)
movl   $0x0,-0x110(%rbp)
movl   $0x1,-0x5c(%rbp)
movl   $0x1,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jne    17a5 <parsekey+0x5c5>
movsbl -0x50(%rbp),%eax
cmp    $0x41,%eax
jl     17a5 <parsekey+0x5c5>
movsbl -0x50(%rbp),%eax
cmp    $0x47,%eax
jg     17a5 <parsekey+0x5c5>
movl   $0x1,-0x5c(%rbp)
movl   $0x1,-0x54(%rbp)
mov    0x2b89(%rip),%rdi
movsbl -0x50(%rbp),%esi
call   1060 <strchr@plt>
mov    0x2b79(%rip),%rcx
sub    %ecx,%eax
sub    $0x1,%eax
mov    %eax,-0x10c(%rbp)
movl   $0x1,-0x148(%rbp)
movsbl -0x4f(%rbp),%eax
cmp    $0x23,%eax
jne    1567 <parsekey+0x387>
mov    -0x10c(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x10c(%rbp)
movl   $0x2,-0x148(%rbp)
jmp    1592 <parsekey+0x3b2>
movsbl -0x4f(%rbp),%eax
cmp    $0x62,%eax
jne    158d <parsekey+0x3ad>
mov    -0x10c(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0x10c(%rbp)
movl   $0x2,-0x148(%rbp)
jmp    1592 <parsekey+0x3b2>
movl   $0x0,-0x110(%rbp)
movl   $0x0,-0x68(%rbp)
lea    -0x50(%rbp),%rdi
call   1050 <strlen@plt>
movslq -0x148(%rbp),%rcx
cmp    %rcx,%rax
jne    16a1 <parsekey+0x4c1>
lea    -0x28(%rbp),%rdi
mov    $0x0,%al
call   10e0 <skipspace@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1100 <readword@plt>
cltq
mov    %rax,-0x108(%rbp)
lea    -0xb0(%rbp),%rdi
mov    $0x0,%al
call   10a0 <lcase@plt>
movl   $0x0,-0x144(%rbp)
cmpl   $0xa,-0x144(%rbp)
jge    1687 <parsekey+0x4a7>
lea    -0xb0(%rbp),%rdi
movslq -0x144(%rbp),%rcx
lea    0x2a94(%rip),%rax
mov    (%rax,%rcx,8),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    166e <parsekey+0x48e>
movl   $0x1,-0x68(%rbp)
mov    -0x10c(%rbp),%eax
movslq -0x144(%rbp),%rdx
lea    0x2ab2(%rip),%rcx
add    (%rcx,%rdx,4),%eax
mov    %eax,-0x10c(%rbp)
movslq -0x144(%rbp),%rcx
lea    0x2acb(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x110(%rbp)
jmp    1673 <parsekey+0x493>
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    15fa <parsekey+0x41a>
cmpl   $0x0,-0x68(%rbp)
je     169c <parsekey+0x4bc>
mov    -0x108(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    17a0 <parsekey+0x5c0>
lea    -0xb0(%rbp),%rdi
movslq -0x148(%rbp),%rax
lea    -0x50(%rbp),%rsi
add    %rax,%rsi
call   1040 <strcpy@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x0,%al
call   10a0 <lcase@plt>
movl   $0x0,-0x144(%rbp)
cmpl   $0xa,-0x144(%rbp)
jge    1760 <parsekey+0x580>
lea    -0xb0(%rbp),%rdi
movslq -0x144(%rbp),%rcx
lea    0x29bb(%rip),%rax
mov    (%rax,%rcx,8),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1747 <parsekey+0x567>
movl   $0x1,-0x68(%rbp)
mov    -0x10c(%rbp),%eax
movslq -0x144(%rbp),%rdx
lea    0x29d9(%rip),%rcx
add    (%rcx,%rdx,4),%eax
mov    %eax,-0x10c(%rbp)
movslq -0x144(%rbp),%rcx
lea    0x29f2(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x110(%rbp)
jmp    174c <parsekey+0x56c>
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    16d3 <parsekey+0x4f3>
cmpl   $0x0,-0x68(%rbp)
jne    179b <parsekey+0x5bb>
lea    -0x100(%rbp),%rdi
movslq -0x148(%rbp),%rax
lea    -0x50(%rbp),%rdx
add    %rax,%rdx
lea    0x91b(%rip),%rsi
mov    $0x0,%al
call   10f0 <sprintf@plt>
lea    -0x100(%rbp),%rdi
mov    $0x0,%al
call   1080 <event_error@plt>
jmp    17a0 <parsekey+0x5c0>
jmp    17a5 <parsekey+0x5c5>
cmpl   $0x0,-0x5c(%rbp)
je     1808 <parsekey+0x628>
cmpl   $0x7,-0x10c(%rbp)
jle    17d9 <parsekey+0x5f9>
lea    0x8f0(%rip),%rdi
mov    $0x0,%al
call   1070 <event_warning@plt>
mov    -0x10c(%rbp),%eax
sub    $0xc,%eax
mov    %eax,-0x10c(%rbp)
cmpl   $0xfffffff9,-0x10c(%rbp)
jge    1803 <parsekey+0x623>
lea    0x8c6(%rip),%rdi
mov    $0x0,%al
call   1070 <event_warning@plt>
mov    -0x10c(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x10c(%rbp)
jmp    1808 <parsekey+0x628>
movsbl -0x50(%rbp),%eax
cmp    $0x5e,%eax
je     182f <parsekey+0x64f>
movsbl -0x50(%rbp),%eax
cmp    $0x5f,%eax
je     182f <parsekey+0x64f>
movsbl -0x50(%rbp),%eax
cmp    $0x3d,%eax
jne    1923 <parsekey+0x743>
lea    -0x50(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x2,%rax
jne    1898 <parsekey+0x6b8>
movsbl -0x4f(%rbp),%eax
cmp    $0x61,%eax
jl     1898 <parsekey+0x6b8>
movsbl -0x4f(%rbp),%eax
cmp    $0x67,%eax
jg     1898 <parsekey+0x6b8>
movsbl -0x4f(%rbp),%eax
sub    $0x61,%eax
mov    %eax,-0x148(%rbp)
mov    -0x50(%rbp),%cl
movslq -0x148(%rbp),%rax
mov    %cl,-0x117(%rbp,%rax,1)
movslq -0x148(%rbp),%rax
movl   $0x1,-0x140(%rbp,%rax,4)
movl   $0x1,-0x54(%rbp)
jmp    191e <parsekey+0x73e>
lea    -0x50(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x3,%rax
jne    1919 <parsekey+0x739>
movsbl -0x50(%rbp),%eax
cmp    $0x3d,%eax
je     1919 <parsekey+0x739>
movsbl -0x50(%rbp),%eax
movsbl -0x4f(%rbp),%ecx
cmp    %ecx,%eax
jne    1919 <parsekey+0x739>
movsbl -0x4e(%rbp),%eax
cmp    $0x61,%eax
jl     1919 <parsekey+0x739>
movsbl -0x4e(%rbp),%eax
cmp    $0x67,%eax
jg     1919 <parsekey+0x739>
movsbl -0x4e(%rbp),%eax
sub    $0x61,%eax
mov    %eax,-0x148(%rbp)
mov    -0x50(%rbp),%cl
movslq -0x148(%rbp),%rax
mov    %cl,-0x117(%rbp,%rax,1)
movslq -0x148(%rbp),%rax
movl   $0x2,-0x140(%rbp,%rax,4)
movl   $0x1,-0x54(%rbp)
jmp    191e <parsekey+0x73e>
jmp    1923 <parsekey+0x743>
cmpl   $0x0,-0x54(%rbp)
jne    1967 <parsekey+0x787>
lea    -0x50(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
jbe    1967 <parsekey+0x787>
lea    -0x100(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    0x77c(%rip),%rsi
mov    $0x0,%al
call   10f0 <sprintf@plt>
lea    -0x100(%rbp),%rdi
mov    $0x0,%al
call   1070 <event_warning@plt>
jmp    1277 <parsekey+0x97>
mov    -0x10c(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x110(%rbp),%edx
lea    -0x117(%rbp),%rcx
lea    -0x140(%rbp),%r8
mov    -0x5c(%rbp),%r9d
mov    -0x58(%rbp),%r15d
lea    -0x90(%rbp),%r14
mov    -0x70(%rbp),%ebx
mov    -0x6c(%rbp),%r11d
mov    -0x60(%rbp),%r10d
mov    -0x64(%rbp),%eax
mov    %r15d,(%rsp)
mov    %r14,0x8(%rsp)
mov    %ebx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10d,0x20(%rsp)
mov    %eax,0x28(%rsp)
mov    $0x0,%al
call   10b0 <event_key@plt>
mov    -0x5c(%rbp),%eax
add    $0x168,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<parsekey>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %rdi,0x78(%rsp)
mov    %rdi,0x8(%rsp)
movl   $0x20202020,0x20(%rsp)
20
movl   $0x20202020,0x23(%rsp)
20
movaps 0xdee(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movabs $0x100000001,%rax
mov    %rax,0x90(%rsp)
movl   $0x1,0x98(%rsp)
lea    0x8(%rsp),%r12
lea    0x30(%rsp),%rbp
xor    %eax,%eax
mov    %rax,0x58(%rsp)
xor    %eax,%eax
mov    %rax,0x68(%rsp)
xor    %eax,%eax
mov    %rax,0x60(%rsp)
xor    %eax,%eax
mov    %rax,0x50(%rsp)
movl   $0x0,0x10(%rsp)
xor    %eax,%eax
mov    %rax,0x28(%rsp)
jmp    1295 <parsekey+0xb5>
xchg   %ax,%ax
mov    $0xffffff9f,%eax
add    %eax,%ecx
mov    %r14b,0x20(%rsp,%rcx,1)
movl   $0x1,0x80(%rsp,%rcx,4)
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
je     1820 <parsekey+0x640>
mov    %r12,%rdi
xor    %eax,%eax
call   10e0 <skipspace@plt>
mov    0x8(%rsp),%rsi
mov    %rbp,%rdi
xor    %eax,%eax
call   1100 <readword@plt>
cltq
mov    %rax,0x8(%rsp)
mov    %rbp,%rdi
lea    0xd7b(%rip),%rsi
xor    %eax,%eax
call   1080 <casecmp@plt>
test   %eax,%eax
je     1330 <parsekey+0x150>
mov    %rbp,%rdi
lea    0xd88(%rip),%rsi
xor    %eax,%eax
call   1080 <casecmp@plt>
test   %eax,%eax
je     13a0 <parsekey+0x1c0>
mov    %rbp,%rdi
lea    0xd9b(%rip),%rsi
xor    %eax,%eax
call   1080 <casecmp@plt>
test   %eax,%eax
je     13f5 <parsekey+0x215>
mov    %rbp,%rdi
xor    %eax,%eax
call   10c0 <isclef@plt>
test   %eax,%eax
je     1447 <parsekey+0x267>
lea    0xc0(%rsp),%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    $0x1,%eax
mov    %rax,0x28(%rsp)
jmp    14b7 <parsekey+0x2d7>
nopl   (%rax)
mov    %r12,%rdi
xor    %eax,%eax
call   10e0 <skipspace@plt>
mov    0x8(%rsp),%rax
cmpb   $0x3d,(%rax)
jne    13e9 <parsekey+0x209>
add    $0x1,%rax
mov    %rax,0x8(%rsp)
mov    %r12,%rdi
xor    %eax,%eax
call   10e0 <skipspace@plt>
mov    0x8(%rsp),%rsi
lea    0xc0(%rsp),%rdi
xor    %eax,%eax
call   1100 <readword@plt>
cltq
cmpb   $0x0,0xc0(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x1,%r13d
mov    0x28(%rsp),%rax
cmovne %r13d,%eax
mov    %rax,0x28(%rsp)
jmp    14bd <parsekey+0x2dd>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
xor    %eax,%eax
call   10e0 <skipspace@plt>
mov    0x8(%rsp),%rax
cmpb   $0x3d,(%rax)
jne    143e <parsekey+0x25e>
add    $0x1,%rax
mov    %rax,0x8(%rsp)
mov    %r12,%rdi
xor    %eax,%eax
call   10e0 <skipspace@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   10d0 <readsnump@plt>
mov    %rax,0x68(%rsp)
mov    $0x1,%eax
mov    %rax,0x60(%rsp)
jmp    14b7 <parsekey+0x2d7>
lea    0xc4f(%rip),%rdi
jmp    14b0 <parsekey+0x2d0>
mov    %r12,%rdi
xor    %eax,%eax
call   10e0 <skipspace@plt>
mov    0x8(%rsp),%rax
cmpb   $0x3d,(%rax)
jne    14a6 <parsekey+0x2c6>
add    $0x1,%rax
mov    %rax,0x8(%rsp)
mov    %r12,%rdi
xor    %eax,%eax
call   10e0 <skipspace@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   10d0 <readsnump@plt>
mov    %rax,0x58(%rsp)
mov    $0x1,%eax
mov    %rax,0x50(%rsp)
jmp    14b7 <parsekey+0x2d7>
lea    0xc21(%rip),%rdi
jmp    14b0 <parsekey+0x2d0>
mov    %rbp,%rdi
lea    0xc5d(%rip),%rsi
xor    %eax,%eax
call   1080 <casecmp@plt>
test   %eax,%eax
je     15d4 <parsekey+0x3f4>
movzbl 0x30(%rsp),%esi
lea    -0x41(%rsi),%eax
xor    %r13d,%r13d
cmp    $0x6,%al
ja     14bd <parsekey+0x2dd>
mov    $0x8,%edx
lea    0xb95(%rip),%rbx
mov    %rbx,%rdi
call   1090 <memchr@plt>
mov    0x31(%rsp),%cl
cmp    $0x23,%cl
jne    15f5 <parsekey+0x415>
mov    %ebx,%ecx
not    %ecx
lea    (%rcx,%rax,1),%r15d
add    $0x7,%r15d
mov    $0x2,%ebp
jmp    1611 <parsekey+0x431>
lea    0xbe2(%rip),%rdi
nopl   (%rax)
xor    %eax,%eax
call   1070 <event_error@plt>
mov    $0x1,%r13d
cmpl   $0x0,0x10(%rsp)
je     1500 <parsekey+0x320>
mov    $0xfffffff4,%ebp
cmp    $0x7,%r15d
jg     14da <parsekey+0x2fa>
mov    $0xc,%ebp
cmp    $0xfffffff8,%r15d
jg     14eb <parsekey+0x30b>
lea    0xbe2(%rip),%rdi
xor    %eax,%eax
call   1060 <event_warning@plt>
add    %ebp,%r15d
lea    0x30(%rsp),%rbp
jmp    1508 <parsekey+0x328>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movl   $0x0,0x10(%rsp)
mov    0x30(%rsp),%r14b
lea    -0x3d(%r14),%eax
cmp    $0x22,%al
ja     1590 <parsekey+0x3b0>
movzbl %al,%eax
movabs $0x600000001,%rcx
bt     %rax,%rcx
jae    1590 <parsekey+0x3b0>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    0x31(%rsp),%dl
movzbl %dl,%ecx
cmp    $0x2,%rax
jne    154b <parsekey+0x36b>
cmp    $0x61,%dl
jl     154b <parsekey+0x36b>
cmp    $0x67,%dl
jle    1270 <parsekey+0x90>
cmp    $0x3,%rax
jne    1590 <parsekey+0x3b0>
cmp    $0x3d,%r14b
je     1590 <parsekey+0x3b0>
cmp    %cl,%r14b
jne    1590 <parsekey+0x3b0>
mov    0x32(%rsp),%al
cmp    $0x61,%al
jl     1590 <parsekey+0x3b0>
cmp    $0x67,%al
jg     1590 <parsekey+0x3b0>
movzbl %al,%eax
mov    $0xffffff9f,%ecx
add    %ecx,%eax
mov    %r14b,0x20(%rsp,%rax,1)
movl   $0x2,0x80(%rsp,%rax,4)
jmp    1287 <parsekey+0xa7>
nopw   0x0(%rax,%rax,1)
test   %r13d,%r13d
jne    1287 <parsekey+0xa7>
test   %r14b,%r14b
je     1287 <parsekey+0xa7>
lea    0xe0(%rsp),%rbx
mov    %rbx,%rdi
lea    0xb2a(%rip),%rsi
lea    0x30(%rsp),%rdx
xor    %eax,%eax
call   10f0 <sprintf@plt>
mov    %rbx,%rdi
lea    0x30(%rsp),%rbp
xor    %eax,%eax
call   1060 <event_warning@plt>
jmp    1287 <parsekey+0xa7>
mov    $0x2,%r15d
mov    $0x1,%r13d
movl   $0x0,0x1c(%rsp)
movl   $0x1,0x10(%rsp)
jmp    1508 <parsekey+0x328>
mov    %ebx,%edx
not    %edx
lea    -0x7(%rdx),%r15d
xor    %ebp,%ebp
cmp    $0x62,%cl
sete   %bpl
cmovne %edx,%r15d
add    %eax,%r15d
add    $0x1,%rbp
lea    0x30(%rsp),%rdi
call   1050 <strlen@plt>
cmp    %rbp,%rax
jne    16fe <parsekey+0x51e>
xor    %r13d,%r13d
mov    %r12,%rdi
xor    %eax,%eax
call   10e0 <skipspace@plt>
mov    0x8(%rsp),%rsi
lea    0xa0(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1100 <readword@plt>
cltq
mov    %rax,0x10(%rsp)
mov    %rbx,%rdi
xor    %eax,%eax
call   10a0 <lcase@plt>
mov    $0x1,%r14b
movl   $0x0,0x1c(%rsp)
lea    0x2765(%rip),%rax
lea    (%rax,%r13,8),%rbp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp,%rbx,8),%rsi
mov    $0x3,%edx
lea    0xa0(%rsp),%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     16c0 <parsekey+0x4e0>
lea    (%rbx,%r13,1),%rax
add    $0x1,%rax
add    $0x1,%rbx
cmp    $0xa,%rax
jne    1680 <parsekey+0x4a0>
jmp    17c0 <parsekey+0x5e0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xa39(%rip),%rax
lea    (%rax,%r13,4),%rax
add    (%rax,%rbx,4),%r15d
lea    0xa5a(%rip),%rax
lea    (%rax,%r13,4),%rax
mov    (%rax,%rbx,4),%eax
mov    %eax,0x1c(%rsp)
lea    (%rbx,%r13,1),%rax
add    %rbx,%r13
add    $0x1,%r13
xor    %r14d,%r14d
cmp    $0x9,%rax
jne    1664 <parsekey+0x484>
jmp    17cc <parsekey+0x5ec>
lea    (%rsp,%rbp,1),%rsi
add    $0x30,%rsi
lea    0xa0(%rsp),%rbx
mov    %rbx,%rdi
mov    %rsi,0x70(%rsp)
call   1040 <strcpy@plt>
xor    %r14d,%r14d
mov    %rbx,%rdi
xor    %eax,%eax
call   10a0 <lcase@plt>
mov    $0x1,%cl
movl   $0x0,0x1c(%rsp)
mov    %ecx,0x10(%rsp)
lea    0x2693(%rip),%rax
lea    (%rax,%r14,8),%rbp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%rbp,%rbx,8),%rsi
mov    $0x3,%edx
lea    0xa0(%rsp),%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     1780 <parsekey+0x5a0>
lea    (%r14,%rbx,1),%rax
add    $0x1,%rax
add    $0x1,%rbx
cmp    $0xa,%rax
jne    1750 <parsekey+0x570>
jmp    17de <parsekey+0x5fe>
nop
lea    0x979(%rip),%rax
lea    (%rax,%r14,4),%rax
add    (%rax,%rbx,4),%r15d
lea    0x99a(%rip),%rax
lea    (%rax,%r14,4),%rax
mov    (%rax,%rbx,4),%eax
mov    %eax,0x1c(%rsp)
lea    (%r14,%rbx,1),%rax
add    %rbx,%r14
add    $0x1,%r14
mov    $0x1,%r13d
xor    %ecx,%ecx
cmp    $0x9,%rax
jne    1732 <parsekey+0x552>
jmp    1813 <parsekey+0x633>
mov    $0x1,%r13d
test   $0x1,%r14b
jne    1813 <parsekey+0x633>
mov    0x10(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    $0x1,%r13d
jmp    1813 <parsekey+0x633>
mov    $0x1,%r13d
testb  $0x1,0x10(%rsp)
je     1813 <parsekey+0x633>
lea    0xe0(%rsp),%rbx
mov    %rbx,%rdi
lea    0x8b4(%rip),%rsi
mov    0x70(%rsp),%rdx
xor    %eax,%eax
call   10f0 <sprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <event_error@plt>
movl   $0x1,0x10(%rsp)
jmp    14c4 <parsekey+0x2e4>
lea    0x20(%rsp),%rcx
lea    0x80(%rsp),%r8
mov    %r15d,%edi
mov    0x78(%rsp),%rsi
mov    0x1c(%rsp),%edx
mov    0x10(%rsp),%ebx
mov    %ebx,%r9d
xor    %eax,%eax
push   0x60(%rsp)
push   0x58(%rsp)
push   0x78(%rsp)
push   0x70(%rsp)
lea    0xe0(%rsp),%rbp
push   %rbp
push   0x50(%rsp)
call   10b0 <event_key@plt>
add    $0x30,%rsp
mov    %ebx,%eax
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@parsekey.key = internal global i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0)
@.str = [8 x i8] c"FCGDAEB\00"
@parsekey.mode = internal global [10 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0)]
@.str.1 = [4 x i8] c"maj\00"
@.str.2 = [4 x i8] c"min\00"
@.str.3 = [2 x i8] c"m\00"
@.str.4 = [4 x i8] c"aeo\00"
@.str.5 = [4 x i8] c"loc\00"
@.str.6 = [4 x i8] c"ion\00"
@.str.7 = [4 x i8] c"dor\00"
@.str.8 = [4 x i8] c"phr\00"
@.str.9 = [4 x i8] c"lyd\00"
@.str.10 = [4 x i8] c"mix\00"
@parsekey.modeshift = internal global [10 x i32] [i32 0, i32 -3, i32 -3, i32 -3, i32 -5, i32 0, i32 -2, i32 -4, i32 1, i32 -1]
@parsekey.modeminor = internal global [10 x i32] [i32 0, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0]
@.str.11 = [5 x i8] c"clef\00"
@.str.12 = [29 x i8] c"clef must be followed by '='\00"
@.str.13 = [10 x i8] c"transpose\00"
@.str.14 = [34 x i8] c"transpose must be followed by '='\00"
@.str.15 = [7 x i8] c"octave\00"
@.str.16 = [31 x i8] c"octave must be followed by '='\00"
@.str.17 = [3 x i8] c"Hp\00"
@.str.18 = [18 x i8] c"Unknown mode '%s'\00"
@.str.19 = [27 x i8] c"Unusual key representation\00"
@.str.20 = [33 x i8] c"Ignoring string '%s' in K: field\00"
define i32 @parsekey(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [30 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [30 x i8]
%14 = alloca [30 x i8]
%15 = alloca [80 x i8]
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i32
%19 = alloca [7 x i8]
%20 = alloca [7 x i32]
%21 = alloca i32
%22 = alloca i32
store i8* %0, i8** %2
%23 = load i8*, i8** %2
store i8* %23, i8** %3
store i32 0, i32* %12
store i32 0, i32* %11
store i32 0, i32* %7
store i32 0, i32* %6
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %21
br label %24
24: ; preds = %34, %1
%25 = load i32, i32* %21
%26 = icmp slt i32 %25, 7
br i1 %26, label %27, label %37
27: ; preds = %24
%28 = load i32, i32* %21
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [7 x i8], [7 x i8]* %19, i64 0, i64 %29
store i8 32, i8* %30
%31 = load i32, i32* %21
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [7 x i32], [7 x i32]* %20, i64 0, i64 %32
store i32 1, i32* %33
br label %34
34: ; preds = %27
%35 = load i32, i32* %21
%36 = add nsw i32 %35, 1
store i32 %36, i32* %21
br label %24
37: ; preds = %24
br label %38
38: ; preds = %387, %37
%39 = load i8*, i8** %3
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %388
43: ; preds = %38
%44 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %3)
%45 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%46 = load i8*, i8** %3
%47 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @readword to i32 (i8*, i8*, ...)*)(i8* %45, i8* %46)
%48 = sext i32 %47 to i64
%49 = inttoptr i64 %48 to i8*
store i8* %49, i8** %3
store i32 0, i32* %5
%50 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%51 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @casecmp to i32 (i8*, i8*, ...)*)(i8* %50, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %76
53: ; preds = %43
%54 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %3)
%55 = load i8*, i8** %3
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp ne i32 %57, 61
br i1 %58, label %59, label %61
59: ; preds = %53
%60 = call i32 (i8*, ...) bitcast (i32 (...)* @event_error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0))
br label %75
61: ; preds = %53
%62 = load i8*, i8** %3
%63 = getelementptr inbounds i8, i8* %62, i64 1
store i8* %63, i8** %3
%64 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %3)
%65 = getelementptr inbounds [30 x i8], [30 x i8]* %13, i64 0, i64 0
%66 = load i8*, i8** %3
%67 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @readword to i32 (i8*, i8*, ...)*)(i8* %65, i8* %66)
%68 = sext i32 %67 to i64
%69 = inttoptr i64 %68 to i8*
store i8* %69, i8** %3
%70 = getelementptr inbounds [30 x i8], [30 x i8]* %13, i64 0, i64 0
%71 = call i64 @strlen(i8* %70)
%72 = icmp ugt i64 %71, 0
br i1 %72, label %73, label %74
73: ; preds = %61
store i32 1, i32* %6
br label %74
74: ; preds = %73, %61
br label %75
75: ; preds = %74, %59
store i32 1, i32* %5
br label %76
76: ; preds = %75, %43
%77 = load i32, i32* %5
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %97
79: ; preds = %76
%80 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%81 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @casecmp to i32 (i8*, i8*, ...)*)(i8* %80, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %97
83: ; preds = %79
%84 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %3)
%85 = load i8*, i8** %3
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = icmp ne i32 %87, 61
br i1 %88, label %89, label %91
89: ; preds = %83
%90 = call i32 (i8*, ...) bitcast (i32 (...)* @event_error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.14, i64 0, i64 0))
br label %96
91: ; preds = %83
%92 = load i8*, i8** %3
%93 = getelementptr inbounds i8, i8* %92, i64 1
store i8* %93, i8** %3
%94 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %3)
%95 = call i32 (i8**, ...) bitcast (i32 (...)* @readsnump to i32 (i8**, ...)*)(i8** %3)
store i32 %95, i32* %11
store i32 1, i32* %9
br label %96
96: ; preds = %91, %89
store i32 1, i32* %5
br label %97
97: ; preds = %96, %79, %76
%98 = load i32, i32* %5
%99 = icmp eq i32 %98, 0
br i1 %99, label %100, label %118
100: ; preds = %97
%101 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%102 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @casecmp to i32 (i8*, i8*, ...)*)(i8* %101, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
%103 = icmp eq i32 %102, 0
br i1 %103, label %104, label %118
104: ; preds = %100
%105 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %3)
%106 = load i8*, i8** %3
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = icmp ne i32 %108, 61
br i1 %109, label %110, label %112
110: ; preds = %104
%111 = call i32 (i8*, ...) bitcast (i32 (...)* @event_error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.16, i64 0, i64 0))
br label %117
112: ; preds = %104
%113 = load i8*, i8** %3
%114 = getelementptr inbounds i8, i8* %113, i64 1
store i8* %114, i8** %3
%115 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %3)
%116 = call i32 (i8**, ...) bitcast (i32 (...)* @readsnump to i32 (i8**, ...)*)(i8** %3)
store i32 %116, i32* %12
store i32 1, i32* %8
br label %117
117: ; preds = %112, %110
store i32 1, i32* %5
br label %118
118: ; preds = %117, %100, %97
%119 = load i32, i32* %5
%120 = icmp eq i32 %119, 0
br i1 %120, label %121, label %129
121: ; preds = %118
%122 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%123 = call i32 (i8*, ...) bitcast (i32 (...)* @isclef to i32 (i8*, ...)*)(i8* %122)
%124 = icmp ne i32 %123, 0
br i1 %124, label %125, label %129
125: ; preds = %121
store i32 1, i32* %6
%126 = getelementptr inbounds [30 x i8], [30 x i8]* %13, i64 0, i64 0
%127 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%128 = call i8* @strcpy(i8* %126, i8* %127)
store i32 1, i32* %5
br label %129
129: ; preds = %125, %121, %118
%130 = load i32, i32* %5
%131 = icmp eq i32 %130, 0
br i1 %131, label %132, label %137
132: ; preds = %129
%133 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%134 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @casecmp to i32 (i8*, i8*, ...)*)(i8* %133, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0))
%135 = icmp eq i32 %134, 0
br i1 %135, label %136, label %137
136: ; preds = %132
store i32 2, i32* %17
store i32 0, i32* %18
store i32 1, i32* %7
store i32 1, i32* %5
br label %137
137: ; preds = %136, %132, %129
%138 = load i32, i32* %5
%139 = icmp eq i32 %138, 0
br i1 %139, label %140, label %272
140: ; preds = %137
%141 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%142 = load i8, i8* %141
%143 = sext i8 %142 to i32
%144 = icmp sge i32 %143, 65
br i1 %144, label %145, label %272
145: ; preds = %140
%146 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%147 = load i8, i8* %146
%148 = sext i8 %147 to i32
%149 = icmp sle i32 %148, 71
br i1 %149, label %150, label %272
150: ; preds = %145
store i32 1, i32* %7
store i32 1, i32* %5
%151 = load i8*, i8** @parsekey.key
%152 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%153 = load i8, i8* %152
%154 = sext i8 %153 to i32
%155 = call i8* @strchr(i8* %151, i32 %154)
%156 = ptrtoint i8* %155 to i32
%157 = load i8*, i8** @parsekey.key
%158 = getelementptr inbounds i8, i8* %157, i64 0
%159 = ptrtoint i8* %158 to i32
%160 = sub nsw i32 %156, %159
%161 = sub nsw i32 %160, 1
store i32 %161, i32* %17
store i32 1, i32* %22
%162 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 1
%163 = load i8, i8* %162
%164 = sext i8 %163 to i32
%165 = icmp eq i32 %164, 35
br i1 %165, label %166, label %169
166: ; preds = %150
%167 = load i32, i32* %17
%168 = add nsw i32 %167, 7
store i32 %168, i32* %17
store i32 2, i32* %22
br label %178
169: ; preds = %150
%170 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 1
%171 = load i8, i8* %170
%172 = sext i8 %171 to i32
%173 = icmp eq i32 %172, 98
br i1 %173, label %174, label %177
174: ; preds = %169
%175 = load i32, i32* %17
%176 = sub nsw i32 %175, 7
store i32 %176, i32* %17
store i32 2, i32* %22
br label %177
177: ; preds = %174, %169
br label %178
178: ; preds = %177, %166
store i32 0, i32* %18
store i32 0, i32* %10
%179 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%180 = call i64 @strlen(i8* %179)
%181 = load i32, i32* %22
%182 = sext i32 %181 to i64
%183 = icmp eq i64 %180, %182
br i1 %183, label %184, label %225
184: ; preds = %178
%185 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %3)
%186 = getelementptr inbounds [30 x i8], [30 x i8]* %14, i64 0, i64 0
%187 = load i8*, i8** %3
%188 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @readword to i32 (i8*, i8*, ...)*)(i8* %186, i8* %187)
%189 = sext i32 %188 to i64
%190 = inttoptr i64 %189 to i8*
store i8* %190, i8** %16
%191 = getelementptr inbounds [30 x i8], [30 x i8]* %14, i64 0, i64 0
%192 = call i32 (i8*, ...) bitcast (i32 (...)* @lcase to i32 (i8*, ...)*)(i8* %191)
store i32 0, i32* %21
br label %193
193: ; preds = %216, %184
%194 = load i32, i32* %21
%195 = icmp slt i32 %194, 10
br i1 %195, label %196, label %219
196: ; preds = %193
%197 = getelementptr inbounds [30 x i8], [30 x i8]* %14, i64 0, i64 0
%198 = load i32, i32* %21
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds [10 x i8*], [10 x i8*]* @parsekey.mode, i64 0, i64 %199
%201 = load i8*, i8** %200
%202 = call i32 @strncmp(i8* %197, i8* %201, i64 3)
%203 = icmp eq i32 %202, 0
br i1 %203, label %204, label %215
204: ; preds = %196
store i32 1, i32* %10
%205 = load i32, i32* %17
%206 = load i32, i32* %21
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds [10 x i32], [10 x i32]* @parsekey.modeshift, i64 0, i64 %207
%209 = load i32, i32* %208
%210 = add nsw i32 %205, %209
store i32 %210, i32* %17
%211 = load i32, i32* %21
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds [10 x i32], [10 x i32]* @parsekey.modeminor, i64 0, i64 %212
%214 = load i32, i32* %213
store i32 %214, i32* %18
br label %215
215: ; preds = %204, %196
br label %216
216: ; preds = %215
%217 = load i32, i32* %21
%218 = add nsw i32 %217, 1
store i32 %218, i32* %21
br label %193
219: ; preds = %193
%220 = load i32, i32* %10
%221 = icmp ne i32 %220, 0
br i1 %221, label %222, label %224
222: ; preds = %219
%223 = load i8*, i8** %16
store i8* %223, i8** %3
br label %224
224: ; preds = %222, %219
br label %271
225: ; preds = %178
%226 = getelementptr inbounds [30 x i8], [30 x i8]* %14, i64 0, i64 0
%227 = load i32, i32* %22
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 %228
%230 = call i8* @strcpy(i8* %226, i8* %229)
%231 = getelementptr inbounds [30 x i8], [30 x i8]* %14, i64 0, i64 0
%232 = call i32 (i8*, ...) bitcast (i32 (...)* @lcase to i32 (i8*, ...)*)(i8* %231)
store i32 0, i32* %21
br label %233
233: ; preds = %256, %225
%234 = load i32, i32* %21
%235 = icmp slt i32 %234, 10
br i1 %235, label %236, label %259
236: ; preds = %233
%237 = getelementptr inbounds [30 x i8], [30 x i8]* %14, i64 0, i64 0
%238 = load i32, i32* %21
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds [10 x i8*], [10 x i8*]* @parsekey.mode, i64 0, i64 %239
%241 = load i8*, i8** %240
%242 = call i32 @strncmp(i8* %237, i8* %241, i64 3)
%243 = icmp eq i32 %242, 0
br i1 %243, label %244, label %255
244: ; preds = %236
store i32 1, i32* %10
%245 = load i32, i32* %17
%246 = load i32, i32* %21
%247 = sext i32 %246 to i64
%248 = getelementptr inbounds [10 x i32], [10 x i32]* @parsekey.modeshift, i64 0, i64 %247
%249 = load i32, i32* %248
%250 = add nsw i32 %245, %249
store i32 %250, i32* %17
%251 = load i32, i32* %21
%252 = sext i32 %251 to i64
%253 = getelementptr inbounds [10 x i32], [10 x i32]* @parsekey.modeminor, i64 0, i64 %252
%254 = load i32, i32* %253
store i32 %254, i32* %18
br label %255
255: ; preds = %244, %236
br label %256
256: ; preds = %255
%257 = load i32, i32* %21
%258 = add nsw i32 %257, 1
store i32 %258, i32* %21
br label %233
259: ; preds = %233
%260 = load i32, i32* %10
%261 = icmp ne i32 %260, 0
br i1 %261, label %270, label %262
262: ; preds = %259
%263 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%264 = load i32, i32* %22
%265 = sext i32 %264 to i64
%266 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 %265
%267 = call i32 (i8*, i8*, ...) @sprintf(i8* %263, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), i8* %266)
%268 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%269 = call i32 (i8*, ...) bitcast (i32 (...)* @event_error to i32 (i8*, ...)*)(i8* %268)
br label %270
270: ; preds = %262, %259
br label %271
271: ; preds = %270, %224
br label %272
272: ; preds = %271, %145, %140, %137
%273 = load i32, i32* %7
%274 = icmp ne i32 %273, 0
br i1 %274, label %275, label %290
275: ; preds = %272
%276 = load i32, i32* %17
%277 = icmp sgt i32 %276, 7
br i1 %277, label %278, label %282
278: ; preds = %275
%279 = call i32 (i8*, ...) bitcast (i32 (...)* @event_warning to i32 (i8*, ...)*)(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, i64 0, i64 0))
%280 = load i32, i32* %17
%281 = sub nsw i32 %280, 12
store i32 %281, i32* %17
br label %282
282: ; preds = %278, %275
%283 = load i32, i32* %17
%284 = icmp slt i32 %283, -7
br i1 %284, label %285, label %289
285: ; preds = %282
%286 = call i32 (i8*, ...) bitcast (i32 (...)* @event_warning to i32 (i8*, ...)*)(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, i64 0, i64 0))
%287 = load i32, i32* %17
%288 = add nsw i32 %287, 12
store i32 %288, i32* %17
br label %289
289: ; preds = %285, %282
br label %290
290: ; preds = %289, %272
%291 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%292 = load i8, i8* %291
%293 = sext i8 %292 to i32
%294 = icmp eq i32 %293, 94
br i1 %294, label %305, label %295
295: ; preds = %290
%296 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%297 = load i8, i8* %296
%298 = sext i8 %297 to i32
%299 = icmp eq i32 %298, 95
br i1 %299, label %305, label %300
300: ; preds = %295
%301 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%302 = load i8, i8* %301
%303 = sext i8 %302 to i32
%304 = icmp eq i32 %303, 61
br i1 %304, label %305, label %374
305: ; preds = %300, %295, %290
%306 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%307 = call i64 @strlen(i8* %306)
%308 = icmp eq i64 %307, 2
br i1 %308, label %309, label %332
309: ; preds = %305
%310 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 1
%311 = load i8, i8* %310
%312 = sext i8 %311 to i32
%313 = icmp sge i32 %312, 97
br i1 %313, label %314, label %332
314: ; preds = %309
%315 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 1
%316 = load i8, i8* %315
%317 = sext i8 %316 to i32
%318 = icmp sle i32 %317, 103
br i1 %318, label %319, label %332
319: ; preds = %314
%320 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 1
%321 = load i8, i8* %320
%322 = sext i8 %321 to i32
%323 = sub nsw i32 %322, 97
store i32 %323, i32* %22
%324 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%325 = load i8, i8* %324
%326 = load i32, i32* %22
%327 = sext i32 %326 to i64
%328 = getelementptr inbounds [7 x i8], [7 x i8]* %19, i64 0, i64 %327
store i8 %325, i8* %328
%329 = load i32, i32* %22
%330 = sext i32 %329 to i64
%331 = getelementptr inbounds [7 x i32], [7 x i32]* %20, i64 0, i64 %330
store i32 1, i32* %331
store i32 1, i32* %5
br label %373
332: ; preds = %314, %309, %305
%333 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%334 = call i64 @strlen(i8* %333)
%335 = icmp eq i64 %334, 3
br i1 %335, label %336, label %372
336: ; preds = %332
%337 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%338 = load i8, i8* %337
%339 = sext i8 %338 to i32
%340 = icmp ne i32 %339, 61
br i1 %340, label %341, label %372
341: ; preds = %336
%342 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%343 = load i8, i8* %342
%344 = sext i8 %343 to i32
%345 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 1
%346 = load i8, i8* %345
%347 = sext i8 %346 to i32
%348 = icmp eq i32 %344, %347
br i1 %348, label %349, label %372
349: ; preds = %341
%350 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 2
%351 = load i8, i8* %350
%352 = sext i8 %351 to i32
%353 = icmp sge i32 %352, 97
br i1 %353, label %354, label %372
354: ; preds = %349
%355 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 2
%356 = load i8, i8* %355
%357 = sext i8 %356 to i32
%358 = icmp sle i32 %357, 103
br i1 %358, label %359, label %372
359: ; preds = %354
%360 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 2
%361 = load i8, i8* %360
%362 = sext i8 %361 to i32
%363 = sub nsw i32 %362, 97
store i32 %363, i32* %22
%364 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%365 = load i8, i8* %364
%366 = load i32, i32* %22
%367 = sext i32 %366 to i64
%368 = getelementptr inbounds [7 x i8], [7 x i8]* %19, i64 0, i64 %367
store i8 %365, i8* %368
%369 = load i32, i32* %22
%370 = sext i32 %369 to i64
%371 = getelementptr inbounds [7 x i32], [7 x i32]* %20, i64 0, i64 %370
store i32 2, i32* %371
store i32 1, i32* %5
br label %372
372: ; preds = %359, %354, %349, %341, %336, %332
br label %373
373: ; preds = %372, %319
br label %374
374: ; preds = %373, %300
%375 = load i32, i32* %5
%376 = icmp eq i32 %375, 0
br i1 %376, label %377, label %387
377: ; preds = %374
%378 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%379 = call i64 @strlen(i8* %378)
%380 = icmp ugt i64 %379, 0
br i1 %380, label %381, label %387
381: ; preds = %377
%382 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%383 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%384 = call i32 (i8*, i8*, ...) @sprintf(i8* %382, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.20, i64 0, i64 0), i8* %383)
%385 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%386 = call i32 (i8*, ...) bitcast (i32 (...)* @event_warning to i32 (i8*, ...)*)(i8* %385)
br label %387
387: ; preds = %381, %377, %374
br label %38
388: ; preds = %38
%389 = load i32, i32* %17
%390 = load i8*, i8** %2
%391 = load i32, i32* %18
%392 = getelementptr inbounds [7 x i8], [7 x i8]* %19, i64 0, i64 0
%393 = getelementptr inbounds [7 x i32], [7 x i32]* %20, i64 0, i64 0
%394 = load i32, i32* %7
%395 = load i32, i32* %6
%396 = getelementptr inbounds [30 x i8], [30 x i8]* %13, i64 0, i64 0
%397 = load i32, i32* %12
%398 = load i32, i32* %11
%399 = load i32, i32* %8
%400 = load i32, i32* %9
%401 = call i32 (i32, i8*, i32, i8*, i32*, i32, i32, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @event_key to i32 (i32, i8*, i32, i8*, i32*, i32, i32, i8*, i32, i32, i32, i32, ...)*)(i32 %389, i8* %390, i32 %391, i8* %392, i32* %393, i32 %394, i32 %395, i8* %396, i32 %397, i32 %398, i32 %399, i32 %400)
%402 = load i32, i32* %7
ret i32 %402
}

LLVM IR (-O2):
@.str = [8 x i8] c"FCGDAEB\00"
@parsekey.mode = internal unnamed_addr constant [10 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0)]
@.str.1 = [4 x i8] c"maj\00"
@.str.2 = [4 x i8] c"min\00"
@.str.3 = [2 x i8] c"m\00"
@.str.4 = [4 x i8] c"aeo\00"
@.str.5 = [4 x i8] c"loc\00"
@.str.6 = [4 x i8] c"ion\00"
@.str.7 = [4 x i8] c"dor\00"
@.str.8 = [4 x i8] c"phr\00"
@.str.9 = [4 x i8] c"lyd\00"
@.str.10 = [4 x i8] c"mix\00"
@parsekey.modeshift = internal unnamed_addr constant [10 x i32] [i32 0, i32 -3, i32 -3, i32 -3, i32 -5, i32 0, i32 -2, i32 -4, i32 1, i32 -1]
@parsekey.modeminor = internal unnamed_addr constant [10 x i32] [i32 0, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0]
@.str.11 = [5 x i8] c"clef\00"
@.str.12 = [29 x i8] c"clef must be followed by '='\00"
@.str.13 = [10 x i8] c"transpose\00"
@.str.14 = [34 x i8] c"transpose must be followed by '='\00"
@.str.15 = [7 x i8] c"octave\00"
@.str.16 = [31 x i8] c"octave must be followed by '='\00"
@.str.17 = [3 x i8] c"Hp\00"
@.str.18 = [18 x i8] c"Unknown mode '%s'\00"
@.str.19 = [27 x i8] c"Unusual key representation\00"
@.str.20 = [33 x i8] c"Ignoring string '%s' in K: field\00"
define i32 @parsekey(i8* %0) {
%2 = alloca i8*
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
%5 = alloca [30 x i8]
%6 = alloca [80 x i8]
%7 = alloca [7 x i8]
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%9 = alloca [7 x i32]
%10 = bitcast i8** %2 to i8*
%11 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%15 = bitcast [7 x i32]* %9 to i8*
store i8* %0, i8** %2
%16 = bitcast [7 x i32]* %9 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %16
%17 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 4
store i32 1, i32* %17
%18 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 5
store i32 1, i32* %18
%19 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 6
store i32 1, i32* %19
%20 = load i8, i8* %0
%21 = icmp ne i8 %20, 0
tail call void @llvm.assume(i1 %21)
%22 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 1
%23 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 2
br label %24
24: ; preds = %1, %253
%25 = phi i32 [ undef, %1 ], [ %205, %253 ]
%26 = phi i32 [ undef, %1 ], [ %213, %253 ]
%27 = phi i32 [ 0, %1 ], [ %212, %253 ]
%28 = phi i32 [ 0, %1 ], [ %209, %253 ]
%29 = phi i32 [ 0, %1 ], [ %210, %253 ]
%30 = phi i32 [ 0, %1 ], [ %211, %253 ]
%31 = phi i32 [ 0, %1 ], [ %207, %253 ]
%32 = phi i32 [ 0, %1 ], [ %208, %253 ]
%33 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %2)
%34 = load i8*, i8** %2
%35 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @readword to i32 (i8*, i8*, ...)*)(i8* %11, i8* %34)
%36 = sext i32 %35 to i64
%37 = inttoptr i64 %36 to i8*
store i8* %37, i8** %2
%38 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @casecmp to i32 (i8*, i8*, ...)*)(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %57
40: ; preds = %24
%41 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %2)
%42 = load i8*, i8** %2
%43 = load i8, i8* %42
%44 = icmp eq i8 %43, 61
br i1 %44, label %47, label %45
45: ; preds = %40
%46 = call i32 (i8*, ...) bitcast (i32 (...)* @event_error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0))
br label %179
47: ; preds = %40
%48 = getelementptr inbounds i8, i8* %42, i64 1
store i8* %48, i8** %2
%49 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %2)
%50 = load i8*, i8** %2
%51 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @readword to i32 (i8*, i8*, ...)*)(i8* %12, i8* %50)
%52 = sext i32 %51 to i64
%53 = inttoptr i64 %52 to i8*
store i8* %53, i8** %2
%54 = load i8, i8* %12
%55 = icmp eq i8 %54, 0
%56 = select i1 %55, i32 %32, i32 1
br label %179
57: ; preds = %24
%58 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @casecmp to i32 (i8*, i8*, ...)*)(i8* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %71
60: ; preds = %57
%61 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %2)
%62 = load i8*, i8** %2
%63 = load i8, i8* %62
%64 = icmp eq i8 %63, 61
br i1 %64, label %67, label %65
65: ; preds = %60
%66 = call i32 (i8*, ...) bitcast (i32 (...)* @event_error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.14, i64 0, i64 0))
br label %179
67: ; preds = %60
%68 = getelementptr inbounds i8, i8* %62, i64 1
store i8* %68, i8** %2
%69 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %2)
%70 = call i32 (i8**, ...) bitcast (i32 (...)* @readsnump to i32 (i8**, ...)*)(i8** %2)
br label %179
71: ; preds = %57
%72 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @casecmp to i32 (i8*, i8*, ...)*)(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %85
74: ; preds = %71
%75 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %2)
%76 = load i8*, i8** %2
%77 = load i8, i8* %76
%78 = icmp eq i8 %77, 61
br i1 %78, label %81, label %79
79: ; preds = %74
%80 = call i32 (i8*, ...) bitcast (i32 (...)* @event_error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.16, i64 0, i64 0))
br label %179
81: ; preds = %74
%82 = getelementptr inbounds i8, i8* %76, i64 1
store i8* %82, i8** %2
%83 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %2)
%84 = call i32 (i8**, ...) bitcast (i32 (...)* @readsnump to i32 (i8**, ...)*)(i8** %2)
br label %179
85: ; preds = %71
%86 = call i32 (i8*, ...) bitcast (i32 (...)* @isclef to i32 (i8*, ...)*)(i8* %11)
%87 = icmp eq i32 %86, 0
br i1 %87, label %90, label %88
88: ; preds = %85
%89 = call i8* @strcpy(i8* %12, i8* %11)
br label %179
90: ; preds = %85
%91 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @casecmp to i32 (i8*, i8*, ...)*)(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0))
%92 = icmp eq i32 %91, 0
br i1 %92, label %204, label %93
93: ; preds = %90
%94 = load i8, i8* %11
%95 = add i8 %94, -65
%96 = icmp ult i8 %95, 7
br i1 %96, label %97, label %179
97: ; preds = %93
%98 = zext i8 %94 to i32
%99 = call i8* @memchr(i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %98, i64 8)
%100 = ptrtoint i8* %99 to i64
%101 = trunc i64 %100 to i32
%102 = load i8, i8* %22
%103 = icmp eq i8 %102, 35
br i1 %103, label %104, label %106
104: ; preds = %97
%105 = add i32 %101, add (i32 xor (i32 ptrtoint ([8 x i8]* @.str to i32), i32 -1), i32 7)
br label %111
106: ; preds = %97
%107 = icmp eq i8 %102, 98
%108 = select i1 %107, i32 add (i32 xor (i32 ptrtoint ([8 x i8]* @.str to i32), i32 -1), i32 -7), i32 xor (i32 ptrtoint ([8 x i8]* @.str to i32), i32 -1)
%109 = add i32 %108, %101
%110 = select i1 %107, i64 2, i64 1
br label %111
111: ; preds = %106, %104
%112 = phi i32 [ %105, %104 ], [ %109, %106 ]
%113 = phi i64 [ 2, %104 ], [ %110, %106 ]
%114 = call i64 @strlen(i8* %11)
%115 = icmp eq i64 %114, %113
br i1 %115, label %116, label %149
116: ; preds = %111
%117 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %2)
%118 = load i8*, i8** %2
%119 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @readword to i32 (i8*, i8*, ...)*)(i8* %13, i8* %118)
%120 = sext i32 %119 to i64
%121 = call i32 (i8*, ...) bitcast (i32 (...)* @lcase to i32 (i8*, ...)*)(i8* %13)
br label %122
122: ; preds = %136, %116
%123 = phi i64 [ %142, %136 ], [ 0, %116 ]
%124 = phi i32 [ %141, %136 ], [ 0, %116 ]
%125 = phi i32 [ %139, %136 ], [ %112, %116 ]
%126 = phi i1 [ false, %136 ], [ true, %116 ]
br label %127
127: ; preds = %122, %133
%128 = phi i64 [ %134, %133 ], [ %123, %122 ]
%129 = getelementptr inbounds [10 x i8*], [10 x i8*]* @parsekey.mode, i64 0, i64 %128
%130 = load i8*, i8** %129
%131 = call i32 @strncmp(i8* %13, i8* dereferenceable(1) %130, i64 3)
%132 = icmp eq i32 %131, 0
br i1 %132, label %136, label %133
133: ; preds = %127
%134 = add nuw nsw i64 %128, 1
%135 = icmp eq i64 %134, 10
br i1 %135, label %144, label %127
136: ; preds = %127
%137 = getelementptr inbounds [10 x i32], [10 x i32]* @parsekey.modeshift, i64 0, i64 %128
%138 = load i32, i32* %137
%139 = add nsw i32 %138, %125
%140 = getelementptr inbounds [10 x i32], [10 x i32]* @parsekey.modeminor, i64 0, i64 %128
%141 = load i32, i32* %140
%142 = add nuw nsw i64 %128, 1
%143 = icmp eq i64 %142, 10
br i1 %143, label %145, label %122
144: ; preds = %133
br i1 %126, label %187, label %145
145: ; preds = %136, %144
%146 = phi i32 [ %125, %144 ], [ %139, %136 ]
%147 = phi i32 [ %124, %144 ], [ %141, %136 ]
%148 = inttoptr i64 %120 to i8*
store i8* %148, i8** %2
br label %187
149: ; preds = %111
%150 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 %113
%151 = call i8* @strcpy(i8* %13, i8* %150)
%152 = call i32 (i8*, ...) bitcast (i32 (...)* @lcase to i32 (i8*, ...)*)(i8* %13)
br label %153
153: ; preds = %167, %149
%154 = phi i64 [ %173, %167 ], [ 0, %149 ]
%155 = phi i32 [ %172, %167 ], [ 0, %149 ]
%156 = phi i32 [ %170, %167 ], [ %112, %149 ]
%157 = phi i1 [ false, %167 ], [ true, %149 ]
br label %158
158: ; preds = %153, %164
%159 = phi i64 [ %165, %164 ], [ %154, %153 ]
%160 = getelementptr inbounds [10 x i8*], [10 x i8*]* @parsekey.mode, i64 0, i64 %159
%161 = load i8*, i8** %160
%162 = call i32 @strncmp(i8* %13, i8* dereferenceable(1) %161, i64 3)
%163 = icmp eq i32 %162, 0
br i1 %163, label %167, label %164
164: ; preds = %158
%165 = add nuw nsw i64 %159, 1
%166 = icmp eq i64 %165, 10
br i1 %166, label %175, label %158
167: ; preds = %158
%168 = getelementptr inbounds [10 x i32], [10 x i32]* @parsekey.modeshift, i64 0, i64 %159
%169 = load i32, i32* %168
%170 = add nsw i32 %169, %156
%171 = getelementptr inbounds [10 x i32], [10 x i32]* @parsekey.modeminor, i64 0, i64 %159
%172 = load i32, i32* %171
%173 = add nuw nsw i64 %159, 1
%174 = icmp eq i64 %173, 10
br i1 %174, label %187, label %153
175: ; preds = %164
br i1 %157, label %176, label %187
176: ; preds = %175
%177 = call i32 (i8*, i8*, ...) @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), i8* %150)
%178 = call i32 (i8*, ...) bitcast (i32 (...)* @event_error to i32 (i8*, ...)*)(i8* %14)
br label %187
179: ; preds = %45, %47, %65, %67, %79, %81, %88, %93
%180 = phi i32 [ %27, %93 ], [ %27, %88 ], [ %84, %81 ], [ %27, %79 ], [ %27, %67 ], [ %27, %65 ], [ %27, %47 ], [ %27, %45 ]
%181 = phi i32 [ %30, %93 ], [ %30, %88 ], [ 1, %81 ], [ %30, %79 ], [ %30, %67 ], [ %30, %65 ], [ %30, %47 ], [ %30, %45 ]
%182 = phi i32 [ %29, %93 ], [ %29, %88 ], [ %29, %81 ], [ %29, %79 ], [ 1, %67 ], [ %29, %65 ], [ %29, %47 ], [ %29, %45 ]
%183 = phi i32 [ %28, %93 ], [ %28, %88 ], [ %28, %81 ], [ %28, %79 ], [ %70, %67 ], [ %28, %65 ], [ %28, %47 ], [ %28, %45 ]
%184 = phi i32 [ %32, %93 ], [ 1, %88 ], [ %32, %81 ], [ %32, %79 ], [ %32, %67 ], [ %32, %65 ], [ %56, %47 ], [ %32, %45 ]
%185 = phi i32 [ 0, %93 ], [ 1, %88 ], [ 1, %81 ], [ 1, %79 ], [ 1, %67 ], [ 1, %65 ], [ 1, %47 ], [ 1, %45 ]
%186 = icmp eq i32 %31, 0
br i1 %186, label %204, label %187
187: ; preds = %167, %176, %175, %144, %145, %179
%188 = phi i32 [ %25, %179 ], [ %155, %176 ], [ %155, %175 ], [ %124, %144 ], [ %147, %145 ], [ %172, %167 ]
%189 = phi i32 [ %26, %179 ], [ %156, %176 ], [ %156, %175 ], [ %125, %144 ], [ %146, %145 ], [ %170, %167 ]
%190 = phi i32 [ %185, %179 ], [ 1, %176 ], [ 1, %175 ], [ 1, %144 ], [ 1, %145 ], [ 1, %167 ]
%191 = phi i32 [ %31, %179 ], [ 1, %176 ], [ 1, %175 ], [ 1, %144 ], [ 1, %145 ], [ 1, %167 ]
%192 = phi i32 [ %184, %179 ], [ %32, %176 ], [ %32, %175 ], [ %32, %144 ], [ %32, %145 ], [ %32, %167 ]
%193 = phi i32 [ %183, %179 ], [ %28, %176 ], [ %28, %175 ], [ %28, %144 ], [ %28, %145 ], [ %28, %167 ]
%194 = phi i32 [ %182, %179 ], [ %29, %176 ], [ %29, %175 ], [ %29, %144 ], [ %29, %145 ], [ %29, %167 ]
%195 = phi i32 [ %181, %179 ], [ %30, %176 ], [ %30, %175 ], [ %30, %144 ], [ %30, %145 ], [ %30, %167 ]
%196 = phi i32 [ %180, %179 ], [ %27, %176 ], [ %27, %175 ], [ %27, %144 ], [ %27, %145 ], [ %27, %167 ]
%197 = icmp sgt i32 %189, 7
br i1 %197, label %200, label %198
198: ; preds = %187
%199 = icmp slt i32 %189, -7
br i1 %199, label %200, label %204
200: ; preds = %198, %187
%201 = phi i32 [ -12, %187 ], [ 12, %198 ]
%202 = call i32 (i8*, ...) bitcast (i32 (...)* @event_warning to i32 (i8*, ...)*)(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, i64 0, i64 0))
%203 = add nsw i32 %201, %189
br label %204
204: ; preds = %200, %90, %198, %179
%205 = phi i32 [ %188, %198 ], [ %25, %179 ], [ 0, %90 ], [ %188, %200 ]
%206 = phi i32 [ %190, %198 ], [ %185, %179 ], [ 1, %90 ], [ %190, %200 ]
%207 = phi i32 [ %191, %198 ], [ 0, %179 ], [ 1, %90 ], [ %191, %200 ]
%208 = phi i32 [ %192, %198 ], [ %184, %179 ], [ %32, %90 ], [ %192, %200 ]
%209 = phi i32 [ %193, %198 ], [ %183, %179 ], [ %28, %90 ], [ %193, %200 ]
%210 = phi i32 [ %194, %198 ], [ %182, %179 ], [ %29, %90 ], [ %194, %200 ]
%211 = phi i32 [ %195, %198 ], [ %181, %179 ], [ %30, %90 ], [ %195, %200 ]
%212 = phi i32 [ %196, %198 ], [ %180, %179 ], [ %27, %90 ], [ %196, %200 ]
%213 = phi i32 [ %189, %198 ], [ %26, %179 ], [ 2, %90 ], [ %203, %200 ]
%214 = load i8, i8* %11
switch i8 %214, label %246 [
i8 95, label %215
i8 94, label %215
i8 61, label %215
]
215: ; preds = %204, %204, %204
%216 = call i64 @strlen(i8* %11)
%217 = icmp eq i64 %216, 2
%218 = load i8, i8* %22
%219 = icmp sgt i8 %218, 96
%220 = select i1 %217, i1 %219, i1 false
%221 = icmp slt i8 %218, 104
%222 = select i1 %220, i1 %221, i1 false
br i1 %222, label %223, label %229
223: ; preds = %215
%224 = zext i8 %218 to i64
%225 = add nuw nsw i64 %224, 4294967199
%226 = and i64 %225, 4294967295
%227 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 %226
store i8 %214, i8* %227
%228 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 %226
store i32 1, i32* %228
br label %253
229: ; preds = %215
%230 = icmp eq i64 %216, 3
%231 = icmp ne i8 %214, 61
%232 = select i1 %230, i1 %231, i1 false
br i1 %232, label %233, label %246
233: ; preds = %229
%234 = icmp eq i8 %214, %218
%235 = load i8, i8* %23
%236 = icmp sgt i8 %235, 96
%237 = select i1 %234, i1 %236, i1 false
%238 = icmp slt i8 %235, 104
%239 = select i1 %237, i1 %238, i1 false
br i1 %239, label %240, label %246
240: ; preds = %233
%241 = zext i8 %235 to i64
%242 = add nuw nsw i64 %241, 4294967199
%243 = and i64 %242, 4294967295
%244 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 %243
store i8 %214, i8* %244
%245 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 %243
store i32 2, i32* %245
br label %253
246: ; preds = %204, %233, %229
%247 = icmp ne i32 %206, 0
%248 = icmp eq i8 %214, 0
%249 = select i1 %247, i1 true, i1 %248
br i1 %249, label %253, label %250
250: ; preds = %246
%251 = call i32 (i8*, i8*, ...) @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.20, i64 0, i64 0), i8* %11)
%252 = call i32 (i8*, ...) bitcast (i32 (...)* @event_warning to i32 (i8*, ...)*)(i8* %14)
br label %253
253: ; preds = %240, %223, %250, %246
%254 = load i8*, i8** %2
%255 = load i8, i8* %254
%256 = icmp eq i8 %255, 0
br i1 %256, label %257, label %24
257: ; preds = %253
%258 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 0
%259 = call i32 (i32, i8*, i32, i8*, i32*, i32, i32, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @event_key to i32 (i32, i8*, i32, i8*, i32*, i32, i32, i8*, i32, i32, i32, i32, ...)*)(i32 %213, i8* %0, i32 %205, i8* %8, i32* %258, i32 %207, i32 %208, i8* %12, i32 %212, i32 %209, i32 %211, i32 %210)
ret i32 %207
}