#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*/ test_printf_stderr(char *, ...);
void test_memory_null_empty(const unsigned char *m, char c) {
  if (m == NULL)
    test_printf_stderr("% 4s %c%s\n", "", c, "NULL");
  else
    test_printf_stderr("%04x %c%s\n", 0u, c, "empty");
}


x86 assembly (clang, -O0):
<test_memory_null_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1152 <test_memory_null_empty+0x42>
movsbl -0x9(%rbp),%edx
lea    0xec8(%rip),%rdi
lea    0xecb(%rip),%rsi
lea    0xec5(%rip),%rcx
mov    $0x0,%al
call   1030 <test_printf_stderr@plt>
jmp    116d <test_memory_null_empty+0x5d>
movsbl -0x9(%rbp),%edx
lea    0xeb3(%rip),%rdi
xor    %esi,%esi
lea    0xeb5(%rip),%rcx
mov    $0x0,%al
call   1030 <test_printf_stderr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_memory_null_empty>:
mov    %esi,%edx
test   %rdi,%rdi
je     112e <test_memory_null_empty+0x1e>
lea    0xef2(%rip),%rdi
lea    0xef6(%rip),%rcx
xor    %esi,%esi
xor    %eax,%eax
jmp    1030 <test_printf_stderr@plt>
lea    0xecb(%rip),%rdi
lea    0xece(%rip),%rsi
lea    0xec8(%rip),%rcx
xor    %eax,%eax
jmp    1030 <test_printf_stderr@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"% 4s %c%s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [5 x i8] c"NULL\00"
@.str.3 = [11 x i8] c"%04x %c%s\0A\00"
@.str.4 = [6 x i8] c"empty\00"
define void @test_memory_null_empty(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8, i8* %4
%9 = sext i8 %8 to i32
%10 = call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32 %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %15
11: ; preds = %2
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
%14 = call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %15
15: ; preds = %11, %7
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"% 4s %c%s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [5 x i8] c"NULL\00"
@.str.3 = [11 x i8] c"%04x %c%s\0A\00"
@.str.4 = [6 x i8] c"empty\00"
define void @test_memory_null_empty(i8* readnone %0, i8 signext %1) {
%3 = icmp eq i8* %0, null
%4 = sext i8 %1 to i32
br i1 %3, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %9
7: ; preds = %2
%8 = tail call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
ret void
}