#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*/ ChangeGoods();
int /*<<< orphan*/ Loggin2S();
int /*<<< orphan*/ LogginGoods();
int /*<<< orphan*/ QueryGoods();
int /*<<< orphan*/ RemoveGoods();
int /*<<< orphan*/ SayHello();
int /*<<< orphan*/ ShowHelp();
int /*<<< orphan*/ ShowInputTypeError();
int /*<<< orphan*/ ShowMainMenu();
int /*<<< orphan*/ StatisGoods();
int /*<<< orphan*/ ToMainScreen();
int /*<<< orphan*/ TypeError(int /*<<< orphan*/);
int /*<<< orphan*/ TypeLongError(int /*<<< orphan*/);
int /*<<< orphan*/ TypeNullError(int /*<<< orphan*/);
int /*<<< orphan*/ WantEnter();
int WantNum();
int /*<<< orphan*/ system(char *);
int ListenMainKey() {
  int op;
  op = WantNum();
  switch (op) {
  case -1:
    system("clear");
    SayHello();
    ;
    TypeError(0);
    ShowMainMenu();
    return 0;
    ;
  case -2:
    system("clear");
    SayHello();
    ;
    TypeNullError(0);
    ShowMainMenu();
    return 0;
    ;
  case -3:
    system("clear");
    SayHello();
    ;
    TypeLongError(0);
    ShowMainMenu();
    return 0;
    ;
  }
  switch (op) {
  case 1:
    while (!LogginGoods()) {
    };
    ;
    break;
    ;
  case 2:
    while (!ChangeGoods()) {
    };
    ;
    break;
    ;
  case 3:
    while (!RemoveGoods()) {
    };
    ;
    break;
    ;
  case 4:
    while (!Loggin2S()) {
    };
    ;
    break;
    ;
  case 5:
    while (!QueryGoods()) {
    };
    ;
    break;
    ;
  case 6:
    while (!StatisGoods()) {
    };
    ;
    break;
    ;
  case 7:
    ShowHelp();
    break;
    ;
  case 0:
    return 1;
    break;
    ;
  default:
    ShowInputTypeError();
    WantEnter();
    ToMainScreen();
    return 0;
    ;
  };
  return 0;
}


x86 assembly (clang, -O0):
<ListenMainKey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
call   10e0 <WantNum@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0xfffffffd,%eax
je     12b2 <ListenMainKey+0xa2>
jmp    1236 <ListenMainKey+0x26>
mov    -0xc(%rbp),%eax
sub    $0xfffffffe,%eax
je     1285 <ListenMainKey+0x75>
jmp    1247 <ListenMainKey+0x37>
mov    -0xc(%rbp),%eax
sub    $0xffffffff,%eax
jne    12df <ListenMainKey+0xcf>
jmp    1258 <ListenMainKey+0x48>
lea    0xdc1(%rip),%rdi
call   1080 <system@plt>
mov    $0x0,%al
call   10c0 <SayHello@plt>
xor    %edi,%edi
call   10f0 <TypeError@plt>
mov    $0x0,%al
call   1030 <ShowMainMenu@plt>
movl   $0x0,-0x4(%rbp)
jmp    1446 <ListenMainKey+0x236>
lea    0xd94(%rip),%rdi
call   1080 <system@plt>
mov    $0x0,%al
call   10c0 <SayHello@plt>
xor    %edi,%edi
call   1130 <TypeNullError@plt>
mov    $0x0,%al
call   1030 <ShowMainMenu@plt>
movl   $0x0,-0x4(%rbp)
jmp    1446 <ListenMainKey+0x236>
lea    0xd67(%rip),%rdi
call   1080 <system@plt>
mov    $0x0,%al
call   10c0 <SayHello@plt>
xor    %edi,%edi
call   1090 <TypeLongError@plt>
mov    $0x0,%al
call   1030 <ShowMainMenu@plt>
movl   $0x0,-0x4(%rbp)
jmp    1446 <ListenMainKey+0x236>
mov    -0x8(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x7,%rax
ja     141e <ListenMainKey+0x20e>
mov    -0x18(%rbp),%rax
lea    0xd05(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1309 <ListenMainKey+0xf9>
mov    $0x0,%al
call   1120 <LogginGoods@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1325 <ListenMainKey+0x115>
jmp    132a <ListenMainKey+0x11a>
jmp    1309 <ListenMainKey+0xf9>
jmp    143f <ListenMainKey+0x22f>
jmp    1334 <ListenMainKey+0x124>
mov    $0x0,%al
call   1060 <ChangeGoods@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1350 <ListenMainKey+0x140>
jmp    1355 <ListenMainKey+0x145>
jmp    1334 <ListenMainKey+0x124>
jmp    143f <ListenMainKey+0x22f>
jmp    135f <ListenMainKey+0x14f>
mov    $0x0,%al
call   1050 <RemoveGoods@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    137b <ListenMainKey+0x16b>
jmp    1380 <ListenMainKey+0x170>
jmp    135f <ListenMainKey+0x14f>
jmp    143f <ListenMainKey+0x22f>
jmp    138a <ListenMainKey+0x17a>
mov    $0x0,%al
call   10a0 <Loggin2S@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13a6 <ListenMainKey+0x196>
jmp    13ab <ListenMainKey+0x19b>
jmp    138a <ListenMainKey+0x17a>
jmp    143f <ListenMainKey+0x22f>
jmp    13b5 <ListenMainKey+0x1a5>
mov    $0x0,%al
call   10b0 <QueryGoods@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13d1 <ListenMainKey+0x1c1>
jmp    13d6 <ListenMainKey+0x1c6>
jmp    13b5 <ListenMainKey+0x1a5>
jmp    143f <ListenMainKey+0x22f>
jmp    13e0 <ListenMainKey+0x1d0>
mov    $0x0,%al
call   1110 <StatisGoods@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13fc <ListenMainKey+0x1ec>
jmp    1401 <ListenMainKey+0x1f1>
jmp    13e0 <ListenMainKey+0x1d0>
jmp    143f <ListenMainKey+0x22f>
mov    $0x0,%al
call   1070 <ShowHelp@plt>
jmp    143f <ListenMainKey+0x22f>
movl   $0x1,-0x4(%rbp)
jmp    1446 <ListenMainKey+0x236>
mov    $0x0,%al
call   1040 <ShowInputTypeError@plt>
mov    $0x0,%al
call   1100 <WantEnter@plt>
mov    $0x0,%al
call   10d0 <ToMainScreen@plt>
movl   $0x0,-0x4(%rbp)
jmp    1446 <ListenMainKey+0x236>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ListenMainKey>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   10e0 <WantNum@plt>
add    $0x3,%eax
cmp    $0xa,%eax
ja     1255 <ListenMainKey+0x45>
mov    $0x1,%ebx
lea    0xdd2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xdee(%rip),%rdi
call   1080 <system@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   10c0 <SayHello@plt>
xor    %edi,%edi
call   1090 <TypeLongError@plt>
jmp    12a9 <ListenMainKey+0x99>
xor    %eax,%eax
call   1040 <ShowInputTypeError@plt>
xor    %eax,%eax
call   1100 <WantEnter@plt>
xor    %eax,%eax
call   10d0 <ToMainScreen@plt>
jmp    1326 <ListenMainKey+0x116>
lea    0xdb6(%rip),%rdi
call   1080 <system@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   10c0 <SayHello@plt>
xor    %edi,%edi
call   1130 <TypeNullError@plt>
jmp    12a9 <ListenMainKey+0x99>
lea    0xd98(%rip),%rdi
call   1080 <system@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   10c0 <SayHello@plt>
xor    %edi,%edi
call   10f0 <TypeError@plt>
xor    %eax,%eax
call   1030 <ShowMainMenu@plt>
jmp    1326 <ListenMainKey+0x116>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1120 <LogginGoods@plt>
test   %eax,%eax
je     12c0 <ListenMainKey+0xb0>
jmp    1326 <ListenMainKey+0x116>
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1060 <ChangeGoods@plt>
test   %eax,%eax
je     12d0 <ListenMainKey+0xc0>
jmp    1326 <ListenMainKey+0x116>
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1050 <RemoveGoods@plt>
test   %eax,%eax
je     12e0 <ListenMainKey+0xd0>
jmp    1326 <ListenMainKey+0x116>
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   10a0 <Loggin2S@plt>
test   %eax,%eax
je     12f0 <ListenMainKey+0xe0>
jmp    1326 <ListenMainKey+0x116>
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   10b0 <QueryGoods@plt>
test   %eax,%eax
je     1300 <ListenMainKey+0xf0>
jmp    1326 <ListenMainKey+0x116>
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1110 <StatisGoods@plt>
test   %eax,%eax
je     1310 <ListenMainKey+0x100>
jmp    1326 <ListenMainKey+0x116>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <ShowHelp@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
define i32 @ListenMainKey() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @WantNum()
store i32 %3, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %20 [
i32 -1, label %5
i32 -2, label %10
i32 -3, label %15
]
5: ; preds = %0
%6 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @SayHello()
%8 = call i32 @TypeError(i32 0)
%9 = call i32 (...) @ShowMainMenu()
store i32 0, i32* %1
br label %72
10: ; preds = %0
%11 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (...) @SayHello()
%13 = call i32 @TypeNullError(i32 0)
%14 = call i32 (...) @ShowMainMenu()
store i32 0, i32* %1
br label %72
15: ; preds = %0
%16 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%17 = call i32 (...) @SayHello()
%18 = call i32 @TypeLongError(i32 0)
%19 = call i32 (...) @ShowMainMenu()
store i32 0, i32* %1
br label %72
20: ; preds = %0
%21 = load i32, i32* %2
switch i32 %21, label %67 [
i32 1, label %22
i32 2, label %29
i32 3, label %36
i32 4, label %43
i32 5, label %50
i32 6, label %57
i32 7, label %64
i32 0, label %66
]
22: ; preds = %20
br label %23
23: ; preds = %27, %22
%24 = call i32 (...) @LogginGoods()
%25 = icmp ne i32 %24, 0
%26 = xor i1 %25, true
br i1 %26, label %27, label %28
27: ; preds = %23
br label %23
28: ; preds = %23
br label %71
29: ; preds = %20
br label %30
30: ; preds = %34, %29
%31 = call i32 (...) @ChangeGoods()
%32 = icmp ne i32 %31, 0
%33 = xor i1 %32, true
br i1 %33, label %34, label %35
34: ; preds = %30
br label %30
35: ; preds = %30
br label %71
36: ; preds = %20
br label %37
37: ; preds = %41, %36
%38 = call i32 (...) @RemoveGoods()
%39 = icmp ne i32 %38, 0
%40 = xor i1 %39, true
br i1 %40, label %41, label %42
41: ; preds = %37
br label %37
42: ; preds = %37
br label %71
43: ; preds = %20
br label %44
44: ; preds = %48, %43
%45 = call i32 (...) @Loggin2S()
%46 = icmp ne i32 %45, 0
%47 = xor i1 %46, true
br i1 %47, label %48, label %49
48: ; preds = %44
br label %44
49: ; preds = %44
br label %71
50: ; preds = %20
br label %51
51: ; preds = %55, %50
%52 = call i32 (...) @QueryGoods()
%53 = icmp ne i32 %52, 0
%54 = xor i1 %53, true
br i1 %54, label %55, label %56
55: ; preds = %51
br label %51
56: ; preds = %51
br label %71
57: ; preds = %20
br label %58
58: ; preds = %62, %57
%59 = call i32 (...) @StatisGoods()
%60 = icmp ne i32 %59, 0
%61 = xor i1 %60, true
br i1 %61, label %62, label %63
62: ; preds = %58
br label %58
63: ; preds = %58
br label %71
64: ; preds = %20
%65 = call i32 (...) @ShowHelp()
br label %71
66: ; preds = %20
store i32 1, i32* %1
br label %72
67: ; preds = %20
%68 = call i32 (...) @ShowInputTypeError()
%69 = call i32 (...) @WantEnter()
%70 = call i32 (...) @ToMainScreen()
store i32 0, i32* %1
br label %72
71: ; preds = %64, %63, %56, %49, %42, %35, %28
store i32 0, i32* %1
br label %72
72: ; preds = %71, %67, %66, %15, %10, %5
%73 = load i32, i32* %1
ret i32 %73
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define i32 @ListenMainKey() {
%1 = tail call i32 (...) @WantNum()
switch i32 %1, label %37 [
i32 -1, label %2
i32 -2, label %7
i32 -3, label %12
i32 1, label %17
i32 2, label %20
i32 3, label %23
i32 4, label %26
i32 5, label %29
i32 6, label %32
i32 7, label %35
i32 0, label %41
]
2: ; preds = %0
%3 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @SayHello()
%5 = tail call i32 @TypeError(i32 0)
%6 = tail call i32 (...) @ShowMainMenu()
br label %41
7: ; preds = %0
%8 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 (...) @SayHello()
%10 = tail call i32 @TypeNullError(i32 0)
%11 = tail call i32 (...) @ShowMainMenu()
br label %41
12: ; preds = %0
%13 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32 (...) @SayHello()
%15 = tail call i32 @TypeLongError(i32 0)
%16 = tail call i32 (...) @ShowMainMenu()
br label %41
17: ; preds = %0, %17
%18 = tail call i32 (...) @LogginGoods()
%19 = icmp eq i32 %18, 0
br i1 %19, label %17, label %41
20: ; preds = %0, %20
%21 = tail call i32 (...) @ChangeGoods()
%22 = icmp eq i32 %21, 0
br i1 %22, label %20, label %41
23: ; preds = %0, %23
%24 = tail call i32 (...) @RemoveGoods()
%25 = icmp eq i32 %24, 0
br i1 %25, label %23, label %41
26: ; preds = %0, %26
%27 = tail call i32 (...) @Loggin2S()
%28 = icmp eq i32 %27, 0
br i1 %28, label %26, label %41
29: ; preds = %0, %29
%30 = tail call i32 (...) @QueryGoods()
%31 = icmp eq i32 %30, 0
br i1 %31, label %29, label %41
32: ; preds = %0, %32
%33 = tail call i32 (...) @StatisGoods()
%34 = icmp eq i32 %33, 0
br i1 %34, label %32, label %41
35: ; preds = %0
%36 = tail call i32 (...) @ShowHelp()
br label %41
37: ; preds = %0
%38 = tail call i32 (...) @ShowInputTypeError()
%39 = tail call i32 (...) @WantEnter()
%40 = tail call i32 (...) @ToMainScreen()
br label %41
41: ; preds = %32, %29, %26, %23, %20, %17, %35, %0, %37, %12, %7, %2
%42 = phi i32 [ 0, %37 ], [ 0, %12 ], [ 0, %7 ], [ 0, %2 ], [ 1, %0 ], [ 0, %35 ], [ 0, %17 ], [ 0, %20 ], [ 0, %23 ], [ 0, %26 ], [ 0, %29 ], [ 0, %32 ]
ret i32 %42
}