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

/* Variables and functions */
int /*<<< orphan*/ PyRun_SimpleFile(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ PyRun_SimpleString(char *);
int /*<<< orphan*/ Py_Initialize();
int /*<<< orphan*/ feof(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  char line[1024];
  FILE *fd = fopen("Radare.py", "r");
  Py_Initialize();
  PyRun_SimpleString("_Radare = Radare");
  PyRun_SimpleFile(fd, "Radare.py");
  while (!feof(stdin)) {
    line[0] = '\0';
    fgets(line, 1024, stdin);
    if (!feof(stdin))
      line[strlen(line) - 1] = '\0';
    else
      break;
    PyRun_SimpleString(line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
lea    0xe7a(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x418(%rbp)
mov    $0x0,%al
call   1030 <Py_Initialize@plt>
lea    0xe62(%rip),%rdi
call   1040 <PyRun_SimpleString@plt>
mov    -0x418(%rbp),%rdi
lea    0xe43(%rip),%rsi
call   1080 <PyRun_SimpleFile@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11e5 <main+0x75>
jmp    1251 <main+0xe1>
movb   $0x0,-0x410(%rbp)
lea    -0x410(%rbp),%rdi
mov    0x2dee(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1060 <fgets@plt>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
call   1070 <feof@plt>
cmp    $0x0,%eax
jne    123b <main+0xcb>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x410(%rbp,%rax,1)
jmp    1240 <main+0xd0>
jmp    1251 <main+0xe1>
lea    -0x410(%rbp),%rdi
call   1040 <PyRun_SimpleString@plt>
jmp    11c2 <main+0x52>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x408,%rsp
lea    0xe7f(%rip),%r14
lea    0xe82(%rip),%rsi
mov    %r14,%rdi
call   1090 <fopen@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <Py_Initialize@plt>
lea    0xe6b(%rip),%rdi
call   1040 <PyRun_SimpleString@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <PyRun_SimpleFile@plt>
mov    0x2e30(%rip),%r14
mov    (%r14),%edi
call   1070 <feof@plt>
test   %eax,%eax
jne    1213 <main+0xa3>
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
movb   $0x0,(%rsp)
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1060 <fgets@plt>
mov    (%r14),%edi
call   1070 <feof@plt>
test   %eax,%eax
jne    1213 <main+0xa3>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
call   1040 <PyRun_SimpleString@plt>
mov    (%r14),%edi
call   1070 <feof@plt>
test   %eax,%eax
je     11d0 <main+0x60>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Radare.py\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [17 x i8] c"_Radare = Radare\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %3
%5 = call i32 (...) @Py_Initialize()
%6 = call i32 @PyRun_SimpleString(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32*, i32** %3
%8 = call i32 @PyRun_SimpleFile(i32* %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %29, %0
%10 = load i32, i32* @stdin
%11 = call i32 @feof(i32 %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
br i1 %13, label %14, label %32
14: ; preds = %9
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
store i8 0, i8* %15
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%17 = load i32, i32* @stdin
%18 = call i32 @fgets(i8* %16, i32 1024, i32 %17)
%19 = load i32, i32* @stdin
%20 = call i32 @feof(i32 %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %28, label %22
22: ; preds = %14
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%24 = call i32 @strlen(i8* %23)
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %26
store i8 0, i8* %27
br label %29
28: ; preds = %14
br label %32
29: ; preds = %22
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%31 = call i32 @PyRun_SimpleString(i8* %30)
br label %9
32: ; preds = %28, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"Radare.py\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [17 x i8] c"_Radare = Radare\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (...) @Py_Initialize()
%5 = tail call i32 @PyRun_SimpleString(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @PyRun_SimpleFile(i32* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stdin
%8 = call i32 @feof(i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %25
10: ; preds = %0, %16
store i8 0, i8* %2
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %2, i32 1024, i32 %11)
%13 = load i32, i32* @stdin
%14 = call i32 @feof(i32 %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %10
%17 = call i32 @strlen(i8* %2)
%18 = add nsw i32 %17, -1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %19
store i8 0, i8* %20
%21 = call i32 @PyRun_SimpleString(i8* %2)
%22 = load i32, i32* @stdin
%23 = call i32 @feof(i32 %22)
%24 = icmp eq i32 %23, 0
br i1 %24, label %10, label %25
25: ; preds = %16, %10, %0
ret i32 0
}