// File: /workspace/github_c_makefile_star2_O0/neosploit[P]compiler/libfort/lib/fort.c
// Function: ft_row_printf_impl_
static int ft_row_printf_impl_(ft_table_t *table, size_t row, const struct f_string_view *fmt, va_list *va)
{
    size_t i = 0;
    size_t new_cols = 0;

    if (table == NULL)
        return -1;

    f_row_t *new_row = create_row_from_fmt_string(fmt, va);

    if (new_row == NULL) {
        return -1;
    }

    f_row_t **cur_row_p = NULL;
    size_t sz = vector_size(table->rows);
    if (row >= sz) {
        size_t push_n = row - sz + 1;
        for (i = 0; i < push_n; ++i) {
            f_row_t *padding_row = create_row();
            if (padding_row == NULL)
                goto clear;

            if (FT_IS_ERROR(vector_push(table->rows, &padding_row))) {
                destroy_row(padding_row);
                goto clear;
            }
        }
    }
    /* todo: clearing pushed items in case of error ?? */

    new_cols = columns_in_row(new_row);
    cur_row_p = &VECTOR_AT(table->rows, row, f_row_t *);

    switch (table->properties->entire_table_properties.add_strategy) {
        case FT_STRATEGY_INSERT: {
            if (FT_IS_ERROR(insert_row(*cur_row_p, new_row, table->cur_col)))
                goto clear;
            break;
        }
        case FT_STRATEGY_REPLACE: {
            if (FT_IS_ERROR(swap_row(*cur_row_p, new_row, table->cur_col)))
                goto clear;
            break;
        }
        default:
            assert(0 && "Unexpected situation inside libfort");
            break;
    }

    table->cur_col += new_cols;
    destroy_row(new_row);
    return (int)new_cols;

clear:
    destroy_row(new_row);
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %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)
cmpq $0x0, -0x10(%rbp)
jne 0x144ab
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x14632
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x17050
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x144cf
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x14632
movq $0x0, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x132b0
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x50(%rbp), %rax
jb 0x1455d
movq -0x18(%rbp), %rax
subq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x1455b
callq 0x171f0
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x14528
jmp 0x14622
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq -0x60(%rbp), %rsi
callq 0x13720
cmpl $0x0, %eax
jge 0x1454b
movq -0x60(%rbp), %rdi
callq 0x13300
jmp 0x14622
jmp 0x1454d
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x14509
jmp 0x1455d
movq -0x40(%rbp), %rdi
callq 0x14270
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x13350
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x178(%rax), %eax
movl %eax, -0x64(%rbp)
testl %eax, %eax
je 0x145c0
jmp 0x14595
movl -0x64(%rbp), %eax
subl $0x1, %eax
jne 0x145e1
jmp 0x1459f
movq -0x48(%rbp), %rax
movq (%rax), %rdi
movq -0x40(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
callq 0x17200
cmpl $0x0, %eax
jge 0x145be
jmp 0x14622
jmp 0x14600
movq -0x48(%rbp), %rax
movq (%rax), %rdi
movq -0x40(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
callq 0x17370
cmpl $0x0, %eax
jge 0x145df
jmp 0x14622
jmp 0x14600
leaq 0xe5d9(%rip), %rdi      # 0x22bc1
leaq 0xe5a7(%rip), %rsi      # 0x22b96
movl $0xb78, %edx            # imm = 0xB78
leaq 0xee2c(%rip), %rcx      # 0x23427
callq 0x7120
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x40(%rbp), %rdi
callq 0x13300
movq -0x38(%rbp), %rax
movl %eax, -0x4(%rbp)
jmp 0x14632
movq -0x40(%rbp), %rdi
callq 0x13300
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)