// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
testq %rdi, %rdi
je 0xfbed
movq %rdi, %r14
movq (%rdi), %rax
testq %rax, %rax
je 0xfbed
movq %rcx, %r13
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
cmpq %rcx, %rsi
jne 0xf9ac
movq 0x18(%r14), %rsi
cmpq %rcx, %r13
jne 0xf9b5
movq 0x18(%r14), %r13
cmpq %rcx, %rdx
jne 0xf9be
movq 0x18(%r14), %rdx
cmpq %rcx, %r8
jne 0xf9c7
movq 0x18(%r14), %r8
cmpq %r13, %rsi
seta %cl
movq %rdx, -0x30(%rbp)
cmpq %r8, %rdx
seta %dl
orb %cl, %dl
movl $0xfffffffe, %r12d      # imm = 0xFFFFFFFE
jne 0xfb9d
movq %r8, -0x38(%rbp)
movq (%rax), %r15
movq %rsi, -0x40(%rbp)
cmpq %r15, %rsi
movq -0x30(%rbp), %rsi
jae 0xfb07
movq -0x40(%rbp), %rdx
movq %r14, -0x58(%rbp)
movq %r15, -0x50(%rbp)
movq %r13, -0x48(%rbp)
movq (%r14), %rax
movq 0x8(%rax), %rcx
movq 0x18(%rax), %rax
imulq %rdx, %rax
movq (%rcx,%rax), %rbx
testq %rbx, %rbx
je 0xfbce
movq %rdx, -0x60(%rbp)
movq (%rbx), %rax
testq %rax, %rax
movq -0x38(%rbp), %rcx
je 0xfbaf
cmpq %rcx, %rsi
ja 0xfaee
movq (%rax), %r12
testq %r12, %r12
je 0xfaee
cmpq %rsi, %r12
movq -0x38(%rbp), %rdx
jbe 0xfab2
movq -0x30(%rbp), %r13
movq (%rbx), %rax
movq 0x8(%rax), %rcx
movq 0x18(%rax), %rax
imulq %r13, %rax
movq (%rcx,%rax), %r15
testq %r15, %r15
je 0xfaa5
movq (%r15), %r14
testq %r14, %r14
je 0xfa98
movq (%r14), %rdi
callq *0x117b0(%rip)          # 0x21238
movq $0x0, (%r14)
movq %r14, %rdi
callq *0x117a0(%rip)          # 0x21238
movq %r15, %rdi
callq *0x11797(%rip)          # 0x21238
movq -0x38(%rbp), %rdx
cmpq %rdx, %r13
jae 0xfab2
incq %r13
cmpq %r12, %r13
jb 0xfa5f
decq %r12
cmpq %rdx, %r12
cmovaeq %rdx, %r12
movq %r12, %rax
movq -0x30(%rbp), %rsi
subq %rsi, %rax
incq %rax
movq -0x58(%rbp), %r14
movq -0x50(%rbp), %r15
movq -0x48(%rbp), %r13
je 0xfaee
incq %r12
movq (%rbx), %rdi
callq 0xfc0c
movq -0x30(%rbp), %rsi
decq %r12
cmpq %r12, %rsi
jne 0xfada
movq -0x60(%rbp), %rcx
leaq 0x1(%rcx), %rax
cmpq %r15, %rax
jae 0xfb07
cmpq %r13, %rcx
movq %rax, %rdx
jb 0xfa0d
decq %r15
cmpq %r13, %r15
cmovaeq %r13, %r15
movq -0x40(%rbp), %rbx
subq %rbx, %r15
xorl %r12d, %r12d
cmpq $-0x1, %r15
je 0xfb9d
incq %r15
movq (%r14), %rax
movq 0x8(%rax), %rcx
movq 0x18(%rax), %rax
imulq %rbx, %rax
movq (%rcx,%rax), %rdi
testq %rdi, %rdi
je 0xfb4f
movq (%rdi), %rax
testq %rax, %rax
je 0xfb4f
cmpq $0x0, (%rax)
je 0xfb4f
incq %rbx
jmp 0xfb93
callq 0xef82
movq (%r14), %rdi
movq %rbx, %rsi
callq 0xfc0c
testl %eax, %eax
js 0xfb9a
movq 0x28(%r14), %rax
testq %rax, %rax
je 0xfbaf
cmpq (%rax), %rbx
jae 0xfb93
movq 0x8(%rax), %rcx
movq 0x18(%rax), %rax
imulq %rbx, %rax
movq (%rcx,%rax), %rdi
callq *0x116b1(%rip)          # 0x21238
movq 0x28(%r14), %rdi
movq %rbx, %rsi
callq 0xfc0c
decq %r15
jne 0xfb24
jmp 0xfb9d
movl %eax, %r12d
movl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xac05(%rip), %rdi      # 0x1a7bb
leaq 0x9ec9(%rip), %rsi      # 0x19a86
leaq 0xb7d9(%rip), %rcx      # 0x1b39d
movl $0x1c74, %edx           # imm = 0x1C74
callq 0x7130
leaq 0xab09(%rip), %rdi      # 0x1a6de
leaq 0x9eaa(%rip), %rsi      # 0x19a86
leaq 0xb733(%rip), %rcx      # 0x1b316
movl $0x1500, %edx           # imm = 0x1500
callq 0x7130
leaq 0x9f8b(%rip), %rdi      # 0x19b7f
leaq 0x9e8b(%rip), %rsi      # 0x19a86
leaq 0x9fba(%rip), %rcx      # 0x19bbc
movl $0xb14, %edx            # imm = 0xB14
callq 0x7130