#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 */
struct list_node {
  int dummy;
};
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ cmd_continue(int /*<<< orphan*/, int *, struct list_node *);
int /*<<< orphan*/ cmd_delete_breakpoint(int /*<<< orphan*/,
                                         struct list_node **,
                                         struct list_node *);
int /*<<< orphan*/ cmd_display_ins_eip(int /*<<< orphan*/);
int /*<<< orphan*/ cmd_help();
int /*<<< orphan*/ cmd_list_breakpoinst(struct list_node *);
int /*<<< orphan*/ cmd_nextline(int /*<<< orphan*/, int *, struct list_node *);
int /*<<< orphan*/ cmd_run(int /*<<< orphan*/);
int /*<<< orphan*/ cmd_set_breakpoint(int /*<<< orphan*/, struct list_node **,
                                      struct list_node *);
int /*<<< orphan*/ eatendline();
int /*<<< orphan*/ list_destroy(struct list_node **);
int /*<<< orphan*/ procprint(char *);
int /*<<< orphan*/ prompt_break(int /*<<< orphan*/, struct list_node *,
                                struct list_node *);
scalar_t__ scanf(char *, char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int /*<<< orphan*/ wait(int *);
void run_debugger(pid_t pid, struct list_node *func_list) {
  int status;
  wait(&status);
  int why_stop = 0;
  struct list_node *bps_list = NULL;
  char cmd[10] = "";
  int is_running = 0;
  while (1) {
    procprint("");
    if (EOF == scanf("%s", cmd)) {
      procprint("done\n");
      break;
    }
    if (!strncmp(cmd, "b", 10)) {
      cmd_set_breakpoint(pid, &bps_list, func_list);
      eatendline();
      continue;
    } else if (!strncmp(cmd, "d", 10)) {
      cmd_delete_breakpoint(pid, &bps_list, func_list);
      why_stop = !0;
      eatendline();
      continue;
    } else if (!strncmp(cmd, "lbp", 10)) {
      cmd_list_breakpoinst(bps_list);
    } else if (!strncmp(cmd, "i", 10)) {
      cmd_display_ins_eip(pid);
    } else if (!strncmp(cmd, "c", 10)) {
      if (is_running != 1) {
        procprint("The program is not being run.\n");
        eatendline();
        continue;
      }
      cmd_continue(pid, &why_stop, bps_list);
      prompt_break(pid, bps_list, func_list);
    } else if (!strncmp(cmd, "n", 10)) {
      if (is_running != 1) {
        procprint("The program is not being run.\n");
        eatendline();
        continue;
      }
      cmd_nextline(pid, &why_stop, bps_list);
    } else if (!strncmp(cmd, "r", 10)) {
      if (is_running == 1) {
        procprint("target is being run\n");
        eatendline();
        continue;
      }
      is_running = 1;
      cmd_run(pid);
      prompt_break(pid, bps_list, func_list);
    } else if (!strncmp(cmd, "h", 10) || !strncmp(cmd, "help", 10)) {
      cmd_help();
    } else {
      procprint("no support for this operation\n");
      eatendline();
      continue;
    }
    eatendline();
  }
  list_destroy(&bps_list);
  list_destroy(&func_list);
}


x86 assembly (clang, -O0):
<run_debugger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
call   1110 <wait@plt>
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x2a(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1090 <memset@plt>
movl   $0x0,-0x30(%rbp)
lea    0xdee(%rip),%rdi
call   10d0 <procprint@plt>
mov    0x2d97(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
lea    -0x2a(%rbp),%rsi
lea    0xd9d(%rip),%rdi
call   10e0 <scanf@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
jne    1289 <run_debugger+0x89>
lea    0xd84(%rip),%rdi
call   10d0 <procprint@plt>
jmp    1508 <run_debugger+0x308>
lea    -0x2a(%rbp),%rdi
lea    0xd75(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    12c3 <run_debugger+0xc3>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    -0x20(%rbp),%rsi
call   1120 <cmd_set_breakpoint@plt>
mov    $0x0,%al
call   1060 <eatendline@plt>
jmp    123e <run_debugger+0x3e>
lea    -0x2a(%rbp),%rdi
lea    0xd3d(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    1304 <run_debugger+0x104>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    -0x20(%rbp),%rsi
call   1050 <cmd_delete_breakpoint@plt>
movl   $0x1,-0x18(%rbp)
mov    $0x0,%al
call   1060 <eatendline@plt>
jmp    123e <run_debugger+0x3e>
lea    -0x2a(%rbp),%rdi
lea    0xcfe(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    1330 <run_debugger+0x130>
mov    -0x20(%rbp),%rdi
call   10b0 <cmd_list_breakpoinst@plt>
jmp    14f2 <run_debugger+0x2f2>
lea    -0x2a(%rbp),%rdi
lea    0xcd6(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    135b <run_debugger+0x15b>
mov    -0x4(%rbp),%edi
call   1030 <cmd_display_ins_eip@plt>
jmp    14ed <run_debugger+0x2ed>
lea    -0x2a(%rbp),%rdi
lea    0xcad(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    13c0 <run_debugger+0x1c0>
cmpl   $0x1,-0x30(%rbp)
je     139b <run_debugger+0x19b>
lea    0xc8b(%rip),%rdi
call   10d0 <procprint@plt>
mov    $0x0,%al
call   1060 <eatendline@plt>
jmp    123e <run_debugger+0x3e>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rdx
lea    -0x18(%rbp),%rsi
call   10f0 <cmd_continue@plt>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   10c0 <prompt_break@plt>
jmp    14e8 <run_debugger+0x2e8>
lea    -0x2a(%rbp),%rdi
lea    0xc69(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    1415 <run_debugger+0x215>
cmpl   $0x1,-0x30(%rbp)
je     1400 <run_debugger+0x200>
lea    0xc26(%rip),%rdi
call   10d0 <procprint@plt>
mov    $0x0,%al
call   1060 <eatendline@plt>
jmp    123e <run_debugger+0x3e>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rdx
lea    -0x18(%rbp),%rsi
call   1080 <cmd_nextline@plt>
jmp    14e3 <run_debugger+0x2e3>
lea    -0x2a(%rbp),%rdi
lea    0xc16(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    1479 <run_debugger+0x279>
cmpl   $0x1,-0x30(%rbp)
jne    1455 <run_debugger+0x255>
lea    0xbf4(%rip),%rdi
call   10d0 <procprint@plt>
mov    $0x0,%al
call   1060 <eatendline@plt>
jmp    123e <run_debugger+0x3e>
movl   $0x1,-0x30(%rbp)
mov    -0x4(%rbp),%edi
call   1070 <cmd_run@plt>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   10c0 <prompt_break@plt>
jmp    14de <run_debugger+0x2de>
lea    -0x2a(%rbp),%rdi
lea    0xbc9(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
je     14b5 <run_debugger+0x2b5>
lea    -0x2a(%rbp),%rdi
lea    0xbad(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    14c1 <run_debugger+0x2c1>
mov    $0x0,%al
call   1100 <cmd_help@plt>
jmp    14d9 <run_debugger+0x2d9>
lea    0xb8c(%rip),%rdi
call   10d0 <procprint@plt>
mov    $0x0,%al
call   1060 <eatendline@plt>
jmp    123e <run_debugger+0x3e>
jmp    14de <run_debugger+0x2de>
jmp    14e3 <run_debugger+0x2e3>
jmp    14e8 <run_debugger+0x2e8>
jmp    14ed <run_debugger+0x2ed>
jmp    14f2 <run_debugger+0x2f2>
jmp    14f7 <run_debugger+0x2f7>
jmp    14fc <run_debugger+0x2fc>
mov    $0x0,%al
call   1060 <eatendline@plt>
jmp    123e <run_debugger+0x3e>
lea    -0x20(%rbp),%rdi
call   10a0 <list_destroy@plt>
lea    -0x10(%rbp),%rdi
call   10a0 <list_destroy@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_debugger>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r12
mov    %edi,%r15d
mov    %rsi,0x28(%rsp)
lea    0x34(%rsp),%rdi
call   1100 <wait@plt>
movl   $0x0,0x14(%rsp)
movq   $0x0,0x8(%rsp)
movw   $0x0,0x20(%rsp)
movq   $0x0,0x18(%rsp)
lea    0xdf8(%rip),%rdi
call   10c0 <procprint@plt>
mov    0x2da1(%rip),%r14
mov    (%r14),%rbp
lea    0xdaf(%rip),%rdi
lea    0x18(%rsp),%rsi
call   10d0 <scanf@plt>
cmp    %rax,%rbp
jne    128f <run_debugger+0x9f>
lea    0xd9c(%rip),%rdi
call   10c0 <procprint@plt>
lea    0x8(%rsp),%rdi
call   1090 <list_destroy@plt>
lea    0x28(%rsp),%rdi
call   1090 <list_destroy@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd73(%rip),%rbx
lea    0x18(%rsp),%rbp
movl   $0x0,0x4(%rsp)
jmp    12ee <run_debugger+0xfe>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15d,%edi
lea    0x8(%rsp),%rsi
mov    %r12,%rdx
call   1110 <cmd_set_breakpoint@plt>
xor    %eax,%eax
call   1060 <eatendline@plt>
lea    0xd65(%rip),%rdi
call   10c0 <procprint@plt>
mov    (%r14),%r13
lea    0xd23(%rip),%rdi
mov    %rbp,%rsi
call   10d0 <scanf@plt>
cmp    %rax,%r13
je     1260 <run_debugger+0x70>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     12b0 <run_debugger+0xc0>
mov    %rbp,%rdi
lea    0xcff(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     13f0 <run_debugger+0x200>
mov    %rbp,%rdi
lea    0xce5(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     1419 <run_debugger+0x229>
mov    %rbp,%rdi
lea    0xccd(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     1428 <run_debugger+0x238>
mov    %rbp,%rdi
lea    0xcb3(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     1435 <run_debugger+0x245>
mov    %rbp,%rdi
lea    0xcb8(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     1450 <run_debugger+0x260>
mov    %rbp,%rdi
lea    0xc9e(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     1481 <run_debugger+0x291>
mov    %rbp,%rdi
lea    0xc99(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     140d <run_debugger+0x21d>
mov    %rbp,%rdi
lea    0xc83(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     140d <run_debugger+0x21d>
lea    0xc73(%rip),%rdi
call   10c0 <procprint@plt>
jmp    12c0 <run_debugger+0xd0>
nopl   0x0(%rax,%rax,1)
mov    %r15d,%edi
lea    0x8(%rsp),%rsi
mov    %r12,%rdx
call   1050 <cmd_delete_breakpoint@plt>
movl   $0x1,0x14(%rsp)
jmp    12c0 <run_debugger+0xd0>
xor    %eax,%eax
call   10f0 <cmd_help@plt>
jmp    14b6 <run_debugger+0x2c6>
mov    0x8(%rsp),%rdi
call   10a0 <cmd_list_breakpoinst@plt>
jmp    14b6 <run_debugger+0x2c6>
mov    %r15d,%edi
call   1030 <cmd_display_ins_eip@plt>
jmp    14b6 <run_debugger+0x2c6>
cmpl   $0x1,0x4(%rsp)
jne    146b <run_debugger+0x27b>
mov    0x8(%rsp),%rdx
mov    %r15d,%edi
lea    0x14(%rsp),%rsi
call   10e0 <cmd_continue@plt>
jmp    149e <run_debugger+0x2ae>
cmpl   $0x1,0x4(%rsp)
jne    146b <run_debugger+0x27b>
mov    0x8(%rsp),%rdx
mov    %r15d,%edi
lea    0x14(%rsp),%rsi
call   1080 <cmd_nextline@plt>
jmp    14ae <run_debugger+0x2be>
lea    0xba3(%rip),%rdi
call   10c0 <procprint@plt>
movl   $0x0,0x4(%rsp)
jmp    14b6 <run_debugger+0x2c6>
cmpl   $0x1,0x4(%rsp)
jne    1496 <run_debugger+0x2a6>
lea    0xba9(%rip),%rdi
call   10c0 <procprint@plt>
jmp    14ae <run_debugger+0x2be>
mov    %r15d,%edi
call   1070 <cmd_run@plt>
mov    0x8(%rsp),%rsi
mov    %r15d,%edi
mov    %r12,%rdx
call   10b0 <prompt_break@plt>
movl   $0x1,0x4(%rsp)
xor    %eax,%eax
call   1060 <eatendline@plt>
lea    0xb6f(%rip),%rdi
call   10c0 <procprint@plt>
mov    (%r14),%rbx
lea    0xb2d(%rip),%rdi
mov    %rbp,%rsi
call   10d0 <scanf@plt>
cmp    %rax,%rbx
lea    0xb24(%rip),%rbx
jne    12ee <run_debugger+0xfe>
jmp    1260 <run_debugger+0x70>

LLVM IR (-O0):
%struct.list_node = type { i32 }
@.str = [1 x i8] zeroinitializer
@EOF = global i64 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [6 x i8] c"done\0A\00"
@.str.3 = [2 x i8] c"b\00"
@.str.4 = [2 x i8] c"d\00"
@.str.5 = [4 x i8] c"lbp\00"
@.str.6 = [2 x i8] c"i\00"
@.str.7 = [2 x i8] c"c\00"
@.str.8 = [31 x i8] c"The program is not being run.\0A\00"
@.str.9 = [2 x i8] c"n\00"
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [21 x i8] c"target is being run\0A\00"
@.str.12 = [2 x i8] c"h\00"
@.str.13 = [5 x i8] c"help\00"
@.str.14 = [31 x i8] c"no support for this operation\0A\00"
define void @run_debugger(i32 %0, %struct.list_node* %1) {
%3 = alloca i32
%4 = alloca %struct.list_node*
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.list_node*
%8 = alloca [10 x i8]
%9 = alloca i32
store i32 %0, i32* %3
store %struct.list_node* %1, %struct.list_node** %4
%10 = call i32 @wait(i32* %5)
store i32 0, i32* %6
store %struct.list_node* null, %struct.list_node** %7
%11 = bitcast [10 x i8]* %8 to i8*
store i32 0, i32* %9
br label %12
12: ; preds = %2, %24, %33, %59, %77, %91, %111, %121
%13 = call i32 @procprint(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%14 = load i64, i64* @EOF
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%16 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = icmp eq i64 %14, %16
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 @procprint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %123
20: ; preds = %12
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%22 = call i32 @strncmp(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 10)
%23 = icmp ne i32 %22, 0
br i1 %23, label %29, label %24
24: ; preds = %20
%25 = load i32, i32* %3
%26 = load %struct.list_node*, %struct.list_node** %4
%27 = call i32 @cmd_set_breakpoint(i32 %25, %struct.list_node** %7, %struct.list_node* %26)
%28 = call i32 (...) @eatendline()
br label %12
29: ; preds = %20
%30 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%31 = call i32 @strncmp(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 10)
%32 = icmp ne i32 %31, 0
br i1 %32, label %38, label %33
33: ; preds = %29
%34 = load i32, i32* %3
%35 = load %struct.list_node*, %struct.list_node** %4
%36 = call i32 @cmd_delete_breakpoint(i32 %34, %struct.list_node** %7, %struct.list_node* %35)
store i32 1, i32* %6
%37 = call i32 (...) @eatendline()
br label %12
38: ; preds = %29
%39 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%40 = call i32 @strncmp(i8* %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 10)
%41 = icmp ne i32 %40, 0
br i1 %41, label %45, label %42
42: ; preds = %38
%43 = load %struct.list_node*, %struct.list_node** %7
%44 = call i32 @cmd_list_breakpoinst(%struct.list_node* %43)
br label %119
45: ; preds = %38
%46 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%47 = call i32 @strncmp(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i32 10)
%48 = icmp ne i32 %47, 0
br i1 %48, label %52, label %49
49: ; preds = %45
%50 = load i32, i32* %3
%51 = call i32 @cmd_display_ins_eip(i32 %50)
br label %118
52: ; preds = %45
%53 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%54 = call i32 @strncmp(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 10)
%55 = icmp ne i32 %54, 0
br i1 %55, label %70, label %56
56: ; preds = %52
%57 = load i32, i32* %9
%58 = icmp ne i32 %57, 1
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = call i32 @procprint(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
%61 = call i32 (...) @eatendline()
br label %12
62: ; preds = %56
%63 = load i32, i32* %3
%64 = load %struct.list_node*, %struct.list_node** %7
%65 = call i32 @cmd_continue(i32 %63, i32* %6, %struct.list_node* %64)
%66 = load i32, i32* %3
%67 = load %struct.list_node*, %struct.list_node** %7
%68 = load %struct.list_node*, %struct.list_node** %4
%69 = call i32 @prompt_break(i32 %66, %struct.list_node* %67, %struct.list_node* %68)
br label %117
70: ; preds = %52
%71 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%72 = call i32 @strncmp(i8* %71, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i32 10)
%73 = icmp ne i32 %72, 0
br i1 %73, label %84, label %74
74: ; preds = %70
%75 = load i32, i32* %9
%76 = icmp ne i32 %75, 1
br i1 %76, label %77, label %80
77: ; preds = %74
%78 = call i32 @procprint(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
%79 = call i32 (...) @eatendline()
br label %12
80: ; preds = %74
%81 = load i32, i32* %3
%82 = load %struct.list_node*, %struct.list_node** %7
%83 = call i32 @cmd_nextline(i32 %81, i32* %6, %struct.list_node* %82)
br label %116
84: ; preds = %70
%85 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%86 = call i32 @strncmp(i8* %85, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 10)
%87 = icmp ne i32 %86, 0
br i1 %87, label %101, label %88
88: ; preds = %84
%89 = load i32, i32* %9
%90 = icmp eq i32 %89, 1
br i1 %90, label %91, label %94
91: ; preds = %88
%92 = call i32 @procprint(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0))
%93 = call i32 (...) @eatendline()
br label %12
94: ; preds = %88
store i32 1, i32* %9
%95 = load i32, i32* %3
%96 = call i32 @cmd_run(i32 %95)
%97 = load i32, i32* %3
%98 = load %struct.list_node*, %struct.list_node** %7
%99 = load %struct.list_node*, %struct.list_node** %4
%100 = call i32 @prompt_break(i32 %97, %struct.list_node* %98, %struct.list_node* %99)
br label %115
101: ; preds = %84
%102 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%103 = call i32 @strncmp(i8* %102, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 10)
%104 = icmp ne i32 %103, 0
br i1 %104, label %105, label %109
105: ; preds = %101
%106 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%107 = call i32 @strncmp(i8* %106, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 10)
%108 = icmp ne i32 %107, 0
br i1 %108, label %111, label %109
109: ; preds = %105, %101
%110 = call i32 (...) @cmd_help()
br label %114
111: ; preds = %105
%112 = call i32 @procprint(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.14, i64 0, i64 0))
%113 = call i32 (...) @eatendline()
br label %12
114: ; preds = %109
br label %115
115: ; preds = %114, %94
br label %116
116: ; preds = %115, %80
br label %117
117: ; preds = %116, %62
br label %118
118: ; preds = %117, %49
br label %119
119: ; preds = %118, %42
br label %120
120: ; preds = %119
br label %121
121: ; preds = %120
%122 = call i32 (...) @eatendline()
br label %12
123: ; preds = %18
%124 = call i32 @list_destroy(%struct.list_node** %7)
%125 = call i32 @list_destroy(%struct.list_node** %4)
ret void
}

LLVM IR (-O2):
%struct.list_node = type { i32 }
@.str = [1 x i8] zeroinitializer
@EOF = global i64 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [6 x i8] c"done\0A\00"
@.str.3 = [2 x i8] c"b\00"
@.str.4 = [2 x i8] c"d\00"
@.str.5 = [4 x i8] c"lbp\00"
@.str.6 = [2 x i8] c"i\00"
@.str.7 = [2 x i8] c"c\00"
@.str.8 = [31 x i8] c"The program is not being run.\0A\00"
@.str.9 = [2 x i8] c"n\00"
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [21 x i8] c"target is being run\0A\00"
@.str.12 = [2 x i8] c"h\00"
@.str.13 = [5 x i8] c"help\00"
@.str.14 = [31 x i8] c"no support for this operation\0A\00"
define void @run_debugger(i32 %0, %struct.list_node* %1) {
%3 = alloca %struct.list_node*
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.list_node*
%7 = alloca [10 x i8]
store %struct.list_node* %1, %struct.list_node** %3
%8 = bitcast i32* %4 to i8*
%9 = call i32 @wait(i32* %4)
%10 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%11 = bitcast %struct.list_node** %6 to i8*
store %struct.list_node* null, %struct.list_node** %6
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%13 = call i32 @procprint(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%14 = load i64, i64* @EOF
%15 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%16 = icmp eq i64 %14, %15
br i1 %16, label %19, label %17
17: ; preds = %2, %93
%18 = phi i32 [ %94, %93 ], [ 0, %2 ]
br label %23
19: ; preds = %93, %28, %2
%20 = call i32 @procprint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @list_destroy(%struct.list_node** %6)
%22 = call i32 @list_destroy(%struct.list_node** %3)
ret void
23: ; preds = %17, %28
%24 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 10)
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %34
26: ; preds = %23
%27 = call i32 @cmd_set_breakpoint(i32 %0, %struct.list_node** %6, %struct.list_node* %1)
br label %28
28: ; preds = %26, %37, %91
%29 = call i32 (...) @eatendline()
%30 = call i32 @procprint(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%31 = load i64, i64* @EOF
%32 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%33 = icmp eq i64 %31, %32
br i1 %33, label %19, label %23
34: ; preds = %23
%35 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 10)
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 @cmd_delete_breakpoint(i32 %0, %struct.list_node** %6, %struct.list_node* %1)
store i32 1, i32* %5
br label %28
39: ; preds = %34
%40 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 10)
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load %struct.list_node*, %struct.list_node** %6
%44 = call i32 @cmd_list_breakpoinst(%struct.list_node* %43)
br label %93
45: ; preds = %39
%46 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i32 10)
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = call i32 @cmd_display_ins_eip(i32 %0)
br label %93
50: ; preds = %45
%51 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 10)
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %62
53: ; preds = %50
%54 = icmp eq i32 %18, 1
br i1 %54, label %57, label %55
55: ; preds = %53
%56 = call i32 @procprint(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
br label %93
57: ; preds = %53
%58 = load %struct.list_node*, %struct.list_node** %6
%59 = call i32 @cmd_continue(i32 %0, i32* %5, %struct.list_node* %58)
%60 = load %struct.list_node*, %struct.list_node** %6
%61 = call i32 @prompt_break(i32 %0, %struct.list_node* %60, %struct.list_node* %1)
br label %93
62: ; preds = %50
%63 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i32 10)
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %72
65: ; preds = %62
%66 = icmp eq i32 %18, 1
br i1 %66, label %69, label %67
67: ; preds = %65
%68 = call i32 @procprint(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
br label %93
69: ; preds = %65
%70 = load %struct.list_node*, %struct.list_node** %6
%71 = call i32 @cmd_nextline(i32 %0, i32* %5, %struct.list_node* %70)
br label %93
72: ; preds = %62
%73 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 10)
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %83
75: ; preds = %72
%76 = icmp eq i32 %18, 1
br i1 %76, label %77, label %79
77: ; preds = %75
%78 = call i32 @procprint(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0))
br label %93
79: ; preds = %75
%80 = call i32 @cmd_run(i32 %0)
%81 = load %struct.list_node*, %struct.list_node** %6
%82 = call i32 @prompt_break(i32 %0, %struct.list_node* %81, %struct.list_node* %1)
br label %93
83: ; preds = %72
%84 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 10)
%85 = icmp eq i32 %84, 0
br i1 %85, label %89, label %86
86: ; preds = %83
%87 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 10)
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %91
89: ; preds = %86, %83
%90 = call i32 (...) @cmd_help()
br label %93
91: ; preds = %86
%92 = call i32 @procprint(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.14, i64 0, i64 0))
br label %28
93: ; preds = %42, %57, %79, %89, %69, %48, %77, %67, %55
%94 = phi i32 [ 0, %55 ], [ 0, %67 ], [ 1, %77 ], [ %18, %89 ], [ 1, %79 ], [ 1, %69 ], [ 1, %57 ], [ %18, %48 ], [ %18, %42 ]
%95 = call i32 (...) @eatendline()
%96 = call i32 @procprint(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%97 = load i64, i64* @EOF
%98 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%99 = icmp eq i64 %97, %98
br i1 %99, label %19, label %17
}