// File: /workspace/github_c_makefile_star2_O2/agl[P]obstcp/curve25519/donna_c64/smult.c
// Function: fmul
static void fmul(felem *output, const felem *in2, const felem *in) {
  uint128_t t[9];

  t[0] = ((uint128_t) in[0]) * in2[0];
  t[1] = ((uint128_t) in[0]) * in2[1] +
         ((uint128_t) in[1]) * in2[0];
  t[2] = ((uint128_t) in[0]) * in2[2] +
         ((uint128_t) in[2]) * in2[0] +
         ((uint128_t) in[1]) * in2[1];
  t[3] = ((uint128_t) in[0]) * in2[3] +
         ((uint128_t) in[3]) * in2[0] +
         ((uint128_t) in[1]) * in2[2] +
         ((uint128_t) in[2]) * in2[1];
  t[4] = ((uint128_t) in[0]) * in2[4] +
         ((uint128_t) in[4]) * in2[0] +
         ((uint128_t) in[3]) * in2[1] +
         ((uint128_t) in[1]) * in2[3] +
         ((uint128_t) in[2]) * in2[2];
  t[5] = ((uint128_t) in[4]) * in2[1] +
         ((uint128_t) in[1]) * in2[4] +
         ((uint128_t) in[2]) * in2[3] +
         ((uint128_t) in[3]) * in2[2];
  t[6] = ((uint128_t) in[4]) * in2[2] +
         ((uint128_t) in[2]) * in2[4] +
         ((uint128_t) in[3]) * in2[3];
  t[7] = ((uint128_t) in[3]) * in2[4] +
         ((uint128_t) in[4]) * in2[3];
  t[8] = ((uint128_t) in[4]) * in2[4];

  t[0] += t[5] * 19;
  t[1] += t[6] * 19;
  t[2] += t[7] * 19;
  t[3] += t[8] * 19;

  t[1] += t[0] >> 51;
  t[0] &= 0x7ffffffffffff;
  t[2] += t[1] >> 51;
  t[1] &= 0x7ffffffffffff;
  t[3] += t[2] >> 51;
  t[2] &= 0x7ffffffffffff;
  t[4] += t[3] >> 51;
  t[3] &= 0x7ffffffffffff;
  t[0] += 19 * (t[4] >> 51);
  t[4] &= 0x7ffffffffffff;
  t[1] += t[0] >> 51;
  t[0] &= 0x7ffffffffffff;

  output[0] = t[0];
  output[1] = t[1];
  output[2] = t[2];
  output[3] = t[3];
  output[4] = t[4];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x80, %rsp
movq %rdx, %r13
movq (%rsi), %r10
movq 0x8(%rsi), %r14
movq (%rdx), %r11
movq 0x8(%rdx), %r15
movq %r10, %rax
mulq %r11
movq %rdx, -0x30(%rsp)
movq %rax, -0x38(%rsp)
movq %r14, %rax
mulq %r11
movq %rdx, %rcx
movq %rax, %r8
movq %r15, %rax
mulq %r10
addq %r8, %rax
movq %rax, -0x40(%rsp)
adcq %rcx, %rdx
movq %rdx, -0x48(%rsp)
movq 0x10(%rsi), %rbx
movq %rbx, %rax
mulq %r11
movq %rax, 0x48(%rsp)
movq %rdx, 0x58(%rsp)
movq 0x10(%r13), %rbp
movq %rbp, %rax
mulq %r10
movq %rdx, 0x30(%rsp)
movq %rax, 0x20(%rsp)
movq %r15, %rax
mulq %r14
movq %rax, (%rsp)
movq %rdx, 0x8(%rsp)
movq 0x18(%rsi), %rax
movq %rax, %r8
mulq %r11
movq %rax, 0x68(%rsp)
movq %rdx, 0x78(%rsp)
movq 0x18(%r13), %r12
movq %r12, %rax
mulq %r10
movq %rdx, 0x40(%rsp)
movq %rax, 0x28(%rsp)
movq %rbx, %rax
mulq %r15
movq %rdx, 0x18(%rsp)
movq %rax, -0x8(%rsp)
movq %rbp, %rax
mulq %r14
movq %rax, -0x18(%rsp)
movq %rdx, %r9
movq 0x20(%rsi), %rcx
movq %rcx, %rax
movq %rcx, -0x68(%rsp)
mulq %r11
movq %rax, 0x60(%rsp)
movq %rdx, 0x70(%rsp)
movq 0x20(%r13), %rsi
movq %rsi, %rax
movq %rsi, -0x70(%rsp)
mulq %r10
movq %rdx, 0x50(%rsp)
movq %rax, 0x38(%rsp)
movq %r12, %rax
movq %r12, -0x58(%rsp)
mulq %r14
movq %rdx, 0x10(%rsp)
movq %rax, -0x10(%rsp)
movq %r8, -0x50(%rsp)
movq %r8, %rax
mulq %r15
movq %rdx, -0x20(%rsp)
movq %rax, -0x28(%rsp)
movq %rbp, %rax
mulq %rbx
movq %rdx, %r13
movq %rax, %r10
movq %rsi, %rax
mulq %r14
movq %rdx, -0x78(%rsp)
movq %rax, -0x80(%rsp)
movq %rcx, %rax
mulq %r15
movq %rdx, %r15
movq %rax, %rcx
movq %r8, %rax
movq %rbp, %r8
mulq %rbp
movq %rdx, %rbp
movq %rax, %r11
movq %r12, %rax
mulq %rbx
movq %rdx, %r14
movq %rax, %rsi
addq %r11, %rsi
adcq %rbp, %r14
addq %rcx, %rsi
adcq %r15, %r14
addq -0x80(%rsp), %rsi
adcq -0x78(%rsp), %r14
movq -0x70(%rsp), %rcx
movq %rcx, %rax
mulq %rbx
movq %rdx, -0x78(%rsp)
movq %rax, -0x80(%rsp)
movq -0x68(%rsp), %rbp
movq %rbp, %rax
mulq %r8
movq %rdx, -0x60(%rsp)
movq %rax, %r12
movq -0x58(%rsp), %r8
movq %r8, %rax
movq -0x50(%rsp), %rbx
mulq %rbx
movq %rdx, %r15
movq %rax, %r11
addq %r12, %r11
adcq -0x60(%rsp), %r15
addq -0x80(%rsp), %r11
adcq -0x78(%rsp), %r15
movq %rbp, %rax
mulq %r8
movq %rdx, %r12
movq %rax, %r8
movq %rcx, %rax
mulq %rbx
movq %rdx, %rbx
movq %rax, %rbp
addq %r8, %rbp
adcq %r12, %rbx
imulq $0x13, %r14, %r8
movabsq $0x13, %rcx
movq %rsi, %rax
mulq %rcx
movq %rcx, %r14
movq %rax, %rsi
movq %rdx, %rcx
addq %r8, %rcx
addq -0x38(%rsp), %rsi
adcq -0x30(%rsp), %rcx
imulq $0x13, %r15, %r8
movq %r11, %rax
movq %r14, %r15
mulq %r14
movq %rax, %r14
movq %rdx, %r11
addq %r8, %r11
addq -0x40(%rsp), %r14
adcq -0x48(%rsp), %r11
movq %rbp, %rax
mulq %r15
movq %r15, %r12
movq %rax, %r15
movq %rdx, %r8
imulq $0x13, %rbx, %rbp
movq -0x68(%rsp), %rax
mulq -0x70(%rsp)
movq %rdx, %rbx
mulq %r12
addq %r8, %rbp
imulq $0x13, %rbx, %rbx
addq %rdx, %rbx
movq %rcx, %r12
shrq $0x33, %r12
shldq $0xd, %rsi, %rcx
addq %r14, %rcx
adcq %r11, %r12
movabsq $0x7ffffffffffff, %r8   # imm = 0x7FFFFFFFFFFFF
andq %r8, %rsi
movq %r12, %r11
shldq $0xd, %rcx, %r12
shrq $0x33, %r11
movq (%rsp), %r14
addq 0x48(%rsp), %r14
movq 0x8(%rsp), %rdx
adcq 0x58(%rsp), %rdx
addq 0x20(%rsp), %r14
adcq 0x30(%rsp), %rdx
addq %r15, %r14
adcq %rbp, %rdx
addq %r12, %r14
adcq %r11, %rdx
andq %r8, %rcx
movq %rdx, %r11
shldq $0xd, %r14, %rdx
shrq $0x33, %r11
movq -0x18(%rsp), %r15
addq -0x8(%rsp), %r15
adcq 0x18(%rsp), %r9
addq 0x68(%rsp), %r15
adcq 0x78(%rsp), %r9
addq 0x28(%rsp), %r15
adcq 0x40(%rsp), %r9
addq %rax, %r15
adcq %rbx, %r9
addq %rdx, %r15
adcq %r11, %r9
movq %r9, %rax
shldq $0xd, %r15, %r9
movq %r15, %r11
shrq $0x33, %rax
addq -0x28(%rsp), %r10
adcq -0x20(%rsp), %r13
addq -0x10(%rsp), %r10
adcq 0x10(%rsp), %r13
addq 0x60(%rsp), %r10
adcq 0x70(%rsp), %r13
addq 0x38(%rsp), %r10
adcq 0x50(%rsp), %r13
addq %r9, %r10
adcq %rax, %r13
movq %r13, %rax
shldq $0xd, %r10, %rax
shrq $0x33, %r13
imulq $0x13, %r13, %r9
movabsq $0x13, %rdx
mulq %rdx
addq %rsi, %rax
adcq %r9, %rdx
shldq $0xd, %rax, %rdx
addq %rcx, %rdx
andq %r8, %rax
movq %rax, (%rdi)
movq %rdx, 0x8(%rdi)
andq %r8, %r14
movq %r14, 0x10(%rdi)
andq %r8, %r11
movq %r11, 0x18(%rdi)
andq %r8, %r10
movq %r10, 0x20(%rdi)
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq