#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
main() {
  char *ptr1;
  char *ptr2 = '\0';
  char *ptr3 = {'\0'};
  char *ptr4 = NULL;
  if (ptr1 == NULL) {
    printf("ptr1 is null\n");
  } else {
    printf("ptr1 is not null\n");
  }
  if (ptr2 == NULL) {
    printf("ptr2 is null\n");
  } else {
    printf("ptr2 is not null\n");
  }
  if (ptr3 == NULL) {
    printf("ptr3 is null\n");
  } else {
    printf("ptr3 is not null\n");
  }
  if (ptr4 == NULL) {
    printf("ptr4 is null\n");
  } else {
    printf("ptr4 is not null\n");
  }
  printf("done");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1163 <main+0x43>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    116f <main+0x4f>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
cmpq   $0x0,-0x18(%rbp)
jne    118b <main+0x6b>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
jmp    1197 <main+0x77>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
cmpq   $0x0,-0x20(%rbp)
jne    11b3 <main+0x93>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
jmp    11bf <main+0x9f>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
cmpq   $0x0,-0x28(%rbp)
jne    11db <main+0xbb>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
jmp    11e7 <main+0xc7>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"ptr1 is null\0A\00"
@.str.1 = [18 x i8] c"ptr1 is not null\0A\00"
@.str.2 = [14 x i8] c"ptr2 is null\0A\00"
@.str.3 = [18 x i8] c"ptr2 is not null\0A\00"
@.str.4 = [14 x i8] c"ptr3 is null\0A\00"
@.str.5 = [18 x i8] c"ptr3 is not null\0A\00"
@.str.6 = [14 x i8] c"ptr4 is null\0A\00"
@.str.7 = [18 x i8] c"ptr4 is not null\0A\00"
@.str.8 = [5 x i8] c"done\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i32 0, i32* %1
store i8* null, i8** %3
store i8* null, i8** %4
store i8* null, i8** %5
%6 = load i8*, i8** %2
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
%13 = load i8*, i8** %3
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %19
17: ; preds = %12
%18 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
%20 = load i8*, i8** %4
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %26
24: ; preds = %19
%25 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
%27 = load i8*, i8** %5
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
br label %33
31: ; preds = %26
%32 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
%34 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%35 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.8 = [5 x i8] c"done\00"
@str = [17 x i8] c"ptr1 is not null\00"
@str.9 = [13 x i8] c"ptr2 is null\00"
@str.10 = [13 x i8] c"ptr3 is null\00"
@str.11 = [13 x i8] c"ptr4 is null\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.9, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.11, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%6 = tail call i32 @exit(i32 0)
unreachable
}