#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 */
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ lua_dostring(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
void io_debug(void) {
  while (1) {
    char buffer[250];
    fprintf(stderr, "lua_debug> ");
    if (fgets(buffer, sizeof(buffer), stdin) == 0)
      return;
    if (strcmp(buffer, "cont") == 0)
      return;
    lua_dostring(buffer);
  }
}


x86 assembly (clang, -O0):
<io_debug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
call   1060 <fprintf@plt>
lea    -0x100(%rbp),%rdi
mov    0x2e7a(%rip),%rax
mov    (%rax),%edx
mov    $0xfa,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    1189 <io_debug+0x49>
jmp    11bc <io_debug+0x7c>
lea    -0x100(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11ab <io_debug+0x6b>
jmp    11bc <io_debug+0x7c>
lea    -0x100(%rbp),%rdi
call   1030 <lua_dostring@plt>
jmp    114b <io_debug+0xb>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_debug>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    0x2e81(%rip),%r12
mov    (%r12),%edi
lea    0xe9e(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2e7a(%rip),%r13
mov    0x0(%r13),%edx
mov    %rsp,%rdi
mov    $0xfa,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     11da <io_debug+0x9a>
lea    0xe81(%rip),%r14
mov    %rsp,%rbx
lea    0xe6b(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11da <io_debug+0x9a>
mov    %rbx,%rdi
call   1030 <lua_dostring@plt>
mov    (%r12),%edi
mov    %r15,%rsi
call   1060 <fprintf@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0xfa,%esi
call   1040 <fgets@plt>
test   %rax,%rax
jne    11a0 <io_debug+0x60>
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"lua_debug> \00"
@stdin = global i32 0
@.str.1 = [5 x i8] c"cont\00"
define void @io_debug() {
%1 = alloca [250 x i8]
br label %2
2: ; preds = %0, %15
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [250 x i8], [250 x i8]* %1, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i64 @fgets(i8* %5, i32 250, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
br label %18
10: ; preds = %2
%11 = getelementptr inbounds [250 x i8], [250 x i8]* %1, i64 0, i64 0
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
br label %18
15: ; preds = %10
%16 = getelementptr inbounds [250 x i8], [250 x i8]* %1, i64 0, i64 0
%17 = call i32 @lua_dostring(i8* %16)
br label %2
18: ; preds = %14, %9
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"lua_debug> \00"
@stdin = global i32 0
@.str.1 = [5 x i8] c"cont\00"
define void @io_debug() {
%1 = alloca [250 x i8]
%2 = getelementptr inbounds [250 x i8], [250 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stdin
%6 = call i64 @fgets(i8* %2, i32 250, i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %18, label %8
8: ; preds = %0, %11
%9 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %8
%12 = call i32 @lua_dostring(i8* %2)
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @stdin
%16 = call i64 @fgets(i8* %2, i32 250, i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %8
18: ; preds = %8, %11, %0
ret void
}