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

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ chomp(char *);
int /*<<< orphan*/ delete_comments(char *);
int /*<<< orphan*/ delete_spaces(char *);
int /*<<< orphan*/ eval_line(char *, int *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ free_variables();
int /*<<< orphan*/ print_prompt();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main(void) {
  int error;
  char buffer[1024];
  int line_num;
  line_num = 0;
  error = 0;
  print_prompt();
  while (fgets(buffer, sizeof(buffer), stdin) != NULL) {
    line_num++;
    chomp(buffer);
    delete_spaces(buffer);
    delete_comments(buffer);
    if (*buffer) {
      printf(" '%s'\n", buffer);
      eval_line(buffer, &error);
      if (error) {
        printf("error at line %d !\n", line_num);
        return EXIT_FAILURE;
      }
      print_prompt();
    }
  }
  free_variables();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x414(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <print_prompt@plt>
lea    -0x410(%rbp),%rdi
mov    0x2e30(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     126e <main+0xee>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
lea    -0x410(%rbp),%rdi
call   1080 <chomp@plt>
lea    -0x410(%rbp),%rdi
call   10a0 <delete_spaces@plt>
lea    -0x410(%rbp),%rdi
call   1070 <delete_comments@plt>
cmpb   $0x0,-0x410(%rbp)
je     1269 <main+0xe9>
lea    -0x410(%rbp),%rsi
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x410(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1090 <eval_line@plt>
cmpl   $0x0,-0x8(%rbp)
je     1262 <main+0xe2>
mov    -0x414(%rbp),%esi
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1281 <main+0x101>
mov    $0x0,%al
call   1030 <print_prompt@plt>
jmp    11aa <main+0x2a>
mov    $0x0,%al
call   1060 <free_variables@plt>
mov    0x2d54(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x410,%rsp
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
call   1030 <print_prompt@plt>
mov    0x2e42(%rip),%r13
mov    0x0(%r13),%edx
lea    0x10(%rsp),%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     1240 <main+0xc0>
mov    $0x1,%ebx
lea    0x10(%rsp),%r14
lea    0xe2d(%rip),%r15
lea    0xc(%rsp),%r12
jmp    11f9 <main+0x79>
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%edx
mov    %r14,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
add    $0x1,%ebx
test   %rax,%rax
je     1240 <main+0xc0>
mov    %r14,%rdi
call   1080 <chomp@plt>
mov    %r14,%rdi
call   10a0 <delete_spaces@plt>
mov    %r14,%rdi
call   1070 <delete_comments@plt>
cmpb   $0x0,0x10(%rsp)
je     11e0 <main+0x60>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1090 <eval_line@plt>
cmpl   $0x0,0xc(%rsp)
jne    1250 <main+0xd0>
xor    %eax,%eax
call   1030 <print_prompt@plt>
jmp    11e0 <main+0x60>
xor    %eax,%eax
call   1060 <free_variables@plt>
mov    0x2d82(%rip),%rax
jmp    1267 <main+0xe7>
lea    0xdb0(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2d71(%rip),%rax
mov    (%rax),%eax
add    $0x410,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [7 x i8] c" '%s'\0A\00"
@.str.1 = [20 x i8] c"error at line %d !\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1024 x i8]
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %2
%5 = call i32 (...) @print_prompt()
br label %6
6: ; preds = %36, %0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32* @fgets(i8* %7, i32 1024, i32 %8)
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %37
11: ; preds = %6
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
store i32 %13, i32* %4
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%15 = call i32 @chomp(i8* %14)
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%17 = call i32 @delete_spaces(i8* %16)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%19 = call i32 @delete_comments(i8* %18)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%21 = load i8, i8* %20
%22 = icmp ne i8 %21, 0
br i1 %22, label %23, label %36
23: ; preds = %11
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%27 = call i32 @eval_line(i8* %26, i32* %2)
%28 = load i32, i32* %2
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %23
%31 = load i32, i32* %4
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = load i32, i32* @EXIT_FAILURE
store i32 %33, i32* %1
br label %40
34: ; preds = %23
%35 = call i32 (...) @print_prompt()
br label %36
36: ; preds = %34, %11
br label %6
37: ; preds = %6
%38 = call i32 (...) @free_variables()
%39 = load i32, i32* @EXIT_SUCCESS
store i32 %39, i32* %1
br label %40
40: ; preds = %37, %30
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [7 x i8] c" '%s'\0A\00"
@.str.1 = [20 x i8] c"error at line %d !\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
store i32 0, i32* %1
%5 = tail call i32 (...) @print_prompt()
%6 = load i32, i32* @stdin
%7 = call i32* @fgets(i8* %4, i32 1024, i32 %6)
%8 = icmp eq i32* %7, null
br i1 %8, label %30, label %9
9: ; preds = %0, %26
%10 = phi i32 [ %11, %26 ], [ 0, %0 ]
%11 = add nuw nsw i32 %10, 1
%12 = call i32 @chomp(i8* %4)
%13 = call i32 @delete_spaces(i8* %4)
%14 = call i32 @delete_comments(i8* %4)
%15 = load i8, i8* %4
%16 = icmp eq i8 %15, 0
br i1 %16, label %26, label %17
17: ; preds = %9
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4)
%19 = call i32 @eval_line(i8* %4, i32* %1)
%20 = load i32, i32* %1
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %32
24: ; preds = %17
%25 = call i32 (...) @print_prompt()
br label %26
26: ; preds = %24, %9
%27 = load i32, i32* @stdin
%28 = call i32* @fgets(i8* %4, i32 1024, i32 %27)
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %9
30: ; preds = %26, %0
%31 = call i32 (...) @free_variables()
br label %32
32: ; preds = %30, %22
%33 = phi i32* [ @EXIT_FAILURE, %22 ], [ @EXIT_SUCCESS, %30 ]
%34 = load i32, i32* %33
ret i32 %34
}