#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 */
typedef int /*<<< orphan*/ uint32_t;
struct in6_addr {
  scalar_t__ s6_addr;
};

/* Variables and functions */
int /*<<< orphan*/ htonl(int);
int /*<<< orphan*/ ipv6_addr_set(struct in6_addr *, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/,
                                 int /*<<< orphan*/);
void ipv6_addr_llocal(const struct in6_addr *addr, struct in6_addr *llocal) {
  ipv6_addr_set(llocal, htonl(0xFE800000), 0, ((uint32_t *)addr->s6_addr)[2],
                ((uint32_t *)addr->s6_addr)[3]);
}


x86 assembly (clang, -O0):
<ipv6_addr_llocal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0xfe800000,%edi
call   1030 <htonl@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x8(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0xc(%rax),%r8d
xor    %edx,%edx
call   1040 <ipv6_addr_set@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipv6_addr_llocal>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0xfe800000,%edi
call   1030 <htonl@plt>
mov    (%rbx),%rdx
mov    0x8(%rdx),%ecx
mov    0xc(%rdx),%r8d
mov    %r14,%rdi
mov    %eax,%esi
xor    %edx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <ipv6_addr_set@plt>

LLVM IR (-O0):
%struct.in6_addr = type { i64 }
define void @ipv6_addr_llocal(%struct.in6_addr* %0, %struct.in6_addr* %1) {
%3 = alloca %struct.in6_addr*
%4 = alloca %struct.in6_addr*
store %struct.in6_addr* %0, %struct.in6_addr** %3
store %struct.in6_addr* %1, %struct.in6_addr** %4
%5 = load %struct.in6_addr*, %struct.in6_addr** %4
%6 = call i32 @htonl(i32 -25165824)
%7 = load %struct.in6_addr*, %struct.in6_addr** %3
%8 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %7, i32 0, i32 0
%9 = load i64, i64* %8
%10 = inttoptr i64 %9 to i32*
%11 = getelementptr inbounds i32, i32* %10, i64 2
%12 = load i32, i32* %11
%13 = load %struct.in6_addr*, %struct.in6_addr** %3
%14 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %13, i32 0, i32 0
%15 = load i64, i64* %14
%16 = inttoptr i64 %15 to i32*
%17 = getelementptr inbounds i32, i32* %16, i64 3
%18 = load i32, i32* %17
%19 = call i32 @ipv6_addr_set(%struct.in6_addr* %5, i32 %6, i32 0, i32 %12, i32 %18)
ret void
}

LLVM IR (-O2):
%struct.in6_addr = type { i64 }
define void @ipv6_addr_llocal(%struct.in6_addr* nocapture %0, %struct.in6_addr* %1) {
%3 = tail call i32 @htonl(i32 -25165824)
%4 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %0, i64 0, i32 0
%5 = load i64, i64* %4
%6 = inttoptr i64 %5 to i32*
%7 = getelementptr inbounds i32, i32* %6, i64 2
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %6, i64 3
%10 = load i32, i32* %9
%11 = tail call i32 @ipv6_addr_set(%struct.in6_addr* %1, i32 %3, i32 0, i32 %8, i32 %10)
ret void
}