#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*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ pyrhash(int /*<<< orphan*/ const *,
                           int /*<<< orphan*/ const *, int);
uint64_t pkt_cookie(uint32_t saddr, uint32_t daddr, uint16_t sport,
                    uint16_t dport, uint64_t seed) {
  uint32_t buf[4];
  uint64_t key[2];
  key[0] = seed;
  key[1] = seed;
  buf[0] = daddr;
  buf[1] = dport;
  buf[2] = saddr;
  buf[3] = sport;
  return pyrhash((const uint8_t *)key, (const uint8_t *)buf, sizeof(buf));
}


x86 assembly (clang, -O0):
<pkt_cookie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
lea    -0x38(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x10,%edx
call   1030 <pyrhash@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pkt_cookie>:
sub    $0x28,%rsp
mov    %r8d,0x8(%rsp)
mov    %r8d,0xc(%rsp)
mov    %esi,0x10(%rsp)
mov    %ecx,0x14(%rsp)
mov    %edi,0x18(%rsp)
mov    %edx,0x1c(%rsp)
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    $0x10,%edx
call   1030 <pyrhash@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @pkt_cookie(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [4 x i32]
%12 = alloca [2 x i32]
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%13 = load i32, i32* %10
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
store i32 %13, i32* %14
%15 = load i32, i32* %10
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
store i32 %15, i32* %16
%17 = load i32, i32* %7
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 0
store i32 %17, i32* %18
%19 = load i32, i32* %9
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 1
store i32 %19, i32* %20
%21 = load i32, i32* %6
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 2
store i32 %21, i32* %22
%23 = load i32, i32* %8
%24 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 3
store i32 %23, i32* %24
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%26 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 0
%27 = call i32 @pyrhash(i32* %25, i32* %26, i32 16)
ret i32 %27
}

LLVM IR (-O2):
define i32 @pkt_cookie(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca [4 x i32]
%7 = alloca [2 x i32]
%8 = bitcast [4 x i32]* %6 to i8*
%9 = bitcast [2 x i32]* %7 to i8*
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32 %4, i32* %10
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 %4, i32* %11
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
store i32 %1, i32* %12
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 1
store i32 %3, i32* %13
%14 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 2
store i32 %0, i32* %14
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 3
store i32 %2, i32* %15
%16 = call i32 @pyrhash(i32* %10, i32* %12, i32 16)
ret i32 %16
}