// File: /workspace/github_cpp_makefile_star2_O2/occivink[P]pyct/monocypher.cpp
// Function: fe_tobytes(unsigned char*, int const*)
static void fe_tobytes(u8 s[32], const fe h)
{
    i32 t[10];
    COPY(t, h, 10);
    i32 q = (19 * t[9] + (((i32) 1) << 24)) >> 25;
    //                 |t9|                    < 1.1 * 2^24
    //  -1.1 * 2^24  <  t9                     < 1.1 * 2^24
    //  -21  * 2^24  <  19 * t9                < 21  * 2^24
    //  -2^29        <  19 * t9 + 2^24         < 2^29
    //  -2^29 / 2^25 < (19 * t9 + 2^24) / 2^25 < 2^29 / 2^25
    //  -16          < (19 * t9 + 2^24) / 2^25 < 16
    FOR (i, 0, 5) {
        q += t[2*i  ]; q >>= 26; // q = 0 or -1
        q += t[2*i+1]; q >>= 25; // q = 0 or -1
    }
    // q =  0 iff h >= 0
    // q = -1 iff h <  0
    // Adding q * 19 to h reduces h to its proper range.
    q *= 19;  // Shift carry back to the beginning
    FOR (i, 0, 5) {
        t[i*2  ] += q;  q = t[i*2  ] >> 26;  t[i*2  ] -= q * ((i32)1 << 26);
        t[i*2+1] += q;  q = t[i*2+1] >> 25;  t[i*2+1] -= q * ((i32)1 << 25);
    }
    // h is now fully reduced, and q represents the excess bit.

    store32_le(s +  0, ((u32)t[0] >>  0) | ((u32)t[1] << 26));
    store32_le(s +  4, ((u32)t[1] >>  6) | ((u32)t[2] << 19));
    store32_le(s +  8, ((u32)t[2] >> 13) | ((u32)t[3] << 13));
    store32_le(s + 12, ((u32)t[3] >> 19) | ((u32)t[4] <<  6));
    store32_le(s + 16, ((u32)t[5] >>  0) | ((u32)t[6] << 25));
    store32_le(s + 20, ((u32)t[6] >>  7) | ((u32)t[7] << 19));
    store32_le(s + 24, ((u32)t[7] >> 13) | ((u32)t[8] << 12));
    store32_le(s + 28, ((u32)t[8] >> 20) | ((u32)t[9] <<  6));

    WIPE_BUFFER(t);
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
xorl %eax, %eax
cmpq $0xa, %rax
je 0x6da8
movl (%rsi,%rax,4), %ecx
movl %ecx, (%rsp,%rax,4)
incq %rax
jmp 0x6d97
imull $0x13, 0x24(%rsp), %eax
addl $0x1000000, %eax        # imm = 0x1000000
xorl %ecx, %ecx
sarl $0x19, %eax
cmpq $0x5, %rcx
je 0x6dcc
addl (%rsp,%rcx,8), %eax
sarl $0x1a, %eax
addl 0x4(%rsp,%rcx,8), %eax
incq %rcx
jmp 0x6db4
imull $0x13, %eax, %ecx
xorl %eax, %eax
cmpq $0x5, %rax
je 0x6e00
addl (%rsp,%rax,8), %ecx
movl %ecx, %edx
sarl $0x1a, %edx
andl $0x3ffffff, %ecx        # imm = 0x3FFFFFF
movl %ecx, (%rsp,%rax,8)
addl 0x4(%rsp,%rax,8), %edx
movl %edx, %ecx
sarl $0x19, %ecx
andl $0x1ffffff, %edx        # imm = 0x1FFFFFF
movl %edx, 0x4(%rsp,%rax,8)
incq %rax
jmp 0x6dd1
movq %rsp, %rax
movl (%rax), %ecx
movl 0x4(%rax), %edx
movl %edx, %esi
shll $0x1a, %esi
orl %ecx, %esi
movb %cl, (%rdi)
movb %ch, 0x1(%rdi)
shrl $0x10, %ecx
movb %cl, 0x2(%rdi)
shrl $0x18, %esi
movb %sil, 0x3(%rdi)
movl %edx, %ecx
shrl $0x6, %ecx
movl 0x8(%rax), %esi
movl %esi, %r8d
shll $0x13, %r8d
orl %ecx, %r8d
movb %cl, 0x4(%rdi)
shrl $0xe, %edx
movb %dl, 0x5(%rdi)
movl %r8d, %ecx
shrl $0x10, %ecx
movb %cl, 0x6(%rdi)
shrl $0x18, %r8d
movb %r8b, 0x7(%rdi)
shrl $0xd, %esi
movl 0xc(%rax), %edx
movl %edx, %ecx
shll $0xd, %ecx
orl %esi, %ecx
movb %sil, 0x8(%rdi)
movb %ch, 0x9(%rdi)
shrl $0x10, %ecx
movb %cl, 0xa(%rdi)
movl %edx, %ecx
shrl $0xb, %ecx
movb %cl, 0xb(%rdi)
shrl $0x13, %edx
movl 0x10(%rax), %ecx
movl %ecx, %ebx
shll $0x6, %ebx
orl %edx, %ebx
movb %bl, 0xc(%rdi)
movb %bh, 0xd(%rdi)
movl %ecx, %edx
shrl $0xa, %edx
movb %dl, 0xe(%rdi)
shrl $0x12, %ecx
movb %cl, 0xf(%rdi)
movl 0x14(%rax), %ecx
movl 0x18(%rax), %edx
movl %edx, %esi
shll $0x19, %esi
orl %ecx, %esi
movb %cl, 0x10(%rdi)
movb %ch, 0x11(%rdi)
shrl $0x10, %ecx
movb %cl, 0x12(%rdi)
shrl $0x18, %esi
movb %sil, 0x13(%rdi)
movl %edx, %ecx
shrl $0x7, %ecx
movl 0x1c(%rax), %esi
movl %esi, %r8d
shll $0x13, %r8d
orl %ecx, %r8d
movb %cl, 0x14(%rdi)
shrl $0xf, %edx
movb %dl, 0x15(%rdi)
movl %r8d, %ecx
shrl $0x10, %ecx
movb %cl, 0x16(%rdi)
shrl $0x18, %r8d
movb %r8b, 0x17(%rdi)
shrl $0xd, %esi
movl 0x20(%rax), %edx
movl %edx, %ecx
shll $0xc, %ecx
orl %esi, %ecx
movb %sil, 0x18(%rdi)
movb %ch, 0x19(%rdi)
shrl $0x10, %ecx
movb %cl, 0x1a(%rdi)
movl %edx, %ecx
shrl $0xc, %ecx
movb %cl, 0x1b(%rdi)
shrl $0x14, %edx
movl 0x24(%rax), %ecx
movl %ecx, %ebx
shll $0x6, %ebx
orl %edx, %ebx
movb %bl, 0x1c(%rdi)
movb %bh, 0x1d(%rdi)
movl %ecx, %edx
shrl $0xa, %edx
movb %dl, 0x1e(%rdi)
shrl $0x12, %ecx
movb %cl, 0x1f(%rdi)
pushq $0x28
popq %rsi
movq %rax, %rdi
callq 0x25a4
addq $0x30, %rsp
popq %rbx
retq