// File: /workspace/github_c_makefile_star2_O0/neosploit[P]compiler/libfort/lib/fort.c
// Function: snprintf_row
FT_INTERNAL
int snprintf_row(const f_row_t *row, f_conv_context_t *cntx, size_t *col_width_arr, size_t col_width_arr_sz,
                 size_t row_height)
{
    const f_context_t *context = cntx->cntx;
    assert(context);

    if (row == NULL)
        return -1;

    size_t cols_in_row = columns_in_row(row);
    if (cols_in_row > col_width_arr_sz)
        return -1;

    /*  Row separator anatomy
     *
     *  L    data    IV    data   IV   data    R
     */
    f_table_properties_t *properties = context->table_properties;

    typedef const char *(*border_chars_point_t)[BORDER_ITEM_POS_SIZE];
    enum ft_row_type row_type = (enum ft_row_type)get_cell_property_hierarchically(properties, context->row, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE);
    const char *(*bord_chars)[BORDER_ITEM_POS_SIZE] = (row_type == FT_ROW_HEADER)
            ? (border_chars_point_t)(&properties->border_style.header_border_chars)
            : (border_chars_point_t)(&properties->border_style.border_chars);
    const char **L = &(*bord_chars)[LL_bip];
    const char **IV = &(*bord_chars)[IV_bip];
    const char **R = &(*bord_chars)[RR_bip];


    size_t written = 0;
    int tmp = 0;
    size_t i = 0;
    fort_entire_table_properties_t *entire_tprops = &context->table_properties->entire_table_properties;
    for (i = 0; i < row_height; ++i) {
        /* Print left margin */
        CHCK_RSLT_ADD_TO_WRITTEN(print_n_strings(cntx, entire_tprops->left_margin, FT_SPACE));

        /* Print left table boundary */
        CHCK_RSLT_ADD_TO_WRITTEN(print_n_strings(cntx, 1, *L));
        size_t j = 0;
        while (j < col_width_arr_sz) {
            if (j < cols_in_row) {
                ((f_context_t *)context)->column = j;
                f_cell_t *cell = VECTOR_AT(row->cells, j, f_cell_t *);
                size_t cell_vis_width = 0;

                size_t group_slave_sz = group_cell_number(row, j);
                cell_vis_width = col_width_arr[j];
                size_t slave_j = 0;
                size_t master_j = j;
                for (slave_j = master_j + 1; slave_j < (master_j + group_slave_sz); ++slave_j) {
                    cell_vis_width += col_width_arr[slave_j] + FORT_COL_SEPARATOR_LENGTH;
                    ++j;
                }

                CHCK_RSLT_ADD_TO_WRITTEN(cell_printf(cell, i, cntx, cell_vis_width));
            } else {
                /* Print empty cell */
                CHCK_RSLT_ADD_TO_WRITTEN(print_n_strings(cntx, col_width_arr[j], FT_SPACE));
            }

            /* Print boundary between cells */
            if (j < col_width_arr_sz - 1)
                CHCK_RSLT_ADD_TO_WRITTEN(print_n_strings(cntx, 1, *IV));

            ++j;
        }

        /* Print right table boundary */
        CHCK_RSLT_ADD_TO_WRITTEN(print_n_strings(cntx, 1, *R));

        /* Print right margin */
        CHCK_RSLT_ADD_TO_WRITTEN(print_n_strings(cntx, entire_tprops->right_margin, FT_SPACE));

        /* Print new line character */
        CHCK_RSLT_ADD_TO_WRITTEN(print_n_strings(cntx, 1, FT_NEWLINE));
    }
    return (int)written;

clear:
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x19904
jmp 0x19923
leaq 0xa30b(%rip), %rdi      # 0x23c16
leaq 0x9284(%rip), %rsi      # 0x22b96
movl $0x17cf, %edx           # imm = 0x17CF
leaq 0xa8c1(%rip), %rcx      # 0x241df
callq 0x7120
cmpq $0x0, -0x10(%rbp)
jne 0x19936
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x19d38
movq -0x10(%rbp), %rdi
callq 0x14270
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x28(%rbp), %rax
jbe 0x19959
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x19d38
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x80, %ecx
callq 0x1a550
movl %eax, -0x4c(%rbp)
cmpl $0x1, -0x4c(%rbp)
jne 0x1999b
movq -0x48(%rbp), %rax
addq $0x98, %rax
movq %rax, -0xc8(%rbp)
jmp 0x199a6
movq -0x48(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x68(%rbp)
movq -0x58(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movl $0x0, -0x7c(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
addq $0x168, %rax            # imm = 0x168
movq %rax, -0x90(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x19d28
jmp 0x19a21
movq -0x18(%rbp), %rdi
movq -0x90(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
leaq 0x8bf2(%rip), %rdx      # 0x22629
callq 0x19700
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
jge 0x19a4a
jmp 0x19d31
movslq -0x7c(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x19a58
movq -0x18(%rbp), %rdi
movq -0x60(%rbp), %rax
movq (%rax), %rdx
movl $0x1, %esi
callq 0x19700
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
jge 0x19a7b
jmp 0x19d31
movslq -0x7c(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
movq $0x0, -0x98(%rbp)
movq -0x98(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x19c7b
movq -0x98(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x19be0
movq -0x98(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x98(%rbp), %rsi
callq 0x13350
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0x10(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x1a800
movq %rax, -0xb0(%rbp)
movq -0x20(%rbp), %rax
movq -0x98(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xa8(%rbp)
movq $0x0, -0xb8(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq -0xc0(%rbp), %rcx
addq -0xb0(%rbp), %rcx
cmpq %rcx, %rax
jae 0x19ba4
movq -0x20(%rbp), %rax
movq -0xb8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq $0x1, %rax
addq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
movq -0xb8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb8(%rbp)
jmp 0x19b43
jmp 0x19ba6
movq -0xa0(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0xa8(%rbp), %rcx
callq 0x1cf80
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
jge 0x19bd2
jmp 0x19d31
movslq -0x7c(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x19c1d
jmp 0x19be2
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq -0x98(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x8a2d(%rip), %rdx      # 0x22629
callq 0x19700
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
jge 0x19c0f
jmp 0x19d31
movslq -0x7c(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x19c1d
movq -0x98(%rbp), %rax
movq -0x28(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x19c64
jmp 0x19c33
movq -0x18(%rbp), %rdi
movq -0x68(%rbp), %rax
movq (%rax), %rdx
movl $0x1, %esi
callq 0x19700
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
jge 0x19c56
jmp 0x19d31
movslq -0x7c(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x19c64
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x19a92
jmp 0x19c7d
movq -0x18(%rbp), %rdi
movq -0x70(%rbp), %rax
movq (%rax), %rdx
movl $0x1, %esi
callq 0x19700
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
jge 0x19ca0
jmp 0x19d31
movslq -0x7c(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x19cae
movq -0x18(%rbp), %rdi
movq -0x90(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %esi
leaq 0x8964(%rip), %rdx      # 0x22629
callq 0x19700
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
jge 0x19cd5
jmp 0x19d31
movslq -0x7c(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x19ce3
movq -0x18(%rbp), %rdi
movl $0x1, %esi
leaq 0x836a(%rip), %rdx      # 0x2205d
callq 0x19700
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
jge 0x19d03
jmp 0x19d31
movslq -0x7c(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x19d11
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x19a0e
movq -0x78(%rbp), %rax
movl %eax, -0x4(%rbp)
jmp 0x19d38
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)