#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*/ calculate();
int /*<<< orphan*/ convert();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ system(char *);
int main(void) {
  int num;
  char sel, dis;
BE:
  system("clear");
  printf("========================\n");
  printf("欢迎使用xiaoliang计算器！\n");
  printf("1、计算\n");
  printf("2、转换\n");
  printf("========================\n");
  printf("\n请选择计算类型:");
  scanf("%d%c", &num, &dis);
  switch (num) {
  case 1:
    calculate();
    break;
  case 2:
    convert();
    break;
  default:
    printf("\n(⊙o⊙)哦，输入有误！\n");
    break;
  }
  printf("\n是否继续(Y/N)?\n");
  scanf("%c%c", &sel, &dis);
  if (sel == 'Y' || sel == 'y')
    goto BE;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1040 <system@plt>
lea    0xe94(%rip),%rdi
mov    %rdi,-0x18(%rbp)
call   1050 <printf@plt>
lea    0xe9e(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <printf@plt>
lea    0xeac(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
lea    -0x8(%rbp),%rsi
lea    -0xa(%rbp),%rdx
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     11ef <main+0x9f>
jmp    11de <main+0x8e>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11fb <main+0xab>
jmp    1207 <main+0xb7>
mov    $0x0,%al
call   1060 <calculate@plt>
jmp    1213 <main+0xc3>
mov    $0x0,%al
call   1030 <convert@plt>
jmp    1213 <main+0xc3>
lea    0xe6a(%rip),%rdi
call   1050 <printf@plt>
lea    0xe7f(%rip),%rdi
call   1050 <printf@plt>
lea    0xe88(%rip),%rdi
lea    -0x9(%rbp),%rsi
lea    -0xa(%rbp),%rdx
mov    $0x0,%al
call   1070 <scanf@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x59,%eax
je     124f <main+0xff>
movsbl -0x9(%rbp),%eax
cmp    $0x79,%eax
jne    1254 <main+0x104>
jmp    115f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeee(%rip),%rbx
lea    0x4(%rsp),%r15
lea    0x3(%rsp),%r12
lea    0xef6(%rip),%r13
lea    0xe99(%rip),%rbp
lea    0x2(%rsp),%r14
jmp    11d3 <main+0x73>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xee6(%rip),%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1080 <scanf@plt>
movzbl 0x2(%rsp),%eax
and    $0xdf,%al
cmp    $0x59,%al
jne    126c <main+0x10c>
lea    0xe26(%rip),%rdi
call   1050 <system@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe3a(%rip),%rdi
call   1040 <puts@plt>
lea    0xe50(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4f(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xdec(%rip),%rdi
call   1060 <printf@plt>
lea    0xdf8(%rip),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1080 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     1260 <main+0x100>
cmp    $0x1,%eax
jne    11a0 <main+0x40>
xor    %eax,%eax
call   1070 <calculate@plt>
jmp    11ac <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <convert@plt>
jmp    11ac <main+0x4c>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [26 x i8] c"========================\0A\00"
@.str.2 = [35 x i8] c"\E6\AC\A2\E8\BF\8E\E4\BD\BF\E7\94\A8xiaoliang\E8\AE\A1\E7\AE\97\E5\99\A8\EF\BC\81\0A\00"
@.str.3 = [12 x i8] c"1\E3\80\81\E8\AE\A1\E7\AE\97\0A\00"
@.str.4 = [12 x i8] c"2\E3\80\81\E8\BD\AC\E6\8D\A2\0A\00"
@.str.5 = [24 x i8] c"\0A\E8\AF\B7\E9\80\89\E6\8B\A9\E8\AE\A1\E7\AE\97\E7\B1\BB\E5\9E\8B:\00"
@.str.6 = [5 x i8] c"%d%c\00"
@.str.7 = [33 x i8] c"\0A(\E2\8A\99o\E2\8A\99)\E5\93\A6\EF\BC\8C\E8\BE\93\E5\85\A5\E6\9C\89\E8\AF\AF\EF\BC\81\0A\00"
@.str.8 = [21 x i8] c"\0A\E6\98\AF\E5\90\A6\E7\BB\A7\E7\BB\AD(Y/N)?\0A\00"
@.str.9 = [5 x i8] c"%c%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
store i32 0, i32* %1
br label %5
5: ; preds = %31, %0
%6 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32* %2, i8* %4)
%14 = load i32, i32* %2
switch i32 %14, label %19 [
i32 1, label %15
i32 2, label %17
]
15: ; preds = %5
%16 = call i32 (...) @calculate()
br label %21
17: ; preds = %5
%18 = call i32 (...) @convert()
br label %21
19: ; preds = %5
%20 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
br label %21
21: ; preds = %19, %17, %15
%22 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %3, i8* %4)
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 89
br i1 %26, label %31, label %27
27: ; preds = %21
%28 = load i8, i8* %3
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 121
br i1 %30, label %31, label %32
31: ; preds = %27, %21
br label %5
32: ; preds = %27
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.5 = [24 x i8] c"\0A\E8\AF\B7\E9\80\89\E6\8B\A9\E8\AE\A1\E7\AE\97\E7\B1\BB\E5\9E\8B:\00"
@.str.6 = [5 x i8] c"%d%c\00"
@.str.9 = [5 x i8] c"%c%c\00"
@str.10 = [34 x i8] c"\E6\AC\A2\E8\BF\8E\E4\BD\BF\E7\94\A8xiaoliang\E8\AE\A1\E7\AE\97\E5\99\A8\EF\BC\81\00"
@str.11 = [11 x i8] c"1\E3\80\81\E8\AE\A1\E7\AE\97\00"
@str.12 = [11 x i8] c"2\E3\80\81\E8\BD\AC\E6\8D\A2\00"
@str.13 = [25 x i8] c"========================\00"
@str.14 = [20 x i8] c"\0A\E6\98\AF\E5\90\A6\E7\BB\A7\E7\BB\AD(Y/N)?\00"
@str.15 = [32 x i8] c"\0A(\E2\8A\99o\E2\8A\99)\E5\93\A6\EF\BC\8C\E8\BE\93\E5\85\A5\E6\9C\89\E8\AF\AF\EF\BC\81\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = bitcast i32* %1 to i8*
br label %5
5: ; preds = %21, %0
%6 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.13, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.10, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.11, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.12, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.13, i64 0, i64 0))
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32* %1, i8* %3)
%14 = load i32, i32* %1
switch i32 %14, label %19 [
i32 1, label %15
i32 2, label %17
]
15: ; preds = %5
%16 = call i32 (...) @calculate()
br label %21
17: ; preds = %5
%18 = call i32 (...) @convert()
br label %21
19: ; preds = %5
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.15, i64 0, i64 0))
br label %21
21: ; preds = %19, %17, %15
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.14, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %2, i8* %3)
%24 = load i8, i8* %2
%25 = and i8 %24, -33
%26 = icmp eq i8 %25, 89
br i1 %26, label %5, label %27
27: ; preds = %21
ret i32 0
}