// File: /workspace/github_cpp_makefile_star2_O1/bitwiseshiftleft[P]crandom/chacha.c
// Function: crandom_chacha_expand
extern_c void
crandom_chacha_expand(u_int64_t iv,
                      u_int64_t ctr,
                      int nr,
                      int output_size,
                      const unsigned char *key_,
                      unsigned char *output_) {
# if MIGHT_HAVE_SSE2
  if (HAVE(SSE2)) {
    ssereg *key = (ssereg *)key_;
    ssereg *output = (ssereg *)output_;
                     
    ssereg a1 = key[0], a2 = a1, aa = a1,
           b1 = key[1], b2 = b1, bb = b1,
           c1 = {iv, ctr}, c2 = {iv, ctr+1}, cc = c1,
           d1 = {0x3320646e61707865ull, 0x6b20657479622d32ull}, d2 = d1, dd = d1,
           p = {0, 1};
     
    int i,r;
#   if (NEED_XOP)
      if (HAVE(XOP)) {
        for (i=0; i<output_size; i+=128) {
          for (r=nr; r>0; r-=2)
            DOUBLE_ROUND(quarter_round_xop);
          OUTPUT_FUNCTION;
        }
        return;
      }
#   endif
#   if (NEED_SSSE3)
      if (HAVE(SSSE3)) {
        for (i=0; i<output_size; i+=128) {
          for (r=nr; r>0; r-=2)
            DOUBLE_ROUND(quarter_round_ssse3);
          OUTPUT_FUNCTION;
        }
        return;
      }
#   endif
#   if (NEED_SSE2)
      if (HAVE(SSE2)) {
        for (i=0; i<output_size; i+=128) {
          for (r=nr; r>0; r-=2)
            DOUBLE_ROUND(quarter_round_sse2);
          OUTPUT_FUNCTION;
        }
        return;
      }
#   endif
  }
# endif

# if NEED_CONV
  {
    const u_int32_t *key = (const u_int32_t *)key_;
    u_int32_t
      x[16],
      input[16] = {
        key[0], key[1], key[2], key[3],
        key[4], key[5], key[6], key[7],
        iv, iv>>32, ctr, ctr>>32,
        0x61707865, 0x3320646e, 0x79622d32, 0x6b206574
      },
      *output = (u_int32_t *)output_;
    int i, r;
  
    for (i=0; i<output_size; i+= 64) {
      for (r=0; r<16; r++) {
        x[r] = input[r];
      }
      for (r=nr; r>0; r-=2) {
        quarter_round(&x[0], &x[4],  &x[8], &x[12]);
        quarter_round(&x[1], &x[5],  &x[9], &x[13]);
        quarter_round(&x[2], &x[6], &x[10], &x[14]);
        quarter_round(&x[3], &x[7], &x[11], &x[15]);
        
        quarter_round(&x[0], &x[5], &x[10], &x[15]);
        quarter_round(&x[1], &x[6], &x[11], &x[12]);
        quarter_round(&x[2], &x[7],  &x[8], &x[13]);
        quarter_round(&x[3], &x[4],  &x[9], &x[14]);
      }
      for (r=0; r<16; r++) {
        output[r] = x[r] + input[r];
      }
      
      output += 16;
      input[11] ++;
      if (!input[11]) input[12]++;
    }
  }
  
#endif // NEED_CONV
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %r9, %r14
movq %r8, %r13
movl %ecx, %ebp
movq %rsi, %r15
movq %rdi, %r12
leaq 0x4ae2(%rip), %rbx      # 0x84f0
cmpl $0x0, (%rbx)
movq %rdx, 0x50(%rsp)
je 0x4165
movl (%rbx), %eax
testb $0x2, %al
je 0x3dd2
movdqa (%r13), %xmm15
movdqa 0x10(%r13), %xmm14
testl %eax, %eax
je 0x4178
movl (%rbx), %eax
testb $0x2, %al
je 0x3dd2
testl %ebp, %ebp
jle 0x3dca
leaq 0x1(%r15), %rcx
movq %r12, %xmm8
movq %r15, %xmm1
movq %rcx, %xmm2
movdqa %xmm8, %xmm0
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
punpcklqdq %xmm2, %xmm8    # xmm8 = xmm8[0],xmm2[0]
leal 0x2(%rdx), %ecx
xorl %r8d, %r8d
movdqa 0x1845(%rip), %xmm2     # 0x52c0
movdqa 0x184d(%rip), %xmm3     # 0x52d0
movdqa 0x1855(%rip), %xmm4     # 0x52e0
movdqa 0x185d(%rip), %xmm5     # 0x52f0
movq %r14, %rsi
testl %edx, %edx
jle 0x3d2d
movl %ecx, %edi
movdqa %xmm2, %xmm9
movdqa %xmm2, %xmm11
movdqa %xmm0, %xmm12
movdqa %xmm14, %xmm10
movdqa %xmm14, %xmm1
movdqa %xmm14, %xmm13
movdqa %xmm15, %xmm6
movdqa %xmm15, %xmm7
paddd %xmm13, %xmm7
pxor %xmm7, %xmm11
movdqa %xmm11, %xmm14
psrld $0x10, %xmm14
pslld $0x10, %xmm11
por %xmm14, %xmm11
paddd %xmm11, %xmm12
pxor %xmm12, %xmm13
movdqa %xmm13, %xmm14
psrld $0x14, %xmm14
pslld $0xc, %xmm13
por %xmm14, %xmm13
paddd %xmm13, %xmm7
pxor %xmm7, %xmm11
movdqa %xmm11, %xmm14
psrld $0x18, %xmm14
pslld $0x8, %xmm11
por %xmm14, %xmm11
paddd %xmm11, %xmm12
pxor %xmm12, %xmm13
movdqa %xmm13, %xmm14
psrld $0x19, %xmm14
pslld $0x7, %xmm13
por %xmm14, %xmm13
paddd %xmm10, %xmm6
pxor %xmm6, %xmm9
movdqa %xmm9, %xmm14
psrld $0x10, %xmm14
pslld $0x10, %xmm9
por %xmm14, %xmm9
paddd %xmm9, %xmm8
pxor %xmm8, %xmm10
movdqa %xmm10, %xmm14
psrld $0x14, %xmm14
pslld $0xc, %xmm10
por %xmm14, %xmm10
paddd %xmm10, %xmm6
pxor %xmm6, %xmm9
movdqa %xmm9, %xmm14
psrld $0x18, %xmm14
pslld $0x8, %xmm9
por %xmm14, %xmm9
paddd %xmm9, %xmm8
pxor %xmm8, %xmm10
movdqa %xmm10, %xmm14
psrld $0x19, %xmm14
pslld $0x7, %xmm10
por %xmm14, %xmm10
pshufd $0x39, %xmm13, %xmm13   # xmm13 = xmm13[1,2,3,0]
pshufd $0x4e, %xmm12, %xmm12   # xmm12 = xmm12[2,3,0,1]
pshufd $0x93, %xmm11, %xmm11   # xmm11 = xmm11[3,0,1,2]
pshufd $0x39, %xmm10, %xmm10   # xmm10 = xmm10[1,2,3,0]
pshufd $0x4e, %xmm8, %xmm8     # xmm8 = xmm8[2,3,0,1]
pshufd $0x93, %xmm9, %xmm9     # xmm9 = xmm9[3,0,1,2]
paddd %xmm13, %xmm7
pxor %xmm7, %xmm11
movdqa %xmm11, %xmm14
psrld $0x10, %xmm14
pslld $0x10, %xmm11
por %xmm14, %xmm11
paddd %xmm11, %xmm12
pxor %xmm12, %xmm13
movdqa %xmm13, %xmm14
psrld $0x14, %xmm14
pslld $0xc, %xmm13
por %xmm14, %xmm13
paddd %xmm13, %xmm7
pxor %xmm7, %xmm11
movdqa %xmm11, %xmm14
psrld $0x18, %xmm14
pslld $0x8, %xmm11
por %xmm14, %xmm11
paddd %xmm11, %xmm12
pxor %xmm12, %xmm13
movdqa %xmm13, %xmm14
psrld $0x19, %xmm14
pslld $0x7, %xmm13
por %xmm14, %xmm13
paddd %xmm10, %xmm6
pxor %xmm6, %xmm9
movdqa %xmm9, %xmm14
psrld $0x10, %xmm14
pslld $0x10, %xmm9
por %xmm14, %xmm9
paddd %xmm9, %xmm8
pxor %xmm8, %xmm10
movdqa %xmm10, %xmm14
psrld $0x14, %xmm14
pslld $0xc, %xmm10
por %xmm14, %xmm10
paddd %xmm10, %xmm6
pxor %xmm6, %xmm9
movdqa %xmm9, %xmm14
psrld $0x18, %xmm14
pslld $0x8, %xmm9
por %xmm14, %xmm9
paddd %xmm9, %xmm8
pxor %xmm8, %xmm10
movdqa %xmm10, %xmm14
psrld $0x19, %xmm14
pslld $0x7, %xmm10
por %xmm14, %xmm10
pshufd $0x93, %xmm13, %xmm13   # xmm13 = xmm13[3,0,1,2]
pshufd $0x4e, %xmm12, %xmm12   # xmm12 = xmm12[2,3,0,1]
pshufd $0x39, %xmm11, %xmm11   # xmm11 = xmm11[1,2,3,0]
pshufd $0x93, %xmm10, %xmm10   # xmm10 = xmm10[3,0,1,2]
pshufd $0x4e, %xmm8, %xmm8     # xmm8 = xmm8[2,3,0,1]
pshufd $0x39, %xmm9, %xmm9     # xmm9 = xmm9[1,2,3,0]
addl $-0x2, %edi
cmpl $0x2, %edi
jg 0x3ac8
paddd %xmm2, %xmm11
paddd %xmm2, %xmm9
movdqa %xmm1, %xmm14
jmp 0x3d54
movdqa %xmm15, %xmm7
movdqa %xmm15, %xmm6
movdqa %xmm14, %xmm13
movdqa %xmm14, %xmm10
movdqa %xmm0, %xmm12
movdqa 0x1561(%rip), %xmm9     # 0x52b0
movdqa %xmm9, %xmm11
paddd %xmm15, %xmm7
movdqa %xmm7, (%rsi)
paddd %xmm14, %xmm13
movdqa %xmm13, 0x10(%rsi)
paddd %xmm0, %xmm12
movdqa %xmm12, 0x20(%rsi)
movdqa %xmm11, 0x30(%rsi)
paddd %xmm15, %xmm6
movdqa %xmm6, 0x40(%rsi)
paddd %xmm14, %xmm10
movdqa %xmm10, 0x50(%rsi)
paddd %xmm0, %xmm8
paddd %xmm3, %xmm8
movdqa %xmm8, 0x60(%rsi)
movdqa %xmm9, 0x70(%rsi)
subq $-0x80, %rsi
movdqa %xmm0, %xmm6
paddq %xmm4, %xmm6
paddq %xmm5, %xmm0
subl $-0x80, %r8d
movdqa %xmm0, %xmm8
movdqa %xmm6, %xmm0
cmpl %ebp, %r8d
jl 0x3a96
testb $0x2, %al
jne 0x4153
movl (%r13), %eax
movl %eax, 0x90(%rsp)
movl 0x4(%r13), %eax
movl %eax, 0x94(%rsp)
movl 0x8(%r13), %eax
movl %eax, 0x98(%rsp)
movl 0xc(%r13), %eax
movl %eax, 0x9c(%rsp)
movl 0x10(%r13), %eax
movl %eax, 0xa0(%rsp)
movl 0x14(%r13), %eax
movl %eax, 0xa4(%rsp)
movl 0x18(%r13), %eax
movl %eax, 0xa8(%rsp)
movl 0x1c(%r13), %eax
movl %eax, 0xac(%rsp)
movl %r12d, 0xb0(%rsp)
shrq $0x20, %r12
movl %r12d, 0xb4(%rsp)
movl %r15d, 0xb8(%rsp)
shrq $0x20, %r15
movl %r15d, 0xbc(%rsp)
movdqa 0x1466(%rip), %xmm0     # 0x52c0
movdqa %xmm0, 0xc0(%rsp)
testl %ebp, %ebp
jle 0x4153
movl 0xbc(%rsp), %esi
movl 0xc0(%rsp), %eax
movl %eax, 0xc(%rsp)
leal 0x2(%rdx), %eax
movl %eax, 0x5c(%rsp)
xorl %edi, %edi
movl %ebp, 0x60(%rsp)
movdqa 0x90(%rsp), %xmm0
movdqa 0xa0(%rsp), %xmm1
movdqa 0xb0(%rsp), %xmm2
movdqa 0xc0(%rsp), %xmm3
movdqa %xmm3, 0x40(%rsp)
movdqa %xmm2, 0x30(%rsp)
movdqa %xmm1, 0x20(%rsp)
movdqa %xmm0, 0x10(%rsp)
testl %edx, %edx
jle 0x410e
movq %rdi, 0xd8(%rsp)
movl %esi, 0x64(%rsp)
movq %r14, 0xe0(%rsp)
movl 0x10(%rsp), %eax
movl %eax, 0x70(%rsp)
movl 0x14(%rsp), %eax
movl %eax, 0x80(%rsp)
movl 0x20(%rsp), %edi
movl 0x40(%rsp), %ebx
movl 0x30(%rsp), %esi
movl 0x24(%rsp), %eax
movl 0x44(%rsp), %ecx
movl 0x34(%rsp), %ebp
movl 0x18(%rsp), %r14d
movl 0x28(%rsp), %edx
movl 0x48(%rsp), %r13d
movl 0x38(%rsp), %r12d
movl 0x1c(%rsp), %r15d
movl 0x2c(%rsp), %r11d
movl 0x4c(%rsp), %r10d
movl 0x3c(%rsp), %r8d
movl %r8d, 0x8(%rsp)
movl 0x5c(%rsp), %r8d
movl %r8d, 0x68(%rsp)
movl 0x70(%rsp), %r9d
addl %edi, %r9d
xorl %r9d, %ebx
roll $0x10, %ebx
addl %ebx, %esi
xorl %esi, %edi
roll $0xc, %edi
addl %edi, %r9d
xorl %r9d, %ebx
roll $0x8, %ebx
addl %ebx, %esi
xorl %esi, %edi
roll $0x7, %edi
movl 0x80(%rsp), %r8d
addl %eax, %r8d
xorl %r8d, %ecx
roll $0x10, %ecx
addl %ecx, %ebp
xorl %ebp, %eax
roll $0xc, %eax
addl %eax, %r8d
xorl %r8d, %ecx
roll $0x8, %ecx
addl %ecx, %ebp
movl %ebp, 0x6c(%rsp)
xorl %ebp, %eax
roll $0x7, %eax
addl %edx, %r14d
xorl %r14d, %r13d
roll $0x10, %r13d
addl %r13d, %r12d
xorl %r12d, %edx
roll $0xc, %edx
addl %edx, %r14d
xorl %r14d, %r13d
roll $0x8, %r13d
addl %r13d, %r12d
xorl %r12d, %edx
roll $0x7, %edx
addl %r11d, %r15d
xorl %r15d, %r10d
roll $0x10, %r10d
movl 0x8(%rsp), %ebp
addl %r10d, %ebp
xorl %ebp, %r11d
roll $0xc, %r11d
addl %r11d, %r15d
xorl %r15d, %r10d
roll $0x8, %r10d
addl %r10d, %ebp
xorl %ebp, %r11d
roll $0x7, %r11d
addl %eax, %r9d
xorl %r9d, %r10d
roll $0x10, %r10d
addl %r10d, %r12d
xorl %r12d, %eax
roll $0xc, %eax
addl %eax, %r9d
movl %r9d, 0x70(%rsp)
xorl %r9d, %r10d
roll $0x8, %r10d
addl %r10d, %r12d
xorl %r12d, %eax
roll $0x7, %eax
addl %edx, %r8d
xorl %r8d, %ebx
roll $0x10, %ebx
addl %ebx, %ebp
xorl %ebp, %edx
roll $0xc, %edx
addl %edx, %r8d
movl %r8d, 0x80(%rsp)
xorl %r8d, %ebx
movl 0x68(%rsp), %r8d
roll $0x8, %ebx
addl %ebx, %ebp
movl %ebp, 0x8(%rsp)
xorl %ebp, %edx
movl 0x6c(%rsp), %ebp
roll $0x7, %edx
addl %r11d, %r14d
xorl %r14d, %ecx
roll $0x10, %ecx
addl %ecx, %esi
xorl %esi, %r11d
roll $0xc, %r11d
addl %r11d, %r14d
xorl %r14d, %ecx
roll $0x8, %ecx
addl %ecx, %esi
xorl %esi, %r11d
roll $0x7, %r11d
addl %edi, %r15d
xorl %r15d, %r13d
roll $0x10, %r13d
addl %r13d, %ebp
xorl %ebp, %edi
roll $0xc, %edi
addl %edi, %r15d
xorl %r15d, %r13d
roll $0x8, %r13d
addl %r13d, %ebp
xorl %ebp, %edi
roll $0x7, %edi
addl $-0x2, %r8d
cmpl $0x2, %r8d
jg 0x3f3e
movl %edi, 0x20(%rsp)
movl 0x70(%rsp), %edi
movl %edi, 0x10(%rsp)
movl %ebx, 0x40(%rsp)
movl %esi, 0x30(%rsp)
movl 0x80(%rsp), %esi
movl %esi, 0x14(%rsp)
movl %eax, 0x24(%rsp)
movl %ecx, 0x44(%rsp)
movl %ebp, 0x34(%rsp)
movl %r14d, 0x18(%rsp)
movl %edx, 0x28(%rsp)
movl %r13d, 0x48(%rsp)
movl %r12d, 0x38(%rsp)
movl %r15d, 0x1c(%rsp)
movl %r11d, 0x2c(%rsp)
movl %r10d, 0x4c(%rsp)
movl 0x8(%rsp), %eax
movl %eax, 0x3c(%rsp)
movq 0xe0(%rsp), %r14
movl 0x60(%rsp), %ebp
movq 0x50(%rsp), %rdx
movl 0x64(%rsp), %esi
movq 0xd8(%rsp), %rdi
xorl %eax, %eax
movl 0x90(%rsp,%rax,4), %ecx
addl 0x10(%rsp,%rax,4), %ecx
movl %ecx, (%r14,%rax,4)
incq %rax
cmpq $0x10, %rax
jne 0x4110
incl %esi
movl %esi, 0xbc(%rsp)
jne 0x4144
movl 0xc(%rsp), %eax
incl %eax
movl %eax, 0xc(%rsp)
movl %eax, 0xc0(%rsp)
addq $0x40, %r14
addl $0x40, %edi
cmpl %ebp, %edi
jl 0x3e8a
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
callq 0x48e8
movq 0x50(%rsp), %rdx
movl %eax, (%rbx)
jmp 0x3a1c
xorl %eax, %eax
movdqa %xmm15, 0x80(%rsp)
movdqa %xmm14, 0x70(%rsp)
callq 0x48e8
movdqa 0x70(%rsp), %xmm14
movdqa 0x80(%rsp), %xmm15
movq 0x50(%rsp), %rdx
movl %eax, (%rbx)
jmp 0x3a3a
nopl (%rax)