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

/* Variables and functions */
int /*<<< orphan*/ dance_on_breakpoint(int /*<<< orphan*/,
                                       struct breakpoint_t *);
int /*<<< orphan*/ execute_singlestep(int /*<<< orphan*/);
struct breakpoint_t *which_breakpoint(int /*<<< orphan*/, struct list_node *);
void cmd_nextline(pid_t pid, int *why_stop, struct list_node *bps_list) {
  struct breakpoint_t *breakpoint;
  if (0 == *why_stop) {
    breakpoint = which_breakpoint(pid, bps_list);
    dance_on_breakpoint(pid, breakpoint);
    *why_stop = !0;
  } else {
    execute_singlestep(pid);
  }
}


x86 assembly (clang, -O0):
<cmd_nextline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmp    (%rcx),%eax
jne    117c <cmd_nextline+0x4c>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1040 <which_breakpoint@plt>
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <dance_on_breakpoint@plt>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    1184 <cmd_nextline+0x54>
mov    -0x4(%rbp),%edi
call   1050 <execute_singlestep@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_nextline>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
cmpl   $0x0,(%rsi)
je     1147 <cmd_nextline+0x17>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <execute_singlestep@plt>
mov    %rsi,%rbx
mov    %ebp,%edi
mov    %rdx,%rsi
call   1040 <which_breakpoint@plt>
mov    %ebp,%edi
mov    %rax,%rsi
call   1030 <dance_on_breakpoint@plt>
movl   $0x1,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.list_node = type { i32 }
%struct.breakpoint_t = type { i32 }
define void @cmd_nextline(i32 %0, i32* %1, %struct.list_node* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca %struct.list_node*
%7 = alloca %struct.breakpoint_t*
store i32 %0, i32* %4
store i32* %1, i32** %5
store %struct.list_node* %2, %struct.list_node** %6
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
%10 = icmp eq i32 0, %9
br i1 %10, label %11, label %19
11: ; preds = %3
%12 = load i32, i32* %4
%13 = load %struct.list_node*, %struct.list_node** %6
%14 = call %struct.breakpoint_t* @which_breakpoint(i32 %12, %struct.list_node* %13)
store %struct.breakpoint_t* %14, %struct.breakpoint_t** %7
%15 = load i32, i32* %4
%16 = load %struct.breakpoint_t*, %struct.breakpoint_t** %7
%17 = call i32 @dance_on_breakpoint(i32 %15, %struct.breakpoint_t* %16)
%18 = load i32*, i32** %5
store i32 1, i32* %18
br label %22
19: ; preds = %3
%20 = load i32, i32* %4
%21 = call i32 @execute_singlestep(i32 %20)
br label %22
22: ; preds = %19, %11
ret void
}

LLVM IR (-O2):
%struct.list_node = type { i32 }
%struct.breakpoint_t = type { i32 }
define void @cmd_nextline(i32 %0, i32* nocapture %1, %struct.list_node* %2) {
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call %struct.breakpoint_t* @which_breakpoint(i32 %0, %struct.list_node* %2)
%8 = tail call i32 @dance_on_breakpoint(i32 %0, %struct.breakpoint_t* %7)
store i32 1, i32* %1
br label %11
9: ; preds = %3
%10 = tail call i32 @execute_singlestep(i32 %0)
br label %11
11: ; preds = %9, %6
ret void
}