// File: ctSkennerton[P]fxtract/util/rsort.c
// Function: scatter
static void
scatter(int nsrcs, RANGE * srcv, int pos, int seglen,
        PARTNO ** mapv, PARTNO * partv, PART * pdata)
{
    int i, dn = 1;
    uint8_t buf[seglen];

    for (i = 0; i < nsrcs; ++i) {
        RSREC **rpp = srcv[i].alpha;

        while (rpp != srcv[i].omega) {
            RSREC *rp = *rpp++;
            int keybytes = KEYLENG(rp) - pos;

            if (keybytes <= 0) {

                *srcv[i].alpha++ = rp;

            }
            else {
                int n = imin(seglen, keybytes);
                uint8_t const *dp = KEYDATA(rp, pos, n, buf);
                int rix = mapv[pos][*dp];

                while (--n > 0)
                    rix += mapv[pos + n][dp[n]];

                pdata[dn] = (PART) {
                partv[rix], &srcv[i], rp};
                partv[rix] = dn++;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq 0x10(%rbp), %rax
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movl $0x1, -0x30(%rbp)
movl -0x18(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x38(%rbp)
movq %rax, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x88(%rbp)
movq %rcx, %rsp
movq %rax, -0x40(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x676e
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq -0x2c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
je 0x675e
movq -0x48(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x48(%rbp)
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x6260
subl -0x14(%rbp), %eax
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
jg 0x667d
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rdx
movslq -0x2c(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x8, %rsi
movq %rsi, (%rdx)
movq %rcx, (%rax)
jmp 0x6759
movl -0x18(%rbp), %edi
movl -0x54(%rbp), %esi
callq 0x6ac0
movq -0x88(%rbp), %rcx
movl %eax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x58(%rbp), %edx
callq 0x6af0
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x60(%rbp), %rcx
movzbl (%rcx), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x64(%rbp)
movl -0x58(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x58(%rbp)
cmpl $0x0, %eax
jle 0x66f4
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
addl -0x58(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq -0x60(%rbp), %rcx
movslq -0x58(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movl (%rax,%rcx,4), %eax
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
jmp 0x66be
movq 0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0x28(%rbp), %rcx
movslq -0x64(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x80(%rbp)
movq -0x10(%rbp), %rcx
movslq -0x2c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq %rcx, -0x78(%rbp)
movq -0x50(%rbp), %rcx
movq %rcx, -0x70(%rbp)
movq -0x80(%rbp), %rcx
movq %rcx, (%rax)
movq -0x78(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x70(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x30(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x660d
jmp 0x6760
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x65eb
movq -0x38(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopw (%rax,%rax)