#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 */
void *_kt_backslash_escape(char const *, char const **);
int /*<<< orphan*/ _kt_is_emacs_ctrl(char const *);
int /*<<< orphan*/ _kt_is_emacs_meta(char const *);
int /*<<< orphan*/ isprint(int);
int /*<<< orphan*/ strcmp(char const *, char *);
scalar_t__ toupper(char const);
int _kt_parse_keybinding_string(const char *keyseq, char *binary, int *nc) {
  const char *iptr = keyseq;
  char *optr = binary;
  char c;
  while (*iptr) {
    switch (*iptr) {
    case '^':
      if (iptr[1]) {
        if (iptr[1] == '\\') {
          c = _kt_backslash_escape(iptr + 2, &iptr);
        } else {
          c = iptr[1];
          iptr += 2;
        };
        *optr++ = ((c) == '?' ? '\177' : ((unsigned char)toupper(c) & ~0x40));
      } else {
        *optr++ = *iptr++;
      };
      break;
    case '\\':
      *optr++ = _kt_backslash_escape(iptr + 1, &iptr);
      break;
    case 'M':
      if (_kt_is_emacs_meta(iptr)) {
        *optr++ = '\033';
        iptr += 2;
      } else {
        *optr++ = *iptr++;
      };
      break;
    case 'C':
      if (_kt_is_emacs_ctrl(iptr)) {
        *optr++ =
            ((iptr[2]) == '?' ? '\177'
                              : ((unsigned char)toupper(iptr[2]) & ~0x40));
        iptr += 3;
      } else {
        *optr++ = *iptr++;
      };
      break;
    default:
      if ((((unsigned char)(*iptr) & 0x80) &&
           !isprint((int)(unsigned char)(*iptr)))) {
        *optr++ = '\033';
        *optr++ = ((unsigned char)(*iptr) & ~0x80);
        iptr++;
      } else if (iptr == keyseq &&
                 !((unsigned char)(*iptr) < ' ' ||
                   (unsigned char)(*iptr) == '\177') &&
                 strcmp(keyseq, "up") != 0 && strcmp(keyseq, "down") != 0 &&
                 strcmp(keyseq, "left") != 0 && strcmp(keyseq, "right") != 0) {
        *optr++ = '\\';
        *optr++ = *iptr++;
      } else {
        *optr++ = *iptr++;
      };
    };
  };
  *nc = optr - binary;
  return 0;
}


