// File: /workspace/github_c_makefile_star2_O3/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 0xf9aa
movq %rdi, %r14
movq (%rdi), %rax
testq %rax, %rax
je 0xf9aa
movq %rcx, %r13
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
cmpq %rcx, %rsi
jne 0xf776
movq 0x18(%r14), %rsi
cmpq %rcx, %r13
jne 0xf77f
movq 0x18(%r14), %r13
cmpq %rcx, %rdx
jne 0xf788
movq 0x18(%r14), %rdx
cmpq %rcx, %r8
jne 0xf791
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 0xf95a
movq %r8, -0x40(%rbp)
movq (%rax), %r15
movq %rsi, -0x38(%rbp)
cmpq %r15, %rsi
movq -0x30(%rbp), %rsi
jae 0xf8c4
movq -0x38(%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 0xf98b
movq %rdx, -0x60(%rbp)
movq (%rbx), %rax
testq %rax, %rax
je 0xf96c
movq (%rax), %r12
testq %r12, %r12
je 0xf8ab
cmpq %rsi, %r12
movq -0x40(%rbp), %rdx
jbe 0xf86f
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 0xf862
movq (%r15), %r14
testq %r14, %r14
je 0xf855
movq (%r14), %rdi
callq *0x109f3(%rip)          # 0x20238
movq $0x0, (%r14)
movq %r14, %rdi
callq *0x109e3(%rip)          # 0x20238
movq %r15, %rdi
callq *0x109da(%rip)          # 0x20238
movq -0x40(%rbp), %rdx
cmpq %rdx, %r13
jae 0xf86f
incq %r13
cmpq %r12, %r13
jb 0xf81c
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 0xf8ab
incq %r12
movq (%rbx), %rdi
callq 0xf9c9
movq -0x30(%rbp), %rsi
decq %r12
cmpq %r12, %rsi
jne 0xf897
movq -0x60(%rbp), %rcx
leaq 0x1(%rcx), %rax
cmpq %r15, %rax
jae 0xf8c4
cmpq %r13, %rcx
movq %rax, %rdx
jb 0xf7d7
decq %r15
cmpq %r13, %r15
cmovaeq %r13, %r15
movq -0x38(%rbp), %rbx
subq %rbx, %r15
xorl %r12d, %r12d
cmpq $-0x1, %r15
je 0xf95a
incq %r15
movq (%r14), %rax
movq 0x8(%rax), %rcx
movq 0x18(%rax), %rax
imulq %rbx, %rax
movq (%rcx,%rax), %rdi
testq %rdi, %rdi
je 0xf90c
movq (%rdi), %rax
testq %rax, %rax
je 0xf90c
cmpq $0x0, (%rax)
je 0xf90c
incq %rbx
jmp 0xf950
callq 0xedfa
movq (%r14), %rdi
movq %rbx, %rsi
callq 0xf9c9
testl %eax, %eax
js 0xf957
movq 0x28(%r14), %rax
testq %rax, %rax
je 0xf96c
cmpq (%rax), %rbx
jae 0xf950
movq 0x8(%rax), %rcx
movq 0x18(%rax), %rax
imulq %rbx, %rax
movq (%rcx,%rax), %rdi
callq *0x108f4(%rip)          # 0x20238
movq 0x28(%r14), %rdi
movq %rbx, %rsi
callq 0xf9c9
decq %r15
jne 0xf8e1
jmp 0xf95a
movl %eax, %r12d
movl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xadd7(%rip), %rdi      # 0x1a74a
leaq 0xa0fc(%rip), %rsi      # 0x19a76
leaq 0xb84f(%rip), %rcx      # 0x1b1d0
movl $0x1c74, %edx           # imm = 0x1C74
callq 0x7120
leaq 0xacdb(%rip), %rdi      # 0x1a66d
leaq 0xa0dd(%rip), %rsi      # 0x19a76
leaq 0xb7a9(%rip), %rcx      # 0x1b149
movl $0x1500, %edx           # imm = 0x1500
callq 0x7120
leaq 0xa1be(%rip), %rdi      # 0x19b6f
leaq 0xa0be(%rip), %rsi      # 0x19a76
leaq 0xa1ed(%rip), %rcx      # 0x19bac
movl $0xb14, %edx            # imm = 0xB14
callq 0x7120