#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 */
scalar_t__ clStrcmp(char *, char *);
int /*<<< orphan*/ curs_move(int);
int /*<<< orphan*/ get_history(int);
void parse_esc(char *b) {
  if (clStrcmp(b, "A")) {
    get_history(-1);
  } else if (clStrcmp(b, "B")) {
    get_history(1);
  } else if (clStrcmp(b, "D")) {
    curs_move(-1);
  } else if (clStrcmp(b, "C")) {
    curs_move(+1);
  } else if (b[0] == 0xb2) {
  }
}


x86 assembly (clang, -O0):
<parse_esc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <clStrcmp@plt>
cmp    $0x0,%rax
je     1165 <parse_esc+0x35>
mov    $0xffffffff,%edi
call   1050 <get_history@plt>
jmp    120b <parse_esc+0xdb>
mov    -0x8(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1040 <clStrcmp@plt>
cmp    $0x0,%rax
je     118e <parse_esc+0x5e>
mov    $0x1,%edi
call   1050 <get_history@plt>
jmp    1206 <parse_esc+0xd6>
mov    -0x8(%rbp),%rdi
lea    0xe6b(%rip),%rsi
call   1040 <clStrcmp@plt>
cmp    $0x0,%rax
je     11b7 <parse_esc+0x87>
mov    $0xffffffff,%edi
call   1030 <curs_move@plt>
jmp    1201 <parse_esc+0xd1>
mov    -0x8(%rbp),%rdi
lea    0xe44(%rip),%rsi
call   1040 <clStrcmp@plt>
cmp    $0x0,%rax
je     11e0 <parse_esc+0xb0>
mov    $0x1,%edi
call   1030 <curs_move@plt>
jmp    11fc <parse_esc+0xcc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xb2,%eax
jne    11f7 <parse_esc+0xc7>
jmp    11f7 <parse_esc+0xc7>
jmp    11fc <parse_esc+0xcc>
jmp    1201 <parse_esc+0xd1>
jmp    1206 <parse_esc+0xd6>
jmp    120b <parse_esc+0xdb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_esc>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
call   1040 <clStrcmp@plt>
test   %rax,%rax
je     1150 <parse_esc+0x20>
mov    $0xffffffff,%edi
pop    %rbx
jmp    1050 <get_history@plt>
lea    0xeab(%rip),%rsi
mov    %rbx,%rdi
call   1040 <clStrcmp@plt>
test   %rax,%rax
je     116f <parse_esc+0x3f>
mov    $0x1,%edi
pop    %rbx
jmp    1050 <get_history@plt>
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
call   1040 <clStrcmp@plt>
test   %rax,%rax
je     118e <parse_esc+0x5e>
mov    $0xffffffff,%edi
pop    %rbx
jmp    1030 <curs_move@plt>
lea    0xe71(%rip),%rsi
mov    %rbx,%rdi
call   1040 <clStrcmp@plt>
test   %rax,%rax
je     11ad <parse_esc+0x7d>
mov    $0x1,%edi
pop    %rbx
jmp    1030 <curs_move@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"A\00"
@.str.1 = [2 x i8] c"B\00"
@.str.2 = [2 x i8] c"D\00"
@.str.3 = [2 x i8] c"C\00"
define void @parse_esc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @clStrcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @get_history(i32 -1)
br label %37
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i64 @clStrcmp(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @get_history(i32 1)
br label %36
14: ; preds = %8
%15 = load i8*, i8** %2
%16 = call i64 @clStrcmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 @curs_move(i32 -1)
br label %35
20: ; preds = %14
%21 = load i8*, i8** %2
%22 = call i64 @clStrcmp(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @curs_move(i32 1)
br label %34
26: ; preds = %20
%27 = load i8*, i8** %2
%28 = getelementptr inbounds i8, i8* %27, i64 0
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 178
br i1 %31, label %32, label %33
32: ; preds = %26
br label %33
33: ; preds = %32, %26
br label %34
34: ; preds = %33, %24
br label %35
35: ; preds = %34, %18
br label %36
36: ; preds = %35, %12
br label %37
37: ; preds = %36, %6
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"A\00"
@.str.1 = [2 x i8] c"B\00"
@.str.2 = [2 x i8] c"D\00"
@.str.3 = [2 x i8] c"C\00"
define void @parse_esc(i8* %0) {
%2 = tail call i64 @clStrcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @get_history(i32 -1)
br label %21
6: ; preds = %1
%7 = tail call i64 @clStrcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @get_history(i32 1)
br label %21
11: ; preds = %6
%12 = tail call i64 @clStrcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 @curs_move(i32 -1)
br label %21
16: ; preds = %11
%17 = tail call i64 @clStrcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 @curs_move(i32 1)
br label %21
21: ; preds = %16, %9, %19, %14, %4
ret void
}