#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 spawnit(char const *, ...);
int main(int argc, const char **argv) {
  const char *success_exe;
  const char *failure_exe;
  assert(argc == 3);
  success_exe = argv[1];
  failure_exe = argv[2];
  assert(64 == spawnit(NULL));
  assert(0 == spawnit("!", "!", NULL));
  assert(64 == spawnit("!", NULL));
  assert(0 == spawnit(success_exe, NULL));
  assert(1 == spawnit(failure_exe, NULL));
  assert(65 == spawnit("!", success_exe, NULL));
  assert(0 == spawnit("!", failure_exe, NULL));
  assert(126 == spawnit(".", NULL));
  assert(65 == spawnit("!", ".", NULL));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
mov    $0x0,%al
call   1030 <spawnit@plt>
mov    %eax,%ecx
mov    $0x40,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe79(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
mov    $0x0,%al
call   1030 <spawnit@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe51(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <spawnit@plt>
mov    %eax,%ecx
mov    $0x40,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <spawnit@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <spawnit@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rsi
lea    0xdde(%rip),%rdi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x0,%al
call   1030 <spawnit@plt>
mov    %eax,%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x20(%rbp),%rsi
lea    0xdb2(%rip),%rdi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x0,%al
call   1030 <spawnit@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd8f(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <spawnit@plt>
mov    %eax,%ecx
mov    $0x7e,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd65(%rip),%rdi
lea    0xd60(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x0,%al
call   1030 <spawnit@plt>
mov    %eax,%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
xor    %eax,%eax
cmp    $0x3,%edi
sete   %al
mov    %eax,%edi
call   1040 <assert@plt>
mov    0x8(%rbx),%r12
mov    0x10(%rbx),%r14
xor    %edi,%edi
xor    %eax,%eax
call   1030 <spawnit@plt>
xor    %edi,%edi
cmp    $0x40,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xea0(%rip),%r15
mov    %r15,%rdi
mov    %r15,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <spawnit@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    %r15,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <spawnit@plt>
xor    %edi,%edi
cmp    $0x40,%eax
sete   %dil
call   1040 <assert@plt>
mov    %r12,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <spawnit@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    %r14,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <spawnit@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <spawnit@plt>
xor    %edi,%edi
cmp    $0x41,%eax
sete   %dil
call   1040 <assert@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <spawnit@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xdf9(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <spawnit@plt>
xor    %edi,%edi
cmp    $0x7e,%eax
sete   %dil
call   1040 <assert@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <spawnit@plt>
xor    %edi,%edi
cmp    $0x41,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"!\00"
@.str.1 = [2 x i8] c".\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 3
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
store i8* %14, i8** %6
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
store i8* %17, i8** %7
%18 = call i32 (i8*, ...) @spawnit(i8* null)
%19 = icmp eq i32 64, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i32 (i8*, ...) @spawnit(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* null)
%23 = icmp eq i32 0, %22
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = call i32 (i8*, ...) @spawnit(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* null)
%27 = icmp eq i32 64, %26
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = load i8*, i8** %6
%31 = call i32 (i8*, ...) @spawnit(i8* %30, i8* null)
%32 = icmp eq i32 0, %31
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = load i8*, i8** %7
%36 = call i32 (i8*, ...) @spawnit(i8* %35, i8* null)
%37 = icmp eq i32 1, %36
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = load i8*, i8** %6
%41 = call i32 (i8*, ...) @spawnit(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %40, i8* null)
%42 = icmp eq i32 65, %41
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = load i8*, i8** %7
%46 = call i32 (i8*, ...) @spawnit(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %45, i8* null)
%47 = icmp eq i32 0, %46
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
%50 = call i32 (i8*, ...) @spawnit(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* null)
%51 = icmp eq i32 126, %50
%52 = zext i1 %51 to i32
%53 = call i32 @assert(i32 %52)
%54 = call i32 (i8*, ...) @spawnit(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* null)
%55 = icmp eq i32 65, %54
%56 = zext i1 %55 to i32
%57 = call i32 @assert(i32 %56)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"!\00"
@.str.1 = [2 x i8] c".\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 (i8*, ...) @spawnit(i8* null)
%11 = icmp eq i32 %10, 64
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = tail call i32 (i8*, ...) @spawnit(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* null)
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = tail call i32 (i8*, ...) @spawnit(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* null)
%19 = icmp eq i32 %18, 64
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = tail call i32 (i8*, ...) @spawnit(i8* %7, i8* null)
%23 = icmp eq i32 %22, 0
%24 = zext i1 %23 to i32
%25 = tail call i32 @assert(i32 %24)
%26 = tail call i32 (i8*, ...) @spawnit(i8* %9, i8* null)
%27 = icmp eq i32 %26, 1
%28 = zext i1 %27 to i32
%29 = tail call i32 @assert(i32 %28)
%30 = tail call i32 (i8*, ...) @spawnit(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %7, i8* null)
%31 = icmp eq i32 %30, 65
%32 = zext i1 %31 to i32
%33 = tail call i32 @assert(i32 %32)
%34 = tail call i32 (i8*, ...) @spawnit(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %9, i8* null)
%35 = icmp eq i32 %34, 0
%36 = zext i1 %35 to i32
%37 = tail call i32 @assert(i32 %36)
%38 = tail call i32 (i8*, ...) @spawnit(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* null)
%39 = icmp eq i32 %38, 126
%40 = zext i1 %39 to i32
%41 = tail call i32 @assert(i32 %40)
%42 = tail call i32 (i8*, ...) @spawnit(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* null)
%43 = icmp eq i32 %42, 65
%44 = zext i1 %43 to i32
%45 = tail call i32 @assert(i32 %44)
ret i32 0
}