#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 *, char *, char *);
void isNotNull(void *ptr) {
  if (ptr != NULL) {
    printf("%s        PASSED!\n%s", "\x1B[32m", "\x1B[0m");
  } else {
    printf("%s        NOT PASSED!\n        pointer is not null%s\n", "\x1B[31m",
           "\x1B[0m");
  }
}


x86 assembly (clang, -O0):
<isNotNull>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1146 <isNotNull+0x36>
lea    0xed2(%rip),%rdi
lea    0xee0(%rip),%rsi
lea    0xedf(%rip),%rdx
call   1030 <printf@plt>
jmp    1160 <isNotNull+0x50>
lea    0xed3(%rip),%rdi
lea    0xf01(%rip),%rsi
lea    0xec0(%rip),%rdx
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNotNull>:
test   %rdi,%rdi
je     112f <isNotNull+0x1f>
lea    0xee4(%rip),%rdi
lea    0xef2(%rip),%rsi
lea    0xef1(%rip),%rdx
jmp    1030 <printf@plt>
lea    0xeea(%rip),%rdi
lea    0xf18(%rip),%rsi
lea    0xed7(%rip),%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"%s PASSED!\0A%s\00"
@.str.1 = [6 x i8] c"\1B[32m\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
@.str.3 = [53 x i8] c"%s NOT PASSED!\0A pointer is not null%s\0A\00"
@.str.4 = [6 x i8] c"\1B[31m\00"
define void @isNotNull(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %9
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"%s PASSED!\0A%s\00"
@.str.1 = [6 x i8] c"\1B[32m\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
@.str.3 = [53 x i8] c"%s NOT PASSED!\0A pointer is not null%s\0A\00"
@.str.4 = [6 x i8] c"\1B[31m\00"
define void @isNotNull(i8* readnone %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %7
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
ret void
}