#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 */
scalar_t__ feof(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
char *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *rep(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(void) {
  char buf[256 + 1];
  char *bufread;
  bool at_eof = false;
  while (!at_eof) {
    fprintf(stdout, "lisp: ");
    fflush(stdout);
    bufread = fgets(buf, 256, stdin);
    at_eof = feof(stdin) || bufread == NULL;
    if (bufread) {
      fprintf(stdout, "%s", rep(buf));
    }
  }
  fprintf(stdout, "\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x11c(%rbp)
cmpl   $0x0,-0x11c(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1185 <main+0x35>
jmp    1255 <main+0x105>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    0xe6b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e30(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1040 <fgets@plt>
mov    %rax,-0x118(%rbp)
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
call   1060 <feof@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x11d(%rbp)
jne    11ff <main+0xaf>
cmpq   $0x0,-0x118(%rbp)
sete   %al
mov    %al,-0x11d(%rbp)
mov    -0x11d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x11c(%rbp)
cmpq   $0x0,-0x118(%rbp)
je     1250 <main+0x100>
mov    0x2db3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x124(%rbp)
lea    -0x110(%rbp),%rdi
call   1030 <rep@plt>
mov    -0x124(%rbp),%edi
mov    %rax,%rdx
lea    0xdbe(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    116c <main+0x1c>
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
lea    0xda5(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    0x2e70(%rip),%r13
lea    0xe91(%rip),%r14
mov    0x2e72(%rip),%rbp
mov    %rsp,%r12
jmp    1185 <main+0x35>
nopl   0x0(%rax,%rax,1)
test   %r15b,%r15b
jne    11ed <main+0x9d>
mov    0x0(%r13),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%r13),%edi
call   1070 <fflush@plt>
mov    0x0(%rbp),%edx
mov    %r12,%rdi
mov    $0x100,%esi
call   1040 <fgets@plt>
mov    %rax,%rbx
mov    0x0(%rbp),%edi
call   1060 <feof@plt>
test   %rax,%rax
setne  %al
test   %rbx,%rbx
sete   %r15b
or     %al,%r15b
test   %rbx,%rbx
je     1180 <main+0x30>
mov    0x0(%r13),%ebx
mov    %r12,%rdi
call   1030 <rep@plt>
mov    %ebx,%edi
lea    0xe26(%rip),%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1180 <main+0x30>
mov    0x0(%r13),%edi
lea    0xe12(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [7 x i8] c"lisp: \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [257 x i8]
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %5
5: ; preds = %33, %0
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
br i1 %8, label %9, label %34
9: ; preds = %5
%10 = load i32, i32* @stdout
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @stdout
%13 = call i32 @fflush(i32 %12)
%14 = getelementptr inbounds [257 x i8], [257 x i8]* %2, i64 0, i64 0
%15 = load i32, i32* @stdin
%16 = call i8* @fgets(i8* %14, i32 256, i32 %15)
store i8* %16, i8** %3
%17 = load i32, i32* @stdin
%18 = call i64 @feof(i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %9
%21 = load i8*, i8** %3
%22 = icmp eq i8* %21, null
br label %23
23: ; preds = %20, %9
%24 = phi i1 [ true, %9 ], [ %22, %20 ]
%25 = zext i1 %24 to i32
store i32 %25, i32* %4
%26 = load i8*, i8** %3
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %33
28: ; preds = %23
%29 = load i32, i32* @stdout
%30 = getelementptr inbounds [257 x i8], [257 x i8]* %2, i64 0, i64 0
%31 = call i8* @rep(i8* %30)
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %28, %23
br label %5
34: ; preds = %5
%35 = load i32, i32* @stdout
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [7 x i8] c"lisp: \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [257 x i8]
%2 = getelementptr inbounds [257 x i8], [257 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %19
%4 = load i32, i32* @stdout
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdout
%7 = call i32 @fflush(i32 %6)
%8 = load i32, i32* @stdin
%9 = call i8* @fgets(i8* %2, i32 256, i32 %8)
%10 = load i32, i32* @stdin
%11 = call i64 @feof(i32 %10)
%12 = icmp ne i64 %11, 0
%13 = icmp eq i8* %9, null
%14 = select i1 %12, i1 true, i1 %13
br i1 %13, label %19, label %15
15: ; preds = %3
%16 = load i32, i32* @stdout
%17 = call i8* @rep(i8* %2)
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %15, %3
br i1 %14, label %20, label %3
20: ; preds = %19
%21 = load i32, i32* @stdout
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}