// File: /workspace/github_c_makefile_star2_O2/LoupVaillant[P]Monocypher-Utils/src/monocypher.c
// Function: crypto_check_final
int crypto_check_final(crypto_check_ctx *ctx)
{
    ge diff, A;
    u8 h_ram[64], R_check[32];
    u8 *s = ctx->sig + 32;                       // s
    u8 *R = ctx->sig;                            // R
    if (ge_frombytes_neg_vartime(&A, ctx->pk) ||
        is_above_L(s)) { // prevent s malleability
        return -1;
    }
    HASH_FINAL(&ctx->hash, h_ram);
    reduce(h_ram);
    ge_double_scalarmult_vartime(&diff, &A, h_ram, s);
    ge_tobytes(R_check, &diff);                  // R_check = s*B - h_ram*A
    return crypto_verify32(R, R_check);          // R == R_check ? OK : fail
    // No secret, no wipe
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe88, %rsp            # imm = 0xE88
movq %rdi, %r14
leaq 0xe0(%rdi), %rax
movq %rax, 0x8(%rsp)
leaq 0x120(%rdi), %rsi
leaq 0x38(%rsp), %r15
movq %r15, %rdi
callq 0x42a5
leaq 0x60(%rsp), %rbp
movq %rbp, %rdi
callq 0x4475
leaq 0x370(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x4cf6
leaq 0x4065(%rip), %rdx      # 0x9f60
leaq 0x1c0(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x4509
movq %r12, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x44db
movq %r13, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x44f2
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4cf6
movq %rbx, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x4509
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x4cf6
movq %rbp, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x4509
movq %rbp, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x4509
leaq 0x980(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4cf6
leaq 0x480(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x4cf6
movq %r12, %rdi
movq %r12, %rsi
callq 0x4cf6
movq %r12, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x4509
movq %r13, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x4509
movq %r13, %rdi
movq %r13, %rsi
callq 0x4cf6
movq %r13, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4509
movq %r12, %rdi
movq %r13, %rsi
callq 0x4cf6
pushq $0x4
popq %rbx
subq $0x1, %rbx
jb 0x5ffe
movq %r12, %rdi
movq %r12, %rsi
callq 0x4cf6
jmp 0x5feb
leaq 0x480(%rsp), %r12
leaq 0x980(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x4509
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4cf6
pushq $0x9
popq %rbx
subq $0x1, %rbx
jb 0x603d
movq %r12, %rdi
movq %r12, %rsi
callq 0x4cf6
jmp 0x602a
leaq 0x480(%rsp), %rbx
leaq 0x980(%rsp), %rdx
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x4509
leaq 0x260(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4cf6
pushq $0x13
popq %rbx
subq $0x1, %rbx
jb 0x6081
movq %r12, %rdi
movq %r12, %rsi
callq 0x4cf6
jmp 0x606e
leaq 0x260(%rsp), %rsi
leaq 0x480(%rsp), %r12
movq %r12, %rdi
movq %r12, %rdx
callq 0x4509
movq %r12, %rdi
movq %r12, %rsi
callq 0x4cf6
pushq $0x9
popq %rbx
subq $0x1, %rbx
jb 0x60bd
movq %r12, %rdi
movq %r12, %rsi
callq 0x4cf6
jmp 0x60aa
leaq 0x480(%rsp), %r12
leaq 0x980(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x4509
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4cf6
pushq $0x31
popq %rbx
subq $0x1, %rbx
jb 0x60fc
movq %r12, %rdi
movq %r12, %rsi
callq 0x4cf6
jmp 0x60e9
leaq 0x480(%rsp), %rbx
leaq 0x980(%rsp), %rdx
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x4509
leaq 0x260(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4cf6
pushq $0x63
popq %rbx
subq $0x1, %rbx
jb 0x6140
movq %r12, %rdi
movq %r12, %rsi
callq 0x4cf6
jmp 0x612d
leaq 0x260(%rsp), %rsi
leaq 0x480(%rsp), %r12
movq %r12, %rdi
movq %r12, %rdx
callq 0x4509
movq %r12, %rdi
movq %r12, %rsi
callq 0x4cf6
pushq $0x31
popq %rbx
subq $0x1, %rbx
jb 0x617c
movq %r12, %rdi
movq %r12, %rsi
callq 0x4cf6
jmp 0x6169
leaq 0x480(%rsp), %r13
leaq 0x980(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x4509
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x4cf6
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x4cf6
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x4509
pushq $0x28
popq %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1734
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1734
leaq 0x260(%rsp), %rdi
movq %rbp, %rsi
callq 0x1734
leaq 0xb0(%rsp), %rdx
movq %r12, %rdi
movq %r12, %rsi
callq 0x4509
leaq 0x370(%rsp), %rbx
movq %r12, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x4509
leaq 0x180(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x4cf6
leaq 0x1c0(%rsp), %rdx
movq %r13, %rdi
movq %r13, %rsi
callq 0x4509
leaq 0x150(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x44db
movq %r12, %rdi
callq 0x77dc
testl %eax, %eax
je 0x62a5
leaq 0x150(%rsp), %rbx
leaq 0x180(%rsp), %rsi
leaq 0x370(%rsp), %rdx
movq %rbx, %rdi
callq 0x44f2
movq %rbx, %rdi
callq 0x77dc
testl %eax, %eax
je 0x6291
pushq $-0x1
popq %rax
jmp 0x65c8
leaq 0x3cf8(%rip), %rdx      # 0x9f90
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
callq 0x4509
leaq 0x10(%rsp), %rdi
callq 0x76ba
movzbl 0x13f(%r14), %ecx
shrl $0x7, %ecx
cmpl %ecx, %eax
jne 0x62cb
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
callq 0x76a4
leaq 0x100(%r14), %r12
leaq 0x88(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq %r15, %rdx
callq 0x4509
pushq $0x1f
popq %rcx
pushq $-0x1
popq %rax
leaq 0x3b6c(%rip), %rdx      # 0x9e60
testl %ecx, %ecx
js 0x65c8
movl %ecx, %edi
movzbl (%r12,%rdi), %esi
movq (%rdx,%rdi,8), %rdi
cmpq %rsi, %rdi
jb 0x65c8
decl %ecx
cmpq %rsi, %rdi
jbe 0x62f4
leaq 0x180(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2217
movq %r15, %rdi
callq 0x5c80
leaq 0x3c87(%rip), %rbx      # 0x9fc0
leaq 0x1c0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x44a0
leaq 0x1e8(%rsp), %rdi
leaq 0x3c95(%rip), %r13      # 0x9ff0
movq %r13, %rsi
callq 0x44a0
leaq 0x210(%rsp), %rdi
callq 0x4475
leaq 0x238(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x4509
leaq 0x980(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x7810
leaq 0x480(%rsp), %rdi
movq %r14, %rsi
callq 0x7810
leaq 0x260(%rsp), %rdi
movq %r15, %rsi
callq 0x7882
leaq 0x370(%rsp), %rdi
movq %r12, %rsi
callq 0x7882
movl $0xfd, %eax
pushq $-0x1
popq %rbx
testl %eax, %eax
js 0x63ed
movl %eax, %ecx
cmpb $0x0, 0x260(%rsp,%rcx)
jne 0x63eb
cmpb $0x0, 0x370(%rsp,%rcx)
jne 0x63eb
decl %eax
jmp 0x63cd
movl %eax, %ebx
leaq 0xb0(%rsp), %rdi
callq 0x7565
movslq %ebx, %r14
movzbl 0x260(%rsp,%r14), %eax
testb %al, %al
jle 0x6430
shrl %eax
imulq $0xa0, %rax, %rax
leaq (%rsp,%rax), %rdx
addq $0x980, %rdx            # imm = 0x980
leaq 0xb0(%rsp), %rdi
movq %rdi, %rsi
callq 0x791d
jmp 0x6460
testb %al, %al
jns 0x6460
movsbq %al, %rax
negq %rax
shrq %rax
imulq $0xa0, %rax, %rax
leaq (%rsp,%rax), %rdx
addq $0x980, %rdx            # imm = 0x980
leaq 0xb0(%rsp), %rdi
movq %rdi, %rsi
callq 0x7a48
movzbl 0x370(%rsp,%r14), %eax
testb %al, %al
jle 0x6493
shrl %eax
imulq $0xa0, %rax, %rax
leaq (%rsp,%rax), %rdx
addq $0x480, %rdx            # imm = 0x480
leaq 0xb0(%rsp), %rdi
movq %rdi, %rsi
callq 0x791d
jmp 0x64c3
testb %al, %al
jns 0x64c3
movsbq %al, %rax
negq %rax
shrq %rax
imulq $0xa0, %rax, %rax
leaq (%rsp,%rax), %rdx
addq $0x480, %rdx            # imm = 0x480
leaq 0xb0(%rsp), %rdi
movq %rdi, %rsi
callq 0x7a48
movl %ebx, %ebx
leaq 0xb0(%rsp), %r14
leaq 0x1c0(%rsp), %r15
testl %ebx, %ebx
jle 0x65a3
movq %r14, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x758d
movzbl 0x25f(%rsp,%rbx), %eax
testb %al, %al
jle 0x6518
shrl %eax
imulq $0xa0, %rax, %rax
leaq (%rsp,%rax), %rdx
addq $0x980, %rdx            # imm = 0x980
movq %r14, %rdi
movq %r14, %rsi
callq 0x791d
jmp 0x6543
testb %al, %al
jns 0x6543
movsbq %al, %rax
negq %rax
shrq %rax
imulq $0xa0, %rax, %rax
leaq (%rsp,%rax), %rdx
addq $0x980, %rdx            # imm = 0x980
movq %r14, %rdi
movq %r14, %rsi
callq 0x7a48
movzbl 0x36f(%rsp,%rbx), %eax
testb %al, %al
jle 0x6570
shrl %eax
imulq $0xa0, %rax, %rax
leaq (%rsp,%rax), %rdx
addq $0x480, %rdx            # imm = 0x480
movq %r14, %rdi
movq %r14, %rsi
callq 0x791d
jmp 0x659b
testb %al, %al
jns 0x659b
movsbq %al, %rax
negq %rax
shrq %rax
imulq $0xa0, %rax, %rax
leaq (%rsp,%rax), %rdx
addq $0x480, %rdx            # imm = 0x480
movq %r14, %rdi
movq %r14, %rsi
callq 0x7a48
decq %rbx
jmp 0x64d5
leaq 0x980(%rsp), %rbx
leaq 0xb0(%rsp), %rsi
movq %rbx, %rdi
callq 0x5ace
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x16a4
addq $0xe88, %rsp            # imm = 0xE88
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq