// File: /workspace/github_c_makefile_star2_O2/sbp[P]tweetnacl-tools/tweetnacl.c
// Function: core
sv core(u8 *out,const u8 *in,const u8 *k,const u8 *c,int h)
{
  u32 w[16],x[16],y[16],t[4];
  int i,j,m;

  FOR(i,4) {
    x[5*i] = ld32(c+4*i);
    x[1+i] = ld32(k+4*i);
    x[6+i] = ld32(in+4*i);
    x[11+i] = ld32(k+16+4*i);
  }

  FOR(i,16) y[i] = x[i];

  FOR(i,20) {
    FOR(j,4) {
      FOR(m,4) t[m] = x[(5*j+4*m)%16];
      t[1] ^= L32(t[0]+t[3], 7);
      t[2] ^= L32(t[1]+t[0], 9);
      t[3] ^= L32(t[2]+t[1],13);
      t[0] ^= L32(t[3]+t[2],18);
      FOR(m,4) w[4*j+(j+m)%4] = t[m];
    }
    FOR(m,16) x[m] = w[m];
  }

  if (h) {
    FOR(i,16) x[i] += y[i];
    FOR(i,4) {
      x[5*i] -= ld32(c+4*i);
      x[6+i] -= ld32(in+4*i);
    }
    FOR(i,4) {
      st32(out+4*i,x[5*i]);
      st32(out+16+4*i,x[6+i]);
    }
  } else
    FOR(i,16) st32(out + 4 * i,x[i] + y[i]);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, %rbx
xorl %eax, %eax
xorl %edi, %edi
cmpq $0x10, %rdi
je 0x15a2
movl (%rcx,%rdi), %r9d
movq %r9, 0x20(%rsp,%rax)
movl (%rdx,%rdi), %r9d
movq %r9, 0x28(%rsp,%rdi,2)
movl (%rsi,%rdi), %r9d
movq %r9, 0x50(%rsp,%rdi,2)
movl 0x10(%rdx,%rdi), %r9d
movq %r9, 0x78(%rsp,%rdi,2)
addq $0x4, %rdi
addq $0x28, %rax
jmp 0x156d
xorl %eax, %eax
cmpq $0x10, %rax
je 0x15bc
movq 0x20(%rsp,%rax,8), %rdx
movq %rdx, 0xa0(%rsp,%rax,8)
incq %rax
jmp 0x15a4
xorl %eax, %eax
cmpl $0x14, %eax
je 0x16c1
xorl %edx, %edx
xorl %edi, %edi
cmpq $0x4, %rdi
je 0x16a0
xorl %r9d, %r9d
cmpq $0x10, %r9
je 0x15f5
leal (%rdx,%r9), %r10d
andl $0xf, %r10d
movq 0x20(%rsp,%r10,8), %r10
movq %r10, (%rsp,%r9,2)
addq $0x4, %r9
jmp 0x15d8
movq (%rsp), %r9
movq 0x18(%rsp), %r11
leaq (%r11,%r9), %r10
movq %r10, %r14
shlq $0x7, %r14
shrl $0x19, %r10d
orq %r14, %r10
xorq 0x8(%rsp), %r10
movq %r10, 0x8(%rsp)
leaq (%r10,%r9), %r14
movq %r14, %r15
shlq $0x9, %r15
shrl $0x17, %r14d
orq %r15, %r14
xorq 0x10(%rsp), %r14
movq %r14, 0x10(%rsp)
addq %r14, %r10
movq %r10, %r15
shlq $0xd, %r15
shrl $0x13, %r10d
orq %r15, %r10
xorq %r11, %r10
movq %r10, 0x18(%rsp)
addq %r14, %r10
movq %r10, %r11
shlq $0x12, %r11
shrl $0xe, %r10d
orq %r11, %r10
xorq %r9, %r10
movq %r10, (%rsp)
leal (,%rdi,4), %r9d
xorl %r10d, %r10d
cmpq $0x4, %r10
je 0x1694
movq (%rsp,%r10,8), %r11
leal (%rdi,%r10), %r14d
andl $0x3, %r14d
orq %r9, %r14
movq %r11, 0x120(%rsp,%r14,8)
incq %r10
jmp 0x1672
incq %rdi
addq $0x5, %rdx
jmp 0x15cb
xorl %edx, %edx
cmpq $0x10, %rdx
je 0x16ba
movq 0x120(%rsp,%rdx,8), %rdi
movq %rdi, 0x20(%rsp,%rdx,8)
incq %rdx
jmp 0x16a2
incl %eax
jmp 0x15be
testl %r8d, %r8d
je 0x173b
xorl %eax, %eax
cmpq $0x10, %rax
je 0x16e0
movq 0xa0(%rsp,%rax,8), %rdx
addq %rdx, 0x20(%rsp,%rax,8)
incq %rax
jmp 0x16c8
leaq 0x20(%rsp), %rax
xorl %edx, %edx
cmpq $0x10, %rdx
je 0x1705
movl (%rcx,%rdx), %edi
subq %rdi, (%rax)
movl (%rsi,%rdx), %edi
subq %rdi, 0x50(%rsp,%rdx,2)
addq $0x4, %rdx
addq $0x28, %rax
jmp 0x16e7
leaq 0x20(%rsp), %r14
xorl %r15d, %r15d
cmpq $0x10, %r15
je 0x1760
leaq (%rbx,%r15), %rdi
movq (%r14), %rsi
callq 0x3129
leaq (%rbx,%r15), %rdi
addq $0x10, %rdi
movq 0x50(%rsp,%r15,2), %rsi
callq 0x3129
addq $0x4, %r15
addq $0x28, %r14
jmp 0x170d
xorl %r14d, %r14d
cmpq $0x40, %r14
je 0x1760
leaq (%rbx,%r14), %rdi
movq 0xa0(%rsp,%r14,2), %rsi
addq 0x20(%rsp,%r14,2), %rsi
callq 0x3129
addq $0x4, %r14
jmp 0x173e
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbx
popq %r14
popq %r15
retq