// File: /workspace/github_c_makefile_star2_O3/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, %rbx
leaq 0x120(%rdi), %rsi
leaq 0xf8(%rsp), %r14
movq %r14, %rdi
callq 0x4777
movl $0x1, 0x28(%r14)
pxor %xmm0, %xmm0
movdqu %xmm0, 0x2c(%r14)
movdqu %xmm0, 0x3c(%r14)
movl $0x0, 0x4c(%r14)
leaq 0x250(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x517b
leaq 0x399a(%rip), %rdx      # 0x9f60
leaq 0x1b0(%rsp), %rdi
movq %r15, %rsi
callq 0x494b
xorl %eax, %eax
movl 0x120(%rsp,%rax,4), %ecx
subl %ecx, 0x250(%rsp,%rax,4)
incq %rax
cmpq $0xa, %rax
jne 0x65d8
xorl %eax, %eax
movl 0x120(%rsp,%rax,4), %ecx
addl %ecx, 0x1b0(%rsp,%rax,4)
incq %rax
cmpq $0xa, %rax
jne 0x65f1
movq %rsp, %r15
leaq 0x1b0(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x517b
movq %r15, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x494b
leaq 0xd0(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x517b
movq %r13, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x494b
leaq 0x250(%rsp), %rdx
movq %r13, %rdi
movq %r13, %rsi
callq 0x494b
leaq 0x470(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x517b
leaq 0x970(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x517b
movq %r15, %rdi
movq %r15, %rsi
callq 0x517b
movq %r15, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x494b
movq %r12, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x494b
movq %r12, %rdi
movq %r12, %rsi
callq 0x517b
movq %r12, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x494b
movq %r15, %rdi
movq %r12, %rsi
callq 0x517b
movl $0x4, %r12d
movq %r15, %rdi
movq %r15, %rsi
callq 0x517b
decq %r12
jne 0x66d7
leaq 0x970(%rsp), %r15
leaq 0x470(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x494b
movq %r15, %rdi
movq %r12, %rsi
callq 0x517b
movl $0x9, %r12d
movq %r15, %rdi
movq %r15, %rsi
callq 0x517b
decq %r12
jne 0x6716
leaq 0x970(%rsp), %r12
leaq 0x470(%rsp), %rdx
movq %r12, %rdi
movq %r12, %rsi
callq 0x494b
leaq 0x360(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x517b
movl $0x13, %r12d
movq %r15, %rdi
movq %r15, %rsi
callq 0x517b
decq %r12
jne 0x675a
leaq 0x360(%rsp), %rsi
leaq 0x970(%rsp), %r15
movq %r15, %rdi
movq %r15, %rdx
callq 0x494b
movq %r15, %rdi
movq %r15, %rsi
callq 0x517b
movl $0x9, %r12d
movq %r15, %rdi
movq %r15, %rsi
callq 0x517b
decq %r12
jne 0x6796
leaq 0x970(%rsp), %r15
leaq 0x470(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x494b
movq %r15, %rdi
movq %r12, %rsi
callq 0x517b
movl $0x31, %r12d
movq %r15, %rdi
movq %r15, %rsi
callq 0x517b
decq %r12
jne 0x67d5
leaq 0x970(%rsp), %r12
leaq 0x470(%rsp), %rdx
movq %r12, %rdi
movq %r12, %rsi
callq 0x494b
leaq 0x360(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x517b
movl $0x63, %r12d
movq %r15, %rdi
movq %r15, %rsi
callq 0x517b
decq %r12
jne 0x6819
leaq 0x360(%rsp), %rsi
leaq 0x970(%rsp), %r15
movq %r15, %rdi
movq %r15, %rdx
callq 0x494b
movq %r15, %rdi
movq %r15, %rsi
callq 0x517b
movl $0x31, %r12d
movq %r15, %rdi
movq %r15, %rsi
callq 0x517b
decq %r12
jne 0x6855
leaq 0x970(%rsp), %rsi
leaq 0x470(%rsp), %r15
movq %r15, %rdi
movq %r15, %rdx
callq 0x494b
movq %r15, %rdi
movq %r15, %rsi
callq 0x517b
movq %r15, %rdi
movq %r15, %rsi
callq 0x517b
leaq 0xd0(%rsp), %rdi
movq %r15, %rsi
movq %rdi, %rdx
callq 0x494b
xorl %eax, %eax
movb $0x0, 0x470(%rsp,%rax)
incq %rax
cmpq $0x28, %rax
jne 0x68ab
xorl %eax, %eax
movb $0x0, 0x970(%rsp,%rax)
incq %rax
cmpq $0x28, %rax
jne 0x68be
xorl %eax, %eax
movb $0x0, 0x360(%rsp,%rax)
incq %rax
cmpq $0x28, %rax
jne 0x68d1
leaq 0xd0(%rsp), %r15
movq %rsp, %rdx
movq %r15, %rdi
movq %r15, %rsi
callq 0x494b
leaq 0x250(%rsp), %rdx
movq %r15, %rdi
movq %r15, %rsi
callq 0x494b
leaq 0x170(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x517b
leaq 0x1b0(%rsp), %rdx
movq %r12, %rdi
movq %r12, %rsi
callq 0x494b
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 0x6933
leaq 0xa0(%rsp), %rdi
callq 0x81f9
testl %eax, %eax
je 0x69b4
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 0x6964
leaq 0xa0(%rsp), %rdi
callq 0x81f9
testl %eax, %eax
je 0x699d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x6d9e
leaq 0x35ec(%rip), %rdx      # 0x9f90
leaq 0xd0(%rsp), %rdi
movq %rdi, %rsi
callq 0x494b
leaq 0x100(%rbx), %r15
leaq 0x470(%rsp), %r12
leaq 0xd0(%rsp), %rsi
movq %r12, %rdi
callq 0x58dc
xorl %ecx, %ecx
movb (%r12), %al
movb $0x0, 0x470(%rsp,%rcx)
incq %rcx
cmpq $0x20, %rcx
jne 0x69d9
andb $0x1, %al
movb 0x13f(%rbx), %cl
shrb $0x7, %cl
cmpb %cl, %al
jne 0x6a0b
xorl %eax, %eax
negl 0xd0(%rsp,%rax,4)
incq %rax
cmpq $0xa, %rax
jne 0x69fb
leaq 0x148(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
movq %r14, %rdx
callq 0x494b
movl $0x1f, %ecx
leaq 0x3431(%rip), %rdx      # 0x9e60
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %ecx, %esi
movzbl (%r15,%rsi), %edi
cmpq %rdi, (%rdx,%rsi,8)
jb 0x6d9e
ja 0x6a51
addl $-0x1, %ecx
jb 0x6a34
jmp 0x6d9e
leaq 0x170(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x240d
movq %r14, %rdi
callq 0x62c6
movaps 0x355d(%rip), %xmm0     # 0x9fd0
leaq 0x228(%rsp), %rdi
movaps %xmm0, -0x68(%rdi)
movaps 0x353a(%rip), %xmm0     # 0x9fc0
movaps %xmm0, -0x78(%rdi)
movabsq $0x85a4db013cd6e5, %rax # imm = 0x85A4DB013CD6E5
movq %rax, -0x58(%rdi)
leaq 0x3521(%rip), %rsi      # 0x9fc0
movaps 0x354a(%rip), %xmm0     # 0x9ff0
movups %xmm0, -0x50(%rdi)
movaps 0x354f(%rip), %xmm0     # 0xa000
movups %xmm0, -0x40(%rdi)
movabsq $-0x6666650199999a, %rax # imm = 0xFF99999AFE666666
movq %rax, -0x30(%rdi)
leaq 0x3526(%rip), %rdx      # 0x9ff0
movl $0x1, -0x28(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, -0x24(%rdi)
movups %xmm0, -0x14(%rdi)
movl $0x0, -0x4(%rdi)
callq 0x494b
leaq 0x470(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x8255
leaq 0x970(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x8255
leaq 0x360(%rsp), %rdi
movq %r14, %rsi
callq 0x82c6
leaq 0x250(%rsp), %rdi
movq %r15, %rsi
callq 0x82c6
movl $0xfd, %ebp
movl %ebp, %eax
cmpb $0x0, 0x360(%rsp,%rax)
jne 0x6b57
cmpb $0x0, 0x250(%rsp,%rax)
jne 0x6b57
addl $-0x1, %ebp
jb 0x6b37
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), %eax
testb %al, %al
jle 0x6bdd
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 0x836d
jmp 0x6c09
testb %al, %al
jns 0x6c09
movsbq %al, %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 0x84c6
movzbl 0x250(%rsp,%r12), %eax
testb %al, %al
jle 0x6c37
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 0x836d
jmp 0x6c63
testb %al, %al
jns 0x6c63
movsbq %al, %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 0x84c6
testl %ebp, %ebp
jle 0x6d48
incq %r12
movq %rsp, %r14
leaq 0x1b0(%rsp), %r15
movq %r14, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x7f99
movzbl 0x35e(%rsp,%r12), %eax
testb %al, %al
jle 0x6cb5
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 0x836d
jmp 0x6ce1
testb %al, %al
jns 0x6ce1
movsbq %al, %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 0x84c6
movzbl 0x24e(%rsp,%r12), %eax
testb %al, %al
jle 0x6d0f
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 0x836d
jmp 0x6d3b
testb %al, %al
jns 0x6d3b
movsbq %al, %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 0x84c6
decq %r12
cmpq $0x1, %r12
ja 0x6c79
leaq 0x470(%rsp), %r14
movq %rsp, %rsi
movq %r14, %rdi
callq 0x603c
movdqu 0xf0(%rbx), %xmm0
pxor 0x10(%r14), %xmm0
movdqu 0xe0(%rbx), %xmm1
pxor (%r14), %xmm1
por %xmm0, %xmm1
pshufd $0xee, %xmm1, %xmm0     # xmm0 = xmm1[2,3,2,3]
por %xmm1, %xmm0
movq %xmm0, %rax
movl %eax, %ecx
shrq $0x20, %rax
orq %rax, %rcx
decq %rcx
xorl %eax, %eax
btq $0x20, %rcx
adcl $-0x1, %eax
addq $0xe78, %rsp            # imm = 0xE78
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq