#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*/ RemoveById();
int /*<<< orphan*/ RemoveByName();
int /*<<< orphan*/ ShowInputTypeError();
int /*<<< orphan*/ ShowRemoveSuccess();
int /*<<< orphan*/ ToMainScreen();
int /*<<< orphan*/ ToRemoveScreen();
int /*<<< orphan*/ WantEnter();
int WantNum();
int RemoveGoods() {
  ToRemoveScreen();
  int type = -1;
  while (type < 0 || type > 2) {
    type = WantNum();
    switch (type) {
    case 1:
      if (RemoveById())
        return 0;
      break;
    case 2:
      if (RemoveByName())
        return 0;
      break;
    case 0:
      ToMainScreen();
      return 1;
    default: {
      ShowInputTypeError();
      WantEnter();
      ToRemoveScreen();
    }
    }
  }
  ShowRemoveSuccess();
  WantEnter();
  return 0;
}


x86 assembly (clang, -O0):
<RemoveGoods>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   10a0 <ToRemoveScreen@plt>
movl   $0xffffffff,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     11af <RemoveGoods+0x2f>
cmpl   $0x2,-0x8(%rbp)
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    11bf <RemoveGoods+0x3f>
jmp    126d <RemoveGoods+0xed>
xor    %eax,%eax
call   1060 <WantNum@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1240 <RemoveGoods+0xc0>
jmp    11dc <RemoveGoods+0x5c>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     11fe <RemoveGoods+0x7e>
jmp    11ed <RemoveGoods+0x6d>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     121f <RemoveGoods+0x9f>
jmp    1253 <RemoveGoods+0xd3>
mov    $0x0,%al
call   1070 <RemoveById@plt>
cmp    $0x0,%eax
je     121a <RemoveGoods+0x9a>
movl   $0x0,-0x4(%rbp)
jmp    1282 <RemoveGoods+0x102>
jmp    1268 <RemoveGoods+0xe8>
mov    $0x0,%al
call   1080 <RemoveByName@plt>
cmp    $0x0,%eax
je     123b <RemoveGoods+0xbb>
movl   $0x0,-0x4(%rbp)
jmp    1282 <RemoveGoods+0x102>
jmp    1268 <RemoveGoods+0xe8>
mov    $0x0,%al
call   1050 <ToMainScreen@plt>
movl   $0x1,-0x4(%rbp)
jmp    1282 <RemoveGoods+0x102>
mov    $0x0,%al
call   1030 <ShowInputTypeError@plt>
mov    $0x0,%al
call   1090 <WantEnter@plt>
mov    $0x0,%al
call   10a0 <ToRemoveScreen@plt>
jmp    1196 <RemoveGoods+0x16>
mov    $0x0,%al
call   1040 <ShowRemoveSuccess@plt>
mov    $0x0,%al
call   1090 <WantEnter@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RemoveGoods>:
push   %rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10a0 <ToRemoveScreen@plt>
xor    %eax,%eax
call   1060 <WantNum@plt>
test   %eax,%eax
je     11bc <RemoveGoods+0x3c>
cmp    $0x2,%eax
je     11ca <RemoveGoods+0x4a>
cmp    $0x1,%eax
je     11d9 <RemoveGoods+0x59>
xor    %eax,%eax
call   1030 <ShowInputTypeError@plt>
xor    %eax,%eax
call   1090 <WantEnter@plt>
jmp    1190 <RemoveGoods+0x10>
xor    %eax,%eax
call   1050 <ToMainScreen@plt>
mov    $0x1,%ebx
jmp    11f6 <RemoveGoods+0x76>
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <RemoveByName@plt>
test   %eax,%eax
jne    11f6 <RemoveGoods+0x76>
jmp    11e6 <RemoveGoods+0x66>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <RemoveById@plt>
test   %eax,%eax
jne    11f6 <RemoveGoods+0x76>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <ShowRemoveSuccess@plt>
xor    %eax,%eax
call   1090 <WantEnter@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @RemoveGoods() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @ToRemoveScreen()
store i32 -1, i32* %2
br label %4
4: ; preds = %31, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 2
br label %10
10: ; preds = %7, %4
%11 = phi i1 [ true, %4 ], [ %9, %7 ]
br i1 %11, label %12, label %32
12: ; preds = %10
%13 = call i32 (...) @WantNum()
store i32 %13, i32* %2
%14 = load i32, i32* %2
switch i32 %14, label %27 [
i32 1, label %15
i32 2, label %20
i32 0, label %25
]
15: ; preds = %12
%16 = call i32 (...) @RemoveById()
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 0, i32* %1
br label %35
19: ; preds = %15
br label %31
20: ; preds = %12
%21 = call i32 (...) @RemoveByName()
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 0, i32* %1
br label %35
24: ; preds = %20
br label %31
25: ; preds = %12
%26 = call i32 (...) @ToMainScreen()
store i32 1, i32* %1
br label %35
27: ; preds = %12
%28 = call i32 (...) @ShowInputTypeError()
%29 = call i32 (...) @WantEnter()
%30 = call i32 (...) @ToRemoveScreen()
br label %31
31: ; preds = %27, %24, %19
br label %4
32: ; preds = %10
%33 = call i32 (...) @ShowRemoveSuccess()
%34 = call i32 (...) @WantEnter()
store i32 0, i32* %1
br label %35
35: ; preds = %32, %25, %23, %18
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
define i32 @RemoveGoods() {
br label %1
1: ; preds = %12, %0
%2 = tail call i32 (...) @ToRemoveScreen()
%3 = tail call i32 (...) @WantNum()
switch i32 %3, label %12 [
i32 1, label %4
i32 2, label %7
i32 0, label %10
]
4: ; preds = %1
%5 = tail call i32 (...) @RemoveById()
%6 = icmp eq i32 %5, 0
br i1 %6, label %15, label %18
7: ; preds = %1
%8 = tail call i32 (...) @RemoveByName()
%9 = icmp eq i32 %8, 0
br i1 %9, label %15, label %18
10: ; preds = %1
%11 = tail call i32 (...) @ToMainScreen()
br label %18
12: ; preds = %1
%13 = tail call i32 (...) @ShowInputTypeError()
%14 = tail call i32 (...) @WantEnter()
br label %1
15: ; preds = %7, %4
%16 = tail call i32 (...) @ShowRemoveSuccess()
%17 = tail call i32 (...) @WantEnter()
br label %18
18: ; preds = %7, %4, %15, %10
%19 = phi i32 [ 1, %10 ], [ 0, %15 ], [ 0, %4 ], [ 0, %7 ]
ret i32 %19
}