// File: /workspace/github_c_makefile_star2_O2/rb-de0[P]hashverifier-for-monacoin/main.c
// Function: print_hash
void print_hash(char* algorithm, char* input, char* output) {

    char input_lyra2re2[80];
    size_t input_length = strlen(input);

    if (strcmp(algorithm, "lyra2rev2") == 0) {

         for (size_t count = 0; count < sizeof(input_lyra2re2) / sizeof(*input_lyra2re2); count++) {
            if (count * 2 >= input_length) {
                input_lyra2re2[count] = 0x00;
            } 
        }

        lyra2re2_hash(input_lyra2re2, output);

    } else if (strcmp(algorithm, "blake") == 0) {
        blake256(input, output);
    } else if (strcmp(algorithm, "cubehash") == 0) {
        cubehash256(input, output);
    } else if (strcmp(algorithm, "keccak") == 0) {
        keccak256(input, output);
    } else if (strcmp(algorithm, "skein") == 0) {
        skein256(input, output);
    } else if (strcmp(algorithm, "bmw") == 0) {
        bmw256(input, output);
    } else if (strcmp(algorithm, "lyra2") == 0) {
        LYRA2(output, 32, input, 32, input, 32, 1, 4, 4);
    } else {
        printf("Algorithum not found\n");
        exit(1);
    }

    printf("%s result : ", algorithm);

    for(int i = 0; i < 32; i++) {
        printf("%02x", (unsigned char)output[i]);
    }

    printf("\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq %rsi, %rdi
callq 0x1060
movq %rax, %r12
leaq 0x1dc0e(%rip), %rsi     # 0x1f004
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
je 0x14b8
leaq 0x1dc07(%rip), %rsi     # 0x1f014
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
je 0x14e6
leaq 0x1dbf6(%rip), %rsi     # 0x1f01a
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
je 0x14f3
leaq 0x1dbf2(%rip), %rsi     # 0x1f02d
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
je 0x1500
leaq 0x1dbd1(%rip), %rsi     # 0x1f023
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
je 0x150d
leaq 0x1dbc0(%rip), %rsi     # 0x1f029
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
je 0x151a
leaq 0x1db8e(%rip), %rsi     # 0x1f00e
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
jne 0x156f
subq $0x8, %rsp
pushq $0x4
popq %rax
pushq $0x20
popq %rcx
movq %rbx, %rdi
movq %rcx, %rsi
movq %r15, %rdx
movq %r15, %r8
movq %rcx, %r9
pushq %rax
pushq %rax
pushq $0x1
callq 0x18d0
addq $0x20, %rsp
jmp 0x1525
leaq -0x70(%rbp), %rax
xorl %ecx, %ecx
cmpq $0xa0, %rcx
je 0x14d8
cmpq %r12, %rcx
jb 0x14cf
movb $0x0, (%rax)
addq $0x2, %rcx
incq %rax
jmp 0x14be
leaq -0x70(%rbp), %rdi
movq %rbx, %rsi
callq 0x1772
jmp 0x1525
movq %r15, %rdi
movq %rbx, %rsi
callq 0x124c
jmp 0x1525
movq %r15, %rdi
movq %rbx, %rsi
callq 0x11ec
jmp 0x1525
movq %r15, %rdi
movq %rbx, %rsi
callq 0x12ac
jmp 0x1525
movq %r15, %rdi
movq %rbx, %rsi
callq 0x130c
jmp 0x1525
movq %r15, %rdi
movq %rbx, %rsi
callq 0x136c
leaq 0x1db08(%rip), %rdi     # 0x1f034
movq %r14, %rsi
xorl %eax, %eax
callq 0x1070
leaq 0x1db04(%rip), %r14     # 0x1f041
xorl %r15d, %r15d
cmpq $0x20, %r15
je 0x155a
movzbl (%rbx,%r15), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1070
incq %r15
jmp 0x1540
pushq $0xa
popq %rdi
callq 0x1040
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1dad6(%rip), %rdi     # 0x1f04c
callq 0x1050
pushq $0x1
popq %rdi
callq 0x10e0