#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*/ getcwd(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ isatty(int /*<<< orphan*/);
int /*<<< orphan*/ mkdir(char *, int /*<<< orphan*/);
int /*<<< orphan*/ read(int, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ readdir(int /*<<< orphan*/);
int /*<<< orphan*/ utime(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ write(int, int /*<<< orphan*/ *, int);
void nullPointer(char *p, int fd) {
  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);
}


x86 assembly (clang, -O0):
<nullPointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%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   1070 <getcwd@plt>
xor    %edi,%edi
call   1090 <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   1080 <read@plt>
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <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>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nullPointer>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
xor    %edi,%edi
call   1050 <isatty@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <mkdir@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1070 <getcwd@plt>
xor    %edi,%edi
call   1090 <readdir@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <utime@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x2a,%edx
call   1080 <read@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <read@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x2a,%edx
call   1060 <write@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <write@plt>

LLVM IR (-O0):
define void @nullPointer(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 @isatty(i32 0)
%6 = load i8*, i8** %3
%7 = call i32 @mkdir(i8* %6, i32 0)
%8 = call i32 @getcwd(i32 0, i32 0)
%9 = call i32 @readdir(i32 0)
%10 = call i32 @utime(i32* null, i32* null)
%11 = load i32, i32* %4
%12 = call i32 @read(i32 %11, i32* null, i32 42)
%13 = load i32, i32* %4
%14 = call i32 @read(i32 %13, i32* null, i32 0)
%15 = load i32, i32* %4
%16 = call i32 @write(i32 %15, i32* null, i32 42)
%17 = load i32, i32* %4
%18 = call i32 @write(i32 %17, i32* null, i32 0)
ret void
}

LLVM IR (-O2):
define void @nullPointer(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @isatty(i32 0)
%4 = tail call i32 @mkdir(i8* %0, i32 0)
%5 = tail call i32 @getcwd(i32 0, i32 0)
%6 = tail call i32 @readdir(i32 0)
%7 = tail call i32 @utime(i32* null, i32* null)
%8 = tail call i32 @read(i32 %1, i32* null, i32 42)
%9 = tail call i32 @read(i32 %1, i32* null, i32 0)
%10 = tail call i32 @write(i32 %1, i32* null, i32 42)
%11 = tail call i32 @write(i32 %1, i32* null, i32 0)
ret void
}