#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 nlattr {
  int dummy;
};
struct msg_buff {
  int dummy;
};

/* Variables and functions */
struct nlattr *__nla_reserve(struct msg_buff *, int, int);
int /*<<< orphan*/ nla_align_64bit(struct msg_buff *, int);
scalar_t__ nla_need_padding_for_64bit(struct msg_buff *);
struct nlattr *__nla_reserve_64bit(struct msg_buff *msg, int attrtype,
                                   int attrlen, int padattr) {
  if (nla_need_padding_for_64bit(msg))
    nla_align_64bit(msg, padattr);
  return __nla_reserve(msg, attrtype, attrlen);
}


x86 assembly (clang, -O0):
<__nla_reserve_64bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <nla_need_padding_for_64bit@plt>
cmp    $0x0,%rax
je     1164 <__nla_reserve_64bit+0x34>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <nla_align_64bit@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <__nla_reserve@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__nla_reserve_64bit>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <nla_need_padding_for_64bit@plt>
test   %rax,%rax
je     1157 <__nla_reserve_64bit+0x27>
mov    %rbx,%rdi
mov    %r15d,%esi
call   1050 <nla_align_64bit@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <__nla_reserve@plt>

LLVM IR (-O0):
%struct.nlattr = type { i32 }
%struct.msg_buff = type { i32 }
define %struct.nlattr* @__nla_reserve_64bit(%struct.msg_buff* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.msg_buff*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.msg_buff* %0, %struct.msg_buff** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load %struct.msg_buff*, %struct.msg_buff** %5
%10 = call i64 @nla_need_padding_for_64bit(%struct.msg_buff* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %4
%13 = load %struct.msg_buff*, %struct.msg_buff** %5
%14 = load i32, i32* %8
%15 = call i32 @nla_align_64bit(%struct.msg_buff* %13, i32 %14)
br label %16
16: ; preds = %12, %4
%17 = load %struct.msg_buff*, %struct.msg_buff** %5
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = call %struct.nlattr* @__nla_reserve(%struct.msg_buff* %17, i32 %18, i32 %19)
ret %struct.nlattr* %20
}

LLVM IR (-O2):
%struct.nlattr = type { i32 }
%struct.msg_buff = type { i32 }
define %struct.nlattr* @__nla_reserve_64bit(%struct.msg_buff* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i64 @nla_need_padding_for_64bit(%struct.msg_buff* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @nla_align_64bit(%struct.msg_buff* %0, i32 %3)
br label %9
9: ; preds = %7, %4
%10 = tail call %struct.nlattr* @__nla_reserve(%struct.msg_buff* %0, i32 %1, i32 %2)
ret %struct.nlattr* %10
}