#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*/ PrintIdCount();
int /*<<< orphan*/ PrintSumCount();
int /*<<< orphan*/ ShowInputTypeError();
int /*<<< orphan*/ ToMainScreen();
int /*<<< orphan*/ ToStatisScreen();
int /*<<< orphan*/ WantEnter();
int WantNum();
int StatisGoods() {
  ToStatisScreen();
  int type = -1;
  while (type < 0 || type > 2) {
    type = WantNum();
    switch (type) {
    case 1:
      PrintSumCount();
      break;
    case 2:
      PrintIdCount();
      break;
    case 0:
      ToMainScreen();
      return 1;
    default: {
      ShowInputTypeError();
      WantEnter();
      ToStatisScreen();
    }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<StatisGoods>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1090 <ToStatisScreen@plt>
movl   $0xffffffff,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     119f <StatisGoods+0x2f>
cmpl   $0x2,-0x8(%rbp)
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    11af <StatisGoods+0x3f>
jmp    1233 <StatisGoods+0xc3>
xor    %eax,%eax
call   1060 <WantNum@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1206 <StatisGoods+0x96>
jmp    11cc <StatisGoods+0x5c>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     11ee <StatisGoods+0x7e>
jmp    11dd <StatisGoods+0x6d>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11fa <StatisGoods+0x8a>
jmp    1219 <StatisGoods+0xa9>
mov    $0x0,%al
call   1070 <PrintSumCount@plt>
jmp    122e <StatisGoods+0xbe>
mov    $0x0,%al
call   1030 <PrintIdCount@plt>
jmp    122e <StatisGoods+0xbe>
mov    $0x0,%al
call   1050 <ToMainScreen@plt>
movl   $0x1,-0x4(%rbp)
jmp    123a <StatisGoods+0xca>
mov    $0x0,%al
call   1040 <ShowInputTypeError@plt>
mov    $0x0,%al
call   1080 <WantEnter@plt>
mov    $0x0,%al
call   1090 <ToStatisScreen@plt>
jmp    1186 <StatisGoods+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StatisGoods>:
push   %rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1090 <ToStatisScreen@plt>
xor    %eax,%eax
call   1060 <WantNum@plt>
test   %eax,%eax
je     11ac <StatisGoods+0x3c>
cmp    $0x2,%eax
je     11ba <StatisGoods+0x4a>
cmp    $0x1,%eax
je     11c5 <StatisGoods+0x55>
xor    %eax,%eax
call   1040 <ShowInputTypeError@plt>
xor    %eax,%eax
call   1080 <WantEnter@plt>
jmp    1180 <StatisGoods+0x10>
xor    %eax,%eax
call   1050 <ToMainScreen@plt>
mov    $0x1,%ebx
jmp    11ce <StatisGoods+0x5e>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <PrintIdCount@plt>
jmp    11ce <StatisGoods+0x5e>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <PrintSumCount@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @StatisGoods() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @ToStatisScreen()
store i32 -1, i32* %2
br label %4
4: ; preds = %25, %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 %26
12: ; preds = %10
%13 = call i32 (...) @WantNum()
store i32 %13, i32* %2
%14 = load i32, i32* %2
switch i32 %14, label %21 [
i32 1, label %15
i32 2, label %17
i32 0, label %19
]
15: ; preds = %12
%16 = call i32 (...) @PrintSumCount()
br label %25
17: ; preds = %12
%18 = call i32 (...) @PrintIdCount()
br label %25
19: ; preds = %12
%20 = call i32 (...) @ToMainScreen()
store i32 1, i32* %1
br label %27
21: ; preds = %12
%22 = call i32 (...) @ShowInputTypeError()
%23 = call i32 (...) @WantEnter()
%24 = call i32 (...) @ToStatisScreen()
br label %25
25: ; preds = %21, %17, %15
br label %4
26: ; preds = %10
store i32 0, i32* %1
br label %27
27: ; preds = %26, %19
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
define i32 @StatisGoods() {
br label %1
1: ; preds = %10, %0
%2 = tail call i32 (...) @ToStatisScreen()
%3 = tail call i32 (...) @WantNum()
switch i32 %3, label %10 [
i32 1, label %4
i32 2, label %6
i32 0, label %8
]
4: ; preds = %1
%5 = tail call i32 (...) @PrintSumCount()
br label %13
6: ; preds = %1
%7 = tail call i32 (...) @PrintIdCount()
br label %13
8: ; preds = %1
%9 = tail call i32 (...) @ToMainScreen()
br label %13
10: ; preds = %1
%11 = tail call i32 (...) @ShowInputTypeError()
%12 = tail call i32 (...) @WantEnter()
br label %1
13: ; preds = %4, %6, %8
%14 = phi i32 [ 1, %8 ], [ 0, %6 ], [ 0, %4 ]
ret i32 %14
}