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

  unsigned i, j;

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

  for (i = 0; i < 32; ++i) {
    u8 byte = n[31 - i];
    for (j = 0; j < 8; ++j) {
      const limb 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(limb) * 10);
  memcpy(resultz, nqz, sizeof(limb) * 10);
}

// Assembly:
subq $0x588, %rsp            # imm = 0x588
movq %rdi, 0x580(%rsp)
movq %rsi, 0x578(%rsp)
movq %rdx, 0x570(%rsp)
movq %rcx, 0x568(%rsp)
leaq 0x4d0(%rsp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x1080
leaq 0x430(%rsp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x1080
movq $0x1, 0x430(%rsp)
leaq 0x390(%rsp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x1080
movq $0x1, 0x390(%rsp)
leaq 0x2f0(%rsp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x1080
leaq 0x4d0(%rsp), %rax
movq %rax, 0x2e8(%rsp)
leaq 0x430(%rsp), %rax
movq %rax, 0x2e0(%rsp)
leaq 0x390(%rsp), %rax
movq %rax, 0x2d8(%rsp)
leaq 0x2f0(%rsp), %rax
movq %rax, 0x2d0(%rsp)
leaq 0x230(%rsp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x1080
leaq 0x190(%rsp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x1080
movq $0x1, 0x190(%rsp)
leaq 0xf0(%rsp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x1080
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x1080
movq $0x1, 0x50(%rsp)
leaq 0x230(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x190(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0xf0(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x2e8(%rsp), %rdi
movq 0x568(%rsp), %rsi
movl $0x50, %edx
callq 0x10b0
movl $0x0, 0x2c(%rsp)
cmpl $0x20, 0x2c(%rsp)
jae 0x294b
movq 0x570(%rsp), %rax
movl $0x1f, %ecx
subl 0x2c(%rsp), %ecx
movl %ecx, %ecx
movb (%rax,%rcx), %al
movb %al, 0x27(%rsp)
movl $0x0, 0x28(%rsp)
cmpl $0x8, 0x28(%rsp)
jae 0x2939
movzbl 0x27(%rsp), %eax
sarl $0x7, %eax
cltq
movq %rax, 0x18(%rsp)
movq 0x2d8(%rsp), %rdi
movq 0x2e8(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x35e0
movq 0x2d0(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x35e0
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x40(%rsp), %rcx
movq 0x2d8(%rsp), %r8
movq 0x2d0(%rsp), %r9
movq 0x2e8(%rsp), %r11
movq 0x2e0(%rsp), %r10
movq 0x568(%rsp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x3680
movq 0x38(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x35e0
movq 0x30(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x35e0
movq 0x2d8(%rsp), %rax
movq %rax, 0x2c8(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x2d8(%rsp)
movq 0x2c8(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x2d0(%rsp), %rax
movq %rax, 0x2c8(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x2d0(%rsp)
movq 0x2c8(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x2e8(%rsp), %rax
movq %rax, 0x2c8(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x2e8(%rsp)
movq 0x2c8(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x2e0(%rsp), %rax
movq %rax, 0x2c8(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x2e0(%rsp)
movq 0x2c8(%rsp), %rax
movq %rax, 0x40(%rsp)
movzbl 0x27(%rsp), %eax
shll %eax
movb %al, 0x27(%rsp)
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x27b1
jmp 0x293b
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x2784
movq 0x580(%rsp), %rdi
movq 0x2d8(%rsp), %rsi
movl $0x50, %edx
callq 0x10b0
movq 0x578(%rsp), %rdi
movq 0x2d0(%rsp), %rsi
movl $0x50, %edx
callq 0x10b0
addq $0x588, %rsp            # imm = 0x588
retq
nopw (%rax,%rax)