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

/* Variables and functions */
int /*<<< orphan*/ fill_word(int /*<<< orphan*/, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ load_word(struct __sk_buff *, int);
int /*<<< orphan*/ update_hash_word(int /*<<< orphan*/ *, int /*<<< orphan*/);
void fill_ipv6(struct __sk_buff *skb, int offset, __u8 *dst, __u64 *hash) {
  __u32 w = load_word(skb, offset);
  fill_word(w, dst, 0);
  update_hash_word(hash, w);
  w = load_word(skb, offset + 4);
  fill_word(w, dst, 4);
  update_hash_word(hash, w);
  w = load_word(skb, offset + 8);
  fill_word(w, dst, 8);
  update_hash_word(hash, w);
  w = load_word(skb, offset + 12);
  fill_word(w, dst, 12);
  update_hash_word(hash, w);
}


x86 assembly (clang, -O0):
<fill_ipv6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <load_word@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1030 <fill_word@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1050 <update_hash_word@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x4,%esi
call   1040 <load_word@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1030 <fill_word@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1050 <update_hash_word@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x8,%esi
call   1040 <load_word@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0x8,%edx
call   1030 <fill_word@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1050 <update_hash_word@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0xc,%esi
call   1040 <load_word@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0xc,%edx
call   1030 <fill_word@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1050 <update_hash_word@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_ipv6>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%ebx
mov    %rdi,%r12
call   1040 <load_word@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %r15,%rsi
xor    %edx,%edx
call   1030 <fill_word@plt>
mov    %r14,%rdi
mov    %ebp,%esi
call   1050 <update_hash_word@plt>
lea    0x4(%rbx),%esi
mov    %r12,%rdi
call   1040 <load_word@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %r15,%rsi
mov    $0x4,%edx
call   1030 <fill_word@plt>
mov    %r14,%rdi
mov    %ebp,%esi
call   1050 <update_hash_word@plt>
lea    0x8(%rbx),%esi
mov    %r12,%rdi
call   1040 <load_word@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %r15,%rsi
mov    $0x8,%edx
call   1030 <fill_word@plt>
mov    %r14,%rdi
mov    %ebp,%esi
call   1050 <update_hash_word@plt>
add    $0xc,%ebx
mov    %r12,%rdi
mov    %ebx,%esi
call   1040 <load_word@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    %r15,%rsi
mov    $0xc,%edx
call   1030 <fill_word@plt>
mov    %r14,%rdi
mov    %ebx,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <update_hash_word@plt>

LLVM IR (-O0):
%struct.__sk_buff = type { i32 }
define void @fill_ipv6(%struct.__sk_buff* %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca %struct.__sk_buff*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store %struct.__sk_buff* %0, %struct.__sk_buff** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%10 = load %struct.__sk_buff*, %struct.__sk_buff** %5
%11 = load i32, i32* %6
%12 = call i32 @load_word(%struct.__sk_buff* %10, i32 %11)
store i32 %12, i32* %9
%13 = load i32, i32* %9
%14 = load i32*, i32** %7
%15 = call i32 @fill_word(i32 %13, i32* %14, i32 0)
%16 = load i32*, i32** %8
%17 = load i32, i32* %9
%18 = call i32 @update_hash_word(i32* %16, i32 %17)
%19 = load %struct.__sk_buff*, %struct.__sk_buff** %5
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 4
%22 = call i32 @load_word(%struct.__sk_buff* %19, i32 %21)
store i32 %22, i32* %9
%23 = load i32, i32* %9
%24 = load i32*, i32** %7
%25 = call i32 @fill_word(i32 %23, i32* %24, i32 4)
%26 = load i32*, i32** %8
%27 = load i32, i32* %9
%28 = call i32 @update_hash_word(i32* %26, i32 %27)
%29 = load %struct.__sk_buff*, %struct.__sk_buff** %5
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 8
%32 = call i32 @load_word(%struct.__sk_buff* %29, i32 %31)
store i32 %32, i32* %9
%33 = load i32, i32* %9
%34 = load i32*, i32** %7
%35 = call i32 @fill_word(i32 %33, i32* %34, i32 8)
%36 = load i32*, i32** %8
%37 = load i32, i32* %9
%38 = call i32 @update_hash_word(i32* %36, i32 %37)
%39 = load %struct.__sk_buff*, %struct.__sk_buff** %5
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 12
%42 = call i32 @load_word(%struct.__sk_buff* %39, i32 %41)
store i32 %42, i32* %9
%43 = load i32, i32* %9
%44 = load i32*, i32** %7
%45 = call i32 @fill_word(i32 %43, i32* %44, i32 12)
%46 = load i32*, i32** %8
%47 = load i32, i32* %9
%48 = call i32 @update_hash_word(i32* %46, i32 %47)
ret void
}

LLVM IR (-O2):
%struct.__sk_buff = type { i32 }
define void @fill_ipv6(%struct.__sk_buff* %0, i32 %1, i32* %2, i32* %3) {
%5 = tail call i32 @load_word(%struct.__sk_buff* %0, i32 %1)
%6 = tail call i32 @fill_word(i32 %5, i32* %2, i32 0)
%7 = tail call i32 @update_hash_word(i32* %3, i32 %5)
%8 = add nsw i32 %1, 4
%9 = tail call i32 @load_word(%struct.__sk_buff* %0, i32 %8)
%10 = tail call i32 @fill_word(i32 %9, i32* %2, i32 4)
%11 = tail call i32 @update_hash_word(i32* %3, i32 %9)
%12 = add nsw i32 %1, 8
%13 = tail call i32 @load_word(%struct.__sk_buff* %0, i32 %12)
%14 = tail call i32 @fill_word(i32 %13, i32* %2, i32 8)
%15 = tail call i32 @update_hash_word(i32* %3, i32 %13)
%16 = add nsw i32 %1, 12
%17 = tail call i32 @load_word(%struct.__sk_buff* %0, i32 %16)
%18 = tail call i32 @fill_word(i32 %17, i32* %2, i32 12)
%19 = tail call i32 @update_hash_word(i32* %3, i32 %17)
ret void
}