#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*/ line;

/* Variables and functions */
int /*<<< orphan*/ exec(char *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
scalar_t__ isCode(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ processCommand(char *);
int /*<<< orphan*/ stdin;
int main() {
  char line[256];
  do {
    printf("~ ");
    if (fgets(line, sizeof(line), stdin)) {
      if (isCode(line)) {
        exec(line);
      } else {
        processCommand(line);
      }
    }
  } while (true);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e6c(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11ca <main+0x7a>
lea    -0x110(%rbp),%rdi
call   1030 <isCode@plt>
cmp    $0x0,%rax
je     11b9 <main+0x69>
lea    -0x110(%rbp),%rdi
call   1070 <exec@plt>
jmp    11c5 <main+0x75>
lea    -0x110(%rbp),%rdi
call   1060 <processCommand@plt>
jmp    11ca <main+0x7a>
jmp    11cf <main+0x7f>
mov    $0x1,%al
test   $0x1,%al
jne    1162 <main+0x12>
jmp    11de <main+0x8e>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
lea    0xe9d(%rip),%r14
mov    0x2e7e(%rip),%r15
mov    %rsp,%rbx
jmp    1175 <main+0x25>
nop
call   1070 <exec@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     1175 <main+0x25>
mov    %rbx,%rdi
call   1030 <isCode@plt>
mov    %rbx,%rdi
test   %rax,%rax
jne    1170 <main+0x20>
call   1060 <processCommand@plt>
jmp    1175 <main+0x25>

LLVM IR (-O0):
@.str = [3 x i8] c"~ \00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %21, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i64 @fgets(i8* %5, i32 256, i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %20
9: ; preds = %3
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%11 = call i64 @isCode(i8* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%15 = call i32 @exec(i8* %14)
br label %19
16: ; preds = %9
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%18 = call i32 @processCommand(i8* %17)
br label %19
19: ; preds = %16, %13
br label %20
20: ; preds = %19, %3
br label %21
21: ; preds = %20
br i1 true, label %3, label %22
22: ; preds = %21
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"~ \00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %8, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stdin
%6 = call i64 @fgets(i8* %2, i32 256, i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %3, %14, %12
br label %3
9: ; preds = %3
%10 = call i64 @isCode(i8* %2)
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = call i32 @exec(i8* %2)
br label %8
14: ; preds = %9
%15 = call i32 @processCommand(i8* %2)
br label %8
}