#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*/ add_node();
int atoi(char *);
int /*<<< orphan*/ del_node();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fgets_eof(char *, int);
int /*<<< orphan*/ init_auto();
int /*<<< orphan*/ make_step();
int /*<<< orphan*/ mark_final();
int /*<<< orphan*/ print_help();
scalar_t__ print_menu();
int /*<<< orphan*/ set_start();
int /*<<< orphan*/ test_input();
int /*<<< orphan*/ view_status();
int main() {
  char linebuf[0x100];
  init_auto();
  print_help();
  while (print_menu()) {
    fgets_eof(linebuf, 0x100);
    switch (atoi(linebuf)) {
    case 1:
      add_node();
      break;
    case 2:
      del_node();
      break;
    case 3:
      make_step();
      break;
    case 4:
      set_start();
      break;
    case 5:
      mark_final();
      break;
    case 6:
      view_status();
      break;
    case 7:
      test_input();
      break;
    case 8:
      exit(0);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   10a0 <init_auto@plt>
mov    $0x0,%al
call   10e0 <print_help@plt>
mov    $0x0,%al
call   1080 <print_menu@plt>
cmp    $0x0,%rax
je     12b1 <main+0xe1>
lea    -0x110(%rbp),%rdi
mov    %rdi,-0x120(%rbp)
mov    $0x100,%esi
call   10c0 <fgets_eof@plt>
mov    -0x120(%rbp),%rdi
call   10d0 <atoi@plt>
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x118(%rbp)
sub    $0x7,%eax
ja     12ac <main+0xdc>
mov    -0x118(%rbp),%rax
lea    0xdb8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1070 <add_node@plt>
jmp    12ac <main+0xdc>
mov    $0x0,%al
call   10b0 <del_node@plt>
jmp    12ac <main+0xdc>
mov    $0x0,%al
call   1030 <make_step@plt>
jmp    12ac <main+0xdc>
mov    $0x0,%al
call   1050 <set_start@plt>
jmp    12ac <main+0xdc>
mov    $0x0,%al
call   1090 <mark_final@plt>
jmp    12ac <main+0xdc>
mov    $0x0,%al
call   1040 <view_status@plt>
jmp    12ac <main+0xdc>
mov    $0x0,%al
call   1060 <test_input@plt>
jmp    12ac <main+0xdc>
xor    %edi,%edi
call   10f0 <exit@plt>
jmp    11f0 <main+0x20>
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x108,%rsp
xor    %eax,%eax
call   10a0 <init_auto@plt>
xor    %eax,%eax
call   10e0 <print_help@plt>
xor    %eax,%eax
call   1080 <print_menu@plt>
test   %rax,%rax
je     1278 <main+0xa8>
mov    %rsp,%rbx
lea    0xdfe(%rip),%r14
jmp    121c <main+0x4c>
xor    %eax,%eax
call   1070 <add_node@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1080 <print_menu@plt>
test   %rax,%rax
je     1278 <main+0xa8>
mov    %rbx,%rdi
mov    $0x100,%esi
call   10c0 <fgets_eof@plt>
mov    %rbx,%rdi
call   10d0 <atoi@plt>
add    $0xffffffff,%eax
cmp    $0x7,%eax
ja     1210 <main+0x40>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
xor    %eax,%eax
call   10b0 <del_node@plt>
jmp    1210 <main+0x40>
xor    %eax,%eax
call   1030 <make_step@plt>
jmp    1210 <main+0x40>
xor    %eax,%eax
call   1050 <set_start@plt>
jmp    1210 <main+0x40>
xor    %eax,%eax
call   1090 <mark_final@plt>
jmp    1210 <main+0x40>
xor    %eax,%eax
call   1040 <view_status@plt>
jmp    1210 <main+0x40>
xor    %eax,%eax
call   1060 <test_input@plt>
jmp    1210 <main+0x40>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret
xor    %edi,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
store i32 0, i32* %1
%3 = call i32 (...) @init_auto()
%4 = call i32 (...) @print_help()
br label %5
5: ; preds = %29, %0
%6 = call i64 (...) @print_menu()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %30
8: ; preds = %5
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%10 = call i32 @fgets_eof(i8* %9, i32 256)
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%12 = call i32 @atoi(i8* %11)
switch i32 %12, label %29 [
i32 1, label %13
i32 2, label %15
i32 3, label %17
i32 4, label %19
i32 5, label %21
i32 6, label %23
i32 7, label %25
i32 8, label %27
]
13: ; preds = %8
%14 = call i32 (...) @add_node()
br label %29
15: ; preds = %8
%16 = call i32 (...) @del_node()
br label %29
17: ; preds = %8
%18 = call i32 (...) @make_step()
br label %29
19: ; preds = %8
%20 = call i32 (...) @set_start()
br label %29
21: ; preds = %8
%22 = call i32 (...) @mark_final()
br label %29
23: ; preds = %8
%24 = call i32 (...) @view_status()
br label %29
25: ; preds = %8
%26 = call i32 (...) @test_input()
br label %29
27: ; preds = %8
%28 = call i32 @exit(i32 0)
unreachable
29: ; preds = %8, %25, %23, %21, %19, %17, %15, %13
br label %5
30: ; preds = %5
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @init_auto()
%4 = tail call i32 (...) @print_help()
%5 = call i64 (...) @print_menu()
%6 = icmp eq i64 %5, 0
br i1 %6, label %29, label %7
7: ; preds = %0, %26
%8 = call i32 @fgets_eof(i8* %2, i32 256)
%9 = call i32 @atoi(i8* %2)
switch i32 %9, label %26 [
i32 1, label %10
i32 2, label %12
i32 3, label %14
i32 4, label %16
i32 5, label %18
i32 6, label %20
i32 7, label %22
i32 8, label %24
]
10: ; preds = %7
%11 = call i32 (...) @add_node()
br label %26
12: ; preds = %7
%13 = call i32 (...) @del_node()
br label %26
14: ; preds = %7
%15 = call i32 (...) @make_step()
br label %26
16: ; preds = %7
%17 = call i32 (...) @set_start()
br label %26
18: ; preds = %7
%19 = call i32 (...) @mark_final()
br label %26
20: ; preds = %7
%21 = call i32 (...) @view_status()
br label %26
22: ; preds = %7
%23 = call i32 (...) @test_input()
br label %26
24: ; preds = %7
%25 = call i32 @exit(i32 0)
unreachable
26: ; preds = %7, %22, %20, %18, %16, %14, %12, %10
%27 = call i64 (...) @print_menu()
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %7
29: ; preds = %26, %0
ret i32 0
}