#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 */
struct exp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ eval(struct exp *);
scalar_t__ isstrspace(char const *);
struct exp *make_exp(char const **);
int /*<<< orphan*/ print_exp(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
char *readline(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
void prompt(void) {
  const char *exp_string = NULL;
  while (1) {
    printf("\nmylisp> ");
    if (exp_string == NULL)
      exp_string = readline(stdin);
    else {
      if (isstrspace(exp_string) != 0)
        exp_string = readline(stdin);
      else
        putchar('\n');
    }
    struct exp *exp = make_exp(&exp_string);
    print_exp(eval(exp));
  }
}


x86 assembly (clang, -O0):
<prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
lea    0xe79(%rip),%rdi
call   1050 <printf@plt>
cmpq   $0x0,-0x8(%rbp)
jne    11ae <prompt+0x3e>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
call   1060 <readline@plt>
mov    %rax,-0x8(%rbp)
jmp    11e7 <prompt+0x77>
mov    -0x8(%rbp),%rdi
call   1080 <isstrspace@plt>
cmp    $0x0,%rax
je     11d8 <prompt+0x68>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
call   1060 <readline@plt>
mov    %rax,-0x8(%rbp)
jmp    11e2 <prompt+0x72>
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    11e7 <prompt+0x77>
lea    -0x8(%rbp),%rdi
call   1030 <make_exp@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <eval@plt>
mov    %eax,%edi
call   1070 <print_exp@plt>
jmp    1180 <prompt+0x10>

x86 assembly (clang, -O2):
<prompt>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0xe77(%rip),%r14
mov    0x2e58(%rip),%r15
lea    0x8(%rsp),%rbx
jmp    11c4 <prompt+0x54>
nopw   0x0(%rax,%rax,1)
mov    (%r15),%edi
call   1060 <readline@plt>
mov    %rax,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <make_exp@plt>
mov    %rax,%rdi
call   1090 <eval@plt>
mov    %eax,%edi
call   1070 <print_exp@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     11a0 <prompt+0x30>
call   1080 <isstrspace@plt>
test   %rax,%rax
jne    11a0 <prompt+0x30>
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    11ad <prompt+0x3d>

LLVM IR (-O0):
%struct.exp = type { i32 }
@.str = [10 x i8] c"\0Amylisp> \00"
@stdin = global i32 0
define void @prompt() {
%1 = alloca i8*
%2 = alloca %struct.exp*
store i8* null, i8** %1
br label %3
3: ; preds = %0, %20
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %1
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i32, i32* @stdin
%9 = call i8* @readline(i32 %8)
store i8* %9, i8** %1
br label %20
10: ; preds = %3
%11 = load i8*, i8** %1
%12 = call i64 @isstrspace(i8* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* @stdin
%16 = call i8* @readline(i32 %15)
store i8* %16, i8** %1
br label %19
17: ; preds = %10
%18 = call i32 @putchar(i8 signext 10)
br label %19
19: ; preds = %17, %14
br label %20
20: ; preds = %19, %7
%21 = call %struct.exp* @make_exp(i8** %1)
store %struct.exp* %21, %struct.exp** %2
%22 = load %struct.exp*, %struct.exp** %2
%23 = call i32 @eval(%struct.exp* %22)
%24 = call i32 @print_exp(i32 %23)
br label %3
}

LLVM IR (-O2):
%struct.exp = type { i32 }
@.str = [10 x i8] c"\0Amylisp> \00"
@stdin = global i32 0
define void @prompt() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i8* null, i8** %1
br label %3
3: ; preds = %18, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %1
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i32, i32* @stdin
%9 = call i8* @readline(i32 %8)
store i8* %9, i8** %1
br label %18
10: ; preds = %3
%11 = call i64 @isstrspace(i8* %5)
%12 = icmp eq i64 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* @stdin
%15 = call i8* @readline(i32 %14)
store i8* %15, i8** %1
br label %18
16: ; preds = %10
%17 = call i32 @putchar(i8 signext 10)
br label %18
18: ; preds = %13, %16, %7
%19 = call %struct.exp* @make_exp(i8** %1)
%20 = call i32 @eval(%struct.exp* %19)
%21 = call i32 @print_exp(i32 %20)
br label %3
}