#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 */

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int lace_compat_fd_spawnlp_wait(int /*<<< orphan*/, int, int,
                                int /*<<< orphan*/ *, char const *, char *,
                                char *, char *, char *, ...);
void ujoin_usage_tests(const char *lace_exe, const char *bad_filename) {
  int istat;
  istat = lace_compat_fd_spawnlp_wait(0, 1, 2, NULL, lace_exe, "-as", "ujoin",
                                      "need_one_more_than_this", NULL);
  assert(istat == 64);
  istat = lace_compat_fd_spawnlp_wait(0, 1, 2, NULL, lace_exe, "-as", "ujoin",
                                      "-", "-", NULL);
  assert(istat == 66);
  istat = lace_compat_fd_spawnlp_wait(0, 1, 2, NULL, lace_exe, "-as", "ujoin",
                                      "-", "-", "-o", bad_filename, NULL);
  assert(istat == 73);
  istat = lace_compat_fd_spawnlp_wait(0, 1, 2, NULL, lace_exe, "-as", "ujoin",
                                      "-", "-", "-p", NULL);
  assert(istat == 64);
}


x86 assembly (clang, -O0):
<ujoin_usage_tests>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x48,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%r8
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %eax,%eax
mov    %eax,%ecx
lea    0xeb4(%rip),%r9
lea    0xeb1(%rip),%r10
lea    0xeb0(%rip),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    $0x0,%al
call   1030 <lace_compat_fd_spawnlp_wait@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x40,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%r8
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %eax,%eax
mov    %eax,%ecx
lea    0xe5e(%rip),%r9
lea    0xe5b(%rip),%r10
lea    0xe72(%rip),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rax,0x10(%rsp)
movq   $0x0,0x18(%rsp)
mov    $0x0,%al
call   1030 <lace_compat_fd_spawnlp_wait@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x42,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%rax
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %ecx,%ecx
lea    0xe01(%rip),%r9
lea    0xdfe(%rip),%rbx
lea    0xe15(%rip),%r11
lea    0xe10(%rip),%r10
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
movq   $0x0,0x28(%rsp)
mov    $0x0,%al
call   1030 <lace_compat_fd_spawnlp_wait@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x49,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%r8
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %eax,%eax
mov    %eax,%ecx
lea    0xd95(%rip),%r9
lea    0xd92(%rip),%r11
lea    0xda9(%rip),%r10
lea    0xda7(%rip),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
movq   $0x0,0x20(%rsp)
mov    $0x0,%al
call   1030 <lace_compat_fd_spawnlp_wait@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x40,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<ujoin_usage_tests>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %rdi,%rbx
sub    $0x8,%rsp
lea    0xed0(%rip),%r10
lea    0xec3(%rip),%r12
lea    0xeb8(%rip),%r14
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
mov    %r14,%r9
xor    %eax,%eax
push   $0x0
push   %r10
push   %r12
call   1030 <lace_compat_fd_spawnlp_wait@plt>
add    $0x20,%rsp
xor    %edi,%edi
cmp    $0x40,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xea0(%rip),%r13
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
mov    %r14,%r9
xor    %eax,%eax
push   $0x0
push   %r13
push   %r13
push   %r12
call   1030 <lace_compat_fd_spawnlp_wait@plt>
add    $0x20,%rsp
xor    %edi,%edi
cmp    $0x42,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe66(%rip),%r10
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
mov    %r14,%r9
xor    %eax,%eax
push   $0x0
push   %r15
push   %r10
push   %r13
push   %r13
push   %r12
call   1030 <lace_compat_fd_spawnlp_wait@plt>
add    $0x30,%rsp
xor    %edi,%edi
cmp    $0x49,%eax
sete   %dil
call   1040 <assert@plt>
sub    $0x8,%rsp
lea    0xe25(%rip),%r10
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
mov    %r14,%r9
xor    %eax,%eax
push   $0x0
push   %r10
push   %r13
push   %r13
push   %r12
call   1030 <lace_compat_fd_spawnlp_wait@plt>
add    $0x30,%rsp
xor    %edi,%edi
cmp    $0x40,%eax
sete   %dil
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"-as\00"
@.str.1 = [6 x i8] c"ujoin\00"
@.str.2 = [24 x i8] c"need_one_more_than_this\00"
@.str.3 = [2 x i8] c"-\00"
@.str.4 = [3 x i8] c"-o\00"
@.str.5 = [3 x i8] c"-p\00"
define void @ujoin_usage_tests(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 (i32, i32, i32, i32*, i8*, i8*, i8*, i8*, i8*, ...) @lace_compat_fd_spawnlp_wait(i32 0, i32 1, i32 2, i32* null, i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* null)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 64
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i8*, i8** %3
%13 = call i32 (i32, i32, i32, i32*, i8*, i8*, i8*, i8*, i8*, ...) @lace_compat_fd_spawnlp_wait(i32 0, i32 1, i32 2, i32* null, i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* null)
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 66
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i8*, i8** %3
%19 = load i8*, i8** %4
%20 = call i32 (i32, i32, i32, i32*, i8*, i8*, i8*, i8*, i8*, ...) @lace_compat_fd_spawnlp_wait(i32 0, i32 1, i32 2, i32* null, i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %19, i8* null)
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = icmp eq i32 %21, 73
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = load i8*, i8** %3
%26 = call i32 (i32, i32, i32, i32*, i8*, i8*, i8*, i8*, i8*, ...) @lace_compat_fd_spawnlp_wait(i32 0, i32 1, i32 2, i32* null, i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* null)
store i32 %26, i32* %5
%27 = load i32, i32* %5
%28 = icmp eq i32 %27, 64
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"-as\00"
@.str.1 = [6 x i8] c"ujoin\00"
@.str.2 = [24 x i8] c"need_one_more_than_this\00"
@.str.3 = [2 x i8] c"-\00"
@.str.4 = [3 x i8] c"-o\00"
@.str.5 = [3 x i8] c"-p\00"
define void @ujoin_usage_tests(i8* %0, i8* %1) {
%3 = tail call i32 (i32, i32, i32, i32*, i8*, i8*, i8*, i8*, i8*, ...) @lace_compat_fd_spawnlp_wait(i32 0, i32 1, i32 2, i32* null, i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* null)
%4 = icmp eq i32 %3, 64
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 (i32, i32, i32, i32*, i8*, i8*, i8*, i8*, i8*, ...) @lace_compat_fd_spawnlp_wait(i32 0, i32 1, i32 2, i32* null, i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* null)
%8 = icmp eq i32 %7, 66
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 (i32, i32, i32, i32*, i8*, i8*, i8*, i8*, i8*, ...) @lace_compat_fd_spawnlp_wait(i32 0, i32 1, i32 2, i32* null, i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %1, i8* null)
%12 = icmp eq i32 %11, 73
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 (i32, i32, i32, i32*, i8*, i8*, i8*, i8*, i8*, ...) @lace_compat_fd_spawnlp_wait(i32 0, i32 1, i32 2, i32* null, i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* null)
%16 = icmp eq i32 %15, 64
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
ret void
}