// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x134c(%rip), %rsi      # 0x339a
movb $0x0, %al
callq 0x10b0
movq -0x18(%rbp), %rdi
leaq 0x1355(%rip), %rsi      # 0x33b5
movb $0x0, %al
callq 0x10b0
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x220d
movq -0x18(%rbp), %rsi
leaq 0x1333(%rip), %rdi      # 0x33b8
callq 0x1070
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,8), %eax
movq %rax, -0x28(%rbp)
subq $0x9, %rax
ja 0x21fd
movq -0x28(%rbp), %rax
leaq 0x106a(%rip), %rcx      # 0x3118
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %edx
leaq 0x12ef(%rip), %rsi      # 0x33bd
movb $0x0, %al
callq 0x10b0
jmp 0x21fd
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %edx
leaq 0x12da(%rip), %rsi      # 0x33cb
movb $0x0, %al
callq 0x10b0
jmp 0x21fd
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %edx
leaq 0x12c6(%rip), %rsi      # 0x33da
movb $0x0, %al
callq 0x10b0
jmp 0x21fd
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %edx
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rsi
movl $0x10, %ecx
subl 0x4(%rax,%rsi,8), %ecx
leaq 0x12a1(%rip), %rsi      # 0x33e9
movb $0x0, %al
callq 0x10b0
jmp 0x21fd
movq -0x18(%rbp), %rdi
leaq 0x12aa(%rip), %rsi      # 0x3409
movb $0x0, %al
callq 0x10b0
jmp 0x21fd
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %edx
leaq 0x1291(%rip), %rsi      # 0x3413
movb $0x0, %al
callq 0x10b0
jmp 0x21fd
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %edx
leaq 0x128a(%rip), %rsi      # 0x342c
movb $0x0, %al
callq 0x10b0
jmp 0x21fd
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %edx
leaq 0x1279(%rip), %rsi      # 0x343b
movb $0x0, %al
callq 0x10b0
jmp 0x21fd
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %edx
leaq 0x1272(%rip), %rsi      # 0x3454
movb $0x0, %al
callq 0x10b0
jmp 0x21fd
movq -0x18(%rbp), %rdi
leaq 0x1277(%rip), %rsi      # 0x346d
movb $0x0, %al
callq 0x10b0
jmp 0x21ff
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x206e
movq -0x18(%rbp), %rdi
leaq 0x1264(%rip), %rsi      # 0x347c
movb $0x0, %al
callq 0x10b0
movq -0x18(%rbp), %rdi
leaq 0x1261(%rip), %rsi      # 0x348b
movb $0x0, %al
callq 0x10b0
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)