void child_execute_job(stdin_fd, stdout_fd, file, argv, envp) int stdin_fd,
    stdout_fd;
struct file *file;
char **argv, **envp;
{
  char *path;
  if (stdin_fd != 0)
    (void)dup2(stdin_fd, 0);
  if (stdout_fd != 1)
    (void)dup2(stdout_fd, 1);
  {
    register int d;
    int max = getdtablesize();
    for (d = 3; d < max; ++d)
      (void)close(d);
  }
  unblock_children();
  path = allocated_variable_expand_for_file("$(PATH)", file);
  exec_command(argv, envp, path);
  {
    int argc;
    char **shell_argv;
    argc = 0;
    while (argv[argc] != 0)
      ++argc;
    shell_argv = (char **)__builtin_alloca((2 + argc + 1) * sizeof(char *));
    shell_argv[0] = variable_expand_for_file("$(SHELL)", file);
    shell_argv[1] = "-c";
    do
      shell_argv[2 + argc] = argv[argc];
    while (argc-- > 0);
    exec_command(shell_argv, envp, path);
    _exit(127);
  }
}


x86 assembly (clang, -O0):
<child_execute_job>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     11b0 <child_execute_job+0x30>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
mov    $0x0,%al
call   1040 <dup2@plt>
cmpl   $0x1,-0x8(%rbp)
je     11c9 <child_execute_job+0x49>
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <dup2@plt>
mov    $0x0,%al
call   10a0 <getdtablesize@plt>
mov    %eax,-0x30(%rbp)
movl   $0x3,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    11fe <child_execute_job+0x7e>
mov    -0x2c(%rbp),%edi
mov    $0x0,%al
call   1050 <close@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11da <child_execute_job+0x5a>
mov    $0x0,%al
call   1080 <unblock_children@plt>
mov    -0x10(%rbp),%rsi
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1070 <allocated_variable_expand_for_file@plt>
cltq
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1060 <exec_command@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1258 <child_execute_job+0xd8>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1237 <child_execute_job+0xb7>
movslq -0x34(%rbp),%rax
lea    0x27(,%rax,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rax
sub    %rcx,%rax
mov    %rax,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xd88(%rip),%rdi
mov    $0x0,%al
call   1090 <variable_expand_for_file@plt>
movslq %eax,%rcx
mov    -0x40(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x40(%rbp),%rax
lea    0xd75(%rip),%rcx
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x40(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x34(%rbp)
cmp    $0x0,%eax
jg     12a0 <child_execute_job+0x120>
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1060 <exec_command@plt>
mov    $0x7f,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<child_execute_job>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%r15
mov    %rcx,%r13
mov    %rdx,-0x30(%rbp)
mov    %esi,%r12d
test   %edi,%edi
je     11bb <child_execute_job+0x2b>
xor    %esi,%esi
xor    %eax,%eax
call   1040 <dup2@plt>
cmp    $0x1,%r12d
je     11d0 <child_execute_job+0x40>
mov    %r12d,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <dup2@plt>
xor    %eax,%eax
call   10b0 <getdtablesize@plt>
cmp    $0x4,%eax
jl     1201 <child_execute_job+0x71>
mov    %eax,%r12d
mov    $0x3,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
xor    %eax,%eax
call   1050 <close@plt>
add    $0x1,%ebx
cmp    %ebx,%r12d
jne    11f0 <child_execute_job+0x60>
movabs $0x100000000,%r14
xor    %ebx,%ebx
xor    %eax,%eax
call   1090 <unblock_children@plt>
lea    0xde5(%rip),%rdi
mov    -0x30(%rbp),%rsi
xor    %eax,%eax
call   1070 <allocated_variable_expand_for_file@plt>
movslq %eax,%rdx
mov    %r13,%rdi
mov    %r15,-0x50(%rbp)
mov    %r15,%rsi
mov    %rdx,-0x48(%rbp)
xor    %eax,%eax
call   1060 <exec_command@plt>
mov    %r13,%rcx
movabs $0xffffffff00000000,%r15
ff ff ff
mov    $0xffffffff,%r13d
mov    %r14,%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    %r14,%r15
add    %r14,%r12
add    $0x1,%r13d
cmpq   $0x0,(%rcx,%rbx,8)
lea    0x1(%rbx),%rbx
jne    1260 <child_execute_job+0xd0>
lea    0x2(%rbx),%eax
mov    %rsp,%rdx
mov    %rdx,-0x40(%rbp)
lea    0xf(,%rax,8),%r14
and    $0xfffffffffffffff0,%r14
mov    %rdx,%rax
sub    %r14,%rax
mov    %rax,-0x38(%rbp)
mov    %rax,%rsp
neg    %r14
lea    0xd66(%rip),%rdi
mov    -0x30(%rbp),%rsi
xor    %eax,%eax
mov    %rcx,-0x30(%rbp)
call   10a0 <variable_expand_for_file@plt>
cltq
mov    -0x40(%rbp),%rcx
mov    %rax,(%rcx,%r14,1)
lea    0xd4f(%rip),%rax
mov    -0x38(%rbp),%rcx
mov    %rax,0x8(%rcx)
sar    $0x20,%r12
test   %r13d,%r13d
mov    $0x0,%eax
cmovs  %r13d,%eax
not    %eax
add    %ebx,%eax
sub    %rax,%r12
lea    (%rcx,%r12,8),%rdi
mov    %rcx,%rbx
sar    $0x20,%r15
sub    %rax,%r15
mov    -0x30(%rbp),%rcx
lea    (%rcx,%r15,8),%rsi
lea    0x8(,%rax,8),%rdx
call   1080 <memcpy@plt>
mov    %rbx,%rdi
mov    -0x50(%rbp),%rsi
mov    -0x48(%rbp),%rdx
xor    %eax,%eax
call   1060 <exec_command@plt>
mov    $0x7f,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
%struct.file = type opaque
@.str = [8 x i8] c"$(PATH)\00"
@.str.1 = [9 x i8] c"$(SHELL)\00"
@.str.2 = [3 x i8] c"-c\00"
define void @child_execute_job(i32 %0, i32 %1, %struct.file* %2, i8** %3, i8** %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.file*
%9 = alloca i8**
%10 = alloca i8**
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8**
store i32 %0, i32* %6
store i32 %1, i32* %7
store %struct.file* %2, %struct.file** %8
store i8** %3, i8*** %9
store i8** %4, i8*** %10
%16 = load i32, i32* %6
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %5
%19 = load i32, i32* %6
%20 = call i32 (i32, i32, ...) bitcast (i32 (...)* @dup2 to i32 (i32, i32, ...)*)(i32 %19, i32 0)
br label %21
21: ; preds = %18, %5
%22 = load i32, i32* %7
%23 = icmp ne i32 %22, 1
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32, i32* %7
%26 = call i32 (i32, i32, ...) bitcast (i32 (...)* @dup2 to i32 (i32, i32, ...)*)(i32 %25, i32 1)
br label %27
27: ; preds = %24, %21
%28 = call i32 (...) @getdtablesize()
store i32 %28, i32* %13
store i32 3, i32* %12
br label %29
29: ; preds = %36, %27
%30 = load i32, i32* %12
%31 = load i32, i32* %13
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %39
33: ; preds = %29
%34 = load i32, i32* %12
%35 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %34)
br label %36
36: ; preds = %33
%37 = load i32, i32* %12
%38 = add nsw i32 %37, 1
store i32 %38, i32* %12
br label %29
39: ; preds = %29
%40 = call i32 (...) @unblock_children()
%41 = load %struct.file*, %struct.file** %8
%42 = call i32 (i8*, %struct.file*, ...) bitcast (i32 (...)* @allocated_variable_expand_for_file to i32 (i8*, %struct.file*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %struct.file* %41)
%43 = sext i32 %42 to i64
%44 = inttoptr i64 %43 to i8*
store i8* %44, i8** %11
%45 = load i8**, i8*** %9
%46 = load i8**, i8*** %10
%47 = load i8*, i8** %11
%48 = call i32 (i8**, i8**, i8*, ...) bitcast (i32 (...)* @exec_command to i32 (i8**, i8**, i8*, ...)*)(i8** %45, i8** %46, i8* %47)
store i32 0, i32* %14
br label %49
49: ; preds = %56, %39
%50 = load i8**, i8*** %9
%51 = load i32, i32* %14
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8*, i8** %50, i64 %52
%54 = load i8*, i8** %53
%55 = icmp ne i8* %54, null
br i1 %55, label %56, label %59
56: ; preds = %49
%57 = load i32, i32* %14
%58 = add nsw i32 %57, 1
store i32 %58, i32* %14
br label %49
59: ; preds = %49
%60 = load i32, i32* %14
%61 = add nsw i32 2, %60
%62 = add nsw i32 %61, 1
%63 = sext i32 %62 to i64
%64 = mul i64 %63, 8
%65 = alloca i8, i64 %64
%66 = bitcast i8* %65 to i8**
store i8** %66, i8*** %15
%67 = load %struct.file*, %struct.file** %8
%68 = call i32 (i8*, %struct.file*, ...) bitcast (i32 (...)* @variable_expand_for_file to i32 (i8*, %struct.file*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %struct.file* %67)
%69 = sext i32 %68 to i64
%70 = inttoptr i64 %69 to i8*
%71 = load i8**, i8*** %15
%72 = getelementptr inbounds i8*, i8** %71, i64 0
store i8* %70, i8** %72
%73 = load i8**, i8*** %15
%74 = getelementptr inbounds i8*, i8** %73, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %74
br label %75
75: ; preds = %86, %59
%76 = load i8**, i8*** %9
%77 = load i32, i32* %14
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8*, i8** %76, i64 %78
%80 = load i8*, i8** %79
%81 = load i8**, i8*** %15
%82 = load i32, i32* %14
%83 = add nsw i32 2, %82
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8*, i8** %81, i64 %84
store i8* %80, i8** %85
br label %86
86: ; preds = %75
%87 = load i32, i32* %14
%88 = add nsw i32 %87, -1
store i32 %88, i32* %14
%89 = icmp sgt i32 %87, 0
br i1 %89, label %75, label %90
90: ; preds = %86
%91 = load i8**, i8*** %15
%92 = load i8**, i8*** %10
%93 = load i8*, i8** %11
%94 = call i32 (i8**, i8**, i8*, ...) bitcast (i32 (...)* @exec_command to i32 (i8**, i8**, i8*, ...)*)(i8** %91, i8** %92, i8* %93)
unreachable
}

LLVM IR (-O2):
%struct.file = type opaque
@.str = [8 x i8] c"$(PATH)\00"
@.str.1 = [9 x i8] c"$(SHELL)\00"
@.str.2 = [3 x i8] c"-c\00"
define void @child_execute_job(i32 %0, i32 %1, %struct.file* %2, i8** %3, i8** %4) {
%6 = icmp eq i32 %0, 0
br i1 %6, label %9, label %7
7: ; preds = %5
%8 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @dup2 to i32 (i32, i32, ...)*)(i32 %0, i32 0)
br label %9
9: ; preds = %7, %5
%10 = icmp eq i32 %1, 1
br i1 %10, label %13, label %11
11: ; preds = %9
%12 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @dup2 to i32 (i32, i32, ...)*)(i32 %1, i32 1)
br label %13
13: ; preds = %11, %9
%14 = tail call i32 (...) @getdtablesize()
%15 = icmp sgt i32 %14, 3
br i1 %15, label %16, label %21
16: ; preds = %13, %16
%17 = phi i32 [ %19, %16 ], [ 3, %13 ]
%18 = tail call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %17)
%19 = add nuw nsw i32 %17, 1
%20 = icmp eq i32 %19, %14
br i1 %20, label %21, label %16
21: ; preds = %16, %13
%22 = tail call i32 (...) @unblock_children()
%23 = tail call i32 (i8*, %struct.file*, ...) bitcast (i32 (...)* @allocated_variable_expand_for_file to i32 (i8*, %struct.file*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %struct.file* %2)
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i8*
%26 = tail call i32 (i8**, i8**, i8*, ...) bitcast (i32 (...)* @exec_command to i32 (i8**, i8**, i8*, ...)*)(i8** %3, i8** %4, i8* %25)
br label %27
27: ; preds = %27, %21
%28 = phi i64 [ %32, %27 ], [ 0, %21 ]
%29 = getelementptr inbounds i8*, i8** %3, i64 %28
%30 = load i8*, i8** %29
%31 = icmp eq i8* %30, null
%32 = add nuw i64 %28, 1
br i1 %31, label %33, label %27
33: ; preds = %27
%34 = trunc i64 %28 to i32
%35 = add i64 %28, 3
%36 = and i64 %35, 4294967295
%37 = alloca i8*, i64 %36
%38 = tail call i32 (i8*, %struct.file*, ...) bitcast (i32 (...)* @variable_expand_for_file to i32 (i8*, %struct.file*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %struct.file* %2)
%39 = sext i32 %38 to i64
%40 = inttoptr i64 %39 to i8*
store i8* %40, i8** %37
%41 = getelementptr inbounds i8*, i8** %37, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %41
%42 = shl i64 %28, 32
%43 = add i64 %42, 8589934592
%44 = ashr exact i64 %43, 32
%45 = call i32 @llvm.smin.i32(i32 %34, i32 0)
%46 = sub i32 %34, %45
%47 = zext i32 %46 to i64
%48 = sub nsw i64 %44, %47
%49 = getelementptr i8*, i8** %37, i64 %48
%50 = bitcast i8** %49 to i8*
%51 = shl i64 %28, 32
%52 = ashr exact i64 %51, 32
%53 = sub nsw i64 %52, %47
%54 = getelementptr i8*, i8** %3, i64 %53
%55 = bitcast i8** %54 to i8*
%56 = shl nuw nsw i64 %47, 3
%57 = add nuw nsw i64 %56, 8
%58 = call i32 (i8**, i8**, i8*, ...) bitcast (i32 (...)* @exec_command to i32 (i8**, i8**, i8*, ...)*)(i8** %37, i8** %4, i8* %25)
unreachable
}