#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 */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int getCmdIndex(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ runCMD(int);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ wait(int /*<<< orphan*/);
int main() {
  pid_t pid;
  char cmdStr[20];
  int cmdIndex;
  while (1) {
    printf("\n-------F : Please Input your command  -------\nuser&:");
    scanf("%s", cmdStr);
    cmdIndex = getCmdIndex(cmdStr);
    runCMD(cmdIndex);
    wait(0);
    printf("-------F :  waiting for next  command -------\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <getCmdIndex@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
call   1060 <runCMD@plt>
xor    %edi,%edi
call   1070 <wait@plt>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
jmp    115f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe8e(%rip),%r14
lea    0xebd(%rip),%r15
mov    %rsp,%rbx
lea    0xeb6(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1050 <getCmdIndex@plt>
mov    %eax,%edi
call   1070 <runCMD@plt>
xor    %edi,%edi
call   1080 <wait@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
jmp    1190 <main+0x30>

LLVM IR (-O0):
@.str = [54 x i8] c"\0A-------F : Please Input your command -------\0Auser&:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [47 x i8] c"-------F : waiting for next command -------\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i8]
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %0, %5
%6 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%10 = call i32 @getCmdIndex(i8* %9)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = call i32 @runCMD(i32 %11)
%13 = call i32 @wait(i32 0)
%14 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
br label %5
}

LLVM IR (-O2):
@.str = [54 x i8] c"\0A-------F : Please Input your command -------\0Auser&:\00"
@.str.1 = [3 x i8] c"%s\00"
@str = [46 x i8] c"-------F : waiting for next command -------\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %3, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = call i32 @getCmdIndex(i8* %2)
%7 = call i32 @runCMD(i32 %6)
%8 = call i32 @wait(i32 0)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
br label %3
}