#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 in6_addr {
  int dummy;
};
typedef int /*<<< orphan*/ __wsum;
typedef int /*<<< orphan*/ __u8;
typedef int /*<<< orphan*/ __u32;
typedef int /*<<< orphan*/ __sum16;

/* Variables and functions */
int /*<<< orphan*/ __csum_ipv6_magic(struct in6_addr const *,
                                     struct in6_addr const *,
                                     int /*<<< orphan*/, int /*<<< orphan*/,
                                     int /*<<< orphan*/);
int /*<<< orphan*/ csum_fold(int /*<<< orphan*/);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
__sum16 csum_ipv6_magic(const struct in6_addr *saddr,
                        const struct in6_addr *daddr, __u32 len, __u8 proto,
                        __wsum sum) {
  return csum_fold(
      __csum_ipv6_magic(saddr, daddr, htonl(len), htonl(proto), sum));
}


x86 assembly (clang, -O0):
<csum_ipv6_magic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <htonl@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <htonl@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%edx
mov    %eax,%ecx
mov    -0x1c(%rbp),%r8d
call   1040 <__csum_ipv6_magic@plt>
mov    %eax,%edi
call   1050 <csum_fold@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csum_ipv6_magic>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r14d
mov    %ecx,%ebp
mov    %rsi,%r15
mov    %rdi,%r12
mov    %edx,%edi
call   1030 <htonl@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1030 <htonl@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %eax,%ecx
mov    %r14d,%r8d
call   1040 <__csum_ipv6_magic@plt>
mov    %eax,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <csum_fold@plt>

LLVM IR (-O0):
%struct.in6_addr = type { i32 }
define i32 @csum_ipv6_magic(%struct.in6_addr* %0, %struct.in6_addr* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.in6_addr*
%7 = alloca %struct.in6_addr*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.in6_addr* %0, %struct.in6_addr** %6
store %struct.in6_addr* %1, %struct.in6_addr** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load %struct.in6_addr*, %struct.in6_addr** %6
%12 = load %struct.in6_addr*, %struct.in6_addr** %7
%13 = load i32, i32* %8
%14 = call i32 @htonl(i32 %13)
%15 = load i32, i32* %9
%16 = call i32 @htonl(i32 %15)
%17 = load i32, i32* %10
%18 = call i32 @__csum_ipv6_magic(%struct.in6_addr* %11, %struct.in6_addr* %12, i32 %14, i32 %16, i32 %17)
%19 = call i32 @csum_fold(i32 %18)
ret i32 %19
}

LLVM IR (-O2):
%struct.in6_addr = type { i32 }
define i32 @csum_ipv6_magic(%struct.in6_addr* %0, %struct.in6_addr* %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @htonl(i32 %2)
%7 = tail call i32 @htonl(i32 %3)
%8 = tail call i32 @__csum_ipv6_magic(%struct.in6_addr* %0, %struct.in6_addr* %1, i32 %6, i32 %7, i32 %4)
%9 = tail call i32 @csum_fold(i32 %8)
ret i32 %9
}