#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 fprintf(int /*<<< orphan*/ *, char *, void *, ...);
scalar_t__ strlen(char *);
int cdeque_dump_str_cb(FILE *o, void *data) {
  if (data != (void *)NULL) {
    return fprintf(o, "%p = [len: %d] \"%s\"\n", data,
                   (int)strlen((char *)data), (char *)data);
  } else {
    return fprintf(o, "%p = NULL\n", data);
  }
}


x86 assembly (clang, -O0):
<cdeque_dump_str_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1178 <cdeque_dump_str_cb+0x58>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
mov    -0x18(%rbp),%r8
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    %eax,-0x4(%rbp)
jmp    1191 <cdeque_dump_str_cb+0x71>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe8e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdeque_dump_str_cb>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rsi,%rsi
je     1157 <cdeque_dump_str_cb+0x37>
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1030 <strlen@plt>
lea    0xec2(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %eax,%ecx
mov    %rbx,%r8
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fprintf@plt>
lea    0xeb7(%rip),%rsi
mov    %r14,%rdi
xor    %edx,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"%p = [len: %d] \22%s\22\0A\00"
@.str.1 = [11 x i8] c"%p = NULL\0A\00"
define i32 @cdeque_dump_str_cb(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i32*, i32** %4
%10 = load i8*, i8** %5
%11 = load i8*, i8** %5
%12 = call i64 @strlen(i8* %11)
%13 = trunc i64 %12 to i32
%14 = load i8*, i8** %5
%15 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %13, i8* %14)
store i32 %15, i32* %3
br label %20
16: ; preds = %2
%17 = load i32*, i32** %4
%18 = load i8*, i8** %5
%19 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %18)
store i32 %19, i32* %3
br label %20
20: ; preds = %16, %8
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [21 x i8] c"%p = [len: %d] \22%s\22\0A\00"
@.str.1 = [11 x i8] c"%p = NULL\0A\00"
define i32 @cdeque_dump_str_cb(i32* nocapture %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i64 @strlen(i8* %1)
%6 = trunc i64 %5 to i32
%7 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %6, i8* %1)
br label %10
8: ; preds = %2
%9 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* null)
br label %10
10: ; preds = %8, %4
%11 = phi i32 [ %7, %4 ], [ %9, %8 ]
ret i32 %11
}