#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*/ motd();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ quit(int *);
scalar_t__ strcmp(char *, char *);
char *strsep(char **, char *);
void clinterp(int *loop, char *uinput) {
  char *fname = strsep(&uinput, " ");
  if (strcmp(fname, "quit") == 0) {
    quit(loop);
  } else if (strcmp(fname, "motd") == 0) {
    motd();
  } else if (strcmp(fname, "target") == 0) {
  } else {
    printf("?invalid command, type help for info\n");
  }
}


x86 assembly (clang, -O0):
<clinterp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1070 <strsep@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    119c <clinterp+0x4c>
mov    -0x8(%rbp),%rdi
call   1050 <quit@plt>
jmp    11f7 <clinterp+0xa7>
mov    -0x18(%rbp),%rdi
lea    0xe60(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11c2 <clinterp+0x72>
mov    $0x0,%al
call   1030 <motd@plt>
jmp    11f2 <clinterp+0xa2>
mov    -0x18(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11e1 <clinterp+0x91>
jmp    11ed <clinterp+0x9d>
lea    0xe2b(%rip),%rdi
call   1040 <printf@plt>
jmp    11f2 <clinterp+0xa2>
jmp    11f7 <clinterp+0xa7>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clinterp>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rsi,(%rsp)
lea    0xe9e(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strsep@plt>
mov    %rax,%rbx
lea    0xe8e(%rip),%rsi
mov    %rax,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11b7 <clinterp+0x67>
lea    0xe7f(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11c1 <clinterp+0x71>
lea    0xe70(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11c8 <clinterp+0x78>
lea    0xe63(%rip),%rdi
call   1030 <puts@plt>
jmp    11c8 <clinterp+0x78>
mov    %r14,%rdi
call   1050 <quit@plt>
jmp    11c8 <clinterp+0x78>
xor    %eax,%eax
call   1040 <motd@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [5 x i8] c"quit\00"
@.str.2 = [5 x i8] c"motd\00"
@.str.3 = [7 x i8] c"target\00"
@.str.4 = [38 x i8] c"?invalid command, type help for info\0A\00"
define void @clinterp(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%6 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32*, i32** %3
%12 = call i32 @quit(i32* %11)
br label %28
13: ; preds = %2
%14 = load i8*, i8** %5
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 (...) @motd()
br label %27
19: ; preds = %13
%20 = load i8*, i8** %5
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %19
br label %26
24: ; preds = %19
%25 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
br label %26
26: ; preds = %24, %23
br label %27
27: ; preds = %26, %17
br label %28
28: ; preds = %27, %10
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [5 x i8] c"quit\00"
@.str.2 = [5 x i8] c"motd\00"
@.str.3 = [7 x i8] c"target\00"
@str = [37 x i8] c"?invalid command, type help for info\00"
define void @clinterp(i32* %0, i8* %1) {
%3 = alloca i8*
store i8* %1, i8** %3
%4 = call i8* @strsep(i8** %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i64 @strcmp(i8* %4, 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 = %2
%8 = call i32 @quit(i32* %0)
br label %19
9: ; preds = %2
%10 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 (...) @motd()
br label %19
14: ; preds = %9
%15 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %19
19: ; preds = %12, %14, %17, %7
ret void
}