#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*/ printf(char *);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/);
int /*<<< orphan*/ test_dynamic();
int /*<<< orphan*/ test_fork();
int /*<<< orphan*/ test_race();
int /*<<< orphan*/ test_static();
int /*<<< orphan*/ test_unlock();
int main(int argc, char *args[]) {
  printf("_POSIX_THREADSAFE_FUNCTIONS is not defined\n");
  printf("testing\n\n");
  test_dynamic();
  printf("\n");
  test_static();
  printf("\n");
  test_race();
  printf("\n");
  test_unlock();
  printf("\n");
  test_fork();
  printf("\npass\n");
  pthread_exit(0);
  return 0;
}


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)
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <test_dynamic@plt>
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1090 <test_static@plt>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <test_race@plt>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1080 <test_unlock@plt>
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <test_fork@plt>
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1070 <pthread_exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe78(%rip),%rdi
call   1040 <puts@plt>
lea    0xe97(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <test_dynamic@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   10a0 <test_static@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1070 <test_race@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1090 <test_unlock@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1060 <test_fork@plt>
lea    0xe49(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <pthread_exit@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"_POSIX_THREADSAFE_FUNCTIONS is not defined\0A\00"
@.str.1 = [10 x i8] c"testing\0A\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [7 x i8] c"\0Apass\0A\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 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (...) @test_dynamic()
%9 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (...) @test_static()
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (...) @test_race()
%13 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (...) @test_unlock()
%15 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (...) @test_fork()
%17 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @pthread_exit(i32 0)
ret i32 0
}

LLVM IR (-O2):
@str = [43 x i8] c"_POSIX_THREADSAFE_FUNCTIONS is not defined\00"
@str.4 = [9 x i8] c"testing\0A\00"
@str.5 = [6 x i8] c"\0Apass\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 (...) @test_dynamic()
%6 = tail call i32 @putchar(i32 10)
%7 = tail call i32 (...) @test_static()
%8 = tail call i32 @putchar(i32 10)
%9 = tail call i32 (...) @test_race()
%10 = tail call i32 @putchar(i32 10)
%11 = tail call i32 (...) @test_unlock()
%12 = tail call i32 @putchar(i32 10)
%13 = tail call i32 (...) @test_fork()
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0))
%15 = tail call i32 @pthread_exit(i32 0)
ret i32 0
}