// File: /workspace/github_c_makefile_star2_O0/neosploit[P]compiler/libfort/lib/fort.c
// Function: create_row_from_wstring
FT_INTERNAL
f_row_t *create_row_from_wstring(const wchar_t *str)
{
    typedef wchar_t char_type;
    char_type *(*strdup_)(const char_type * str) = F_WCSDUP;
    const char_type zero_char = L'\0';
    f_status(*fill_cell_from_string_)(f_cell_t *cell, const wchar_t *str) = fill_cell_from_wstring;
    const char_type *const zero_string = L"";
#define STRCHR wcschr

    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 0x46a(%rip), %rax       # 0x18290
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
leaq 0x4d8(%rip), %rax       # 0x18310
movq %rax, -0x28(%rbp)
leaq 0xc98d(%rip), %rax      # 0x247d0
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 0x17e7c
movq $0x0, -0x8(%rbp)
jmp 0x18030
cmpq $0x0, -0x10(%rbp)
jne 0x17e90
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x18030
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x17eaa
jmp 0x18012
movq -0x58(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x0, (%rax)
je 0x17f83
movq -0x38(%rbp), %rdi
movsbl 0x12356(%rip), %esi     # 0x2a230
callq 0x7220
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x17f0c
movq -0x38(%rbp), %rax
movl $0x0, (%rax)
movq -0x38(%rbp), %rax
addq $0x4, %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 0x17f21
jmp 0x18012
movq -0x28(%rbp), %rax
movq -0x60(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq *%rax
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x64(%rbp)
jge 0x17f46
movq -0x60(%rbp), %rdi
callq 0x17010
jmp 0x18012
movq -0x50(%rbp), %rax
movq (%rax), %rdi
leaq -0x60(%rbp), %rsi
callq 0x13720
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x64(%rbp)
jge 0x17f6d
movq -0x60(%rbp), %rdi
callq 0x17010
jmp 0x18012
cmpq $0x0, -0x38(%rbp)
jne 0x17f76
jmp 0x17f83
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x17ec2
jmp 0x17f85
movq -0x50(%rbp), %rax
movq (%rax), %rdi
callq 0x132b0
movq -0x48(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jae 0x17ffb
callq 0x18140
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
jne 0x17fb0
jmp 0x18012
movq -0x28(%rbp), %rax
movq -0x70(%rbp), %rdi
leaq 0xc811(%rip), %rsi      # 0x247d0
callq *%rax
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
jge 0x17fd5
movq -0x70(%rbp), %rdi
callq 0x17010
jmp 0x18012
movq -0x50(%rbp), %rax
movq (%rax), %rdi
leaq -0x70(%rbp), %rsi
callq 0x13720
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
jge 0x17ff9
movq -0x70(%rbp), %rdi
callq 0x17010
jmp 0x18012
jmp 0x17f85
movq 0x12226(%rip), %rax     # 0x2a228
movq -0x58(%rbp), %rdi
callq *%rax
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x18030
movq -0x50(%rbp), %rdi
callq 0x13300
movq 0x12206(%rip), %rax     # 0x2a228
movq -0x58(%rbp), %rdi
callq *%rax
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)