x86 assembly (clang, -O0):
<_kt_parse_keybinding_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     14fb <_kt_parse_keybinding_string+0x39b>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x1b,%eax
ja     1393 <_kt_parse_keybinding_string+0x233>
mov    -0x38(%rbp),%rax
lea    0xe4b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x20(%rbp),%rax
cmpb   $0x0,0x1(%rax)
je     1253 <_kt_parse_keybinding_string+0xf3>
mov    -0x20(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x5c,%eax
jne    11f6 <_kt_parse_keybinding_string+0x96>
mov    -0x20(%rbp),%rdi
add    $0x2,%rdi
lea    -0x20(%rbp),%rsi
call   1040 <_kt_backslash_escape@plt>
mov    %al,-0x29(%rbp)
jmp    120c <_kt_parse_keybinding_string+0xac>
mov    -0x20(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x29(%rbp)
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
movsbl -0x29(%rbp),%eax
cmp    $0x3f,%eax
jne    1226 <_kt_parse_keybinding_string+0xc6>
mov    $0x7f,%eax
mov    %eax,-0x3c(%rbp)
jmp    1238 <_kt_parse_keybinding_string+0xd8>
movsbl -0x29(%rbp),%edi
call   1030 <toupper@plt>
movzbl %al,%eax
and    $0xffffffbf,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    1275 <_kt_parse_keybinding_string+0x115>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    14f6 <_kt_parse_keybinding_string+0x396>
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
lea    -0x20(%rbp),%rsi
call   1040 <_kt_backslash_escape@plt>
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    14f6 <_kt_parse_keybinding_string+0x396>
mov    -0x20(%rbp),%rdi
call   1080 <_kt_is_emacs_meta@plt>
cmp    $0x0,%eax
je     12d8 <_kt_parse_keybinding_string+0x178>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x1b,(%rax)
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
jmp    12fa <_kt_parse_keybinding_string+0x19a>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    14f6 <_kt_parse_keybinding_string+0x396>
mov    -0x20(%rbp),%rdi
call   1050 <_kt_is_emacs_ctrl@plt>
cmp    $0x0,%eax
je     136c <_kt_parse_keybinding_string+0x20c>
mov    -0x20(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x3f,%eax
jne    132f <_kt_parse_keybinding_string+0x1cf>
mov    $0x7f,%eax
mov    %eax,-0x40(%rbp)
jmp    1345 <_kt_parse_keybinding_string+0x1e5>
mov    -0x20(%rbp),%rax
movsbl 0x2(%rax),%edi
call   1030 <toupper@plt>
movzbl %al,%eax
and    $0xffffffbf,%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x20(%rbp)
jmp    138e <_kt_parse_keybinding_string+0x22e>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    14f6 <_kt_parse_keybinding_string+0x396>
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     13ff <_kt_parse_keybinding_string+0x29f>
mov    -0x20(%rbp),%rax
movzbl (%rax),%edi
call   1070 <isprint@plt>
cmp    $0x0,%eax
jne    13ff <_kt_parse_keybinding_string+0x29f>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x1b,(%rax)
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
and    $0xffffff7f,%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    14f1 <_kt_parse_keybinding_string+0x391>
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jne    14ca <_kt_parse_keybinding_string+0x36a>
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x20,%eax
jl     14ca <_kt_parse_keybinding_string+0x36a>
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x7f,%eax
je     14ca <_kt_parse_keybinding_string+0x36a>
mov    -0x8(%rbp),%rdi
lea    0xc38(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     14ca <_kt_parse_keybinding_string+0x36a>
mov    -0x8(%rbp),%rdi
lea    0xc22(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     14ca <_kt_parse_keybinding_string+0x36a>
mov    -0x8(%rbp),%rdi
lea    0xc0e(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     14ca <_kt_parse_keybinding_string+0x36a>
mov    -0x8(%rbp),%rdi
lea    0xbfa(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     14ca <_kt_parse_keybinding_string+0x36a>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x5c,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    14ec <_kt_parse_keybinding_string+0x38c>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    14f1 <_kt_parse_keybinding_string+0x391>
jmp    14f6 <_kt_parse_keybinding_string+0x396>
jmp    1184 <_kt_parse_keybinding_string+0x24>
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_kt_parse_keybinding_string>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,0x10(%rsp)
mov    %rsi,%r12
mov    %rdi,0x8(%rsp)
mov    (%rdi),%bpl
mov    %rsi,%r15
test   %bpl,%bpl
je     1387 <_kt_parse_keybinding_string+0x227>
mov    %rdi,%r13
lea    0xe6c(%rip),%r14
mov    %rdi,%rbx
mov    %r12,%r15
jmp    11c9 <_kt_parse_keybinding_string+0x69>
nopl   0x0(%rax)
add    $0x1,%rbx
mov    %rbx,%rdi
lea    0x8(%rsp),%rsi
call   1040 <_kt_backslash_escape@plt>
mov    %al,(%r15)
add    $0x1,%r15
mov    0x8(%rsp),%rbx
movzbl (%rbx),%ebp
test   %bpl,%bpl
je     1387 <_kt_parse_keybinding_string+0x227>
movsbl %bpl,%eax
add    $0xffffffbd,%eax
cmp    $0x1b,%eax
ja     1220 <_kt_parse_keybinding_string+0xc0>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    %rbx,%rdi
call   1050 <_kt_is_emacs_ctrl@plt>
mov    0x8(%rsp),%rcx
test   %eax,%eax
je     131e <_kt_parse_keybinding_string+0x1be>
movzbl 0x2(%rcx),%ecx
mov    $0x7f,%al
cmp    $0x3f,%cl
je     1208 <_kt_parse_keybinding_string+0xa8>
movsbl %cl,%edi
call   1030 <toupper@plt>
and    $0xbf,%al
mov    %al,(%r15)
add    $0x1,%r15
addq   $0x3,0x8(%rsp)
jmp    11b8 <_kt_parse_keybinding_string+0x58>
nopw   0x0(%rax,%rax,1)
test   $0x80,%bpl
je     1237 <_kt_parse_keybinding_string+0xd7>
movzbl %bpl,%edi
call   1070 <isprint@plt>
test   %eax,%eax
je     1366 <_kt_parse_keybinding_string+0x206>
cmp    %r13,%rbx
jne    1310 <_kt_parse_keybinding_string+0x1b0>
cmp    $0x20,%bpl
jb     1310 <_kt_parse_keybinding_string+0x1b0>
cmp    $0x7f,%bpl
je     1310 <_kt_parse_keybinding_string+0x1b0>
mov    %r13,%rdi
lea    0xe12(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1310 <_kt_parse_keybinding_string+0x1b0>
mov    %r13,%rdi
lea    0xdfe(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1310 <_kt_parse_keybinding_string+0x1b0>
mov    %r13,%rdi
lea    0xdec(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1310 <_kt_parse_keybinding_string+0x1b0>
mov    %r13,%rdi
lea    0xdde(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1310 <_kt_parse_keybinding_string+0x1b0>
movb   $0x5c,(%r15)
mov    0x8(%rsp),%rax
lea    0x1(%rax),%rcx
mov    %rcx,0x8(%rsp)
movzbl (%rax),%eax
mov    %al,0x1(%r15)
add    $0x2,%r15
jmp    11b8 <_kt_parse_keybinding_string+0x58>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1080 <_kt_is_emacs_meta@plt>
test   %eax,%eax
je     132c <_kt_parse_keybinding_string+0x1cc>
movb   $0x1b,(%r15)
add    $0x1,%r15
addq   $0x2,0x8(%rsp)
jmp    11b8 <_kt_parse_keybinding_string+0x58>
nop
movzbl 0x1(%rbx),%eax
test   %al,%al
je     1310 <_kt_parse_keybinding_string+0x1b0>
add    $0x2,%rbx
cmp    $0x5c,%al
jne    1345 <_kt_parse_keybinding_string+0x1e5>
mov    %rbx,%rdi
lea    0x8(%rsp),%rsi
call   1040 <_kt_backslash_escape@plt>
jmp    134a <_kt_parse_keybinding_string+0x1ea>
nop
lea    0x1(%rbx),%rax
mov    %rax,0x8(%rsp)
movzbl (%rbx),%eax
jmp    133d <_kt_parse_keybinding_string+0x1dd>
lea    0x1(%rcx),%rax
mov    %rax,0x8(%rsp)
movzbl (%rcx),%eax
jmp    133d <_kt_parse_keybinding_string+0x1dd>
mov    0x8(%rsp),%rax
lea    0x1(%rax),%rcx
mov    %rcx,0x8(%rsp)
movzbl (%rax),%eax
mov    %al,(%r15)
jmp    11b4 <_kt_parse_keybinding_string+0x54>
mov    %rbx,0x8(%rsp)
mov    $0x7f,%cl
cmp    $0x3f,%al
je     135e <_kt_parse_keybinding_string+0x1fe>
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %rax,%rcx
and    $0xbf,%cl
mov    %cl,(%r15)
jmp    11b4 <_kt_parse_keybinding_string+0x54>
movb   $0x1b,(%r15)
mov    0x8(%rsp),%rax
movzbl (%rax),%eax
and    $0x7f,%al
mov    %al,0x1(%r15)
add    $0x2,%r15
addq   $0x1,0x8(%rsp)
jmp    11b8 <_kt_parse_keybinding_string+0x58>
sub    %r12d,%r15d
mov    0x10(%rsp),%rax
mov    %r15d,(%rax)
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"up\00"
@.str.1 = [5 x i8] c"down\00"
@.str.2 = [5 x i8] c"left\00"
@.str.3 = [6 x i8] c"right\00"
define i32 @_kt_parse_keybinding_string(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%10 = load i8*, i8** %4
store i8* %10, i8** %7
%11 = load i8*, i8** %5
store i8* %11, i8** %8
br label %12
12: ; preds = %191, %3
%13 = load i8*, i8** %7
%14 = load i8, i8* %13
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %192
16: ; preds = %12
%17 = load i8*, i8** %7
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
switch i32 %19, label %121 [
i32 94, label %20
i32 92, label %65
i32 77, label %72
i32 67, label %88
]
20: ; preds = %16
%21 = load i8*, i8** %7
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8, i8* %22
%24 = icmp ne i8 %23, 0
br i1 %24, label %25, label %58
25: ; preds = %20
%26 = load i8*, i8** %7
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 92
br i1 %30, label %31, label %36
31: ; preds = %25
%32 = load i8*, i8** %7
%33 = getelementptr inbounds i8, i8* %32, i64 2
%34 = call i8* @_kt_backslash_escape(i8* %33, i8** %7)
%35 = ptrtoint i8* %34 to i8
store i8 %35, i8* %9
br label %42
36: ; preds = %25
%37 = load i8*, i8** %7
%38 = getelementptr inbounds i8, i8* %37, i64 1
%39 = load i8, i8* %38
store i8 %39, i8* %9
%40 = load i8*, i8** %7
%41 = getelementptr inbounds i8, i8* %40, i64 2
store i8* %41, i8** %7
br label %42
42: ; preds = %36, %31
%43 = load i8, i8* %9
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 63
br i1 %45, label %46, label %47
46: ; preds = %42
br label %53
47: ; preds = %42
%48 = load i8, i8* %9
%49 = call i64 @toupper(i8 signext %48)
%50 = trunc i64 %49 to i8
%51 = zext i8 %50 to i32
%52 = and i32 %51, -65
br label %53
53: ; preds = %47, %46
%54 = phi i32 [ 127, %46 ], [ %52, %47 ]
%55 = trunc i32 %54 to i8
%56 = load i8*, i8** %8
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %8
store i8 %55, i8* %56
br label %64
58: ; preds = %20
%59 = load i8*, i8** %7
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %7
%61 = load i8, i8* %59
%62 = load i8*, i8** %8
%63 = getelementptr inbounds i8, i8* %62, i32 1
store i8* %63, i8** %8
store i8 %61, i8* %62
br label %64
64: ; preds = %58, %53
br label %191
65: ; preds = %16
%66 = load i8*, i8** %7
%67 = getelementptr inbounds i8, i8* %66, i64 1
%68 = call i8* @_kt_backslash_escape(i8* %67, i8** %7)
%69 = ptrtoint i8* %68 to i8
%70 = load i8*, i8** %8
%71 = getelementptr inbounds i8, i8* %70, i32 1
store i8* %71, i8** %8
store i8 %69, i8* %70
br label %191
72: ; preds = %16
%73 = load i8*, i8** %7
%74 = call i32 @_kt_is_emacs_meta(i8* %73)
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %81
76: ; preds = %72
%77 = load i8*, i8** %8
%78 = getelementptr inbounds i8, i8* %77, i32 1
store i8* %78, i8** %8
store i8 27, i8* %77
%79 = load i8*, i8** %7
%80 = getelementptr inbounds i8, i8* %79, i64 2
store i8* %80, i8** %7
br label %87
81: ; preds = %72
%82 = load i8*, i8** %7
%83 = getelementptr inbounds i8, i8* %82, i32 1
store i8* %83, i8** %7
%84 = load i8, i8* %82
%85 = load i8*, i8** %8
%86 = getelementptr inbounds i8, i8* %85, i32 1
store i8* %86, i8** %8
store i8 %84, i8* %85
br label %87
87: ; preds = %81, %76
br label %191
88: ; preds = %16
%89 = load i8*, i8** %7
%90 = call i32 @_kt_is_emacs_ctrl(i8* %89)
%91 = icmp ne i32 %90, 0
br i1 %91, label %92, label %114
92: ; preds = %88
%93 = load i8*, i8** %7
%94 = getelementptr inbounds i8, i8* %93, i64 2
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = icmp eq i32 %96, 63
br i1 %97, label %98, label %99
98: ; preds = %92
br label %107
99: ; preds = %92
%100 = load i8*, i8** %7
%101 = getelementptr inbounds i8, i8* %100, i64 2
%102 = load i8, i8* %101
%103 = call i64 @toupper(i8 signext %102)
%104 = trunc i64 %103 to i8
%105 = zext i8 %104 to i32
%106 = and i32 %105, -65
br label %107
107: ; preds = %99, %98
%108 = phi i32 [ 127, %98 ], [ %106, %99 ]
%109 = trunc i32 %108 to i8
%110 = load i8*, i8** %8
%111 = getelementptr inbounds i8, i8* %110, i32 1
store i8* %111, i8** %8
store i8 %109, i8* %110
%112 = load i8*, i8** %7
%113 = getelementptr inbounds i8, i8* %112, i64 3
store i8* %113, i8** %7
br label %120
114: ; preds = %88
%115 = load i8*, i8** %7
%116 = getelementptr inbounds i8, i8* %115, i32 1
store i8* %116, i8** %7
%117 = load i8, i8* %115
%118 = load i8*, i8** %8
%119 = getelementptr inbounds i8, i8* %118, i32 1
store i8* %119, i8** %8
store i8 %117, i8* %118
br label %120
120: ; preds = %114, %107
br label %191
121: ; preds = %16
%122 = load i8*, i8** %7
%123 = load i8, i8* %122
%124 = zext i8 %123 to i32
%125 = and i32 %124, 128
%126 = icmp ne i32 %125, 0
br i1 %126, label %127, label %145
127: ; preds = %121
%128 = load i8*, i8** %7
%129 = load i8, i8* %128
%130 = zext i8 %129 to i32
%131 = call i32 @isprint(i32 %130)
%132 = icmp ne i32 %131, 0
br i1 %132, label %145, label %133
133: ; preds = %127
%134 = load i8*, i8** %8
%135 = getelementptr inbounds i8, i8* %134, i32 1
store i8* %135, i8** %8
store i8 27, i8* %134
%136 = load i8*, i8** %7
%137 = load i8, i8* %136
%138 = zext i8 %137 to i32
%139 = and i32 %138, -129
%140 = trunc i32 %139 to i8
%141 = load i8*, i8** %8
%142 = getelementptr inbounds i8, i8* %141, i32 1
store i8* %142, i8** %8
store i8 %140, i8* %141
%143 = load i8*, i8** %7
%144 = getelementptr inbounds i8, i8* %143, i32 1
store i8* %144, i8** %7
br label %190
145: ; preds = %127, %121
%146 = load i8*, i8** %7
%147 = load i8*, i8** %4
%148 = icmp eq i8* %146, %147
br i1 %148, label %149, label %183
149: ; preds = %145
%150 = load i8*, i8** %7
%151 = load i8, i8* %150
%152 = zext i8 %151 to i32
%153 = icmp slt i32 %152, 32
br i1 %153, label %183, label %154
154: ; preds = %149
%155 = load i8*, i8** %7
%156 = load i8, i8* %155
%157 = zext i8 %156 to i32
%158 = icmp eq i32 %157, 127
br i1 %158, label %183, label %159
159: ; preds = %154
%160 = load i8*, i8** %4
%161 = call i32 @strcmp(i8* %160, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%162 = icmp ne i32 %161, 0
br i1 %162, label %163, label %183
163: ; preds = %159
%164 = load i8*, i8** %4
%165 = call i32 @strcmp(i8* %164, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%166 = icmp ne i32 %165, 0
br i1 %166, label %167, label %183
167: ; preds = %163
%168 = load i8*, i8** %4
%169 = call i32 @strcmp(i8* %168, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%170 = icmp ne i32 %169, 0
br i1 %170, label %171, label %183
171: ; preds = %167
%172 = load i8*, i8** %4
%173 = call i32 @strcmp(i8* %172, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%174 = icmp ne i32 %173, 0
br i1 %174, label %175, label %183
175: ; preds = %171
%176 = load i8*, i8** %8
%177 = getelementptr inbounds i8, i8* %176, i32 1
store i8* %177, i8** %8
store i8 92, i8* %176
%178 = load i8*, i8** %7
%179 = getelementptr inbounds i8, i8* %178, i32 1
store i8* %179, i8** %7
%180 = load i8, i8* %178
%181 = load i8*, i8** %8
%182 = getelementptr inbounds i8, i8* %181, i32 1
store i8* %182, i8** %8
store i8 %180, i8* %181
br label %189
183: ; preds = %171, %167, %163, %159, %154, %149, %145
%184 = load i8*, i8** %7
%185 = getelementptr inbounds i8, i8* %184, i32 1
store i8* %185, i8** %7
%186 = load i8, i8* %184
%187 = load i8*, i8** %8
%188 = getelementptr inbounds i8, i8* %187, i32 1
store i8* %188, i8** %8
store i8 %186, i8* %187
br label %189
189: ; preds = %183, %175
br label %190
190: ; preds = %189, %133
br label %191
191: ; preds = %190, %120, %87, %65, %64
br label %12
192: ; preds = %12
%193 = load i8*, i8** %8
%194 = load i8*, i8** %5
%195 = ptrtoint i8* %193 to i64
%196 = ptrtoint i8* %194 to i64
%197 = sub i64 %195, %196
%198 = trunc i64 %197 to i32
%199 = load i32*, i32** %6
store i32 %198, i32* %199
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"up\00"
@.str.1 = [5 x i8] c"down\00"
@.str.2 = [5 x i8] c"left\00"
@.str.3 = [6 x i8] c"right\00"
define i32 @_kt_parse_keybinding_string(i8* %0, i8* %1, i32* nocapture writeonly %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
store i8* %0, i8** %4
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %123, label %8
8: ; preds = %3, %118
%9 = phi i8 [ %121, %118 ], [ %6, %3 ]
%10 = phi i8* [ %120, %118 ], [ %0, %3 ]
%11 = phi i8* [ %119, %118 ], [ %1, %3 ]
%12 = sext i8 %9 to i32
switch i32 %12, label %75 [
i32 94, label %13
i32 92, label %36
i32 77, label %42
i32 67, label %54
]
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
switch i8 %15, label %21 [
i8 0, label %33
i8 92, label %16
]
16: ; preds = %13
%17 = getelementptr inbounds i8, i8* %10, i64 2
%18 = call i8* @_kt_backslash_escape(i8* %17, i8** %4)
%19 = ptrtoint i8* %18 to i64
%20 = trunc i64 %19 to i8
br label %23
21: ; preds = %13
%22 = getelementptr inbounds i8, i8* %10, i64 2
store i8* %22, i8** %4
br label %23
23: ; preds = %21, %16
%24 = phi i8 [ %20, %16 ], [ %15, %21 ]
%25 = icmp eq i8 %24, 63
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = call i64 @toupper(i8 signext %24)
%28 = trunc i64 %27 to i8
%29 = and i8 %28, -65
br label %30
30: ; preds = %23, %26
%31 = phi i8 [ %29, %26 ], [ 127, %23 ]
%32 = getelementptr inbounds i8, i8* %11, i64 1
store i8 %31, i8* %11
br label %118
33: ; preds = %13
store i8* %14, i8** %4
%34 = load i8, i8* %10
%35 = getelementptr inbounds i8, i8* %11, i64 1
store i8 %34, i8* %11
br label %118
36: ; preds = %8
%37 = getelementptr inbounds i8, i8* %10, i64 1
%38 = call i8* @_kt_backslash_escape(i8* %37, i8** %4)
%39 = ptrtoint i8* %38 to i64
%40 = trunc i64 %39 to i8
%41 = getelementptr inbounds i8, i8* %11, i64 1
store i8 %40, i8* %11
br label %118
42: ; preds = %8
%43 = call i32 @_kt_is_emacs_meta(i8* %10)
%44 = icmp eq i32 %43, 0
br i1 %44, label %49, label %45
45: ; preds = %42
%46 = getelementptr inbounds i8, i8* %11, i64 1
store i8 27, i8* %11
%47 = load i8*, i8** %4
%48 = getelementptr inbounds i8, i8* %47, i64 2
store i8* %48, i8** %4
br label %118
49: ; preds = %42
%50 = load i8*, i8** %4
%51 = getelementptr inbounds i8, i8* %50, i64 1
store i8* %51, i8** %4
%52 = load i8, i8* %50
%53 = getelementptr inbounds i8, i8* %11, i64 1
store i8 %52, i8* %11
br label %118
54: ; preds = %8
%55 = call i32 @_kt_is_emacs_ctrl(i8* %10)
%56 = icmp eq i32 %55, 0
%57 = load i8*, i8** %4
br i1 %56, label %71, label %58
58: ; preds = %54
%59 = getelementptr inbounds i8, i8* %57, i64 2
%60 = load i8, i8* %59
%61 = icmp eq i8 %60, 63
br i1 %61, label %66, label %62
62: ; preds = %58
%63 = call i64 @toupper(i8 signext %60)
%64 = trunc i64 %63 to i8
%65 = and i8 %64, -65
br label %66
66: ; preds = %58, %62
%67 = phi i8 [ %65, %62 ], [ 127, %58 ]
%68 = getelementptr inbounds i8, i8* %11, i64 1
store i8 %67, i8* %11
%69 = load i8*, i8** %4
%70 = getelementptr inbounds i8, i8* %69, i64 3
store i8* %70, i8** %4
br label %118
71: ; preds = %54
%72 = getelementptr inbounds i8, i8* %57, i64 1
store i8* %72, i8** %4
%73 = load i8, i8* %57
%74 = getelementptr inbounds i8, i8* %11, i64 1
store i8 %73, i8* %11
br label %118
75: ; preds = %8
%76 = zext i8 %9 to i32
%77 = and i32 %76, 128
%78 = icmp eq i32 %77, 0
br i1 %78, label %90, label %79
79: ; preds = %75
%80 = call i32 @isprint(i32 %76)
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %90
82: ; preds = %79
%83 = getelementptr inbounds i8, i8* %11, i64 1
store i8 27, i8* %11
%84 = load i8*, i8** %4
%85 = load i8, i8* %84
%86 = and i8 %85, 127
%87 = getelementptr inbounds i8, i8* %11, i64 2
store i8 %86, i8* %83
%88 = load i8*, i8** %4
%89 = getelementptr inbounds i8, i8* %88, i64 1
store i8* %89, i8** %4
br label %118
90: ; preds = %79, %75
%91 = icmp eq i8* %10, %0
br i1 %91, label %92, label %114
92: ; preds = %90
%93 = icmp ult i8 %9, 32
%94 = icmp eq i8 %9, 127
%95 = or i1 %93, %94
br i1 %95, label %114, label %96
96: ; preds = %92
%97 = call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%98 = icmp eq i32 %97, 0
br i1 %98, label %114, label %99
99: ; preds = %96
%100 = call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%101 = icmp eq i32 %100, 0
br i1 %101, label %114, label %102
102: ; preds = %99
%103 = call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%104 = icmp eq i32 %103, 0
br i1 %104, label %114, label %105
105: ; preds = %102
%106 = call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%107 = icmp eq i32 %106, 0
br i1 %107, label %114, label %108
108: ; preds = %105
%109 = getelementptr inbounds i8, i8* %11, i64 1
store i8 92, i8* %11
%110 = load i8*, i8** %4
%111 = getelementptr inbounds i8, i8* %110, i64 1
store i8* %111, i8** %4
%112 = load i8, i8* %110
%113 = getelementptr inbounds i8, i8* %11, i64 2
store i8 %112, i8* %109
br label %118
114: ; preds = %105, %102, %99, %96, %92, %90
%115 = getelementptr inbounds i8, i8* %10, i64 1
store i8* %115, i8** %4
%116 = load i8, i8* %10
%117 = getelementptr inbounds i8, i8* %11, i64 1
store i8 %116, i8* %11
br label %118
118: ; preds = %82, %114, %108, %66, %71, %45, %49, %30, %33, %36
%119 = phi i8* [ %117, %114 ], [ %113, %108 ], [ %87, %82 ], [ %68, %66 ], [ %74, %71 ], [ %46, %45 ], [ %53, %49 ], [ %41, %36 ], [ %32, %30 ], [ %35, %33 ]
%120 = load i8*, i8** %4
%121 = load i8, i8* %120
%122 = icmp eq i8 %121, 0
br i1 %122, label %123, label %8
123: ; preds = %118, %3
%124 = phi i8* [ %1, %3 ], [ %119, %118 ]
%125 = ptrtoint i8* %124 to i64
%126 = ptrtoint i8* %1 to i64
%127 = sub i64 %125, %126
%128 = trunc i64 %127 to i32
store i32 %128, i32* %2
ret i32 0
}