#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*/ Goto(int, int);
char getch();
int /*<<< orphan*/ printf(char *);
int Optition(int up, int down, int left, int right, int backspace, int step) {
  char ch;
  int line = up;
  Goto(left, line);
  printf(">>");
  Goto(right, line);
  printf("<<");
  while ((ch = getch()) != 0x0d) {
    while (ch == 0x48) {
      if (line == up) {
        break;
      } else {
        Goto(left, line);
        printf("  ");
        Goto(right, line);
        printf("  ");
        line -= step;
        Goto(left, line);
        printf(">>");
        Goto(right, line);
        printf("<<");
        break;
      }
    }
    while (ch == 0x50) {
      if (line == down) {
        break;
      } else {
        Goto(left, line);
        printf("  ");
        Goto(right, line);
        printf("  ");
        line += step;
        Goto(left, line);
        printf(">>");
        Goto(right, line);
        printf("<<");
        break;
      }
    }
    if (ch == 0x1b) {
      line = backspace;
      break;
    }
  }
  return line;
}


x86 assembly (clang, -O0):
<Optition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <Goto@plt>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <Goto@plt>
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getch@plt>
mov    %al,-0x19(%rbp)
movsbl %al,%eax
cmp    $0xd,%eax
je     12c5 <Optition+0x195>
jmp    119b <Optition+0x6b>
movsbl -0x19(%rbp),%eax
cmp    $0x48,%eax
jne    1220 <Optition+0xf0>
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    11b9 <Optition+0x89>
jmp    1220 <Optition+0xf0>
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <Goto@plt>
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <Goto@plt>
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <Goto@plt>
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <Goto@plt>
lea    0xde8(%rip),%rdi
call   1030 <printf@plt>
jmp    1225 <Optition+0xf5>
movsbl -0x19(%rbp),%eax
cmp    $0x50,%eax
jne    12a8 <Optition+0x178>
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1243 <Optition+0x113>
jmp    12a8 <Optition+0x178>
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <Goto@plt>
lea    0xdb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <Goto@plt>
lea    0xd9a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <Goto@plt>
lea    0xd74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <Goto@plt>
lea    0xd60(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x19(%rbp),%eax
cmp    $0x1b,%eax
jne    12c0 <Optition+0x190>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    12c5 <Optition+0x195>
jmp    1180 <Optition+0x50>
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Optition>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,0x8(%rsp)
mov    %r8d,0xc(%rsp)
mov    %ecx,%r13d
mov    %edx,%r14d
mov    %esi,0x10(%rsp)
mov    %edi,%ebx
mov    %edx,%edi
mov    %ebx,%esi
call   1050 <Goto@plt>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    %r13d,%edi
mov    %ebx,%esi
call   1050 <Goto@plt>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,0x14(%rsp)
jmp    11f9 <Optition+0xc9>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14d,%edi
mov    %ebx,%esi
call   1050 <Goto@plt>
lea    0xe65(%rip),%rbp
mov    %rbp,%rdi
call   1030 <printf@plt>
mov    %r13d,%edi
mov    %ebx,%esi
call   1050 <Goto@plt>
mov    %rbp,%rdi
mov    %r13d,%ebp
call   1030 <printf@plt>
add    0x8(%rsp),%ebx
mov    %ebx,%r15d
mov    %r14d,%edi
mov    %ebx,%esi
call   1050 <Goto@plt>
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1050 <Goto@plt>
lea    0xe18(%rip),%rdi
call   1030 <printf@plt>
mov    %r15d,%ebx
cmp    $0x1b,%r12b
je     1272 <Optition+0x142>
xor    %eax,%eax
call   1040 <getch@plt>
mov    %eax,%r12d
cmp    $0x48,%al
je     1230 <Optition+0x100>
cmp    $0xd,%r12b
je     1276 <Optition+0x146>
cmp    $0x50,%r12b
jne    121d <Optition+0xed>
cmp    0x10(%rsp),%ebx
jne    1190 <Optition+0x60>
mov    %ebx,%r15d
jmp    11f0 <Optition+0xc0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x14(%rsp),%eax
mov    %eax,%r15d
cmp    %eax,%ebx
je     11f0 <Optition+0xc0>
mov    %r14d,%edi
mov    %ebx,%esi
call   1050 <Goto@plt>
lea    0xdba(%rip),%rbp
mov    %rbp,%rdi
call   1030 <printf@plt>
mov    %r13d,%edi
mov    %ebx,%esi
call   1050 <Goto@plt>
mov    %rbp,%rdi
mov    %r13d,%ebp
call   1030 <printf@plt>
sub    0x8(%rsp),%ebx
jmp    11c2 <Optition+0x92>
mov    0xc(%rsp),%ebx
mov    %ebx,%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">>\00"
@.str.1 = [3 x i8] c"<<\00"
@.str.2 = [3 x i8] c" \00"
define i32 @Optition(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8
%14 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%15 = load i32, i32* %7
store i32 %15, i32* %14
%16 = load i32, i32* %9
%17 = load i32, i32* %14
%18 = call i32 @Goto(i32 %16, i32 %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* %10
%21 = load i32, i32* %14
%22 = call i32 @Goto(i32 %20, i32 %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %94, %6
%25 = call signext i8 (...) @getch()
store i8 %25, i8* %13
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 13
br i1 %27, label %28, label %95
28: ; preds = %24
br label %29
29: ; preds = %28
%30 = load i8, i8* %13
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 72
br i1 %32, label %33, label %58
33: ; preds = %29
%34 = load i32, i32* %14
%35 = load i32, i32* %7
%36 = icmp eq i32 %34, %35
br i1 %36, label %37, label %38
37: ; preds = %33
br label %58
38: ; preds = %33
%39 = load i32, i32* %9
%40 = load i32, i32* %14
%41 = call i32 @Goto(i32 %39, i32 %40)
%42 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%43 = load i32, i32* %10
%44 = load i32, i32* %14
%45 = call i32 @Goto(i32 %43, i32 %44)
%46 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%47 = load i32, i32* %12
%48 = load i32, i32* %14
%49 = sub nsw i32 %48, %47
store i32 %49, i32* %14
%50 = load i32, i32* %9
%51 = load i32, i32* %14
%52 = call i32 @Goto(i32 %50, i32 %51)
%53 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%54 = load i32, i32* %10
%55 = load i32, i32* %14
%56 = call i32 @Goto(i32 %54, i32 %55)
%57 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %58
58: ; preds = %38, %37, %29
br label %59
59: ; preds = %58
%60 = load i8, i8* %13
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 80
br i1 %62, label %63, label %88
63: ; preds = %59
%64 = load i32, i32* %14
%65 = load i32, i32* %8
%66 = icmp eq i32 %64, %65
br i1 %66, label %67, label %68
67: ; preds = %63
br label %88
68: ; preds = %63
%69 = load i32, i32* %9
%70 = load i32, i32* %14
%71 = call i32 @Goto(i32 %69, i32 %70)
%72 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%73 = load i32, i32* %10
%74 = load i32, i32* %14
%75 = call i32 @Goto(i32 %73, i32 %74)
%76 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%77 = load i32, i32* %12
%78 = load i32, i32* %14
%79 = add nsw i32 %78, %77
store i32 %79, i32* %14
%80 = load i32, i32* %9
%81 = load i32, i32* %14
%82 = call i32 @Goto(i32 %80, i32 %81)
%83 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%84 = load i32, i32* %10
%85 = load i32, i32* %14
%86 = call i32 @Goto(i32 %84, i32 %85)
%87 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %88
88: ; preds = %68, %67, %59
%89 = load i8, i8* %13
%90 = sext i8 %89 to i32
%91 = icmp eq i32 %90, 27
br i1 %91, label %92, label %94
92: ; preds = %88
%93 = load i32, i32* %11
store i32 %93, i32* %14
br label %95
94: ; preds = %88
br label %24
95: ; preds = %92, %24
%96 = load i32, i32* %14
ret i32 %96
}

LLVM IR (-O2):
@.str = [3 x i8] c">>\00"
@.str.1 = [3 x i8] c"<<\00"
@.str.2 = [3 x i8] c" \00"
define i32 @Optition(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @Goto(i32 %2, i32 %0)
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @Goto(i32 %3, i32 %0)
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %38, %6
%12 = phi i32 [ %0, %6 ], [ %39, %38 ]
%13 = tail call signext i8 (...) @getch()
switch i8 %13, label %22 [
i8 13, label %41
i8 72, label %14
]
14: ; preds = %11
%15 = icmp eq i32 %12, %0
br i1 %15, label %38, label %16
16: ; preds = %14
%17 = tail call i32 @Goto(i32 %2, i32 %12)
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32 @Goto(i32 %3, i32 %12)
%20 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = sub nsw i32 %12, %5
br label %32
22: ; preds = %11
%23 = icmp ne i8 %13, 80
%24 = icmp eq i32 %12, %1
%25 = select i1 %23, i1 true, i1 %24
br i1 %25, label %38, label %26
26: ; preds = %22
%27 = tail call i32 @Goto(i32 %2, i32 %12)
%28 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%29 = tail call i32 @Goto(i32 %3, i32 %12)
%30 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%31 = add nsw i32 %12, %5
br label %32
32: ; preds = %26, %16
%33 = phi i32 [ %21, %16 ], [ %31, %26 ]
%34 = tail call i32 @Goto(i32 %2, i32 %33)
%35 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%36 = tail call i32 @Goto(i32 %3, i32 %33)
%37 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %32, %14, %22
%39 = phi i32 [ %12, %22 ], [ %0, %14 ], [ %33, %32 ]
%40 = icmp eq i8 %13, 27
br i1 %40, label %41, label %11
41: ; preds = %38, %11
%42 = phi i32 [ %12, %11 ], [ %4, %38 ]
ret i32 %42
}