#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 pid_t;

/* Variables and functions */
scalar_t__ EAGAIN;
scalar_t__ errno;
int fork();
int /*<<< orphan*/ list_write_calls(int);
int /*<<< orphan*/ setup_inferior(char const *, char *);
void dbg_inferior_exec(const char *path, char argv[]) {
  pid_t child;
  do {
    child = fork();
    switch (child) {
    case 0:
      setup_inferior(path, argv);
      break;
    case -1:
      break;
    default:
      list_write_calls(child);
      break;
    }
  } while (child == -1 && errno == EAGAIN);
}


x86 assembly (clang, -O0):
<dbg_inferior_exec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
call   1050 <fork@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0xffffffff,%eax
je     1180 <dbg_inferior_exec+0x50>
jmp    115e <dbg_inferior_exec+0x2e>
mov    -0x18(%rbp),%eax
test   %eax,%eax
jne    1185 <dbg_inferior_exec+0x55>
jmp    116e <dbg_inferior_exec+0x3e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <setup_inferior@plt>
jmp    118d <dbg_inferior_exec+0x5d>
jmp    118d <dbg_inferior_exec+0x5d>
mov    -0x14(%rbp),%edi
call   1040 <list_write_calls@plt>
jmp    1192 <dbg_inferior_exec+0x62>
xor    %eax,%eax
cmpl   $0xffffffff,-0x14(%rbp)
mov    %al,-0x19(%rbp)
jne    11bb <dbg_inferior_exec+0x8b>
mov    0x2e38(%rip),%rax
mov    (%rax),%rax
mov    0x2e1e(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1140 <dbg_inferior_exec+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbg_inferior_exec>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    0x2e9b(%rip),%r12
mov    0x2e84(%rip),%rbx
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <fork@plt>
cmp    $0xffffffff,%eax
jne    1171 <dbg_inferior_exec+0x41>
mov    (%r12),%rax
cmp    (%rbx),%rax
je     1150 <dbg_inferior_exec+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
test   %eax,%eax
jne    118b <dbg_inferior_exec+0x5b>
mov    %r15,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <setup_inferior@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <list_write_calls@plt>

LLVM IR (-O0):
@errno = global i64 0
@EAGAIN = global i64 0
define void @dbg_inferior_exec(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %6
6: ; preds = %25, %2
%7 = call i32 (...) @fork()
store i32 %7, i32* %5
%8 = load i32, i32* %5
switch i32 %8, label %14 [
i32 0, label %9
i32 -1, label %13
]
9: ; preds = %6
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = call i32 @setup_inferior(i8* %10, i8* %11)
br label %17
13: ; preds = %6
br label %17
14: ; preds = %6
%15 = load i32, i32* %5
%16 = call i32 @list_write_calls(i32 %15)
br label %17
17: ; preds = %14, %13, %9
br label %18
18: ; preds = %17
%19 = load i32, i32* %5
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = load i64, i64* @errno
%23 = load i64, i64* @EAGAIN
%24 = icmp eq i64 %22, %23
br label %25
25: ; preds = %21, %18
%26 = phi i1 [ false, %18 ], [ %24, %21 ]
br i1 %26, label %6, label %27
27: ; preds = %25
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@EAGAIN = global i64 0
define void @dbg_inferior_exec(i8* %0, i8* %1) {
br label %3
3: ; preds = %9, %2
%4 = tail call i32 (...) @fork()
switch i32 %4, label %7 [
i32 0, label %5
i32 -1, label %9
]
5: ; preds = %3
%6 = tail call i32 @setup_inferior(i8* %0, i8* %1)
br label %13
7: ; preds = %3
%8 = tail call i32 @list_write_calls(i32 %4)
br label %13
9: ; preds = %3
%10 = load i64, i64* @errno
%11 = load i64, i64* @EAGAIN
%12 = icmp eq i64 %10, %11
br i1 %12, label %3, label %13
13: ; preds = %9, %7, %5
ret void
}