#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 tree_node {
  int dummy;
};
struct line {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ die(char *);
int fork();
struct tree_node *parse(struct line *);
int /*<<< orphan*/ wait(void *);
int /*<<< orphan*/ walk_tree(struct tree_node *);
void execute(struct line *l) {
  struct tree_node *ast;
  switch (fork()) {
  case -1:
    die("execute: fork failed\n");
  case 0:
    ast = parse(l);
    walk_tree(ast);
    break;
  default:
    wait((void *)0);
  }
}


x86 assembly (clang, -O0):
<execute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
call   1070 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
sub    $0xffffffff,%eax
je     1186 <execute+0x36>
jmp    1176 <execute+0x26>
mov    -0x14(%rbp),%eax
test   %eax,%eax
je     1192 <execute+0x42>
jmp    11ad <execute+0x5d>
lea    0xe73(%rip),%rdi
call   1040 <die@plt>
mov    -0x8(%rbp),%rdi
call   1050 <parse@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <walk_tree@plt>
jmp    11b6 <execute+0x66>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <wait@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1070 <fork@plt>
test   %eax,%eax
je     1170 <execute+0x20>
cmp    $0xffffffff,%eax
jne    1181 <execute+0x31>
lea    0xe95(%rip),%rdi
call   1040 <die@plt>
mov    %rbx,%rdi
call   1050 <parse@plt>
mov    %rax,%rdi
pop    %rbx
jmp    1030 <walk_tree@plt>
xor    %edi,%edi
pop    %rbx
jmp    1060 <wait@plt>

LLVM IR (-O0):
%struct.line = type { i32 }
%struct.tree_node = type { i32 }
@.str = [22 x i8] c"execute: fork failed\0A\00"
define void @execute(%struct.line* %0) {
%2 = alloca %struct.line*
%3 = alloca %struct.tree_node*
store %struct.line* %0, %struct.line** %2
%4 = call i32 (...) @fork()
switch i32 %4, label %12 [
i32 -1, label %5
i32 0, label %7
]
5: ; preds = %1
%6 = call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %1, %5
%8 = load %struct.line*, %struct.line** %2
%9 = call %struct.tree_node* @parse(%struct.line* %8)
store %struct.tree_node* %9, %struct.tree_node** %3
%10 = load %struct.tree_node*, %struct.tree_node** %3
%11 = call i32 @walk_tree(%struct.tree_node* %10)
br label %14
12: ; preds = %1
%13 = call i32 @wait(i8* null)
br label %14
14: ; preds = %12, %7
ret void
}

LLVM IR (-O2):
%struct.line = type { i32 }
%struct.tree_node = type { i32 }
@.str = [22 x i8] c"execute: fork failed\0A\00"
define void @execute(%struct.line* %0) {
%2 = tail call i32 (...) @fork()
switch i32 %2, label %8 [
i32 -1, label %3
i32 0, label %5
]
3: ; preds = %1
%4 = tail call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %1, %3
%6 = tail call %struct.tree_node* @parse(%struct.line* %0)
%7 = tail call i32 @walk_tree(%struct.tree_node* %6)
br label %10
8: ; preds = %1
%9 = tail call i32 @wait(i8* null)
br label %10
10: ; preds = %8, %5
ret void
}