// File: /workspace/github_c_makefile_star2_O2/skeeto[P]hash-prospector/hp16.c
// Function: hf_print
static void
hf_print(const struct hf_op *ops, int n, FILE *f)
{
    fprintf(f, "uint16_t hash(uint16_t x)\n");
    fprintf(f, "{\n");
    for (int i = 0; i < n; i++) {
        fputs("    ", f);
        switch (ops[i].type) {
        case HF16_XOR:
            fprintf(f, "x ^= 0x%04x;\n", ops[i].imm);
            break;
        case HF16_MUL:
            fprintf(f, "x *= 0x%04xU;\n", ops[i].imm);
            break;
        case HF16_ADD:
            fprintf(f, "x += 0x%04xU;\n", ops[i].imm);
            break;
        case HF16_ROT:
            fprintf(f, "x  = (unsigned)x<<%d | x >>%d;\n",
                    ops[i].imm, 16-ops[i].imm);
            break;
        case HF16_NOT:
            fprintf(f, "x  = ~x;\n");
            break;
        case HF16_XORL:
            fprintf(f, "x ^= (unsigned)x << %d;\n", ops[i].imm);
            break;
        case HF16_XORR:
            fprintf(f, "x ^= x >> %d;\n", ops[i].imm);
            break;
        case HF16_ADDL:
            fprintf(f, "x += (unsigned)x << %d;\n", ops[i].imm);
            break;
        case HF16_SUBL:
            fprintf(f, "x -= (unsigned)x << %d;\n", ops[i].imm);
            break;
        case HF16_SBOX:
            fprintf(f, "x  = sbox[x];\n");
            break;
        }
    }
    fprintf(f, "    return x;\n");
    fprintf(f, "}\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r15
leaq 0x14c7(%rip), %rdi      # 0x32b3
pushq $0x1a
popq %rsi
pushq $0x1
popq %r12
movq %r12, %rdx
movq %rbx, %rcx
callq 0x10e0
leaq 0x14c9(%rip), %rdi      # 0x32ce
pushq $0x2
popq %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x10e0
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
leaq 0x14ae(%rip), %r13      # 0x32d1
leaq 0x1232(%rip), %rbp      # 0x305c
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x1f22
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1060
movl (%r15,%r12,8), %eax
cmpq $0x9, %rax
ja 0x1f1a
movslq (%rbp,%rax,4), %rax
addq %rbp, %rax
jmpq *%rax
movl 0x4(%r15,%r12,8), %edx
movq %rbx, %rdi
leaq 0x146e(%rip), %rsi      # 0x32d6
jmp 0x1f13
leaq 0x14ae(%rip), %rdi      # 0x3322
pushq $0x9
jmp 0x1e81
leaq 0x1507(%rip), %rdi      # 0x3386
pushq $0xe
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x10e0
jmp 0x1f1a
movl 0x4(%r15,%r12,8), %edx
movq %rbx, %rdi
leaq 0x1452(%rip), %rsi      # 0x32f3
jmp 0x1f13
movl 0x4(%r15,%r12,8), %edx
pushq $0x10
popq %rcx
subl %edx, %ecx
movq %rbx, %rdi
leaq 0x144b(%rip), %rsi      # 0x3302
xorl %eax, %eax
callq 0x10a0
jmp 0x1f1a
movl 0x4(%r15,%r12,8), %edx
movq %rbx, %rdi
leaq 0x1485(%rip), %rsi      # 0x3354
jmp 0x1f13
movl 0x4(%r15,%r12,8), %edx
movq %rbx, %rdi
leaq 0x1404(%rip), %rsi      # 0x32e4
jmp 0x1f13
movl 0x4(%r15,%r12,8), %edx
movq %rbx, %rdi
leaq 0x143b(%rip), %rsi      # 0x332c
jmp 0x1f13
movl 0x4(%r15,%r12,8), %edx
movq %rbx, %rdi
leaq 0x1443(%rip), %rsi      # 0x3345
jmp 0x1f13
movl 0x4(%r15,%r12,8), %edx
movq %rbx, %rdi
leaq 0x145a(%rip), %rsi      # 0x336d
xorl %eax, %eax
callq 0x10a0
incq %r12
jmp 0x1e2d
leaq 0x146c(%rip), %rdi      # 0x3395
pushq $0xe
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
movq %rbx, %rcx
callq 0x10e0
leaq 0x1462(%rip), %rdi      # 0x33a4
pushq $0x2
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10e0