// File: Alcaro[P]bridges/arlib/deps/miniz.c
// Function: mz_adler32
mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len)
{
  mz_uint32 i, s1 = (mz_uint32)(adler & 0xffff), s2 = (mz_uint32)(adler >> 16); size_t block_len = buf_len % 5552;
  if (!ptr) return MZ_ADLER32_INIT;
  while (buf_len) {
    for (i = 0; i + 7 < block_len; i += 8, ptr += 8) {
      s1 += ptr[0], s2 += s1; s1 += ptr[1], s2 += s1; s1 += ptr[2], s2 += s1; s1 += ptr[3], s2 += s1;
      s1 += ptr[4], s2 += s1; s1 += ptr[5], s2 += s1; s1 += ptr[6], s2 += s1; s1 += ptr[7], s2 += s1;
    }
    for ( ; i < block_len; ++i) s1 += *ptr++, s2 += s1;
    s1 %= 65521U, s2 %= 65521U; buf_len -= block_len; block_len = 5552;
  }
  return (s2 << 16) + s1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
andq $0xffff, %rax           # imm = 0xFFFF
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
shrq $0x10, %rax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movl $0x15b0, %ecx           # imm = 0x15B0
xorl %edx, %edx
divq %rcx
movq %rdx, -0x38(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x5c52e
movq $0x1, -0x8(%rbp)
jmp 0x5c6a5
jmp 0x5c530
cmpq $0x0, -0x20(%rbp)
je 0x5c696
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
addl $0x7, %eax
movl %eax, %eax
cmpq -0x38(%rbp), %rax
jae 0x5c625
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x2(%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x3(%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x4(%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x5(%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x6(%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x7(%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
jmp 0x5c542
jmp 0x5c627
movl -0x24(%rbp), %eax
cmpq -0x38(%rbp), %rax
jae 0x5c65c
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movzbl (%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5c627
movl -0x28(%rbp), %eax
movl $0xfff1, %ecx           # imm = 0xFFF1
xorl %edx, %edx
divl %ecx
movl %edx, -0x28(%rbp)
movl -0x2c(%rbp), %eax
movl $0xfff1, %ecx           # imm = 0xFFF1
xorl %edx, %edx
divl %ecx
movl %edx, -0x2c(%rbp)
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x20(%rbp)
movq $0x15b0, -0x38(%rbp)    # imm = 0x15B0
jmp 0x5c530
movl -0x2c(%rbp), %eax
shll $0x10, %eax
addl -0x28(%rbp), %eax
movl %eax, %eax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax,%rax)