// File: /workspace/github_c_makefile_star2_O0/neosploit[P]compiler/libfort/lib/fort.c
// Function: create_row_from_string
FT_INTERNAL
f_row_t *create_row_from_string(const char *str)
{
    typedef char char_type;
    char_type *(*strdup_)(const char_type * str) = F_STRDUP;
    const char_type zero_char = '\0';
    f_status(*fill_cell_from_string_)(f_cell_t *cell, const char *str) = fill_cell_from_string;
    const char_type *const zero_string = "";
#define STRCHR strchr

    char_type *pos = NULL;
    char_type *base_pos = NULL;
    size_t number_of_separators = 0;

    f_row_t *row = create_row();
    if (row == NULL)
        return NULL;

    if (str == NULL)
        return row;

    char_type *str_copy = strdup_(str);
    if (str_copy == NULL)
        goto clear;

    pos = str_copy;
    base_pos = str_copy;
    number_of_separators = 0;
    while (*pos) {
        pos = STRCHR(pos, g_col_separator);
        if (pos != NULL) {
            *(pos) = zero_char;
            ++pos;
            number_of_separators++;
        }

        f_cell_t *cell = create_cell();
        if (cell == NULL)
            goto clear;

        int status = fill_cell_from_string_(cell, base_pos);
        if (FT_IS_ERROR(status)) {
            destroy_cell(cell);
            goto clear;
        }

        status = vector_push(row->cells, &cell);
        if (FT_IS_ERROR(status)) {
            destroy_cell(cell);
            goto clear;
        }

        if (pos == NULL)
            break;
        base_pos = pos;
    }

    /* special case if in format string last cell is empty */
    while (vector_size(row->cells) < (number_of_separators + 1)) {
        f_cell_t *cell = create_cell();
        if (cell == NULL)
            goto clear;

        int status = fill_cell_from_string_(cell, zero_string);
        if (FT_IS_ERROR(status)) {
            destroy_cell(cell);
            goto clear;
        }

        status = vector_push(row->cells, &cell);
        if (FT_IS_ERROR(status)) {
            destroy_cell(cell);
            goto clear;
        }
    }

    F_FREE(str_copy);
    return row;

clear:
    destroy_row(row);
    F_FREE(str_copy);
    return NULL;

#undef STRCHR
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
leaq 0x44a(%rip), %rax       # 0x18040
movq %rax, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
leaq 0x4bb(%rip), %rax       # 0x180c0
movq %rax, -0x28(%rbp)
leaq 0xa44e(%rip), %rax      # 0x2205e
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
callq 0x171f0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x17c49
movq $0x0, -0x8(%rbp)
jmp 0x17dfa
cmpq $0x0, -0x10(%rbp)
jne 0x17c5d
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x17dfa
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x17c77
jmp 0x17ddc
movq -0x58(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x38(%rbp), %rax
cmpb $0x0, (%rax)
je 0x17d4d
movq -0x38(%rbp), %rdi
movsbl 0x12589(%rip), %esi     # 0x2a230
callq 0x70e0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x17cd6
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
callq 0x18140
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x17ceb
jmp 0x17ddc
movq -0x28(%rbp), %rax
movq -0x60(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq *%rax
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x64(%rbp)
jge 0x17d10
movq -0x60(%rbp), %rdi
callq 0x17010
jmp 0x17ddc
movq -0x50(%rbp), %rax
movq (%rax), %rdi
leaq -0x60(%rbp), %rsi
callq 0x13720
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x64(%rbp)
jge 0x17d37
movq -0x60(%rbp), %rdi
callq 0x17010
jmp 0x17ddc
cmpq $0x0, -0x38(%rbp)
jne 0x17d40
jmp 0x17d4d
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x17c8f
jmp 0x17d4f
movq -0x50(%rbp), %rax
movq (%rax), %rdi
callq 0x132b0
movq -0x48(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jae 0x17dc5
callq 0x18140
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
jne 0x17d7a
jmp 0x17ddc
movq -0x28(%rbp), %rax
movq -0x70(%rbp), %rdi
leaq 0xa2d5(%rip), %rsi      # 0x2205e
callq *%rax
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
jge 0x17d9f
movq -0x70(%rbp), %rdi
callq 0x17010
jmp 0x17ddc
movq -0x50(%rbp), %rax
movq (%rax), %rdi
leaq -0x70(%rbp), %rsi
callq 0x13720
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
jge 0x17dc3
movq -0x70(%rbp), %rdi
callq 0x17010
jmp 0x17ddc
jmp 0x17d4f
movq 0x1245c(%rip), %rax     # 0x2a228
movq -0x58(%rbp), %rdi
callq *%rax
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x17dfa
movq -0x50(%rbp), %rdi
callq 0x13300
movq 0x1243c(%rip), %rax     # 0x2a228
movq -0x58(%rbp), %rdi
callq *%rax
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)