#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 sshbuf {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, struct sshbuf *,
                           int /*<<< orphan*/);
int /*<<< orphan*/ sshbuf_dump_data(int /*<<< orphan*/, int /*<<< orphan*/,
                                    int /*<<< orphan*/ *);
int /*<<< orphan*/ sshbuf_len(struct sshbuf *);
int /*<<< orphan*/ sshbuf_ptr(struct sshbuf *);
void sshbuf_dump(struct sshbuf *buf, FILE *f) {
  fprintf(f, "buffer %p len = %zu\n", buf, sshbuf_len(buf));
  sshbuf_dump_data(sshbuf_ptr(buf), sshbuf_len(buf), f);
}


x86 assembly (clang, -O0):
<sshbuf_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <sshbuf_len@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
lea    0xe86(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <sshbuf_ptr@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <sshbuf_len@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
call   1060 <sshbuf_dump_data@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sshbuf_dump>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <sshbuf_len@plt>
lea    0xeaa(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
call   1050 <sshbuf_ptr@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <sshbuf_len@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <sshbuf_dump_data@plt>

LLVM IR (-O0):
%struct.sshbuf = type { i32 }
@.str = [21 x i8] c"buffer %p len = %zu\0A\00"
define void @sshbuf_dump(%struct.sshbuf* %0, i32* %1) {
%3 = alloca %struct.sshbuf*
%4 = alloca i32*
store %struct.sshbuf* %0, %struct.sshbuf** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = load %struct.sshbuf*, %struct.sshbuf** %3
%7 = load %struct.sshbuf*, %struct.sshbuf** %3
%8 = call i32 @sshbuf_len(%struct.sshbuf* %7)
%9 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.sshbuf* %6, i32 %8)
%10 = load %struct.sshbuf*, %struct.sshbuf** %3
%11 = call i32 @sshbuf_ptr(%struct.sshbuf* %10)
%12 = load %struct.sshbuf*, %struct.sshbuf** %3
%13 = call i32 @sshbuf_len(%struct.sshbuf* %12)
%14 = load i32*, i32** %4
%15 = call i32 @sshbuf_dump_data(i32 %11, i32 %13, i32* %14)
ret void
}

LLVM IR (-O2):
%struct.sshbuf = type { i32 }
@.str = [21 x i8] c"buffer %p len = %zu\0A\00"
define void @sshbuf_dump(%struct.sshbuf* %0, i32* %1) {
%3 = tail call i32 @sshbuf_len(%struct.sshbuf* %0)
%4 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.sshbuf* %0, i32 %3)
%5 = tail call i32 @sshbuf_ptr(%struct.sshbuf* %0)
%6 = tail call i32 @sshbuf_len(%struct.sshbuf* %0)
%7 = tail call i32 @sshbuf_dump_data(i32 %5, i32 %6, i32* %1)
ret void
}