#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*/ free(char *);
int /*<<< orphan*/ getline(char **, size_t *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ run(char *);
int /*<<< orphan*/ stdin;
void run_repl() {
  printf("%s %s %s\n", "cfuck", "0.2.1", "2015");
  printf("%s\n\n", "Gleb Pospelov <codefo@codefo.com>");
  unsigned long index = 1;
  char *line = NULL;
  size_t length = 0;
  while (index) {
    printf("%lu> ", index);
    if (feof(stdin) != 0)
      break;
    getline(&line, &length, stdin);
    run(line);
    free(line);
    line = NULL;
    index++;
  }
}


x86 assembly (clang, -O0):
<run_repl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
lea    0xea4(%rip),%rsi
lea    0xea3(%rip),%rdx
lea    0xea2(%rip),%rcx
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe99(%rip),%rdi
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
movq   $0x1,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1223 <run_repl+0xd3>
mov    -0x8(%rbp),%rsi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
call   1060 <feof@plt>
cmp    $0x0,%rax
je     11e2 <run_repl+0x92>
jmp    1223 <run_repl+0xd3>
mov    0x2dff(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <getline@plt>
mov    -0x10(%rbp),%rdi
call   1040 <run@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11a8 <run_repl+0x58>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_repl>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe9c(%rip),%rdi
lea    0xe9f(%rip),%rsi
lea    0xe9e(%rip),%rdx
lea    0xe9d(%rip),%rcx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe94(%rip),%rdi
lea    0xe92(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
mov    $0x1,%ebx
lea    0xe90(%rip),%r14
mov    0x2e2f(%rip),%r13
mov    %rsp,%r15
lea    0x8(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13),%edi
call   1060 <feof@plt>
test   %rax,%rax
jne    1219 <run_repl+0xc9>
mov    0x0(%r13),%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <getline@plt>
mov    (%rsp),%rdi
call   1040 <run@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
movq   $0x0,(%rsp)
inc    %rbx
jne    11d0 <run_repl+0x80>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%s %s %s\0A\00"
@.str.1 = [6 x i8] c"cfuck\00"
@.str.2 = [6 x i8] c"0.2.1\00"
@.str.3 = [5 x i8] c"2015\00"
@.str.4 = [5 x i8] c"%s\0A\0A\00"
@.str.5 = [34 x i8] c"Gleb Pospelov <codefo@codefo.com>\00"
@.str.6 = [6 x i8] c"%lu> \00"
@stdin = global i32 0
define void @run_repl() {
%1 = alloca i64
%2 = alloca i8*
%3 = alloca i64
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
store i64 1, i64* %1
store i8* null, i8** %2
store i64 0, i64* %3
br label %6
6: ; preds = %16, %0
%7 = load i64, i64* %1
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = load i64, i64* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i64 %10)
%12 = load i32, i32* @stdin
%13 = call i64 @feof(i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %9
br label %25
16: ; preds = %9
%17 = load i32, i32* @stdin
%18 = call i32 @getline(i8** %2, i64* %3, i32 %17)
%19 = load i8*, i8** %2
%20 = call i32 @run(i8* %19)
%21 = load i8*, i8** %2
%22 = call i32 @free(i8* %21)
store i8* null, i8** %2
%23 = load i64, i64* %1
%24 = add i64 %23, 1
store i64 %24, i64* %1
br label %6
25: ; preds = %15, %6
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%s %s %s\0A\00"
@.str.1 = [6 x i8] c"cfuck\00"
@.str.2 = [6 x i8] c"0.2.1\00"
@.str.3 = [5 x i8] c"2015\00"
@.str.4 = [5 x i8] c"%s\0A\0A\00"
@.str.5 = [34 x i8] c"Gleb Pospelov <codefo@codefo.com>\00"
@.str.6 = [6 x i8] c"%lu> \00"
@stdin = global i32 0
define void @run_repl() {
%1 = alloca i8*
%2 = alloca i64
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%5 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%6 = bitcast i64* %2 to i8*
store i64 0, i64* %2
br label %7
7: ; preds = %0, %13
%8 = phi i64 [ 1, %0 ], [ %20, %13 ]
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i64 %8)
%10 = load i32, i32* @stdin
%11 = call i64 @feof(i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %22
13: ; preds = %7
%14 = load i32, i32* @stdin
%15 = call i32 @getline(i8** %1, i64* %2, i32 %14)
%16 = load i8*, i8** %1
%17 = call i32 @run(i8* %16)
%18 = load i8*, i8** %1
%19 = call i32 @free(i8* %18)
store i8* null, i8** %1
%20 = add i64 %8, 1
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %7
22: ; preds = %7, %13
ret void
}