#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*/ clean_mask_and_pending_signals();
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ test_execve_continue();
int /*<<< orphan*/ test_execve_start(char *);
int /*<<< orphan*/ test_fork();
int /*<<< orphan*/ test_multiple_pending();
int /*<<< orphan*/ test_sigprocmask();
int main(int argc, char *argv[]) {
  if (argc < 1) {
    return 1;
  } else if (argc > 1) {
    test_execve_continue();
    puts("All tests OK");
    return 0;
  }
  test_sigprocmask();
  clean_mask_and_pending_signals();
  test_multiple_pending();
  clean_mask_and_pending_signals();
  test_fork();
  clean_mask_and_pending_signals();
  test_execve_start(argv[0]);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    119c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1207 <main+0x97>
cmpl   $0x1,-0x8(%rbp)
jle    11c5 <main+0x55>
mov    $0x0,%al
call   1060 <test_execve_continue@plt>
lea    0xe4c(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    1207 <main+0x97>
jmp    11ca <main+0x5a>
mov    $0x0,%al
call   1090 <test_sigprocmask@plt>
mov    $0x0,%al
call   1050 <clean_mask_and_pending_signals@plt>
mov    $0x0,%al
call   1080 <test_multiple_pending@plt>
mov    $0x0,%al
call   1050 <clean_mask_and_pending_signals@plt>
mov    $0x0,%al
call   1070 <test_fork@plt>
mov    $0x0,%al
call   1050 <clean_mask_and_pending_signals@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <test_execve_start@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
test   %edi,%edi
jle    11ce <main+0x5e>
cmp    $0x1,%edi
jne    11b9 <main+0x49>
mov    %rsi,%r14
xor    %eax,%eax
call   1090 <test_sigprocmask@plt>
xor    %eax,%eax
call   1050 <clean_mask_and_pending_signals@plt>
xor    %eax,%eax
call   1080 <test_multiple_pending@plt>
xor    %eax,%eax
call   1050 <clean_mask_and_pending_signals@plt>
xor    %eax,%eax
call   1070 <test_fork@plt>
xor    %eax,%eax
call   1050 <clean_mask_and_pending_signals@plt>
mov    (%r14),%rdi
call   1030 <test_execve_start@plt>
jmp    11ce <main+0x5e>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <test_execve_continue@plt>
lea    0xe37(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"All tests OK\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 1, i32* %3
br label %27
9: ; preds = %2
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = call i32 (...) @test_execve_continue()
%14 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %27
15: ; preds = %9
br label %16
16: ; preds = %15
%17 = call i32 (...) @test_sigprocmask()
%18 = call i32 (...) @clean_mask_and_pending_signals()
%19 = call i32 (...) @test_multiple_pending()
%20 = call i32 (...) @clean_mask_and_pending_signals()
%21 = call i32 (...) @test_fork()
%22 = call i32 (...) @clean_mask_and_pending_signals()
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @test_execve_start(i8* %25)
store i32 1, i32* %3
br label %27
27: ; preds = %16, %12, %8
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [13 x i8] c"All tests OK\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %18, label %4
4: ; preds = %2
%5 = icmp eq i32 %0, 1
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = tail call i32 (...) @test_execve_continue()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %18
9: ; preds = %4
%10 = tail call i32 (...) @test_sigprocmask()
%11 = tail call i32 (...) @clean_mask_and_pending_signals()
%12 = tail call i32 (...) @test_multiple_pending()
%13 = tail call i32 (...) @clean_mask_and_pending_signals()
%14 = tail call i32 (...) @test_fork()
%15 = tail call i32 (...) @clean_mask_and_pending_signals()
%16 = load i8*, i8** %1
%17 = tail call i32 @test_execve_start(i8* %16)
br label %18
18: ; preds = %2, %9, %6
%19 = phi i32 [ 0, %6 ], [ 1, %9 ], [ 1, %2 ]
ret i32 %19
}