#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int main() {
  char cmd[128];
  while (1) {
    scanf("%s", cmd);
    if (strcmp(cmd, "help") == 0) {
      printf("This is help cmd!\n");
    } else if (strcmp(cmd, "quit") == 0) {
      exit(0);
    } else {
      printf("Wrong cmd!\n");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x90(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1193 <main+0x53>
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
jmp    11c8 <main+0x88>
lea    -0x90(%rbp),%rdi
lea    0xe7a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11b7 <main+0x77>
xor    %edi,%edi
call   1060 <exit@plt>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
jmp    11c8 <main+0x88>
jmp    1152 <main+0x12>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xea8(%rip),%r14
mov    %rsp,%rbx
lea    0xea1(%rip),%r15
lea    0xeaf(%rip),%r13
lea    0xe98(%rip),%r12
lea    0xe96(%rip),%rbp
jmp    1185 <main+0x45>
nopl   0x0(%rax)
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
mov    %r13,%rdi
test   %rax,%rax
je     1180 <main+0x40>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <strcmp@plt>
mov    %rbp,%rdi
test   %rax,%rax
jne    1180 <main+0x40>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [19 x i8] c"This is help cmd!\0A\00"
@.str.3 = [5 x i8] c"quit\00"
@.str.4 = [12 x i8] c"Wrong cmd!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %0, %20
%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 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %20
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 ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %11
%18 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %17
br label %20
20: ; preds = %19, %9
br label %3
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"help\00"
@.str.3 = [5 x i8] c"quit\00"
@str = [11 x i8] c"Wrong cmd!\00"
@str.5 = [18 x i8] c"This is help cmd!\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 = %12, %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 %12, label %7
7: ; preds = %3
%8 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %7, %3
%13 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.5, i64 0, i64 0), %3 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0), %7 ]
%14 = call i32 @puts(i8* dereferenceable(1) %13)
br label %3
}