// File: /workspace/github_c_makefile_star2_O0/esheldon[P]xshear/src/config.c
// Function: cfg_get_field
static struct cfg_field *cfg_get_field(const struct cfg_string *str, 
                                       size_t current, 
                                       size_t *end, 
                                       enum cfg_status *status) {

    char *name=NULL;
    struct cfg_field *field=NULL;

    // end will be on assignment character
    name=copy_next_identifier(str, current, end, status);
    if (*status) {
        if (CFG_EOF == *status) {
            // no field found at all.  This is OK so we
            // will set status back to success
            *status=CFG_SUCCESS;
            goto _cfg_get_field_bail;
        }
    }

    field=cfg_field_new();
    field->name=name;

    current = *end+1;
    current = find_nonwhite(str, current, status);
    if (*status) { // EOF
        return 0;
    }

    if (str->data[current] == CFG_ARRAY_BEG) {

        // leaves end at array end char
        CFG_FIELD_TYPE(field)=CFG_TYPE_ARRAY;
        *end = copy_array(field, str, current, status);

    } else if (CFG_CFG_BEG == str->data[current]) {

        //fprintf(stderr,"Found begin of sub config: '%s'\n", name);
        CFG_FIELD_TYPE(field)=CFG_TYPE_CFG;
        field->sub = cfg_parse(str, &current, status);
        //*end=current;
        // +1 cause we need to skip the ending brace
        *end=current+1;
    } else if (CFG_CFG_END == str->data[current]) {
        // this never happens
        *status = CFG_FOUND_END;
        *end=current;
    } else if (str->data[current] == CFG_QUOTE) {

        CFG_FIELD_TYPE(field)=CFG_TYPE_SCALAR;
        CFG_FIELD_ELTYPE(field)=CFG_ELTYPE_QUOTED_STRING;
        *end = copy_quoted_string(field, str, current, status);

    } else {

        CFG_FIELD_TYPE(field)=CFG_TYPE_SCALAR;
        CFG_FIELD_ELTYPE(field)=CFG_ELTYPE_BARE;
        //*end = copy_bare_token(field, str, current, status);
        *end = copy_bare_array_token(field, str, current, status);

    }

_cfg_get_field_bail:
    if (*status) {
        field=cfg_field_free(field);
    }
    return field;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x9670
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x92c8
movq -0x28(%rbp), %rcx
movl $0x6, %eax
cmpl (%rcx), %eax
jne 0x92c6
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
jmp 0x946a
jmp 0x92c8
callq 0x9cb0
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x9170
movq %rax, -0x18(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9316
movq $0x0, -0x8(%rbp)
jmp 0x9488
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x5b, %eax
jne 0x935a
movq -0x38(%rbp), %rax
movl $0x1, 0x8(%rax)
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x9770
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
jmp 0x9468
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
movl $0x7b, %eax
cmpl %ecx, %eax
jne 0x93ae
movq -0x38(%rbp), %rax
movl $0x2, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq -0x18(%rbp), %rsi
callq 0x8380
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x18(%rbp), %rcx
addq $0x1, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
jmp 0x9466
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
movl $0x7d, %eax
cmpl %ecx, %eax
jne 0x93e1
movq -0x28(%rbp), %rax
movl $0x1, (%rax)
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
jmp 0x9464
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x22, %eax
jne 0x942d
movq -0x38(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x38(%rbp), %rax
movl $0x1, 0xc(%rax)
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x98e0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
jmp 0x9462
movq -0x38(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x38(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x9a50
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
jmp 0x9464
jmp 0x9466
jmp 0x9468
jmp 0x946a
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9480
movq -0x38(%rbp), %rdi
callq 0x7eb0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)