// File: /workspace/github_c_makefile_star2_O3/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 0x1ec04(%rip), %rsi     # 0x20004
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
je 0x14cb
leaq 0x1ebfd(%rip), %rsi     # 0x20014
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
je 0x14f7
leaq 0x1ebec(%rip), %rsi     # 0x2001a
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
je 0x1504
leaq 0x1ebe8(%rip), %rsi     # 0x2002d
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
je 0x1511
leaq 0x1ebc7(%rip), %rsi     # 0x20023
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
je 0x151e
leaq 0x1ebb6(%rip), %rsi     # 0x20029
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
je 0x152b
leaq 0x1eb84(%rip), %rsi     # 0x2000e
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
jne 0x1580
subq $0x8, %rsp
movl $0x4, %eax
movl $0x20, %esi
movl $0x20, %ecx
movl $0x20, %r9d
movq %rbx, %rdi
movq %r15, %rdx
movq %r15, %r8
pushq %rax
pushq %rax
pushq $0x1
callq 0x18f8
addq $0x20, %rsp
jmp 0x1536
leaq -0x70(%rbp), %rax
xorl %ecx, %ecx
cmpq %r12, %rcx
jb 0x14d9
movb $0x0, (%rax)
addq $0x2, %rcx
incq %rax
cmpq $0xa0, %rcx
jne 0x14d1
leaq -0x70(%rbp), %rdi
movq %rbx, %rsi
callq 0x178f
jmp 0x1536
movq %r15, %rdi
movq %rbx, %rsi
callq 0x124e
jmp 0x1536
movq %r15, %rdi
movq %rbx, %rsi
callq 0x11ec
jmp 0x1536
movq %r15, %rdi
movq %rbx, %rsi
callq 0x12b0
jmp 0x1536
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1312
jmp 0x1536
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1374
leaq 0x1eaf7(%rip), %rdi     # 0x20034
movq %r14, %rsi
xorl %eax, %eax
callq 0x1070
leaq 0x1eaf3(%rip), %r14     # 0x20041
xorl %r15d, %r15d
movzbl (%rbx,%r15), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1070
incq %r15
cmpq $0x20, %r15
jne 0x1551
movl $0xa, %edi
callq 0x1040
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1eac5(%rip), %rdi     # 0x2004c
callq 0x1050
movl $0x1, %edi
callq 0x10e0