// File: /workspace/github_c_makefile_star2_O0/sbp[P]tweetnacl-tools/tweetnacl.c
// Function: crypto_hashblocks_sha512_tweet
int crypto_hashblocks(u8 *x,const u8 *m,u64 n)
{
  u64 z[8],b[8],a[8],w[16],t;
  int i,j;

  FOR(i,8) z[i] = a[i] = dl64(x + 8 * i);

  while (n >= 128) {
    FOR(i,16) w[i] = dl64(m + 8 * i);

    FOR(i,80) {
      FOR(j,8) b[j] = a[j];
      t = a[7] + Sigma1(a[4]) + Ch(a[4],a[5],a[6]) + K[i] + w[i%16];
      b[7] = t + Sigma0(a[0]) + Maj(a[0],a[1],a[2]);
      b[3] += t;
      FOR(j,8) a[(j+1)%8] = b[j];
      if (i%16 == 15)
	FOR(j,16)
	  w[j] += w[(j+9)%16] + sigma0(w[(j+1)%16]) + sigma1(w[(j+14)%16]);
    }

    FOR(i,8) { a[i] += z[i]; z[i] = a[i]; }

    m += 128;
    n -= 128;
  }

  FOR(i,8) ts64(x+8*i,z[i]);

  return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x16c(%rbp)
cmpl $0x8, -0x16c(%rbp)
jge 0x34c0
movq -0x8(%rbp), %rdi
movl -0x16c(%rbp), %eax
shll $0x3, %eax
cltq
addq %rax, %rdi
callq 0x38a0
movq %rax, %rcx
movslq -0x16c(%rbp), %rax
movq %rcx, -0xe0(%rbp,%rax,8)
movslq -0x16c(%rbp), %rax
movq %rcx, -0x60(%rbp,%rax,8)
movl -0x16c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16c(%rbp)
jmp 0x3471
jmp 0x34c2
cmpq $0x80, -0x18(%rbp)
jb 0x383f
movl $0x0, -0x16c(%rbp)
cmpl $0x10, -0x16c(%rbp)
jge 0x351d
movq -0x10(%rbp), %rdi
movl -0x16c(%rbp), %eax
shll $0x3, %eax
cltq
addq %rax, %rdi
callq 0x38a0
movq %rax, %rcx
movslq -0x16c(%rbp), %rax
movq %rcx, -0x160(%rbp,%rax,8)
movl -0x16c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16c(%rbp)
jmp 0x34da
movl $0x0, -0x16c(%rbp)
cmpl $0x50, -0x16c(%rbp)
jge 0x37bc
movl $0x0, -0x170(%rbp)
cmpl $0x8, -0x170(%rbp)
jge 0x3576
movslq -0x170(%rbp), %rax
movq -0xe0(%rbp,%rax,8), %rcx
movslq -0x170(%rbp), %rax
movq %rcx, -0xa0(%rbp,%rax,8)
movl -0x170(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x170(%rbp)
jmp 0x353e
movq -0xa8(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x38f0
movq %rax, %rcx
movq -0x198(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x190(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdx
callq 0x3950
movq %rax, %rcx
movq -0x190(%rbp), %rax
addq %rcx, %rax
movslq -0x16c(%rbp), %rdx
leaq 0x2b57(%rip), %rcx      # 0x6130
addq (%rcx,%rdx,8), %rax
movq %rax, -0x188(%rbp)
movl -0x16c(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
movq -0x188(%rbp), %rax
movslq %edx, %rcx
addq -0x160(%rbp,%rcx,8), %rax
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0xe0(%rbp), %rdi
callq 0x3980
movq %rax, %rcx
movq -0x180(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x178(%rbp)
movq -0xe0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rdx
callq 0x39e0
movq %rax, %rcx
movq -0x178(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x168(%rbp), %rax
addq -0x88(%rbp), %rax
movq %rax, -0x88(%rbp)
movl $0x0, -0x170(%rbp)
cmpl $0x8, -0x170(%rbp)
jge 0x36c8
movslq -0x170(%rbp), %rax
movq -0xa0(%rbp,%rax,8), %rcx
movl -0x170(%rbp), %eax
addl $0x1, %eax
movl $0x8, %esi
cltd
idivl %esi
movslq %edx, %rax
movq %rcx, -0xe0(%rbp,%rax,8)
movl -0x170(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x170(%rbp)
jmp 0x3683
movl -0x16c(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
cmpl $0xf, %edx
jne 0x37a6
movl $0x0, -0x170(%rbp)
cmpl $0x10, -0x170(%rbp)
jge 0x37a4
movl -0x170(%rbp), %eax
addl $0x9, %eax
movl $0x10, %ecx
cltd
idivl %ecx
movslq %edx, %rax
movq -0x160(%rbp,%rax,8), %rax
movq %rax, -0x1a8(%rbp)
movl -0x170(%rbp), %eax
addl $0x1, %eax
movl $0x10, %ecx
cltd
idivl %ecx
movslq %edx, %rax
movq -0x160(%rbp,%rax,8), %rdi
callq 0x3a10
movq %rax, %rcx
movq -0x1a8(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x1a0(%rbp)
movl -0x170(%rbp), %eax
addl $0xe, %eax
movl $0x10, %ecx
cltd
idivl %ecx
movslq %edx, %rax
movq -0x160(%rbp,%rax,8), %rdi
callq 0x3a60
movq -0x1a0(%rbp), %rcx
addq %rax, %rcx
movslq -0x170(%rbp), %rax
addq -0x160(%rbp,%rax,8), %rcx
movq %rcx, -0x160(%rbp,%rax,8)
movl -0x170(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x170(%rbp)
jmp 0x36e9
jmp 0x37a6
jmp 0x37a8
movl -0x16c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16c(%rbp)
jmp 0x3527
movl $0x0, -0x16c(%rbp)
cmpl $0x8, -0x16c(%rbp)
jge 0x381e
movslq -0x16c(%rbp), %rax
movq -0x60(%rbp,%rax,8), %rcx
movslq -0x16c(%rbp), %rax
addq -0xe0(%rbp,%rax,8), %rcx
movq %rcx, -0xe0(%rbp,%rax,8)
movslq -0x16c(%rbp), %rax
movq -0xe0(%rbp,%rax,8), %rcx
movslq -0x16c(%rbp), %rax
movq %rcx, -0x60(%rbp,%rax,8)
movl -0x16c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16c(%rbp)
jmp 0x37c6
movq -0x10(%rbp), %rax
addq $0x80, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
subq $0x80, %rax
movq %rax, -0x18(%rbp)
jmp 0x34c2
movl $0x0, -0x16c(%rbp)
cmpl $0x8, -0x16c(%rbp)
jge 0x3886
movq -0x8(%rbp), %rdi
movl -0x16c(%rbp), %eax
shll $0x3, %eax
cltq
addq %rax, %rdi
movslq -0x16c(%rbp), %rax
movq -0x60(%rbp,%rax,8), %rsi
callq 0x3ab0
movl -0x16c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16c(%rbp)
jmp 0x3849
movq -0x18(%rbp), %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
nopw %cs:(%rax,%rax)