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

/* Variables and functions */
int access(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ fdopen(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ getcwd(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ isatty(int /*<<< orphan*/);
int /*<<< orphan*/ mkdir(char *, int /*<<< orphan*/);
int /*<<< orphan*/ open(int /*<<< orphan*/ *, int /*<<< orphan*/, ...);
int /*<<< orphan*/ pthread_mutex_destroy(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_mutex_init(int /*<<< orphan*/ *,
                                      int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_mutex_lock(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_mutex_trylock(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_mutex_unlock(int /*<<< orphan*/ *);
int /*<<< orphan*/ read(int, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ readdir(int /*<<< orphan*/);
int /*<<< orphan*/ strtok(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ utime(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ write(int, int /*<<< orphan*/ *, int);
void nullPointer(char *p, int fd, pthread_mutex_t mutex) {
  isatty(0);
  mkdir(p, 0);
  getcwd(0, 0);
  readdir(0);
  utime(NULL, NULL);
  read(fd, NULL, 42);
  read(fd, NULL, 0);
  write(fd, NULL, 42);
  write(fd, NULL, 0);
  open(NULL, 0);
  open(NULL, 0, 0);
  int ret = access(NULL, 0);
  fdopen(fd, NULL);
  strtok(p, NULL);
  pthread_mutex_init(NULL, NULL);
  pthread_mutex_init(&mutex, NULL);
  pthread_mutex_destroy(NULL);
  pthread_mutex_lock(NULL);
  (void)pthread_mutex_trylock(NULL);
  pthread_mutex_unlock(NULL);
}


x86 assembly (clang, -O0):
<nullPointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
xor    %edi,%edi
call   1050 <isatty@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <mkdir@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1080 <getcwd@plt>
xor    %edi,%edi
call   10b0 <readdir@plt>
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1030 <utime@plt>
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x2a,%edx
call   10a0 <read@plt>
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10a0 <read@plt>
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x2a,%edx
call   1060 <write@plt>
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <write@plt>
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
mov    $0x0,%al
call   10e0 <open@plt>
xor    %eax,%eax
mov    %eax,%edi
xor    %edx,%edx
mov    %edx,%esi
mov    $0x0,%al
call   10e0 <open@plt>
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   10f0 <access@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
call   10d0 <fdopen@plt>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1100 <strtok@plt>
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1110 <pthread_mutex_init@plt>
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1110 <pthread_mutex_init@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <pthread_mutex_destroy@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1120 <pthread_mutex_lock@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <pthread_mutex_trylock@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10c0 <pthread_mutex_unlock@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nullPointer>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %edx,0x4(%rsp)
xor    %edi,%edi
call   1050 <isatty@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <mkdir@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1080 <getcwd@plt>
xor    %edi,%edi
call   10b0 <readdir@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <utime@plt>
mov    %ebp,%edi
xor    %esi,%esi
mov    $0x2a,%edx
call   10a0 <read@plt>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <read@plt>
mov    %ebp,%edi
xor    %esi,%esi
mov    $0x2a,%edx
call   1060 <write@plt>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <write@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %eax,%eax
call   10e0 <open@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
call   10e0 <open@plt>
xor    %edi,%edi
xor    %esi,%esi
call   10f0 <access@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   10d0 <fdopen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1100 <strtok@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1110 <pthread_mutex_init@plt>
lea    0x4(%rsp),%rdi
xor    %esi,%esi
call   1110 <pthread_mutex_init@plt>
xor    %edi,%edi
call   1070 <pthread_mutex_destroy@plt>
xor    %edi,%edi
call   1120 <pthread_mutex_lock@plt>
xor    %edi,%edi
call   1090 <pthread_mutex_trylock@plt>
xor    %edi,%edi
call   10c0 <pthread_mutex_unlock@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @nullPointer(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = call i32 @isatty(i32 0)
%9 = load i8*, i8** %4
%10 = call i32 @mkdir(i8* %9, i32 0)
%11 = call i32 @getcwd(i32 0, i32 0)
%12 = call i32 @readdir(i32 0)
%13 = call i32 @utime(i32* null, i32* null)
%14 = load i32, i32* %5
%15 = call i32 @read(i32 %14, i32* null, i32 42)
%16 = load i32, i32* %5
%17 = call i32 @read(i32 %16, i32* null, i32 0)
%18 = load i32, i32* %5
%19 = call i32 @write(i32 %18, i32* null, i32 42)
%20 = load i32, i32* %5
%21 = call i32 @write(i32 %20, i32* null, i32 0)
%22 = call i32 (i32*, i32, ...) @open(i32* null, i32 0)
%23 = call i32 (i32*, i32, ...) @open(i32* null, i32 0, i32 0)
%24 = call i32 @access(i32* null, i32 0)
store i32 %24, i32* %7
%25 = load i32, i32* %5
%26 = call i32 @fdopen(i32 %25, i32* null)
%27 = load i8*, i8** %4
%28 = call i32 @strtok(i8* %27, i32* null)
%29 = call i32 @pthread_mutex_init(i32* null, i32* null)
%30 = call i32 @pthread_mutex_init(i32* %6, i32* null)
%31 = call i32 @pthread_mutex_destroy(i32* null)
%32 = call i32 @pthread_mutex_lock(i32* null)
%33 = call i32 @pthread_mutex_trylock(i32* null)
%34 = call i32 @pthread_mutex_unlock(i32* null)
ret void
}

LLVM IR (-O2):
define void @nullPointer(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
store i32 %2, i32* %4
%5 = tail call i32 @isatty(i32 0)
%6 = tail call i32 @mkdir(i8* %0, i32 0)
%7 = tail call i32 @getcwd(i32 0, i32 0)
%8 = tail call i32 @readdir(i32 0)
%9 = tail call i32 @utime(i32* null, i32* null)
%10 = tail call i32 @read(i32 %1, i32* null, i32 42)
%11 = tail call i32 @read(i32 %1, i32* null, i32 0)
%12 = tail call i32 @write(i32 %1, i32* null, i32 42)
%13 = tail call i32 @write(i32 %1, i32* null, i32 0)
%14 = tail call i32 (i32*, i32, ...) @open(i32* null, i32 0)
%15 = tail call i32 (i32*, i32, ...) @open(i32* null, i32 0, i32 0)
%16 = tail call i32 @access(i32* null, i32 0)
%17 = tail call i32 @fdopen(i32 %1, i32* null)
%18 = tail call i32 @strtok(i8* %0, i32* null)
%19 = tail call i32 @pthread_mutex_init(i32* null, i32* null)
%20 = call i32 @pthread_mutex_init(i32* %4, i32* null)
%21 = call i32 @pthread_mutex_destroy(i32* null)
%22 = call i32 @pthread_mutex_lock(i32* null)
%23 = call i32 @pthread_mutex_trylock(i32* null)
%24 = call i32 @pthread_mutex_unlock(i32* null)
ret void
}