// File: /workspace/github_c_makefile_star2_O0/LoupVaillant[P]Monocypher-Utils/src/hash.c
// Function: hash_input
void hash_input(int algorithm, int tag, FILE *input, const char *file_name,
                size_t digest_size, const uint8_t *key, size_t key_size)
{
    uint8_t digest[64];
    uint8_t block[BLOCK_SIZE];
    if (algorithm == BLAKE2B) {
        crypto_blake2b_ctx blake2b_ctx;
        crypto_blake2b_general_init(&blake2b_ctx, digest_size, key, key_size);
        HASH(blake2b);
    }
    if (algorithm == SHA512) {
        crypto_sha512_ctx  sha512_ctx;
        crypto_sha512_init(&sha512_ctx);
        HASH(sha512);
    }

    if (!tag) {
        print_buffer(digest, digest_size);
        printf(" %s\n", file_name);
    } else {
        if (algorithm == BLAKE2B) printf("BLAKE2b");
        if (algorithm == SHA512 ) printf("SHA512" );
        if (digest_size != 64) {
            printf("-%u", (unsigned)digest_size * 8);
        }
        printf(" (%s) = ", file_name);
        print_buffer(digest, digest_size);
        printf("\n");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x14c0, %rsp           # imm = 0x14C0
movq 0x10(%rbp), %rax
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x12f9
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq 0x10(%rbp), %rcx
leaq -0x1150(%rbp), %rdi
callq 0x30a0
movq -0x10(%rbp), %rdi
callq 0x10b0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x14b9(%rbp)
jne 0x1286
movq -0x10(%rbp), %rdi
callq 0x1040
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x14b9(%rbp)
movb -0x14b9(%rbp), %al
testb $0x1, %al
jne 0x1292
jmp 0x12cf
leaq -0x1070(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x1050
movq %rax, -0x1158(%rbp)
leaq -0x1070(%rbp), %rsi
movq -0x1158(%rbp), %rdx
leaq -0x1150(%rbp), %rdi
callq 0x3180
jmp 0x1257
movq -0x10(%rbp), %rdi
callq 0x1040
cmpl $0x0, %eax
je 0x12e9
leaq 0x10d30(%rip), %rdi     # 0x12014
callq 0x11900
leaq -0x70(%rbp), %rsi
leaq -0x1150(%rbp), %rdi
callq 0x3400
cmpl $0x1, -0x4(%rbp)
jne 0x13b1
leaq -0x14b0(%rbp), %rdi
callq 0x10930
movq -0x10(%rbp), %rdi
callq 0x10b0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x14ba(%rbp)
jne 0x133e
movq -0x10(%rbp), %rdi
callq 0x1040
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x14ba(%rbp)
movb -0x14ba(%rbp), %al
testb $0x1, %al
jne 0x134a
jmp 0x1387
leaq -0x1070(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x1050
movq %rax, -0x14b8(%rbp)
leaq -0x1070(%rbp), %rsi
movq -0x14b8(%rbp), %rdx
leaq -0x14b0(%rbp), %rdi
callq 0x10a10
jmp 0x130f
movq -0x10(%rbp), %rdi
callq 0x1040
cmpl $0x0, %eax
je 0x13a1
leaq 0x10c78(%rip), %rdi     # 0x12014
callq 0x11900
leaq -0x70(%rbp), %rsi
leaq -0x14b0(%rbp), %rdi
callq 0x10ca0
cmpl $0x0, -0x8(%rbp)
jne 0x13d8
leaq -0x70(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x11bc0
movq -0x18(%rbp), %rsi
leaq 0x10c6a(%rip), %rdi     # 0x12039
movb $0x0, %al
callq 0x1070
jmp 0x144b
cmpl $0x0, -0x4(%rbp)
jne 0x13ec
leaq 0x10c59(%rip), %rdi     # 0x1203e
movb $0x0, %al
callq 0x1070
cmpl $0x1, -0x4(%rbp)
jne 0x1400
leaq 0x10c4d(%rip), %rdi     # 0x12046
movb $0x0, %al
callq 0x1070
cmpq $0x40, -0x20(%rbp)
je 0x141e
movq -0x20(%rbp), %rax
movl %eax, %esi
shll $0x3, %esi
leaq 0x10c36(%rip), %rdi     # 0x1204d
movb $0x0, %al
callq 0x1070
movq -0x18(%rbp), %rsi
leaq 0x10c28(%rip), %rdi     # 0x12051
movb $0x0, %al
callq 0x1070
leaq -0x70(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x11bc0
leaq 0x11dff(%rip), %rdi     # 0x13243
movb $0x0, %al
callq 0x1070
addq $0x14c0, %rsp           # imm = 0x14C0
popq %rbp
retq
nopw %cs:(%rax,%rax)