#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) {
  for (;;) {
    char buffer[250];
    fprintf(stderr, "lua_debug> ");
    if (fgets(buffer, sizeof(buffer), stdin) == 0 ||
        strcmp(buffer, "cont\n") == 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
je     11a1 <io_debug+0x61>
lea    -0x100(%rbp),%rdi
lea    0xe7a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11aa <io_debug+0x6a>
add    $0x100,%rsp
pop    %rbp
ret
lea    -0x100(%rbp),%rdi
call   1030 <lua_dostring@plt>
jmp    114b <io_debug+0xb>

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 = [6 x i8] c"cont\0A\00"
define void @io_debug() {
%1 = alloca [250 x i8]
br label %2
2: ; preds = %14, %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 = 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 %13, label %9
9: ; preds = %2
%10 = getelementptr inbounds [250 x i8], [250 x i8]* %1, i64 0, i64 0
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9, %2
ret void
14: ; preds = %9
%15 = getelementptr inbounds [250 x i8], [250 x i8]* %1, i64 0, i64 0
%16 = call i32 @lua_dostring(i8* %15)
br label %2
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"lua_debug> \00"
@stdin = global i32 0
@.str.1 = [6 x i8] c"cont\0A\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 ([6 x i8], [6 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 = %11, %8, %0
ret void
}