// File: /workspace/github_c_makefile_star2_O3/sasairc[P]yasuna/src/subset.c
// Function: select_by_speaker
int select_by_speaker(char* speaker, polyaness_t** src, polyaness_t** dest)
{
    int             i       = 0,
                    j       = 0,
                    status  = 0;

    polyaness_t*    pt      = NULL;

    /* no modify */
    if (speaker == NULL) {
        *dest = *src;

        return 0;
    }

    if ((pt = (polyaness_t*)
                malloc(sizeof(polyaness_t))) == NULL) {
        status = -1; goto ERR;
    }

    /* extraction speaker */
    pt->record = (*src)->record;
    pt->recs = 0;
    while (i < (*src)->recs) {
        j = (*src)->record[i]->keys - 1;
        while (j >= 0) {
            if (memcmp(*((*src)->record[i]->key + j), "speaker\0", 8) == 0 &&
                    memcmp(*((*src)->record[i]->value + j), speaker, strlen(speaker) + 1) == 0) {
                *(pt->record + pt->recs) = *((*src)->record + i);
                pt->recs++;
                break;
            }
            j--;
        }
        if (j < 0)
            release_polyaness_cell(&*(pt->record + i));
        i++;
    }
    free(*src);
    *src = NULL;
    *dest = pt;

    /* no quotes */
    if (pt->recs <= 0) {
        status = -2; goto ERR;
    }

    return 0;

ERR:
    switch (status) {
        case    -1:
            fprintf(stderr, "%s: malloc(): %s\n",
                    PROGNAME, strerror(errno));
            break;
        case    -2:
            break;
    }

    return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rsi, %r14
testq %rdi, %rdi
je 0xa9b5
movq %rdi, %r12
movl $0x10, %edi
callq 0x20e0
testq %rax, %rax
je 0xaa03
movq (%r14), %rdi
movq 0x8(%rdi), %rcx
movq %rcx, 0x8(%rsp)
movq %rcx, 0x8(%rax)
movq %rax, (%rsp)
movl $0x0, (%rax)
cmpl $0x0, (%rdi)
jle 0xa9da
movq %rbx, 0x18(%rsp)
xorl %ebx, %ebx
movabsq $0x72656b61657073, %r13 # imm = 0x72656B61657073
movq %r14, 0x20(%rsp)
movq 0x8(%rdi), %rax
movq %rbx, 0x10(%rsp)
movq (%rax,%rbx,8), %r14
movslq (%r14), %rbp
testq %rbp, %rbp
jle 0xa972
movq 0x8(%r14), %r15
incq %rbp
movq -0x10(%r15,%rbp,8), %rax
cmpq %r13, (%rax)
jne 0xa969
movq 0x10(%r14), %rax
movq %r13, %rbx
movq -0x10(%rax,%rbp,8), %r13
movq %r12, %rdi
callq 0x21a0
leaq 0x1(%rax), %rdx
movq %r13, %rdi
movq %rbx, %r13
movq %r12, %rsi
callq 0x2280
testl %eax, %eax
je 0xa99a
decq %rbp
cmpq $0x1, %rbp
ja 0xa935
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rbx
leaq (%rax,%rbx,8), %rdi
callq 0xa3d9
incq %rbx
movq 0x20(%rsp), %r14
movq (%r14), %rdi
movslq (%rdi), %rax
cmpq %rax, %rbx
jl 0xa919
jmp 0xa9bf
movq (%rsp), %rcx
movslq (%rcx), %rax
movq 0x8(%rsp), %rdx
movq %r14, (%rdx,%rax,8)
incl %eax
movl %eax, (%rcx)
movq 0x10(%rsp), %rbx
jmp 0xa985
movq (%r14), %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
jmp 0xa9f2
xorl %eax, %eax
movq (%rsp), %r15
cmpl $0x0, (%r15)
setg %al
leal -0x2(,%rax,2), %ebp
movq 0x18(%rsp), %rbx
jmp 0xa9e3
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
movq (%rsp), %r15
callq 0x2190
movq $0x0, (%r14)
movq %r15, (%rbx)
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x27db
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xa9f2