#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();
int /*<<< orphan*/ divide();
int /*<<< orphan*/ hello();
int /*<<< orphan*/ help();
int /*<<< orphan*/ multiply();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ quit();
int /*<<< orphan*/ rectangle();
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ subtract();
int main() {
  char cmd[128];
  while (1) {
    scanf("%s", cmd);
    if (strcmp(cmd, "help") == 0) {
      help();
    } else if (strcmp(cmd, "hello") == 0) {
      hello();
    } else if (strcmp(cmd, "quit") == 0) {
      quit();
    } else if (strcmp(cmd, "rectangle") == 0) {
      rectangle();
    } else if (strcmp(cmd, "add") == 0) {
      add();
    } else if (strcmp(cmd, "subtract") == 0) {
      subtract();
    } else if (strcmp(cmd, "multiply") == 0) {
      multiply();
    } else if (strcmp(cmd, "divide") == 0) {
      divide();
    } else {
      printf("Error Command!!\n");
      printf("You can input 'help' to get more information\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rsi
lea    0xe30(%rip),%rdi
call   10b0 <scanf@plt>
lea    -0x90(%rbp),%rdi
lea    0xe20(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    11fe <main+0x4e>
mov    $0x0,%al
call   10d0 <help@plt>
jmp    1358 <main+0x1a8>
lea    -0x90(%rbp),%rdi
lea    0xdfc(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1227 <main+0x77>
mov    $0x0,%al
call   1090 <hello@plt>
jmp    1353 <main+0x1a3>
lea    -0x90(%rbp),%rdi
lea    0xdd9(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1250 <main+0xa0>
mov    $0x0,%al
call   1080 <quit@plt>
jmp    134e <main+0x19e>
lea    -0x90(%rbp),%rdi
lea    0xdb5(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1279 <main+0xc9>
mov    $0x0,%al
call   1050 <rectangle@plt>
jmp    1349 <main+0x199>
lea    -0x90(%rbp),%rdi
lea    0xd96(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    12a2 <main+0xf2>
mov    $0x0,%al
call   1030 <add@plt>
jmp    1344 <main+0x194>
lea    -0x90(%rbp),%rdi
lea    0xd71(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    12cb <main+0x11b>
mov    $0x0,%al
call   10c0 <subtract@plt>
jmp    133f <main+0x18f>
lea    -0x90(%rbp),%rdi
lea    0xd51(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    12f4 <main+0x144>
mov    $0x0,%al
call   1040 <multiply@plt>
jmp    133a <main+0x18a>
lea    -0x90(%rbp),%rdi
lea    0xd31(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    131d <main+0x16d>
mov    $0x0,%al
call   1060 <divide@plt>
jmp    1335 <main+0x185>
lea    0xd16(%rip),%rdi
call   1070 <printf@plt>
lea    0xd1b(%rip),%rdi
call   1070 <printf@plt>
jmp    133a <main+0x18a>
jmp    133f <main+0x18f>
jmp    1344 <main+0x194>
jmp    1349 <main+0x199>
jmp    134e <main+0x19e>
jmp    1353 <main+0x1a3>
jmp    1358 <main+0x1a8>
jmp    11c2 <main+0x12>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xe38(%rip),%r14
mov    %rsp,%rbx
lea    0xe31(%rip),%r15
lea    0xe2f(%rip),%r12
lea    0xe2e(%rip),%r13
lea    0xe2c(%rip),%rbp
jmp    11f7 <main+0x47>
nopl   0x0(%rax)
xor    %eax,%eax
call   10d0 <help@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10b0 <scanf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     11f0 <main+0x40>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     12c0 <main+0x110>
mov    %rbx,%rdi
mov    %r13,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     12cc <main+0x11c>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     12d8 <main+0x128>
mov    %rbx,%rdi
lea    0xdc5(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     12e4 <main+0x134>
mov    %rbx,%rdi
lea    0xdb1(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     12f0 <main+0x140>
mov    %rbx,%rdi
lea    0xda6(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     12fc <main+0x14c>
mov    %rbx,%rdi
lea    0xd9b(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1308 <main+0x158>
lea    0xd91(%rip),%rdi
call   1050 <puts@plt>
lea    0xd95(%rip),%rdi
call   1050 <puts@plt>
jmp    11f7 <main+0x47>
nop
xor    %eax,%eax
call   1090 <hello@plt>
jmp    11f7 <main+0x47>
xor    %eax,%eax
call   1080 <quit@plt>
jmp    11f7 <main+0x47>
xor    %eax,%eax
call   1060 <rectangle@plt>
jmp    11f7 <main+0x47>
xor    %eax,%eax
call   1030 <add@plt>
jmp    11f7 <main+0x47>
xor    %eax,%eax
call   10c0 <subtract@plt>
jmp    11f7 <main+0x47>
xor    %eax,%eax
call   1040 <multiply@plt>
jmp    11f7 <main+0x47>
xor    %eax,%eax
call   1070 <divide@plt>
jmp    11f7 <main+0x47>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [6 x i8] c"hello\00"
@.str.3 = [5 x i8] c"quit\00"
@.str.4 = [10 x i8] c"rectangle\00"
@.str.5 = [4 x i8] c"add\00"
@.str.6 = [9 x i8] c"subtract\00"
@.str.7 = [9 x i8] c"multiply\00"
@.str.8 = [7 x i8] c"divide\00"
@.str.9 = [17 x i8] c"Error Command!!\0A\00"
@.str.10 = [46 x i8] c"You can input 'help' to get more information\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %0, %63
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%7 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 (...) @help()
br label %63
11: ; preds = %3
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 (...) @hello()
br label %62
17: ; preds = %11
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 (...) @quit()
br label %61
23: ; preds = %17
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 (...) @rectangle()
br label %60
29: ; preds = %23
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = call i32 (...) @add()
br label %59
35: ; preds = %29
%36 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = call i32 (...) @subtract()
br label %58
41: ; preds = %35
%42 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%43 = call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %41
%46 = call i32 (...) @multiply()
br label %57
47: ; preds = %41
%48 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %47
%52 = call i32 (...) @divide()
br label %56
53: ; preds = %47
%54 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
%55 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0))
br label %56
56: ; preds = %53, %51
br label %57
57: ; preds = %56, %45
br label %58
58: ; preds = %57, %39
br label %59
59: ; preds = %58, %33
br label %60
60: ; preds = %59, %27
br label %61
61: ; preds = %60, %21
br label %62
62: ; preds = %61, %15
br label %63
63: ; preds = %62, %9
br label %3
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [6 x i8] c"hello\00"
@.str.3 = [5 x i8] c"quit\00"
@.str.4 = [10 x i8] c"rectangle\00"
@.str.5 = [4 x i8] c"add\00"
@.str.6 = [9 x i8] c"subtract\00"
@.str.7 = [9 x i8] c"multiply\00"
@.str.8 = [7 x i8] c"divide\00"
@str = [16 x i8] c"Error Command!!\00"
@str.11 = [45 x i8] c"You can input 'help' to get more information\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %14, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 (...) @help()
br label %14
9: ; preds = %3
%10 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = call i32 (...) @hello()
br label %14
14: ; preds = %12, %23, %33, %43, %45, %38, %28, %18, %7
br label %3
15: ; preds = %9
%16 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (...) @quit()
br label %14
20: ; preds = %15
%21 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (...) @rectangle()
br label %14
25: ; preds = %20
%26 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (...) @add()
br label %14
30: ; preds = %25
%31 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 (...) @subtract()
br label %14
35: ; preds = %30
%36 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 (...) @multiply()
br label %14
40: ; preds = %35
%41 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 (...) @divide()
br label %14
45: ; preds = %40
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.11, i64 0, i64 0))
br label %14
}