// File: Alcaro[P]bridges/arlib/deps/miniz.c
// Function: tdefl_radix_sort_syms
static tdefl_sym_freq* tdefl_radix_sort_syms(mz_uint num_syms, tdefl_sym_freq* pSyms0, tdefl_sym_freq* pSyms1)
{
  mz_uint32 total_passes = 2, pass_shift, pass, i, hist[256 * 2]; tdefl_sym_freq* pCur_syms = pSyms0, *pNew_syms = pSyms1; MZ_CLEAR_OBJ(hist);
  for (i = 0; i < num_syms; i++) { mz_uint freq = pSyms0[i].m_key; hist[freq & 0xFF]++; hist[256 + ((freq >> 8) & 0xFF)]++; }
  while ((total_passes > 1) && (num_syms == hist[(total_passes - 1) * 256])) total_passes--;
  for (pass_shift = 0, pass = 0; pass < total_passes; pass++, pass_shift += 8)
  {
    const mz_uint32* pHist = &hist[pass << 8];
    mz_uint offsets[256], cur_ofs = 0;
    for (i = 0; i < 256; i++) { offsets[i] = cur_ofs; cur_ofs += pHist[i]; }
    for (i = 0; i < num_syms; i++) pNew_syms[offsets[(pCur_syms[i].m_key >> pass_shift) & 0xFF]++] = pCur_syms[i];
    { tdefl_sym_freq* t = pCur_syms; pCur_syms = pNew_syms; pNew_syms = t; }
  }
  return pCur_syms;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc70, %rsp            # imm = 0xC70
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x2, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x838(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x840(%rbp)
leaq -0x830(%rbp), %rdi
xorl %esi, %esi
movl $0x800, %edx            # imm = 0x800
callq 0x4170
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x4(%rbp), %eax
jae 0x62015
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
movzwl (%rax,%rcx,4), %eax
movl %eax, -0x844(%rbp)
movl -0x844(%rbp), %eax
andl $0xff, %eax
movl %eax, %eax
movl -0x830(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x830(%rbp,%rax,4)
movl -0x844(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
addl $0x100, %eax            # imm = 0x100
movl %eax, %eax
movl -0x830(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x830(%rbp,%rax,4)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x61fad
jmp 0x62017
xorl %eax, %eax
cmpl $0x1, -0x1c(%rbp)
movb %al, -0xc61(%rbp)
jbe 0x62043
movl -0x4(%rbp), %eax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
shll $0x8, %ecx
movl %ecx, %ecx
cmpl -0x830(%rbp,%rcx,4), %eax
sete %al
movb %al, -0xc61(%rbp)
movb -0xc61(%rbp), %al
testb $0x1, %al
jne 0x6204f
jmp 0x6205a
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x62017
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x62186
movl -0x24(%rbp), %eax
shll $0x8, %eax
movl %eax, %eax
movl %eax, %ecx
leaq -0x830(%rbp), %rax
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x850(%rbp)
movl $0x0, -0xc54(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x100, -0x28(%rbp)     # imm = 0x100
jae 0x620e1
movl -0xc54(%rbp), %ecx
movl -0x28(%rbp), %eax
movl %ecx, -0xc50(%rbp,%rax,4)
movq -0x850(%rbp), %rax
movl -0x28(%rbp), %ecx
movl (%rax,%rcx,4), %eax
addl -0xc54(%rbp), %eax
movl %eax, -0xc54(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x620a4
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x4(%rbp), %eax
jae 0x62145
movq -0x840(%rbp), %rax
movq -0x838(%rbp), %rcx
movl -0x28(%rbp), %edx
movzwl (%rcx,%rdx,4), %edx
movl -0x20(%rbp), %ecx
sarl %cl, %edx
movl %edx, %ecx
andl $0xff, %ecx
movslq %ecx, %rdx
movl -0xc50(%rbp,%rdx,4), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0xc50(%rbp,%rdx,4)
movl %ecx, %ecx
movq -0x838(%rbp), %rdx
movl -0x28(%rbp), %esi
movl (%rdx,%rsi,4), %edx
movl %edx, (%rax,%rcx,4)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x620e8
movq -0x838(%rbp), %rax
movq %rax, -0xc60(%rbp)
movq -0x840(%rbp), %rax
movq %rax, -0x838(%rbp)
movq -0xc60(%rbp), %rax
movq %rax, -0x840(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x20(%rbp)
jmp 0x62068
movq -0x838(%rbp), %rax
addq $0xc70, %rsp            # imm = 0xC70
popq %rbp
retq
nopw %cs:(%rax,%rax)