#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 */
char *cscan();
int /*<<< orphan*/ kprint(char *);
int request(char *);
void promptmode() {
  char *s;
  int ret;
  do {
    kprint("MEGORO:)");
    s = cscan();
    ret = request(s);
    if (ret) {
      if (ret < 0) {
      }
    } else {
      kprint("MEGORO:( COULD NOT RECOGNISE THAT COMMAND!\n");
    }
  } while (1);
}


x86 assembly (clang, -O0):
<promptmode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <kprint@plt>
mov    $0x0,%al
call   1030 <cscan@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <request@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1179 <promptmode+0x49>
cmpl   $0x0,-0xc(%rbp)
jge    1174 <promptmode+0x44>
jmp    1174 <promptmode+0x44>
jmp    1185 <promptmode+0x55>
lea    0xe89(%rip),%rdi
call   1040 <kprint@plt>
jmp    118a <promptmode+0x5a>
mov    $0x1,%al
test   $0x1,%al
jne    1138 <promptmode+0x8>
jmp    1199 <promptmode+0x69>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<promptmode>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rbx
lea    0xec7(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <kprint@plt>
xor    %eax,%eax
call   1030 <cscan@plt>
mov    %rax,%rdi
call   1050 <request@plt>
test   %eax,%eax
jne    1150 <promptmode+0x20>
mov    %r14,%rdi
call   1040 <kprint@plt>
jmp    1150 <promptmode+0x20>

LLVM IR (-O0):
@.str = [9 x i8] c"MEGORO:)\00"
@.str.1 = [44 x i8] c"MEGORO:( COULD NOT RECOGNISE THAT COMMAND!\0A\00"
define void @promptmode() {
%1 = alloca i8*
%2 = alloca i32
br label %3
3: ; preds = %18, %0
%4 = call i32 @kprint(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = call i8* (...) @cscan()
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @request(i8* %6)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
br label %14
14: ; preds = %13, %10
br label %17
15: ; preds = %3
%16 = call i32 @kprint(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %14
br label %18
18: ; preds = %17
br i1 true, label %3, label %19
19: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"MEGORO:)\00"
@.str.1 = [44 x i8] c"MEGORO:( COULD NOT RECOGNISE THAT COMMAND!\0A\00"
define void @promptmode() {
br label %1
1: ; preds = %6, %0
%2 = tail call i32 @kprint(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i8* (...) @cscan()
%4 = tail call i32 @request(i8* %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1, %7
br label %1
7: ; preds = %1
%8 = tail call i32 @kprint(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %6
}