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

/* Variables and functions */
int /*<<< orphan*/ clearerr(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/);
int /*<<< orphan*/ ferror(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fgetpos(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fputc(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ *freopen(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ frexp(double, int /*<<< orphan*/);
int /*<<< orphan*/ fsetpos(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ ftell(int /*<<< orphan*/);
int /*<<< orphan*/ itoa(int, int /*<<< orphan*/, int);
scalar_t__ mbstowcs(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
int /*<<< orphan*/ puts(int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(int /*<<< orphan*/ *, int, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strchr(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcmp(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcoll(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcspn(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(int /*<<< orphan*/);
int /*<<< orphan*/ strncat(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ strncmp(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ strncpy(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ strspn(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strstr(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strtok(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ strtol(int /*<<< orphan*/, int /*<<< orphan*/,
                          int /*<<< orphan*/);
int /*<<< orphan*/ strtoul(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ strtoull(int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/);
int /*<<< orphan*/ strxfrm(int /*<<< orphan*/, char *, int);
scalar_t__ wcstombs(int /*<<< orphan*/, char *, int /*<<< orphan*/);
void nullpointer(int value) {
  int res = 0;
  FILE *fp;
  clearerr(0);
  feof(0);
  fgetc(0);
  fclose(0);
  ferror(0);
  ftell(0);
  puts(0);
  fp = fopen(0, 0);
  fclose(fp);
  fp = 0;
  fflush(0);
  fp = freopen(0, "abc", stdin);
  fclose(fp);
  fp = 0;
  fputc(0, 0);
  fputs(0, 0);
  fgetpos(0, 0);
  frexp(1.0, 0);
  fsetpos(0, 0);
  itoa(123, 0, 10);
  putchar(0);
  strchr(0, 0);
  strlen(0);
  strcpy(0, 0);
  strspn(0, 0);
  strcspn(0, 0);
  strcoll(0, 0);
  strcat(0, 0);
  strcmp(0, 0);
  strncpy(0, 0, 1);
  strncat(0, 0, 1);
  strncmp(0, 0, 1);
  strstr(0, 0);
  strtoul(0, 0, 0);
  strtoull(0, 0, 0);
  strtol(0, 0, 0);
  res += mbstowcs(0, "", 0);
  res += wcstombs(0, L"", 0);
  strtok(NULL, "xyz");
  strxfrm(0, "foo", 0);
  strxfrm(0, "foo", 42);
  snprintf(NULL, 0, "someformatstring");
  snprintf(NULL, 42, "someformatstring");
}


x86 assembly (clang, -O0):
<nullpointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %edi,%edi
call   11d0 <clearerr@plt>
xor    %edi,%edi
call   11b0 <feof@plt>
xor    %edi,%edi
call   1120 <fgetc@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fclose@plt>
xor    %edi,%edi
call   1080 <ferror@plt>
xor    %edi,%edi
call   11a0 <ftell@plt>
xor    %edi,%edi
call   1070 <puts@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1200 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <fclose@plt>
movq   $0x0,-0x10(%rbp)
xor    %edi,%edi
call   11e0 <fflush@plt>
mov    0x2c27(%rip),%rax
mov    (%rax),%edx
xor    %edi,%edi
lea    0xc3c(%rip),%rsi
call   1100 <freopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <fclose@plt>
movq   $0x0,-0x10(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1140 <fputc@plt>
xor    %esi,%esi
mov    %esi,%edi
call   10f0 <fputs@plt>
xor    %esi,%esi
mov    %esi,%edi
call   10d0 <fgetpos@plt>
movsd  0xbf7(%rip),%xmm0
xor    %edi,%edi
call   1160 <frexp@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1220 <fsetpos@plt>
mov    $0x7b,%edi
xor    %esi,%esi
mov    $0xa,%edx
call   1260 <itoa@plt>
xor    %edi,%edi
call   1030 <putchar@plt>
xor    %esi,%esi
mov    %esi,%edi
call   10c0 <strchr@plt>
xor    %edi,%edi
call   10b0 <strlen@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1060 <strcpy@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1130 <strspn@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1150 <strcspn@plt>
xor    %esi,%esi
mov    %esi,%edi
call   11f0 <strcoll@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1250 <strcat@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1190 <strcmp@plt>
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1040 <strncpy@plt>
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1110 <strncat@plt>
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1050 <strncmp@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1270 <strstr@plt>
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1230 <strtoul@plt>
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1170 <strtoull@plt>
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   11c0 <strtol@plt>
xor    %edx,%edx
lea    0xb37(%rip),%rsi
mov    %edx,%edi
call   1090 <mbstowcs@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
xor    %edx,%edx
lea    0xb37(%rip),%rsi
mov    %edx,%edi
call   1240 <wcstombs@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xafc(%rip),%rsi
call   1210 <strtok@plt>
xor    %edx,%edx
lea    0xaf2(%rip),%rsi
mov    %edx,%edi
call   1180 <strxfrm@plt>
xor    %edi,%edi
lea    0xae2(%rip),%rsi
mov    $0x2a,%edx
call   1180 <strxfrm@plt>
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
lea    0xacf(%rip),%rdx
call   10e0 <snprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
mov    $0x2a,%esi
lea    0xaba(%rip),%rdx
call   10e0 <snprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nullpointer>:
push   %rbx
xor    %edi,%edi
call   11d0 <clearerr@plt>
xor    %edi,%edi
call   11b0 <feof@plt>
xor    %edi,%edi
call   1120 <fgetc@plt>
xor    %edi,%edi
call   10a0 <fclose@plt>
xor    %edi,%edi
call   1080 <ferror@plt>
xor    %edi,%edi
call   11a0 <ftell@plt>
xor    %edi,%edi
call   1070 <puts@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1200 <fopen@plt>
mov    %rax,%rdi
call   10a0 <fclose@plt>
xor    %edi,%edi
call   11e0 <fflush@plt>
mov    0x2c47(%rip),%rax
mov    (%rax),%edx
lea    0xc5e(%rip),%rsi
xor    %edi,%edi
call   1100 <freopen@plt>
mov    %rax,%rdi
call   10a0 <fclose@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1140 <fputc@plt>
xor    %edi,%edi
xor    %esi,%esi
call   10f0 <fputs@plt>
xor    %edi,%edi
xor    %esi,%esi
call   10d0 <fgetpos@plt>
movsd  0xc24(%rip),%xmm0
xor    %edi,%edi
call   1160 <frexp@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1220 <fsetpos@plt>
mov    $0x7b,%edi
xor    %esi,%esi
mov    $0xa,%edx
call   1260 <itoa@plt>
xor    %edi,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
xor    %esi,%esi
call   10c0 <strchr@plt>
xor    %edi,%edi
call   10b0 <strlen@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1060 <strcpy@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1130 <strspn@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1150 <strcspn@plt>
xor    %edi,%edi
xor    %esi,%esi
call   11f0 <strcoll@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1250 <strcat@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1190 <strcmp@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <strncpy@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1110 <strncat@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1050 <strncmp@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1270 <strstr@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1230 <strtoul@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1170 <strtoull@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   11c0 <strtol@plt>
lea    0xb66(%rip),%rsi
xor    %edi,%edi
xor    %edx,%edx
call   1090 <mbstowcs@plt>
lea    0xb73(%rip),%rsi
xor    %edi,%edi
xor    %edx,%edx
call   1240 <wcstombs@plt>
lea    0xb47(%rip),%rsi
xor    %edi,%edi
call   1210 <strtok@plt>
lea    0xb3d(%rip),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1180 <strxfrm@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x2a,%edx
call   1180 <strxfrm@plt>
lea    0xb1f(%rip),%rbx
xor    %edi,%edi
xor    %esi,%esi
mov    %rbx,%rdx
call   10e0 <snprintf@plt>
xor    %edi,%edi
mov    $0x2a,%esi
mov    %rbx,%rdx
pop    %rbx
jmp    10e0 <snprintf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@stdin = global i32 0
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [1 x i32] zeroinitializer
@.str.3 = [4 x i8] c"xyz\00"
@.str.4 = [4 x i8] c"foo\00"
@.str.5 = [17 x i8] c"someformatstring\00"
define void @nullpointer(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %2
store i32 0, i32* %3
%5 = call i32 @clearerr(i32 0)
%6 = call i32 @feof(i32 0)
%7 = call i32 @fgetc(i32 0)
%8 = call i32 @fclose(i32* null)
%9 = call i32 @ferror(i32 0)
%10 = call i32 @ftell(i32 0)
%11 = call i32 @puts(i32 0)
%12 = call i32* @fopen(i32 0, i32 0)
store i32* %12, i32** %4
%13 = load i32*, i32** %4
%14 = call i32 @fclose(i32* %13)
store i32* null, i32** %4
%15 = call i32 @fflush(i32 0)
%16 = load i32, i32* @stdin
%17 = call i32* @freopen(i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
store i32* %17, i32** %4
%18 = load i32*, i32** %4
%19 = call i32 @fclose(i32* %18)
store i32* null, i32** %4
%20 = call i32 @fputc(i32 0, i32 0)
%21 = call i32 @fputs(i32 0, i32 0)
%22 = call i32 @fgetpos(i32 0, i32 0)
%23 = call i32 @frexp(double 1.000000e+00, i32 0)
%24 = call i32 @fsetpos(i32 0, i32 0)
%25 = call i32 @itoa(i32 123, i32 0, i32 10)
%26 = call i32 @putchar(i32 0)
%27 = call i32 @strchr(i32 0, i32 0)
%28 = call i32 @strlen(i32 0)
%29 = call i32 @strcpy(i32 0, i32 0)
%30 = call i32 @strspn(i32 0, i32 0)
%31 = call i32 @strcspn(i32 0, i32 0)
%32 = call i32 @strcoll(i32 0, i32 0)
%33 = call i32 @strcat(i32 0, i32 0)
%34 = call i32 @strcmp(i32 0, i32 0)
%35 = call i32 @strncpy(i32 0, i32 0, i32 1)
%36 = call i32 @strncat(i32 0, i32 0, i32 1)
%37 = call i32 @strncmp(i32 0, i32 0, i32 1)
%38 = call i32 @strstr(i32 0, i32 0)
%39 = call i32 @strtoul(i32 0, i32 0, i32 0)
%40 = call i32 @strtoull(i32 0, i32 0, i32 0)
%41 = call i32 @strtol(i32 0, i32 0, i32 0)
%42 = call i64 @mbstowcs(i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32 0)
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = add nsw i64 %44, %42
%46 = trunc i64 %45 to i32
store i32 %46, i32* %3
%47 = call i64 @wcstombs(i32 0, i8* bitcast ([1 x i32]* @.str.2 to i8*), i32 0)
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = add nsw i64 %49, %47
%51 = trunc i64 %50 to i32
store i32 %51, i32* %3
%52 = call i32 @strtok(i32* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%53 = call i32 @strxfrm(i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 0)
%54 = call i32 @strxfrm(i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 42)
%55 = call i32 @snprintf(i32* null, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%56 = call i32 @snprintf(i32* null, i32 42, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
@stdin = global i32 0
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [1 x i32] zeroinitializer
@.str.3 = [4 x i8] c"xyz\00"
@.str.4 = [4 x i8] c"foo\00"
@.str.5 = [17 x i8] c"someformatstring\00"
define void @nullpointer(i32 %0) {
%2 = tail call i32 @clearerr(i32 0)
%3 = tail call i32 @feof(i32 0)
%4 = tail call i32 @fgetc(i32 0)
%5 = tail call i32 @fclose(i32* null)
%6 = tail call i32 @ferror(i32 0)
%7 = tail call i32 @ftell(i32 0)
%8 = tail call i32 @puts(i32 0)
%9 = tail call i32* @fopen(i32 0, i32 0)
%10 = tail call i32 @fclose(i32* %9)
%11 = tail call i32 @fflush(i32 0)
%12 = load i32, i32* @stdin
%13 = tail call i32* @freopen(i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = tail call i32 @fclose(i32* %13)
%15 = tail call i32 @fputc(i32 0, i32 0)
%16 = tail call i32 @fputs(i32 0, i32 0)
%17 = tail call i32 @fgetpos(i32 0, i32 0)
%18 = tail call i32 @frexp(double 1.000000e+00, i32 0)
%19 = tail call i32 @fsetpos(i32 0, i32 0)
%20 = tail call i32 @itoa(i32 123, i32 0, i32 10)
%21 = tail call i32 @putchar(i32 0)
%22 = tail call i32 @strchr(i32 0, i32 0)
%23 = tail call i32 @strlen(i32 0)
%24 = tail call i32 @strcpy(i32 0, i32 0)
%25 = tail call i32 @strspn(i32 0, i32 0)
%26 = tail call i32 @strcspn(i32 0, i32 0)
%27 = tail call i32 @strcoll(i32 0, i32 0)
%28 = tail call i32 @strcat(i32 0, i32 0)
%29 = tail call i32 @strcmp(i32 0, i32 0)
%30 = tail call i32 @strncpy(i32 0, i32 0, i32 1)
%31 = tail call i32 @strncat(i32 0, i32 0, i32 1)
%32 = tail call i32 @strncmp(i32 0, i32 0, i32 1)
%33 = tail call i32 @strstr(i32 0, i32 0)
%34 = tail call i32 @strtoul(i32 0, i32 0, i32 0)
%35 = tail call i32 @strtoull(i32 0, i32 0, i32 0)
%36 = tail call i32 @strtol(i32 0, i32 0, i32 0)
%37 = tail call i64 @mbstowcs(i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32 0)
%38 = tail call i64 @wcstombs(i32 0, i8* bitcast ([1 x i32]* @.str.2 to i8*), i32 0)
%39 = tail call i32 @strtok(i32* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%40 = tail call i32 @strxfrm(i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 0)
%41 = tail call i32 @strxfrm(i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 42)
%42 = tail call i32 @snprintf(i32* null, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%43 = tail call i32 @snprintf(i32* null, i32 42, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
ret void
}