// File: /workspace/github_c_makefile_star2_O2/jogolden[P]ps4flashtool/sha1.c
// Function: sha1_process_bytes
void
sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
{
  /* When we already have some bits in our internal buffer concatenate
     both inputs first.  */
  if (ctx->buflen != 0)
    {
      size_t left_over = ctx->buflen;
      size_t add = 128 - left_over > len ? len : 128 - left_over;

      memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
      ctx->buflen += add;

      if (ctx->buflen > 64)
	{
	  sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx);

	  ctx->buflen &= 63;
	  /* The regions in the following copy operation cannot overlap.  */
	  memcpy (ctx->buffer,
		  &((char *) ctx->buffer)[(left_over + add) & ~63],
		  ctx->buflen);
	}

      buffer = (const char *) buffer + add;
      len -= add;
    }

  /* Process available complete blocks.  */
  if (len >= 64)
    {
#if !_STRING_ARCH_unaligned
# define alignof(type) offsetof (struct { char c; type x; }, x)
# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
      if (UNALIGNED_P (buffer))
	while (len > 64)
	  {
	    sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
	    buffer = (const char *) buffer + 64;
	    len -= 64;
	  }
      else
#endif
	{
	  sha1_process_block (buffer, len & ~63, ctx);
	  buffer = (const char *) buffer + (len & ~63);
	  len &= 63;
	}
    }

  /* Move remaining bytes in internal buffer.  */
  if (len > 0)
    {
      size_t left_over = ctx->buflen;

      memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
      left_over += len;
      if (left_over >= 64)
	{
	  sha1_process_block (ctx->buffer, 64, ctx);
	  left_over -= 64;
	  memcpy (ctx->buffer, &ctx->buffer[16], left_over);
	}
      ctx->buflen = left_over;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl 0x1c(%rdx), %r13d
testq %r13, %r13
je 0x5e71
movl $0x80, %r12d
subq %r13, %r12
cmpq %r14, %r12
cmovaeq %r14, %r12
leaq (%rbx,%r13), %rdi
addq $0x20, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2140
movl 0x1c(%rbx), %esi
addl %r12d, %esi
movl %esi, 0x1c(%rbx)
cmpl $0x41, %esi
jb 0x5e6b
leaq 0x20(%rbx), %rbp
andl $-0x40, %esi
movq %rbp, %rdi
movq %rbx, %rdx
callq 0x4ba3
movl 0x1c(%rbx), %edx
andl $0x3f, %edx
movl %edx, 0x1c(%rbx)
addq %r12, %r13
andq $-0x40, %r13
addq %rbp, %r13
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2140
addq %r12, %r15
subq %r12, %r14
cmpq $0x40, %r14
jb 0x5ee9
testb $0x3, %r15b
je 0x5ecd
leaq 0x20(%rbx), %r12
pushq $0x40
popq %r13
cmpq $0x41, %r14
jb 0x5eee
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movups 0x30(%r15), %xmm3
movups %xmm3, 0x30(%r12)
movups %xmm2, 0x20(%r12)
movups %xmm1, 0x10(%r12)
movups %xmm0, (%r12)
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x4ba3
addq $0x40, %r15
addq $-0x40, %r14
jmp 0x5e85
movq %r14, %r12
andq $-0x40, %r12
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x4ba3
addq %r12, %r15
andl $0x3f, %r14d
testq %r14, %r14
je 0x5f37
movl 0x1c(%rbx), %r12d
leaq (%rbx,%r12), %rdi
addq $0x20, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2140
addq %r12, %r14
cmpq $0x40, %r14
jb 0x5f33
leaq 0x20(%rbx), %r15
pushq $0x40
popq %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x4ba3
addq $-0x40, %r14
leaq 0x60(%rbx), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x2140
movl %r14d, 0x1c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop