#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 */
struct wpabuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wpa_hexdump_key(int, char const *, int /*<<< orphan*/,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ wpabuf_head(struct wpabuf const *);
int /*<<< orphan*/ wpabuf_len(struct wpabuf const *);
void wpa_hexdump_buf_key(int level, const char *title,
                         const struct wpabuf *buf) {
  wpa_hexdump_key(level, title, buf ? wpabuf_head(buf) : 0,
                  buf ? wpabuf_len(buf) : 0);
}


x86 assembly (clang, -O0):
<wpa_hexdump_buf_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116d <wpa_hexdump_buf_key+0x3d>
mov    -0x18(%rbp),%rdi
call   1040 <wpabuf_head@plt>
mov    %eax,-0x28(%rbp)
jmp    1177 <wpa_hexdump_buf_key+0x47>
xor    %eax,%eax
mov    %eax,-0x28(%rbp)
jmp    1177 <wpa_hexdump_buf_key+0x47>
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1199 <wpa_hexdump_buf_key+0x69>
mov    -0x18(%rbp),%rdi
call   1030 <wpabuf_len@plt>
mov    %eax,-0x30(%rbp)
jmp    11a3 <wpa_hexdump_buf_key+0x73>
xor    %eax,%eax
mov    %eax,-0x30(%rbp)
jmp    11a3 <wpa_hexdump_buf_key+0x73>
mov    -0x2c(%rbp),%edx
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edi
mov    -0x30(%rbp),%ecx
call   1050 <wpa_hexdump_key@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wpa_hexdump_buf_key>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r15d
test   %rdx,%rdx
je     115b <wpa_hexdump_buf_key+0x2b>
mov    %rdx,%rbp
mov    %rdx,%rdi
call   1040 <wpabuf_head@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1030 <wpabuf_len@plt>
mov    %eax,%ecx
jmp    115f <wpa_hexdump_buf_key+0x2f>
xor    %ebx,%ebx
xor    %ecx,%ecx
mov    %r15d,%edi
mov    %r14,%rsi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <wpa_hexdump_key@plt>

LLVM IR (-O0):
%struct.wpabuf = type { i32 }
define void @wpa_hexdump_buf_key(i32 %0, i8* %1, %struct.wpabuf* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca %struct.wpabuf*
store i32 %0, i32* %4
store i8* %1, i8** %5
store %struct.wpabuf* %2, %struct.wpabuf** %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load %struct.wpabuf*, %struct.wpabuf** %6
%10 = icmp ne %struct.wpabuf* %9, null
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = load %struct.wpabuf*, %struct.wpabuf** %6
%13 = call i32 @wpabuf_head(%struct.wpabuf* %12)
br label %15
14: ; preds = %3
br label %15
15: ; preds = %14, %11
%16 = phi i32 [ %13, %11 ], [ 0, %14 ]
%17 = load %struct.wpabuf*, %struct.wpabuf** %6
%18 = icmp ne %struct.wpabuf* %17, null
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load %struct.wpabuf*, %struct.wpabuf** %6
%21 = call i32 @wpabuf_len(%struct.wpabuf* %20)
br label %23
22: ; preds = %15
br label %23
23: ; preds = %22, %19
%24 = phi i32 [ %21, %19 ], [ 0, %22 ]
%25 = call i32 @wpa_hexdump_key(i32 %7, i8* %8, i32 %16, i32 %24)
ret void
}

LLVM IR (-O2):
%struct.wpabuf = type { i32 }
define void @wpa_hexdump_buf_key(i32 %0, i8* %1, %struct.wpabuf* %2) {
%4 = icmp eq %struct.wpabuf* %2, null
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = tail call i32 @wpabuf_head(%struct.wpabuf* %2)
%7 = tail call i32 @wpabuf_len(%struct.wpabuf* %2)
br label %8
8: ; preds = %3, %5
%9 = phi i32 [ %6, %5 ], [ 0, %3 ]
%10 = phi i32 [ %7, %5 ], [ 0, %3 ]
%11 = tail call i32 @wpa_hexdump_key(i32 %0, i8* %1, i32 %9, i32 %10)
ret void
}