#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*/ cmd_end();
int /*<<< orphan*/ cmd_page();
int /*<<< orphan*/ kprint(char *);
scalar_t__ strcmp(char *, char *);
void user_input(char *input) {
  if (strcmp(input, "END") == 0) {
    cmd_end();
    return;
  }
  if (strcmp(input, "PAGE") == 0) {
    cmd_page();
    return;
  }
  kprint("Command ");
  kprint(input);
  kprint(" unknown");
  kprint("\n> ");
}


x86 assembly (clang, -O0):
<user_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1172 <user_input+0x32>
mov    $0x0,%al
call   1060 <cmd_end@plt>
jmp    11c5 <user_input+0x85>
mov    -0x8(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1198 <user_input+0x58>
mov    $0x0,%al
call   1040 <cmd_page@plt>
jmp    11c5 <user_input+0x85>
lea    0xe6a(%rip),%rdi
call   1050 <kprint@plt>
mov    -0x8(%rbp),%rdi
call   1050 <kprint@plt>
lea    0xe5e(%rip),%rdi
call   1050 <kprint@plt>
lea    0xe5b(%rip),%rdi
call   1050 <kprint@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_input>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1196 <user_input+0x56>
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     119e <user_input+0x5e>
lea    0xe99(%rip),%rdi
call   1050 <kprint@plt>
mov    %rbx,%rdi
call   1050 <kprint@plt>
lea    0xe8e(%rip),%rdi
call   1050 <kprint@plt>
lea    0xe8b(%rip),%rdi
pop    %rbx
jmp    1050 <kprint@plt>
xor    %eax,%eax
pop    %rbx
jmp    1060 <cmd_end@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <cmd_page@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"END\00"
@.str.1 = [5 x i8] c"PAGE\00"
@.str.2 = [9 x i8] c"Command \00"
@.str.3 = [9 x i8] c" unknown\00"
@.str.4 = [4 x i8] c"\0A> \00"
define void @user_input(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @cmd_end()
br label %20
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 (...) @cmd_page()
br label %20
14: ; preds = %8
%15 = call i32 @kprint(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%16 = load i8*, i8** %2
%17 = call i32 @kprint(i8* %16)
%18 = call i32 @kprint(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @kprint(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %14, %12, %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"END\00"
@.str.1 = [5 x i8] c"PAGE\00"
@.str.2 = [9 x i8] c"Command \00"
@.str.3 = [9 x i8] c" unknown\00"
@.str.4 = [4 x i8] c"\0A> \00"
define void @user_input(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @cmd_end()
br label %16
6: ; preds = %1
%7 = tail call i64 @strcmp(i8* %0, 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 = %6
%10 = tail call i32 (...) @cmd_page()
br label %16
11: ; preds = %6
%12 = tail call i32 @kprint(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @kprint(i8* %0)
%14 = tail call i32 @kprint(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%15 = tail call i32 @kprint(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %16
16: ; preds = %11, %9, %4
ret void
}