#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*/ w0;
struct __sk_buff {
  int dummy;
};
typedef int __u32;

/* Variables and functions */
int load_word(struct __sk_buff *, int);
__u32 flow_addr_hash_ipv6(struct __sk_buff *skb, int off) {
  __u32 w0 = load_word(skb, off);
  __u32 w1 = load_word(skb, off + sizeof(w0));
  __u32 w2 = load_word(skb, off + sizeof(w0) * 2);
  __u32 w3 = load_word(skb, off + sizeof(w0) * 3);
  return w0 ^ w1 ^ w2 ^ w3;
}


x86 assembly (clang, -O0):
<flow_addr_hash_ipv6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <load_word@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
add    $0x4,%rax
mov    %eax,%esi
call   1030 <load_word@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
add    $0x8,%rax
mov    %eax,%esi
call   1030 <load_word@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
add    $0xc,%rax
mov    %eax,%esi
call   1030 <load_word@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
xor    -0x14(%rbp),%eax
xor    -0x18(%rbp),%eax
xor    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flow_addr_hash_ipv6>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
call   1030 <load_word@plt>
mov    %eax,%r15d
lea    0x4(%rbx),%esi
mov    %r14,%rdi
call   1030 <load_word@plt>
mov    %eax,%ebp
lea    0x8(%rbx),%esi
mov    %r14,%rdi
call   1030 <load_word@plt>
mov    %eax,%r12d
add    $0xc,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <load_word@plt>
xor    %r15d,%ebp
xor    %r12d,%eax
xor    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.__sk_buff = type { i32 }
define i32 @flow_addr_hash_ipv6(%struct.__sk_buff* %0, i32 %1) {
%3 = alloca %struct.__sk_buff*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.__sk_buff* %0, %struct.__sk_buff** %3
store i32 %1, i32* %4
%9 = load %struct.__sk_buff*, %struct.__sk_buff** %3
%10 = load i32, i32* %4
%11 = call i32 @load_word(%struct.__sk_buff* %9, i32 %10)
store i32 %11, i32* %5
%12 = load %struct.__sk_buff*, %struct.__sk_buff** %3
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = add i64 %14, 4
%16 = trunc i64 %15 to i32
%17 = call i32 @load_word(%struct.__sk_buff* %12, i32 %16)
store i32 %17, i32* %6
%18 = load %struct.__sk_buff*, %struct.__sk_buff** %3
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = add i64 %20, 8
%22 = trunc i64 %21 to i32
%23 = call i32 @load_word(%struct.__sk_buff* %18, i32 %22)
store i32 %23, i32* %7
%24 = load %struct.__sk_buff*, %struct.__sk_buff** %3
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = add i64 %26, 12
%28 = trunc i64 %27 to i32
%29 = call i32 @load_word(%struct.__sk_buff* %24, i32 %28)
store i32 %29, i32* %8
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = xor i32 %30, %31
%33 = load i32, i32* %7
%34 = xor i32 %32, %33
%35 = load i32, i32* %8
%36 = xor i32 %34, %35
ret i32 %36
}

LLVM IR (-O2):
%struct.__sk_buff = type { i32 }
define i32 @flow_addr_hash_ipv6(%struct.__sk_buff* %0, i32 %1) {
%3 = tail call i32 @load_word(%struct.__sk_buff* %0, i32 %1)
%4 = add i32 %1, 4
%5 = tail call i32 @load_word(%struct.__sk_buff* %0, i32 %4)
%6 = add i32 %1, 8
%7 = tail call i32 @load_word(%struct.__sk_buff* %0, i32 %6)
%8 = add i32 %1, 12
%9 = tail call i32 @load_word(%struct.__sk_buff* %0, i32 %8)
%10 = xor i32 %5, %3
%11 = xor i32 %10, %7
%12 = xor i32 %11, %9
ret i32 %12
}