#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ character_insert(char);
int /*<<< orphan*/ enter_insert();
int /*<<< orphan*/ ischaracter(char);
int /*<<< orphan*/ mode_change(int);
void input_mode_insert(char c) {
  switch (c) {
  case 0x1b:
    mode_change(1);
    return;
  case 0x0D:
  case 0x0A:
    enter_insert();
    return;
  default:
    if (!ischaracter(c))
      return;
    character_insert(c);
    return;
  }
}


x86 assembly (clang, -O0):
<input_mode_insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0xa,%eax
je     1194 <input_mode_insert+0x54>
jmp    1163 <input_mode_insert+0x23>
mov    -0x8(%rbp),%eax
sub    $0xd,%eax
je     1194 <input_mode_insert+0x54>
jmp    1174 <input_mode_insert+0x34>
mov    -0x8(%rbp),%eax
sub    $0x1b,%eax
jne    11a0 <input_mode_insert+0x60>
jmp    1185 <input_mode_insert+0x45>
mov    $0x1,%edi
call   1030 <mode_change@plt>
jmp    11c0 <input_mode_insert+0x80>
mov    $0x0,%al
call   1040 <enter_insert@plt>
jmp    11c0 <input_mode_insert+0x80>
movsbl -0x1(%rbp),%edi
call   1050 <ischaracter@plt>
cmp    $0x0,%eax
jne    11b7 <input_mode_insert+0x77>
jmp    11c0 <input_mode_insert+0x80>
movsbl -0x1(%rbp),%edi
call   1060 <character_insert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_mode_insert>:
push   %rbx
cmp    $0xa,%edi
je     115b <input_mode_insert+0x1b>
cmp    $0xd,%edi
je     115b <input_mode_insert+0x1b>
cmp    $0x1b,%edi
jne    1163 <input_mode_insert+0x23>
mov    $0x1,%edi
pop    %rbx
jmp    1030 <mode_change@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <enter_insert@plt>
movsbl %dil,%ebx
mov    %ebx,%edi
call   1050 <ischaracter@plt>
test   %eax,%eax
je     117a <input_mode_insert+0x3a>
mov    %ebx,%edi
pop    %rbx
jmp    1060 <character_insert@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @input_mode_insert(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
switch i32 %4, label %9 [
i32 27, label %5
i32 13, label %7
i32 10, label %7
]
5: ; preds = %1
%6 = call i32 @mode_change(i32 1)
br label %17
7: ; preds = %1, %1
%8 = call i32 (...) @enter_insert()
br label %17
9: ; preds = %1
%10 = load i8, i8* %2
%11 = call i32 @ischaracter(i8 signext %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %9
br label %17
14: ; preds = %9
%15 = load i8, i8* %2
%16 = call i32 @character_insert(i8 signext %15)
br label %17
17: ; preds = %14, %13, %7, %5
ret void
}

LLVM IR (-O2):
define void @input_mode_insert(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %7 [
i32 27, label %3
i32 13, label %5
i32 10, label %5
]
3: ; preds = %1
%4 = tail call i32 @mode_change(i32 1)
br label %12
5: ; preds = %1, %1
%6 = tail call i32 (...) @enter_insert()
br label %12
7: ; preds = %1
%8 = tail call i32 @ischaracter(i8 signext %0)
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @character_insert(i8 signext %0)
br label %12
12: ; preds = %7, %10, %5, %3
ret void
}