// File: /workspace/github_c_makefile_star2_O2/AlxHnr[P]nano-backup/third-party/SipHash/siphash.c
// Function: siphash
uint64_t siphash(const uint8_t *in, const size_t inlen, const uint8_t *k)
{
    uint64_t v0 = 0x736f6d6570736575ULL;
    uint64_t v1 = 0x646f72616e646f6dULL;
    uint64_t v2 = 0x6c7967656e657261ULL;
    uint64_t v3 = 0x7465646279746573ULL;
    uint64_t k0 = U8TO64_LE(k);
    uint64_t k1 = U8TO64_LE(k + 8);
    uint64_t m;
    int i;
    const uint8_t *end = in + inlen - (inlen % sizeof(uint64_t));
    const int left = inlen & 7;
    uint64_t b = ((uint64_t)inlen) << 56;
    uint64_t hash;
    uint8_t *out = (uint8_t *)&hash;
    v3 ^= k1;
    v2 ^= k0;
    v1 ^= k1;
    v0 ^= k0;

    for (; in != end; in += 8) {
        m = U8TO64_LE(in);
        v3 ^= m;

        for (i = 0; i < cROUNDS; ++i)
            SIPROUND;

        v0 ^= m;
    }

    switch (left) {
    case 7:
        b |= ((uint64_t)in[6]) << 48;
        attribute_fallthrough
    case 6:
        b |= ((uint64_t)in[5]) << 40;
        attribute_fallthrough
    case 5:
        b |= ((uint64_t)in[4]) << 32;
        attribute_fallthrough
    case 4:
        b |= ((uint64_t)in[3]) << 24;
        attribute_fallthrough
    case 3:
        b |= ((uint64_t)in[2]) << 16;
        attribute_fallthrough
    case 2:
        b |= ((uint64_t)in[1]) << 8;
        attribute_fallthrough
    case 1:
        b |= ((uint64_t)in[0]);
        break;
    case 0:
        break;
    }

    v3 ^= b;

    for (i = 0; i < cROUNDS; ++i)
        SIPROUND;

    v0 ^= b;

    v2 ^= 0xff;

    for (i = 0; i < dROUNDS; ++i)
        SIPROUND;

    b = v0 ^ v1 ^ v2 ^ v3;
    U64TO8_LE(out, b);

    return hash;
}

// Assembly:
pushq %r14
pushq %rbx
movq (%rdx), %r11
movq 0x8(%rdx), %rdx
movl %esi, %r10d
andl $0x7, %r10d
movq %rsi, %r8
shlq $0x38, %r8
movabsq $0x7465646279746573, %rcx # imm = 0x7465646279746573
xorq %rdx, %rcx
movabsq $0x6c7967656e657261, %r9 # imm = 0x6C7967656E657261
xorq %r11, %r9
movabsq $0x646f72616e646f6d, %rax # imm = 0x646F72616E646F6D
xorq %rdx, %rax
movabsq $0x736f6d6570736575, %rdx # imm = 0x736F6D6570736575
xorq %r11, %rdx
andq $-0x8, %rsi
movq %rsi, %r11
movq %rdi, %rbx
testq %r11, %r11
je 0xcc7e
addq %rax, %rdx
rolq $0xd, %rax
xorq %rdx, %rax
movq (%rbx), %r14
xorq %r14, %rcx
addq %rcx, %r9
rolq $0x10, %rcx
xorq %r9, %rcx
addq %rax, %r9
rolq $0x11, %rax
xorq %r9, %rax
rolq $0x20, %r9
rolq $0x20, %rdx
addq %rcx, %rdx
rolq $0x15, %rcx
xorq %rdx, %rcx
xorq %r14, %rdx
addq $0x8, %rbx
addq $-0x8, %r11
jmp 0xcc36
movl %r10d, %r10d
leaq 0x2418(%rip), %r11      # 0xf0a0
movslq (%r11,%r10,4), %r10
addq %r11, %r10
jmpq *%r10
movzbl 0x6(%rdi,%rsi), %r10d
shlq $0x30, %r10
orq %r10, %r8
movzbl 0x5(%rdi,%rsi), %r10d
shlq $0x28, %r10
orq %r10, %r8
movzbl 0x4(%rdi,%rsi), %r10d
shlq $0x20, %r10
orq %r10, %r8
movzbl 0x3(%rdi,%rsi), %r10d
shll $0x18, %r10d
orq %r10, %r8
movzbl 0x2(%rdi,%rsi), %r10d
shll $0x10, %r10d
orq %r10, %r8
movzbl 0x1(%rdi,%rsi), %r10d
shll $0x8, %r10d
orq %r10, %r8
movzbl (%rdi,%rsi), %esi
orq %rsi, %r8
addq %rax, %rdx
rolq $0xd, %rax
xorq %rdx, %rax
xorq %r8, %rcx
addq %rcx, %r9
leaq (%rax,%r9), %rsi
rolq $0x11, %rax
xorq %rsi, %rax
rolq $0x20, %rsi
rolq $0x20, %rdx
rolq $0x10, %rcx
xorq %r9, %rcx
addq %rcx, %rdx
rolq $0x15, %rcx
xorq %rdx, %rcx
xorq %r8, %rdx
xorq $0xff, %rsi
movl $0x3, %edi
subl $0x1, %edi
jb 0xcd61
addq %rax, %rdx
rolq $0xd, %rax
xorq %rdx, %rax
rolq $0x20, %rdx
addq %rcx, %rsi
rolq $0x10, %rcx
xorq %rsi, %rcx
addq %rcx, %rdx
rolq $0x15, %rcx
addq %rax, %rsi
rolq $0x11, %rax
xorq %rdx, %rcx
xorq %rsi, %rax
rolq $0x20, %rsi
jmp 0xcd2a
xorq %rcx, %rsi
xorq %rdx, %rax
xorq %rsi, %rax
popq %rbx
popq %r14
retq
nop