// File: /workspace/github_c_makefile_star2_O1/rongarret[P]clmm/tweetnacl.c
// Function: crypto_scalarmult_curve25519_tweet
int crypto_scalarmult(u8 *q,const u8 *n,const u8 *p)
{
  u8 z[32];
  i64 x[96],r,i;
  gf a,b,c,d,e,f;
  FOR(i,31) z[i]=n[i];
  z[31]=(n[31]&127)|64;
  z[0]&=248;
  unpack25519(x,p);
  FOR(i,16) {
    b[i]=x[i];
    d[i]=a[i]=c[i]=0;
  }
  a[0]=d[0]=1;
  for(i=254;i>=0;--i) {
    r=(z[i>>3]>>(i&7))&1;
    sel25519(a,b,r);
    sel25519(c,d,r);
    A(e,a,c);
    Z(a,a,c);
    A(c,b,d);
    Z(b,b,d);
    S(d,e);
    S(f,a);
    M(a,c,a);
    M(c,b,e);
    A(e,a,c);
    Z(a,a,c);
    S(b,a);
    Z(c,d,f);
    M(a,c,_121665);
    A(a,a,d);
    M(c,c,a);
    M(a,d,f);
    M(d,b,x);
    S(b,e);
    sel25519(a,b,r);
    sel25519(c,d,r);
  }
  FOR(i,16) {
    x[i+32]=a[i];
    x[i+48]=c[i];
    x[i+64]=b[i];
    x[i+80]=d[i];
  }
  inv25519(x+48,x+48);
  M(x+32,x+32,x+48);
  pack25519(q,x+32);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x628, %rsp            # imm = 0x628
movq %rdi, -0x30(%rbp)
movups (%rsi), %xmm0
movups 0xf(%rsi), %xmm1
movups %xmm1, -0x41(%rbp)
movaps %xmm0, -0x50(%rbp)
movb 0x1f(%rsi), %al
andb $0x3f, %al
orb $0x40, %al
movb %al, -0x31(%rbp)
andb $-0x8, -0x50(%rbp)
xorl %eax, %eax
movzwl (%rdx,%rax,2), %ecx
movq %rcx, -0x650(%rbp,%rax,8)
incq %rax
cmpq $0x10, %rax
jne 0x23e8
leaq -0x650(%rbp), %rsi
andq $0x7fff, 0x78(%rsi)     # imm = 0x7FFF
xorps %xmm0, %xmm0
leaq -0x150(%rbp), %r15
movaps %xmm0, (%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x40(%r15)
movaps %xmm0, 0x50(%r15)
movaps %xmm0, 0x60(%r15)
movaps %xmm0, 0x70(%r15)
leaq -0x250(%rbp), %r12
movaps %xmm0, (%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x50(%r12)
movaps %xmm0, 0x60(%r12)
movaps %xmm0, 0x70(%r12)
leaq -0xd0(%rbp), %rdx
movaps %xmm0, 0x70(%rdx)
movaps %xmm0, 0x60(%rdx)
movaps %xmm0, 0x50(%rdx)
movaps %xmm0, 0x40(%rdx)
movaps %xmm0, 0x30(%rdx)
movaps %xmm0, 0x20(%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, (%rdx)
leaq -0x1d0(%rbp), %rdi
movl $0x10, %ecx
rep  movsq (%rsi), %es:(%rdi)
movl $0x1, %eax
movq %rax, (%rdx)
movq %rax, (%r12)
movl $0xfe, %r13d
movq %r13, %rax
shrq $0x3, %rax
movzbl -0x50(%rbp,%rax), %eax
movl %r13d, %ecx
andl $0x7, %ecx
btl %ecx, %eax
movl $0x0, %ebx
sbbq %rbx, %rbx
xorl %eax, %eax
movq -0x250(%rbp,%rax,8), %rcx
movq -0x1d0(%rbp,%rax,8), %rdx
movq %rdx, %rsi
xorq %rcx, %rsi
andq %rbx, %rsi
xorq %rsi, %rcx
movq %rcx, -0x250(%rbp,%rax,8)
xorq %rdx, %rsi
movq %rsi, -0x1d0(%rbp,%rax,8)
incq %rax
cmpq $0x10, %rax
jne 0x24d9
xorl %eax, %eax
movq -0x150(%rbp,%rax,8), %rcx
movq -0xd0(%rbp,%rax,8), %rdx
movq %rdx, %rsi
xorq %rcx, %rsi
andq %rbx, %rsi
xorq %rsi, %rcx
movq %rcx, -0x150(%rbp,%rax,8)
xorq %rdx, %rsi
movq %rsi, -0xd0(%rbp,%rax,8)
incq %rax
cmpq $0x10, %rax
jne 0x2513
xorl %eax, %eax
movq -0x150(%rbp,%rax,8), %rcx
addq -0x250(%rbp,%rax,8), %rcx
movq %rcx, -0x2d0(%rbp,%rax,8)
incq %rax
cmpq $0x10, %rax
jne 0x254d
xorl %eax, %eax
movq -0x150(%rbp,%rax,8), %rcx
subq %rcx, -0x250(%rbp,%rax,8)
incq %rax
cmpq $0x10, %rax
jne 0x2570
xorl %eax, %eax
movq -0xd0(%rbp,%rax,8), %rcx
addq -0x1d0(%rbp,%rax,8), %rcx
movq %rcx, -0x150(%rbp,%rax,8)
incq %rax
cmpq $0x10, %rax
jne 0x258b
xorl %eax, %eax
movq -0xd0(%rbp,%rax,8), %rcx
subq %rcx, -0x1d0(%rbp,%rax,8)
incq %rax
cmpq $0x10, %rax
jne 0x25ae
leaq -0xd0(%rbp), %rdi
leaq -0x2d0(%rbp), %r14
movq %r14, %rsi
movq %r14, %rdx
callq 0x281d
leaq -0x350(%rbp), %rdi
movq %r12, %rsi
movq %r12, %rdx
callq 0x281d
movq %r12, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x281d
movq %r15, %rdi
leaq -0x1d0(%rbp), %rsi
movq %r14, %rdx
callq 0x281d
xorl %eax, %eax
movq -0x150(%rbp,%rax,8), %rcx
addq -0x250(%rbp,%rax,8), %rcx
movq %rcx, -0x2d0(%rbp,%rax,8)
incq %rax
cmpq $0x10, %rax
jne 0x2614
xorl %eax, %eax
movq -0x150(%rbp,%rax,8), %rcx
subq %rcx, -0x250(%rbp,%rax,8)
incq %rax
cmpq $0x10, %rax
jne 0x2637
leaq -0x1d0(%rbp), %rdi
movq %r12, %rsi
movq %r12, %rdx
callq 0x281d
xorl %eax, %eax
movq -0xd0(%rbp,%rax,8), %rcx
subq -0x350(%rbp,%rax,8), %rcx
movq %rcx, -0x150(%rbp,%rax,8)
incq %rax
cmpq $0x10, %rax
jne 0x2664
movq %r12, %rdi
movq %r15, %rsi
leaq 0x1f7e(%rip), %rdx      # 0x4610
callq 0x281d
xorl %eax, %eax
movq -0xd0(%rbp,%rax,8), %rcx
addq %rcx, -0x250(%rbp,%rax,8)
incq %rax
cmpq $0x10, %rax
jne 0x2699
movq %r15, %rdi
movq %r15, %r14
movq %r15, %rsi
movq %r12, %rdx
callq 0x281d
movq %r12, %rdi
leaq -0xd0(%rbp), %r15
movq %r15, %rsi
leaq -0x350(%rbp), %rdx
callq 0x281d
movq %r15, %rdi
leaq -0x1d0(%rbp), %r15
movq %r15, %rsi
leaq -0x650(%rbp), %rdx
callq 0x281d
movq %r15, %rdi
leaq -0x2d0(%rbp), %rdx
movq %rdx, %rsi
callq 0x281d
xorl %eax, %eax
movq -0x250(%rbp,%rax,8), %rcx
movq -0x1d0(%rbp,%rax,8), %rdx
movq %rdx, %rsi
xorq %rcx, %rsi
andq %rbx, %rsi
xorq %rsi, %rcx
movq %rcx, -0x250(%rbp,%rax,8)
xorq %rdx, %rsi
movq %rsi, -0x1d0(%rbp,%rax,8)
incq %rax
cmpq $0x10, %rax
jne 0x2709
xorl %eax, %eax
movq -0x150(%rbp,%rax,8), %rcx
movq -0xd0(%rbp,%rax,8), %rdx
movq %rdx, %rsi
xorq %rcx, %rsi
andq %rbx, %rsi
xorq %rsi, %rcx
movq %rcx, -0x150(%rbp,%rax,8)
xorq %rdx, %rsi
movq %rsi, -0xd0(%rbp,%rax,8)
incq %rax
cmpq $0x10, %rax
jne 0x2743
subq $0x1, %r13
movq %r14, %r15
jae 0x24ba
xorl %eax, %eax
movq -0x250(%rbp,%rax), %rcx
movq %rcx, -0x550(%rbp,%rax)
movq -0x150(%rbp,%rax), %rcx
movq %rcx, -0x4d0(%rbp,%rax)
movq -0x1d0(%rbp,%rax), %rcx
movq %rcx, -0x450(%rbp,%rax)
movq -0xd0(%rbp,%rax), %rcx
movq %rcx, -0x3d0(%rbp,%rax)
addq $0x8, %rax
cmpq $0x80, %rax
jne 0x278a
leaq -0x4d0(%rbp), %rbx
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x28ca
leaq -0x550(%rbp), %r14
movq %r14, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x281d
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x294a
xorl %eax, %eax
addq $0x628, %rsp            # imm = 0x628
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq