// File: /workspace/github_c_makefile_star2_O0/sasairc[P]yasuna/src/subset.c
// Function: plain_dict_to_polyaness
static
int plain_dict_to_polyaness(FILE* fp, polyaness_t** pt)
{
    int     i       = 0,
            j       = 0,
            status  = 0;

    char*   quote   = NULL,
        **  buf     = NULL;

    rewind(fp);
    if (load_file_to_array(&buf, TH_LINES, TH_LENGTH, fp) < 0) {
        status = -1; goto ERR;
    }

    if ((quote = (char*)
                malloc(sizeof(char) * (strlen("quote") + 1))) == NULL) {
        status = -2; goto ERR;
    }

    /* mapping char* address to polyaness_t */
    memcpy(quote, "quote\0", strlen("quote") + 1);
    j = (*pt)->recs - 1;
    while (i < (*pt)->recs && i <= j) {
        (*pt)->record[i]->keys      = 1;
        (*pt)->record[j]->keys      = 1;
        *((*pt)->record[i]->key)    = quote;
        *((*pt)->record[i]->value)  = *(buf + i);
        *((*pt)->record[j]->key)    = quote;
        *((*pt)->record[j]->value)  = *(buf + j);
        i++;
        j--;
    }
    free(buf);

    return 0;

ERR:
    switch (status) {
        case    -1:
            fprintf(stderr, "%s: load_file_to_array(): %s\n",
                    PROGNAME, strerror(errno));
            break;
        case    -2:
            fprintf(stderr, "%s: malloc(): %s\n",
                    PROGNAME, strerror(errno));
            if (quote != NULL)
                free(quote);
            if (buf != NULL)
                free2d(buf, (*pt)->recs);
            break;
    }

    return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2250
movq -0x10(%rbp), %rcx
leaq -0x38(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
movl $0x280, %edx            # imm = 0x280
callq 0x4a20
cmpl $0x0, %eax
jge 0x10c56
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
jmp 0x10dad
movl $0x6, %edi
callq 0x20e0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x10c76
movl $0xfffffffe, -0x24(%rbp) # imm = 0xFFFFFFFE
jmp 0x10dad
movq -0x30(%rbp), %rax
movl 0x18e9(%rip), %ecx      # 0x12569
movl %ecx, (%rax)
movw 0x18e4(%rip), %cx       # 0x1256d
movw %cx, 0x4(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rdx
xorl %eax, %eax
cmpl (%rdx), %ecx
movb %al, -0x39(%rbp)
jge 0x10cbb
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
setle %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x10cc7
jmp 0x10d98
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x1, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x1, (%rax)
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x10(%rax), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x10(%rax), %rax
movq %rcx, (%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x10c9c
movq -0x38(%rbp), %rdi
callq 0x2170
movl $0x0, -0x4(%rbp)
jmp 0x10e67
movl -0x24(%rbp), %eax
movl %eax, -0x40(%rbp)
subl $-0x2, %eax
je 0x10e00
jmp 0x10dba
movl -0x40(%rbp), %eax
subl $-0x1, %eax
jne 0x10e61
jmp 0x10dc8
movq 0x5211(%rip), %rax      # 0x15fe0
movq (%rax), %rax
movq %rax, -0x48(%rbp)
callq 0x2300
movl (%rax), %edi
callq 0x2220
movq -0x48(%rbp), %rdi
movq %rax, %rcx
leaq 0x1870(%rip), %rsi      # 0x12660
leaq 0x1423(%rip), %rdx      # 0x1221a
movb $0x0, %al
callq 0x23a0
jmp 0x10e61
movq 0x51d9(%rip), %rax      # 0x15fe0
movq (%rax), %rax
movq %rax, -0x50(%rbp)
callq 0x2300
movl (%rax), %edi
callq 0x2220
movq -0x50(%rbp), %rdi
movq %rax, %rcx
leaq 0x17d0(%rip), %rsi      # 0x125f8
leaq 0x13eb(%rip), %rdx      # 0x1221a
movb $0x0, %al
callq 0x23a0
cmpq $0x0, -0x30(%rbp)
je 0x10e46
movq -0x30(%rbp), %rdi
callq 0x2170
cmpq $0x0, -0x38(%rbp)
je 0x10e5f
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl (%rax), %esi
callq 0x63b0
jmp 0x10e61
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq