// File: /workspace/github_c_makefile_star2_O1/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 $0xe78, %rsp            # imm = 0xE78
movq %rdi, %r14
leaq 0xe0(%rdi), %rbx
leaq 0x120(%rdi), %rsi
leaq 0xf8(%rsp), %r15
movq %r15, %rdi
callq 0x476b
movl $0x1, 0x28(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x2c(%r15)
movups %xmm0, 0x3c(%r15)
movl $0x0, 0x4c(%r15)
leaq 0x250(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x51c2
leaq 0x391e(%rip), %rdx      # 0x9f50
leaq 0x1b0(%rsp), %rdi
movq %r12, %rsi
callq 0x4992
xorl %eax, %eax
movl 0x120(%rsp,%rax,4), %ecx
subl %ecx, 0x250(%rsp,%rax,4)
incq %rax
cmpq $0xa, %rax
jne 0x6644
xorl %eax, %eax
movl 0x120(%rsp,%rax,4), %ecx
addl %ecx, 0x1b0(%rsp,%rax,4)
incq %rax
cmpq $0xa, %rax
jne 0x665d
movq %rsp, %r12
leaq 0x1b0(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x51c2
movq %r12, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4992
leaq 0xd0(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0x51c2
movq %rbp, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x4992
leaq 0x250(%rsp), %rdx
movq %rbp, %rdi
movq %rbp, %rsi
callq 0x4992
leaq 0x470(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0x51c2
leaq 0x970(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x51c2
movq %r12, %rdi
movq %r12, %rsi
callq 0x51c2
movq %r12, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x4992
movq %r13, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x4992
movq %r13, %rdi
movq %r13, %rsi
callq 0x51c2
movq %r13, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4992
movq %r12, %rdi
movq %r13, %rsi
callq 0x51c2
movl $0x4, %r13d
movq %r12, %rdi
movq %r12, %rsi
callq 0x51c2
decq %r13
jne 0x6743
leaq 0x970(%rsp), %r12
leaq 0x470(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4992
movq %r12, %rdi
movq %r13, %rsi
callq 0x51c2
movl $0x9, %r13d
movq %r12, %rdi
movq %r12, %rsi
callq 0x51c2
decq %r13
jne 0x6782
leaq 0x970(%rsp), %r13
leaq 0x470(%rsp), %rdx
movq %r13, %rdi
movq %r13, %rsi
callq 0x4992
leaq 0x360(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x51c2
movl $0x13, %r13d
movq %r12, %rdi
movq %r12, %rsi
callq 0x51c2
decq %r13
jne 0x67c6
leaq 0x360(%rsp), %rsi
leaq 0x970(%rsp), %r12
movq %r12, %rdi
movq %r12, %rdx
callq 0x4992
movq %r12, %rdi
movq %r12, %rsi
callq 0x51c2
movl $0x9, %r13d
movq %r12, %rdi
movq %r12, %rsi
callq 0x51c2
decq %r13
jne 0x6802
leaq 0x970(%rsp), %r12
leaq 0x470(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4992
movq %r12, %rdi
movq %r13, %rsi
callq 0x51c2
movl $0x31, %r13d
movq %r12, %rdi
movq %r12, %rsi
callq 0x51c2
decq %r13
jne 0x6841
leaq 0x970(%rsp), %r13
leaq 0x470(%rsp), %rdx
movq %r13, %rdi
movq %r13, %rsi
callq 0x4992
leaq 0x360(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x51c2
movl $0x63, %r13d
movq %r12, %rdi
movq %r12, %rsi
callq 0x51c2
decq %r13
jne 0x6885
leaq 0x360(%rsp), %rsi
leaq 0x970(%rsp), %r12
movq %r12, %rdi
movq %r12, %rdx
callq 0x4992
movq %r12, %rdi
movq %r12, %rsi
callq 0x51c2
movl $0x31, %r13d
movq %r12, %rdi
movq %r12, %rsi
callq 0x51c2
decq %r13
jne 0x68c1
leaq 0x970(%rsp), %rsi
leaq 0x470(%rsp), %r12
movq %r12, %rdi
movq %r12, %rdx
callq 0x4992
movq %r12, %rdi
movq %r12, %rsi
callq 0x51c2
movq %r12, %rdi
movq %r12, %rsi
callq 0x51c2
leaq 0xd0(%rsp), %rdi
movq %r12, %rsi
movq %rdi, %rdx
callq 0x4992
xorl %eax, %eax
movb $0x0, 0x470(%rsp,%rax)
incq %rax
cmpq $0x28, %rax
jne 0x6917
xorl %eax, %eax
movb $0x0, 0x970(%rsp,%rax)
incq %rax
cmpq $0x28, %rax
jne 0x692a
xorl %eax, %eax
movb $0x0, 0x360(%rsp,%rax)
incq %rax
cmpq $0x28, %rax
jne 0x693d
leaq 0xd0(%rsp), %r12
movq %rsp, %rdx
movq %r12, %rdi
movq %r12, %rsi
callq 0x4992
leaq 0x250(%rsp), %rdx
movq %r12, %rdi
movq %r12, %rsi
callq 0x4992
leaq 0x170(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x51c2
leaq 0x1b0(%rsp), %rdx
movq %r13, %rdi
movq %r13, %rsi
callq 0x4992
xorl %eax, %eax
movl 0x170(%rsp,%rax,4), %ecx
subl 0x250(%rsp,%rax,4), %ecx
movl %ecx, 0xa0(%rsp,%rax,4)
incq %rax
cmpq $0xa, %rax
jne 0x699f
leaq 0xa0(%rsp), %rdi
callq 0x81d3
testl %eax, %eax
je 0x6a20
xorl %eax, %eax
movl 0x250(%rsp,%rax,4), %ecx
addl 0x170(%rsp,%rax,4), %ecx
movl %ecx, 0xa0(%rsp,%rax,4)
incq %rax
cmpq $0xa, %rax
jne 0x69d0
leaq 0xa0(%rsp), %rdi
callq 0x81d3
testl %eax, %eax
je 0x6a09
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x6ddf
leaq 0x3570(%rip), %rdx      # 0x9f80
leaq 0xd0(%rsp), %rdi
movq %rdi, %rsi
callq 0x4992
leaq 0x100(%r14), %r12
leaq 0x470(%rsp), %r13
leaq 0xd0(%rsp), %rsi
movq %r13, %rdi
callq 0x5923
xorl %ecx, %ecx
movb (%r13), %al
movb $0x0, 0x470(%rsp,%rcx)
incq %rcx
cmpq $0x20, %rcx
jne 0x6a45
andb $0x1, %al
movb 0x13f(%r14), %cl
shrb $0x7, %cl
cmpb %cl, %al
jne 0x6a78
xorl %eax, %eax
negl 0xd0(%rsp,%rax,4)
incq %rax
cmpq $0xa, %rax
jne 0x6a68
leaq 0x148(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
movq %r15, %rdx
callq 0x4992
movl $0x1f, %ecx
leaq 0x33b4(%rip), %rdx      # 0x9e50
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %ecx, %esi
movzbl (%r12,%rsi), %edi
cmpq %rdi, (%rdx,%rsi,8)
jb 0x6ddf
ja 0x6abe
addl $-0x1, %ecx
jb 0x6aa1
jmp 0x6ddf
leaq 0x170(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x242c
movq %r15, %rdi
callq 0x635d
movaps 0x34e0(%rip), %xmm0     # 0x9fc0
leaq 0x228(%rsp), %rdi
movaps %xmm0, -0x68(%rdi)
movaps 0x34bd(%rip), %xmm0     # 0x9fb0
movaps %xmm0, -0x78(%rdi)
movabsq $0x85a4db013cd6e5, %rax # imm = 0x85A4DB013CD6E5
movq %rax, -0x58(%rdi)
leaq 0x34a4(%rip), %rsi      # 0x9fb0
movaps 0x34cd(%rip), %xmm0     # 0x9fe0
movups %xmm0, -0x50(%rdi)
movaps 0x34d2(%rip), %xmm0     # 0x9ff0
movups %xmm0, -0x40(%rdi)
movabsq $-0x6666650199999a, %rax # imm = 0xFF99999AFE666666
movq %rax, -0x30(%rdi)
leaq 0x34a9(%rip), %rdx      # 0x9fe0
movl $0x1, -0x28(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, -0x24(%rdi)
movups %xmm0, -0x14(%rdi)
movl $0x0, -0x4(%rdi)
callq 0x4992
leaq 0x470(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x820d
leaq 0x970(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x820d
leaq 0x360(%rsp), %rdi
movq %r15, %rsi
callq 0x827e
leaq 0x250(%rsp), %rdi
movq %r12, %rsi
callq 0x827e
movl $0xfd, %ebp
movl %ebp, %eax
cmpb $0x0, 0x360(%rsp,%rax)
jne 0x6bc4
cmpb $0x0, 0x250(%rsp,%rax)
jne 0x6bc4
addl $-0x1, %ebp
jb 0x6ba4
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq $0x0, 0x20(%rsp)
movl $0x1, 0x28(%rsp)
movups %xmm0, 0x2c(%rsp)
movups %xmm0, 0x3c(%rsp)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x4c(%rsp)
movups %xmm0, 0x54(%rsp)
movups %xmm0, 0x64(%rsp)
movups %xmm0, 0x74(%rsp)
movups %xmm0, 0x84(%rsp)
movups %xmm0, 0x90(%rsp)
movslq %ebp, %r12
movzbl 0x360(%rsp,%r12), %r14d
testb %r14b, %r14b
jle 0x6c4c
movl %r14d, %eax
shrl %eax
leaq (%rax,%rax,4), %rax
shll $0x5, %eax
leaq (%rsp,%rax), %rdx
addq $0x470, %rdx            # imm = 0x470
movq %rsp, %rdi
movq %rdi, %rsi
callq 0x8326
testb %r14b, %r14b
jns 0x6c79
movsbq %r14b, %rax
negq %rax
shrq %rax
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
leaq (%rsp,%rax), %rdx
addq $0x470, %rdx            # imm = 0x470
movq %rsp, %rdi
movq %rdi, %rsi
callq 0x847f
movzbl 0x250(%rsp,%r12), %r14d
testb %r14b, %r14b
jle 0x6ca9
movl %r14d, %eax
shrl %eax
leaq (%rax,%rax,4), %rax
shll $0x5, %eax
leaq (%rsp,%rax), %rdx
addq $0x970, %rdx            # imm = 0x970
movq %rsp, %rdi
movq %rdi, %rsi
callq 0x8326
testb %r14b, %r14b
jns 0x6cd6
movsbq %r14b, %rax
negq %rax
shrq %rax
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
leaq (%rsp,%rax), %rdx
addq $0x970, %rdx            # imm = 0x970
movq %rsp, %rdi
movq %rdi, %rsi
callq 0x847f
testl %ebp, %ebp
jle 0x6dc1
incq %r12
movq %rsp, %r14
leaq 0x1b0(%rsp), %r15
movq %r14, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x7fb3
movzbl 0x35e(%rsp,%r12), %r13d
testb %r13b, %r13b
jle 0x6d2a
movl %r13d, %eax
shrl %eax
leaq (%rax,%rax,4), %rax
shll $0x5, %eax
leaq (%rsp,%rax), %rdx
addq $0x470, %rdx            # imm = 0x470
movq %r14, %rdi
movq %r14, %rsi
callq 0x8326
testb %r13b, %r13b
jns 0x6d57
movsbq %r13b, %rax
negq %rax
shrq %rax
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
leaq (%rsp,%rax), %rdx
addq $0x470, %rdx            # imm = 0x470
movq %r14, %rdi
movq %r14, %rsi
callq 0x847f
movzbl 0x24e(%rsp,%r12), %r13d
testb %r13b, %r13b
jle 0x6d87
movl %r13d, %eax
shrl %eax
leaq (%rax,%rax,4), %rax
shll $0x5, %eax
leaq (%rsp,%rax), %rdx
addq $0x970, %rdx            # imm = 0x970
movq %r14, %rdi
movq %r14, %rsi
callq 0x8326
testb %r13b, %r13b
jns 0x6db4
movsbq %r13b, %rax
negq %rax
shrq %rax
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
leaq (%rsp,%rax), %rdx
addq $0x970, %rdx            # imm = 0x970
movq %r14, %rdi
movq %r14, %rsi
callq 0x847f
decq %r12
cmpq $0x1, %r12
jg 0x6cec
leaq 0x470(%rsp), %r14
movq %rsp, %rsi
movq %r14, %rdi
callq 0x60e1
movq %rbx, %rdi
movq %r14, %rsi
callq 0x177f
addq $0xe78, %rsp            # imm = 0xE78
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq