#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 blob_buf {
  int dummy;
};
struct blob_attr {
  int dummy;
};

/* Variables and functions */
int blobmsg_add_field(struct blob_buf *, int /*<<< orphan*/, int /*<<< orphan*/,
                      int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ blobmsg_data(struct blob_attr *);
int /*<<< orphan*/ blobmsg_data_len(struct blob_attr *);
int /*<<< orphan*/ blobmsg_name(struct blob_attr *);
int /*<<< orphan*/ blobmsg_type(struct blob_attr *);
int blobmsg_add_blob(struct blob_buf *buf, struct blob_attr *attr) {
  return blobmsg_add_field(buf, blobmsg_type(attr), blobmsg_name(attr),
                           blobmsg_data(attr), blobmsg_data_len(attr));
}


x86 assembly (clang, -O0):
<blobmsg_add_blob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <blobmsg_type@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <blobmsg_name@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <blobmsg_data@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <blobmsg_data_len@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    %eax,%r8d
call   1070 <blobmsg_add_field@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blobmsg_add_blob>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1050 <blobmsg_type@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
call   1060 <blobmsg_name@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   1030 <blobmsg_data@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <blobmsg_data_len@plt>
mov    %r14,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <blobmsg_add_field@plt>

LLVM IR (-O0):
%struct.blob_buf = type { i32 }
%struct.blob_attr = type { i32 }
define i32 @blobmsg_add_blob(%struct.blob_buf* %0, %struct.blob_attr* %1) {
%3 = alloca %struct.blob_buf*
%4 = alloca %struct.blob_attr*
store %struct.blob_buf* %0, %struct.blob_buf** %3
store %struct.blob_attr* %1, %struct.blob_attr** %4
%5 = load %struct.blob_buf*, %struct.blob_buf** %3
%6 = load %struct.blob_attr*, %struct.blob_attr** %4
%7 = call i32 @blobmsg_type(%struct.blob_attr* %6)
%8 = load %struct.blob_attr*, %struct.blob_attr** %4
%9 = call i32 @blobmsg_name(%struct.blob_attr* %8)
%10 = load %struct.blob_attr*, %struct.blob_attr** %4
%11 = call i32 @blobmsg_data(%struct.blob_attr* %10)
%12 = load %struct.blob_attr*, %struct.blob_attr** %4
%13 = call i32 @blobmsg_data_len(%struct.blob_attr* %12)
%14 = call i32 @blobmsg_add_field(%struct.blob_buf* %5, i32 %7, i32 %9, i32 %11, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
%struct.blob_buf = type { i32 }
%struct.blob_attr = type { i32 }
define i32 @blobmsg_add_blob(%struct.blob_buf* %0, %struct.blob_attr* %1) {
%3 = tail call i32 @blobmsg_type(%struct.blob_attr* %1)
%4 = tail call i32 @blobmsg_name(%struct.blob_attr* %1)
%5 = tail call i32 @blobmsg_data(%struct.blob_attr* %1)
%6 = tail call i32 @blobmsg_data_len(%struct.blob_attr* %1)
%7 = tail call i32 @blobmsg_add_field(%struct.blob_buf* %0, i32 %3, i32 %4, i32 %5, i32 %6)
ret i32 %7
}