// File: /workspace/github_c_makefile_star2_O1/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 $0x78, %rsp
movq %rdx, %r13
movq (%rsi), %r9
movq 0x8(%rsi), %r14
movq (%rdx), %r11
movq 0x8(%rdx), %r12
movq %r9, %rax
mulq %r11
movq %rdx, -0x30(%rsp)
movq %rax, -0x38(%rsp)
movq %r14, %rax
mulq %r11
movq %rdx, %rcx
movq %rax, %r8
movq %r12, %rax
mulq %r9
addq %r8, %rax
movq %rax, -0x40(%rsp)
adcq %rcx, %rdx
movq %rdx, -0x48(%rsp)
movq 0x10(%rsi), %rbp
movq %rbp, %rax
mulq %r11
movq %rax, 0x40(%rsp)
movq %rdx, 0x50(%rsp)
movq 0x10(%r13), %rcx
movq %rcx, %rax
mulq %r9
movq %rdx, 0x28(%rsp)
movq %rax, 0x18(%rsp)
movq %r12, %rax
mulq %r14
movq %rax, -0x8(%rsp)
movq %rdx, (%rsp)
movq 0x18(%rsi), %rax
movq %rax, %rbx
mulq %r11
movq %rax, 0x58(%rsp)
movq %rdx, 0x68(%rsp)
movq 0x18(%r13), %r15
movq %r15, %rax
movq %r15, -0x80(%rsp)
mulq %r9
movq %rdx, 0x38(%rsp)
movq %rax, 0x20(%rsp)
movq %rbp, %rax
mulq %r12
movq %rdx, 0x10(%rsp)
movq %rax, -0x10(%rsp)
movq %rcx, %rax
mulq %r14
movq %rax, -0x50(%rsp)
movq %rdx, %r10
movq 0x20(%rsi), %rsi
movq %rsi, %rax
movq %rsi, -0x68(%rsp)
mulq %r11
movq %rax, 0x60(%rsp)
movq %rdx, 0x70(%rsp)
movq 0x20(%r13), %r8
movq %r8, %rax
movq %r8, -0x60(%rsp)
mulq %r9
movq %rdx, 0x48(%rsp)
movq %rax, 0x30(%rsp)
movq %r15, %rax
mulq %r14
movq %rdx, 0x8(%rsp)
movq %rax, -0x18(%rsp)
movq %rbx, -0x58(%rsp)
movq %rbx, %rax
mulq %r12
movq %rdx, -0x20(%rsp)
movq %rax, -0x28(%rsp)
movq %rcx, %r11
movq %rcx, %rax
mulq %rbp
movq %rdx, %r13
movq %rax, %r9
movq %r8, %rax
mulq %r14
movq %rdx, -0x70(%rsp)
movq %rax, -0x78(%rsp)
movq %rsi, %rax
mulq %r12
movq %rdx, %rcx
movq %rax, %r15
movq %rbx, %rax
movq %r11, %rbx
mulq %r11
movq %rdx, %r8
movq %rax, %r11
movq -0x80(%rsp), %r12
movq %r12, %rax
mulq %rbp
movq %rdx, %r14
movq %rax, %rsi
addq %r11, %rsi
adcq %r8, %r14
addq %r15, %rsi
adcq %rcx, %r14
addq -0x78(%rsp), %rsi
adcq -0x70(%rsp), %r14
movq -0x60(%rsp), %rcx
movq %rcx, %rax
mulq %rbp
movq %rdx, -0x70(%rsp)
movq %rax, -0x78(%rsp)
movq -0x68(%rsp), %rbp
movq %rbp, %rax
mulq %rbx
movq %rdx, %r15
movq %rax, %rbx
movq %r12, %rax
movq -0x58(%rsp), %r8
mulq %r8
movq %rdx, %r12
movq %rax, %r11
addq %rbx, %r11
adcq %r15, %r12
addq -0x78(%rsp), %r11
adcq -0x70(%rsp), %r12
movq %rbp, %rax
mulq -0x80(%rsp)
movq %rdx, %r15
movq %rax, %rbp
movq %rcx, %rax
mulq %r8
movq %rdx, %rbx
movq %rax, %r8
addq %rbp, %r8
adcq %r15, %rbx
leaq (%r14,%r14,8), %rax
leaq (%r14,%rax,2), %r14
movl $0x13, %edx
movq %rsi, %rax
mulq %rdx
movq %rax, %rbp
movq %rdx, %r15
addq %r14, %r15
addq -0x38(%rsp), %rbp
adcq -0x30(%rsp), %r15
leaq (%r12,%r12,8), %rax
leaq (%r12,%rax,2), %rsi
movq %r11, %rax
movl $0x13, %r11d
mulq %r11
movq %rax, %r12
movq %rdx, %r14
addq %rsi, %r14
addq -0x40(%rsp), %r12
adcq -0x48(%rsp), %r14
movq %r8, %rax
mulq %r11
movl $0x13, %esi
movq %rax, -0x80(%rsp)
movq %rdx, %r11
leaq (%rbx,%rbx,8), %rax
leaq (%rbx,%rax,2), %rax
addq %rax, %r11
movq -0x68(%rsp), %rax
mulq %rcx
leaq (%rdx,%rdx,8), %r8
leaq (%rdx,%r8,2), %r8
mulq %rsi
addq %r8, %rdx
movq %r15, %rbx
shrq $0x33, %rbx
shldq $0xd, %rbp, %r15
addq %r12, %r15
adcq %r14, %rbx
movabsq $0x7ffffffffffff, %r8   # imm = 0x7FFFFFFFFFFFF
andq %r8, %rbp
movq %rbx, %r14
shldq $0xd, %r15, %rbx
shrq $0x33, %r14
movq -0x8(%rsp), %r12
addq 0x40(%rsp), %r12
movq (%rsp), %rsi
adcq 0x50(%rsp), %rsi
addq 0x18(%rsp), %r12
adcq 0x28(%rsp), %rsi
addq -0x80(%rsp), %r12
adcq %r11, %rsi
addq %rbx, %r12
movq %r12, %r11
adcq %r14, %rsi
andq %r8, %r15
movq %rsi, %rbx
shldq $0xd, %r12, %rsi
shrq $0x33, %rbx
movq -0x50(%rsp), %rcx
addq -0x10(%rsp), %rcx
adcq 0x10(%rsp), %r10
addq 0x58(%rsp), %rcx
adcq 0x68(%rsp), %r10
addq 0x20(%rsp), %rcx
adcq 0x38(%rsp), %r10
addq %rax, %rcx
adcq %rdx, %r10
addq %rsi, %rcx
adcq %rbx, %r10
movq %r10, %rax
shldq $0xd, %rcx, %r10
shrq $0x33, %rax
addq -0x28(%rsp), %r9
adcq -0x20(%rsp), %r13
addq -0x18(%rsp), %r9
adcq 0x8(%rsp), %r13
addq 0x60(%rsp), %r9
adcq 0x70(%rsp), %r13
addq 0x30(%rsp), %r9
adcq 0x48(%rsp), %r13
addq %r10, %r9
adcq %rax, %r13
movq %r13, %rax
shrq $0x33, %r13
leaq (,%r13,8), %rdx
addq %r13, %rdx
leaq (,%rdx,2), %rsi
addq %r13, %rsi
shldq $0xd, %r9, %rax
movl $0x13, %edx
mulq %rdx
addq %rbp, %rax
adcq %rsi, %rdx
shldq $0xd, %rax, %rdx
addq %r15, %rdx
andq %r8, %rax
movq %rax, (%rdi)
movq %rdx, 0x8(%rdi)
andq %r8, %r11
movq %r11, 0x10(%rdi)
andq %r8, %rcx
movq %rcx, 0x18(%rdi)
andq %r8, %r9
movq %r9, 0x20(%rdi)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq