#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 /*<<< orphan*/ posix_spawnattr_t;
typedef int /*<<< orphan*/ posix_spawn_file_actions_t;
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int posix_spawn(int /*<<< orphan*/ *, char *const, int /*<<< orphan*/,
                int /*<<< orphan*/, char *const *, char *const *);
int /*<<< orphan*/ posix_spawn_file_actions_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ posix_spawnattr_setflags(int /*<<< orphan*/ *,
                                            int /*<<< orphan*/);
int main(void) {
  pid_t pid;
  posix_spawn_file_actions_t actions;
  posix_spawnattr_t attr;
  char *const argv[2] = {"/bin/true", 0};
  char *const envp[1] = {0};
  posix_spawnattr_setflags(&attr, 0);
  posix_spawn_file_actions_init(&actions);
  return posix_spawn(&pid, argv[0], 0, 0, argv, envp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cb7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1060 <posix_spawnattr_setflags@plt>
lea    -0xc(%rbp),%rdi
call   1030 <posix_spawn_file_actions_init@plt>
mov    -0x20(%rbp),%rsi
lea    -0x20(%rbp),%r8
lea    -0x28(%rbp),%r9
lea    -0x8(%rbp),%rdi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1050 <posix_spawn@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movaps 0x2cd5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x14(%rsp),%rdi
xor    %esi,%esi
call   1050 <posix_spawnattr_setflags@plt>
lea    0x18(%rsp),%rdi
call   1030 <posix_spawn_file_actions_init@plt>
lea    0xe9a(%rip),%rsi
lea    0x1c(%rsp),%rdi
lea    0x20(%rsp),%r8
lea    0x8(%rsp),%r9
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <posix_spawn@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"/bin/true\00"
@__const.main.argv = [2 x i8*] [i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8* null]
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [2 x i8*]
%6 = alloca [1 x i8*]
store i32 0, i32* %1
%7 = bitcast [2 x i8*]* %5 to i8*
%8 = bitcast [1 x i8*]* %6 to i8*
%9 = call i32 @posix_spawnattr_setflags(i32* %4, i32 0)
%10 = call i32 @posix_spawn_file_actions_init(i32* %3)
%11 = getelementptr inbounds [2 x i8*], [2 x i8*]* %5, i64 0, i64 0
%12 = load i8*, i8** %11
%13 = getelementptr inbounds [2 x i8*], [2 x i8*]* %5, i64 0, i64 0
%14 = getelementptr inbounds [1 x i8*], [1 x i8*]* %6, i64 0, i64 0
%15 = call i32 @posix_spawn(i32* %2, i8* %12, i32 0, i32 0, i8** %13, i8** %14)
ret i32 %15
}

LLVM IR (-O2):
@.str = [10 x i8] c"/bin/true\00"
@__const.main.argv = [2 x i8*] [i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8* null]
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [2 x i8*]
%5 = alloca [1 x i8*]
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast [2 x i8*]* %4 to i8*
%10 = bitcast [1 x i8*]* %5 to i8*
%11 = bitcast [1 x i8*]* %5 to i64*
store i64 0, i64* %11
%12 = call i32 @posix_spawnattr_setflags(i32* %3, i32 0)
%13 = call i32 @posix_spawn_file_actions_init(i32* %2)
%14 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 0
%15 = getelementptr inbounds [1 x i8*], [1 x i8*]* %5, i64 0, i64 0
%16 = call i32 @posix_spawn(i32* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i8** %14, i8** %15)
ret i32 %16
}