// File: /workspace/github_c_makefile_star2_O0/skeeto[P]enchive/src/curve25519-donna.c
// Function: cmult
static void
cmult(int64_t *resultx, int64_t *resultz, const uint8_t *n, const int64_t *q)
{
  int64_t a[19] = {0}, b[19] = {1}, c[19] = {1}, d[19] = {0};
  int64_t *nqpqx = a, *nqpqz = b, *nqx = c, *nqz = d, *t;
  int64_t e[19] = {0}, f[19] = {1}, g[19] = {0}, h[19] = {1};
  int64_t *nqpqx2 = e, *nqpqz2 = f, *nqx2 = g, *nqz2 = h;

  unsigned i, j;

  memcpy(nqpqx, q, sizeof(int64_t) * 10);

  for (i = 0; i < 32; ++i) {
    uint8_t byte = n[31 - i];
    for (j = 0; j < 8; ++j) {
      const int64_t bit = byte >> 7;

      swap_conditional(nqx, nqpqx, bit);
      swap_conditional(nqz, nqpqz, bit);
      fmonty(nqx2, nqz2,
             nqpqx2, nqpqz2,
             nqx, nqz,
             nqpqx, nqpqz,
             q);
      swap_conditional(nqx2, nqpqx2, bit);
      swap_conditional(nqz2, nqpqz2, bit);

      t = nqx;
      nqx = nqx2;
      nqx2 = t;
      t = nqz;
      nqz = nqz2;
      nqz2 = t;
      t = nqpqx;
      nqpqx = nqpqx2;
      nqpqx2 = t;
      t = nqpqz;
      nqpqz = nqpqz2;
      nqpqz2 = t;

      byte <<= 1;
    }
  }

  memcpy(resultx, nqx, sizeof(int64_t) * 10);
  memcpy(resultz, nqz, sizeof(int64_t) * 10);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x590, %rsp            # imm = 0x590
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x2160
leaq -0x160(%rbp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x2160
movq $0x1, -0x160(%rbp)
leaq -0x200(%rbp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x2160
movq $0x1, -0x200(%rbp)
leaq -0x2a0(%rbp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x2160
leaq -0xc0(%rbp), %rax
movq %rax, -0x2a8(%rbp)
leaq -0x160(%rbp), %rax
movq %rax, -0x2b0(%rbp)
leaq -0x200(%rbp), %rax
movq %rax, -0x2b8(%rbp)
leaq -0x2a0(%rbp), %rax
movq %rax, -0x2c0(%rbp)
leaq -0x360(%rbp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x2160
leaq -0x400(%rbp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x2160
movq $0x1, -0x400(%rbp)
leaq -0x4a0(%rbp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x2160
leaq -0x540(%rbp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x2160
movq $0x1, -0x540(%rbp)
leaq -0x360(%rbp), %rax
movq %rax, -0x548(%rbp)
leaq -0x400(%rbp), %rax
movq %rax, -0x550(%rbp)
leaq -0x4a0(%rbp), %rax
movq %rax, -0x558(%rbp)
leaq -0x540(%rbp), %rax
movq %rax, -0x560(%rbp)
movq -0x2a8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x50, %edx
callq 0x2230
movl $0x0, -0x564(%rbp)
cmpl $0x20, -0x564(%rbp)
jae 0x7a57
movq -0x18(%rbp), %rax
movl $0x1f, %ecx
subl -0x564(%rbp), %ecx
movl %ecx, %ecx
movb (%rax,%rcx), %al
movb %al, -0x569(%rbp)
movl $0x0, -0x568(%rbp)
cmpl $0x8, -0x568(%rbp)
jae 0x7a41
movzbl -0x569(%rbp), %eax
sarl $0x7, %eax
cltq
movq %rax, -0x578(%rbp)
movq -0x2b8(%rbp), %rdi
movq -0x2a8(%rbp), %rsi
movq -0x578(%rbp), %rdx
callq 0x86b0
movq -0x2c0(%rbp), %rdi
movq -0x2b0(%rbp), %rsi
movq -0x578(%rbp), %rdx
callq 0x86b0
movq -0x558(%rbp), %rdi
movq -0x560(%rbp), %rsi
movq -0x548(%rbp), %rdx
movq -0x550(%rbp), %rcx
movq -0x2b8(%rbp), %r8
movq -0x2c0(%rbp), %r9
movq -0x2a8(%rbp), %r11
movq -0x2b0(%rbp), %r10
movq -0x20(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x8740
movq -0x558(%rbp), %rdi
movq -0x548(%rbp), %rsi
movq -0x578(%rbp), %rdx
callq 0x86b0
movq -0x560(%rbp), %rdi
movq -0x550(%rbp), %rsi
movq -0x578(%rbp), %rdx
callq 0x86b0
movq -0x2b8(%rbp), %rax
movq %rax, -0x2c8(%rbp)
movq -0x558(%rbp), %rax
movq %rax, -0x2b8(%rbp)
movq -0x2c8(%rbp), %rax
movq %rax, -0x558(%rbp)
movq -0x2c0(%rbp), %rax
movq %rax, -0x2c8(%rbp)
movq -0x560(%rbp), %rax
movq %rax, -0x2c0(%rbp)
movq -0x2c8(%rbp), %rax
movq %rax, -0x560(%rbp)
movq -0x2a8(%rbp), %rax
movq %rax, -0x2c8(%rbp)
movq -0x548(%rbp), %rax
movq %rax, -0x2a8(%rbp)
movq -0x2c8(%rbp), %rax
movq %rax, -0x548(%rbp)
movq -0x2b0(%rbp), %rax
movq %rax, -0x2c8(%rbp)
movq -0x550(%rbp), %rax
movq %rax, -0x2b0(%rbp)
movq -0x2c8(%rbp), %rax
movq %rax, -0x550(%rbp)
movzbl -0x569(%rbp), %eax
shll %eax
movb %al, -0x569(%rbp)
movl -0x568(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x568(%rbp)
jmp 0x789f
jmp 0x7a43
movl -0x564(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x564(%rbp)
jmp 0x786e
movq -0x8(%rbp), %rdi
movq -0x2b8(%rbp), %rsi
movl $0x50, %edx
callq 0x2230
movq -0x10(%rbp), %rdi
movq -0x2c0(%rbp), %rsi
movl $0x50, %edx
callq 0x2230
addq $0x590, %rsp            # imm = 0x590
popq %rbp
retq
nopw (%rax,%rax)