#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 */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ gets(char *);
int /*<<< orphan*/ lua_dostring(char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
void io_debug(void) {
  while (1) {
    char buffer[250];
    fprintf(stderr, "lua_debug> ");
    if (gets(buffer) == 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    0x2e8e(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
call   1050 <fprintf@plt>
lea    -0x100(%rbp),%rdi
call   1060 <gets@plt>
cmp    $0x0,%rax
jne    117b <io_debug+0x3b>
jmp    11ae <io_debug+0x6e>
lea    -0x100(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    119d <io_debug+0x5d>
jmp    11ae <io_debug+0x6e>
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   %r12
push   %rbx
sub    $0x108,%rsp
mov    0x2e8b(%rip),%r12
mov    (%r12),%edi
lea    0xea0(%rip),%rsi
call   1050 <fprintf@plt>
mov    %rsp,%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     11c1 <io_debug+0x81>
lea    0xe93(%rip),%r14
mov    %rsp,%rbx
lea    0xe7d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c1 <io_debug+0x81>
mov    %rbx,%rdi
call   1030 <lua_dostring@plt>
mov    (%r12),%edi
mov    %r15,%rsi
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1060 <gets@plt>
test   %rax,%rax
jne    1190 <io_debug+0x50>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"lua_debug> \00"
@.str.1 = [5 x i8] c"cont\00"
define void @io_debug() {
%1 = alloca [250 x i8]
br label %2
2: ; preds = %0, %14
%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 = call i64 @gets(i8* %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
br label %17
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 ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
br label %17
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
17: ; preds = %13, %8
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"lua_debug> \00"
@.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 = call i64 @gets(i8* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %0, %10
%8 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %7
%11 = call i32 @lua_dostring(i8* %2)
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%14 = call i64 @gets(i8* %2)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %7
16: ; preds = %7, %10, %0
ret void
}