#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);
int /*<<< orphan*/ print_string_safely(char, char *, char *, int, char);
int /*<<< orphan*/ printf(char *, ...);
void print_string_safely_with_title(char ignore_nulls_flag, char *title,
                                    char *buffer, char *str, int len,
                                    char hex_flag) {
  if (title == 0) {
    printf("Error:\t%s\n",
           "Null Pointer Exception - print_string_safely_with_title");
    exit(-1);
  }
  printf("%s = [", title);
  print_string_safely(ignore_nulls_flag, buffer, str, len, hex_flag);
  printf("]\n");
}


x86 assembly (clang, -O0):
<print_string_safely_with_title>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %r9b,%al
mov    %dil,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %al,-0x25(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    117c <print_string_safely_with_title+0x4c>
lea    0xe9c(%rip),%rdi
lea    0xea0(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rsi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1(%rbp),%al
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
movsbl %al,%edi
movsbl -0x25(%rbp),%r8d
call   1050 <print_string_safely@plt>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_string_safely_with_title>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %rsi,%rsi
je     1193 <print_string_safely_with_title+0x53>
mov    %r9d,%r12d
mov    %r8d,%r14d
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %edi,%ebp
lea    0xee1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl %bpl,%edi
movsbl %r12b,%r8d
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1060 <print_string_safely@plt>
lea    0xec4(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>
lea    0xe66(%rip),%rdi
lea    0xe6a(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"Error:\09%s\0A\00"
@.str.1 = [56 x i8] c"Null Pointer Exception - print_string_safely_with_title\00"
@.str.2 = [7 x i8] c"%s = [\00"
@.str.3 = [3 x i8] c"]\0A\00"
define void @print_string_safely_with_title(i8 signext %0, i8* %1, i8* %2, i8* %3, i32 %4, i8 signext %5) {
%7 = alloca i8
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8
store i8 %0, i8* %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i32 %4, i32* %11
store i8 %5, i8* %12
%13 = load i8*, i8** %8
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %18
15: ; preds = %6
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @exit(i32 -1)
unreachable
18: ; preds = %6
%19 = load i8*, i8** %8
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = load i8, i8* %7
%22 = load i8*, i8** %9
%23 = load i8*, i8** %10
%24 = load i32, i32* %11
%25 = load i8, i8* %12
%26 = call i32 @print_string_safely(i8 signext %21, i8* %22, i8* %23, i32 %24, i8 signext %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Error:\09%s\0A\00"
@.str.1 = [56 x i8] c"Null Pointer Exception - print_string_safely_with_title\00"
@.str.2 = [7 x i8] c"%s = [\00"
@str = [2 x i8] c"]\00"
define void @print_string_safely_with_title(i8 signext %0, i8* %1, i8* %2, i8* %3, i32 %4, i8 signext %5) {
%7 = icmp eq i8* %1, null
br i1 %7, label %8, label %11
8: ; preds = %6
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %6
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%13 = tail call i32 @print_string_safely(i8 signext %0, i8* %2, i8* %3, i32 %4, i8 signext %5)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}