// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/bcf_sr_sort.c
// Function: grp_create_key
static char *grp_create_key(sr_sort_t *srt)
{
    if ( !srt->str.l ) return strdup("");
    int i;
    hts_expand(char*,srt->noff,srt->mcharp,srt->charp);
    for (i=0; i<srt->noff; i++)
    {
        srt->charp[i] = srt->str.s + srt->off[i];
        if ( i>0 ) srt->charp[i][-1] = 0;
    }
    qsort(srt->charp, srt->noff, sizeof(*srt->charp), cmpstringp);
    char *ret = (char*) malloc(srt->str.l + 1), *ptr = ret;
    for (i=0; i<srt->noff; i++)
    {
        int len = strlen(srt->charp[i]);
        memcpy(ptr, srt->charp[i], len);
        ptr += len + 1;
        ptr[-1] = i+1==srt->noff ? 0 : ';';
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x170(%rax)
jne 0xe1b0f
leaq 0x2d0e9(%rip), %rdi     # 0x10ebea
callq 0x4930
movq %rax, -0x8(%rbp)
jmp 0xe1cf3
jmp 0xe1b11
movq -0x10(%rbp), %rax
movl 0x18c(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x198(%rcx), %eax
jle 0xe1b92
movq -0x10(%rbp), %rax
cmpl $0x1, 0x18c(%rax)
jl 0xe1b43
movq -0x10(%rbp), %rax
movl 0x18c(%rax), %eax
movl %eax, -0x30(%rbp)
jmp 0xe1b4d
movl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xe1b4d
movl -0x30(%rbp), %eax
movslq %eax, %rdi
movq -0x10(%rbp), %rax
movslq 0x198(%rax), %rsi
movq -0x10(%rbp), %r9
addq $0x1a0, %r9             # imm = 0x1A0
movl $0x4, %edx
movl $0x8, %ecx
xorl %r8d, %r8d
leaq 0x37203(%rip), %rax     # 0x118d80
movq %rax, (%rsp)
callq 0x16180
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x198(%rax)
jmp 0xe1b94
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x18c(%rcx), %eax
jge 0xe1c08
movq -0x10(%rbp), %rax
movq 0x180(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x190(%rax), %rax
movslq -0x14(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
addq %rax, %rdx
movq -0x10(%rbp), %rax
movq 0x1a0(%rax), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpl $0x0, -0x14(%rbp)
jle 0xe1bfb
movq -0x10(%rbp), %rax
movq 0x1a0(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movb $0x0, -0x1(%rax)
jmp 0xe1bfd
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xe1b9b
movq -0x10(%rbp), %rax
movq 0x1a0(%rax), %rdi
movq -0x10(%rbp), %rax
movslq 0x18c(%rax), %rsi
movl $0x8, %edx
leaq 0x1566(%rip), %rcx      # 0xe3190
callq 0x49a0
movq -0x10(%rbp), %rax
movq 0x170(%rax), %rdi
addq $0x1, %rdi
callq 0x4670
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x18c(%rcx), %eax
jge 0xe1ceb
movq -0x10(%rbp), %rax
movq 0x1a0(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x41a0
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x1a0(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movslq -0x2c(%rbp), %rdx
callq 0x43b0
movl -0x2c(%rbp), %ecx
addl $0x1, %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movl -0x14(%rbp), %edx
addl $0x1, %edx
movq -0x10(%rbp), %rax
movl 0x18c(%rax), %esi
movl $0x3b, %eax
xorl %ecx, %ecx
cmpl %esi, %edx
cmovel %ecx, %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, -0x1(%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xe1c56
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)