// File: /workspace/github_c_makefile_star2_O2/neosploit[P]compiler/libfort/lib/fort.c
// Function: ft_erase_range
int ft_erase_range(ft_table_t *table,
                   size_t top_left_row, size_t top_left_col,
                   size_t bottom_right_row, size_t bottom_right_col)
{
    assert(table && table->rows);
    int status = FT_SUCCESS;

    size_t rows_n = vector_size(table->rows);

    if (top_left_row == FT_CUR_ROW)
        top_left_row = table->cur_row;
    if (bottom_right_row == FT_CUR_ROW)
        bottom_right_row = table->cur_row;

    if (top_left_col == FT_CUR_COLUMN)
        top_left_col = table->cur_row;
    if (bottom_right_col == FT_CUR_COLUMN)
        bottom_right_col = table->cur_row;

    if (top_left_row > bottom_right_row || top_left_col > bottom_right_col)
        return FT_EINVAL;

    f_row_t *row = NULL;
    size_t i = top_left_row;
    while (i < rows_n && i <= bottom_right_row) {
        row = VECTOR_AT(table->rows, i, f_row_t *);
        status = ft_row_erase_range(row, top_left_col, bottom_right_col);
        if (FT_IS_ERROR(status))
            return status;
        ++i;
    }

    f_separator_t *separator = NULL;

    size_t n_iterations = MIN(rows_n - 1, bottom_right_row) - top_left_row + 1;
    size_t j = 0;
    i = top_left_row;
    for (j = 0; j < n_iterations; ++j) {
        row = VECTOR_AT(table->rows, i, f_row_t *);
        if (columns_in_row(row)) {
            ++i;
        } else {
            destroy_row(row);
            status = vector_erase(table->rows, i);
            if (FT_IS_ERROR(status))
                return status;
            if (i < vector_size(table->separators)) {
                separator = VECTOR_AT(table->separators, i, f_separator_t *);
                destroy_separator(separator);
                vector_erase(table->separators, i);
            }
        }
    }

    return FT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
testq %rdi, %rdi
je 0xf223
movq %rdi, %r13
movq (%rdi), %rax
testq %rax, %rax
je 0xf223
movq %r8, %r12
movq %rdx, %rbx
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
cmpq %rcx, -0x38(%rbp)
jne 0xf072
movq 0x18(%r13), %rdx
movq %rdx, -0x38(%rbp)
cmpq %rcx, -0x30(%rbp)
jne 0xf080
movq 0x18(%r13), %rdx
movq %rdx, -0x30(%rbp)
cmpq %rcx, %rbx
jne 0xf089
movq 0x18(%r13), %rbx
cmpq %rcx, %r12
jne 0xf092
movq 0x18(%r13), %r12
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
seta %cl
cmpq %r12, %rbx
seta %dl
orb %cl, %dl
je 0xf0af
pushq $-0x2
popq %rax
jmp 0xf1f5
movq (%rax), %r14
movq %r13, -0x40(%rbp)
movq %r14, -0x48(%rbp)
cmpq %r14, %rsi
jae 0xf15e
cmpq -0x30(%rbp), %rsi
ja 0xf15e
movq (%r13), %rax
movq 0x8(%rax), %rcx
movq 0x18(%rax), %rax
movq %rsi, -0x50(%rbp)
imulq %rsi, %rax
movq (%rcx,%rax), %r14
testq %r14, %r14
je 0xf204
movq (%r14), %rdi
callq 0xe77d
testq %rax, %rax
je 0xf14e
movq %rax, %r15
movq %rbx, %r13
cmpq %r15, %r13
jae 0xf128
cmpq %r12, %r13
ja 0xf128
movq (%r14), %rax
movq 0x8(%rax), %rcx
movq 0x18(%rax), %rax
imulq %r13, %rax
movq (%rcx,%rax), %rdi
callq 0x12048
incq %r13
jmp 0xf101
decq %r15
cmpq %r12, %r15
cmovaeq %r12, %r15
incq %r15
movq -0x40(%rbp), %r13
cmpq %r15, %rbx
je 0xf14e
movq (%r14), %rdi
movq %rbx, %rsi
callq 0xf242
decq %r15
jmp 0xf139
movq -0x50(%rbp), %rsi
incq %rsi
movq -0x48(%rbp), %r14
jmp 0xf0ba
decq %r14
movq -0x30(%rbp), %rax
cmpq %rax, %r14
cmovaeq %rax, %r14
movq -0x38(%rbp), %rbx
subq %rbx, %r14
incq %r14
subq $0x1, %r14
jb 0xf1f3
movq (%r13), %rax
movq 0x8(%rax), %rcx
movq 0x18(%rax), %rax
imulq %rbx, %rax
movq (%rcx,%rax), %rdi
testq %rdi, %rdi
je 0xf1a8
movq (%rdi), %rax
testq %rax, %rax
je 0xf1a8
cmpq $0x0, (%rax)
je 0xf1a8
incq %rbx
jmp 0xf176
callq 0xe7a9
movq (%r13), %rdi
movq %rbx, %rsi
callq 0xf242
testl %eax, %eax
js 0xf1f5
movq 0x28(%r13), %rdi
callq 0xe77d
cmpq %rax, %rbx
jae 0xf176
movq 0x28(%r13), %rax
movq 0x8(%rax), %rcx
movq 0x18(%rax), %rax
imulq %rbx, %rax
movq (%rcx,%rax), %rdi
callq *0x11053(%rip)          # 0x20238
movq 0x28(%r13), %rdi
movq %rbx, %rsi
callq 0xf242
jmp 0xf176
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa462(%rip), %rdi      # 0x1966d
leaq 0x9864(%rip), %rsi      # 0x18a76
leaq 0xafa0(%rip), %rcx      # 0x1a1b9
movl $0x1500, %edx           # imm = 0x1500
callq 0x7120
leaq 0x9945(%rip), %rdi      # 0x18b6f
leaq 0x9845(%rip), %rsi      # 0x18a76
leaq 0x9974(%rip), %rcx      # 0x18bac
movl $0xb14, %edx            # imm = 0xB14
callq 0x7120