// File: /workspace/github_c_makefile_star2_O0/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
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x13ec2
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x13ec2
jmp 0x13ee1
leaq 0xedc6(%rip), %rdi      # 0x22c8f
leaq 0xecc6(%rip), %rsi      # 0x22b96
movl $0xb14, %edx            # imm = 0xB14
leaq 0xedf0(%rip), %rcx      # 0x22ccc
callq 0x7120
movl $0x0, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x132b0
movq %rax, -0x40(%rbp)
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq %rax, -0x18(%rbp)
jne 0x13f0f
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq %rax, -0x28(%rbp)
jne 0x13f26
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq %rax, -0x20(%rbp)
jne 0x13f3d
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq %rax, -0x30(%rbp)
jne 0x13f54
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x28(%rbp), %rax
ja 0x13f68
movq -0x20(%rbp), %rax
cmpq -0x30(%rbp), %rax
jbe 0x13f74
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x14123
movq $0x0, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
xorl %eax, %eax
cmpq -0x40(%rbp), %rcx
movb %al, -0x69(%rbp)
jae 0x13fa1
movq -0x50(%rbp), %rax
cmpq -0x28(%rbp), %rax
setbe %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x13faa
jmp 0x13ff4
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x50(%rbp), %rsi
callq 0x13350
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x14130
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0x13fe6
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14123
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x13f84
movq $0x0, -0x58(%rbp)
movq -0x40(%rbp), %rax
subq $0x1, %rax
cmpq -0x28(%rbp), %rax
jae 0x14018
movq -0x40(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x14020
movq -0x28(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
subq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x60(%rbp), %rax
jae 0x1411c
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x50(%rbp), %rsi
callq 0x13350
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x14270
cmpq $0x0, %rax
je 0x1408a
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x14109
movq -0x48(%rbp), %rdi
callq 0x13300
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x50(%rbp), %rsi
callq 0x142c0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0x140b4
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14123
movq -0x50(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x132b0
movq %rax, %rcx
movq -0x80(%rbp), %rax
cmpq %rcx, %rax
jae 0x14107
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x50(%rbp), %rsi
callq 0x13350
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x133a0
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x50(%rbp), %rsi
callq 0x142c0
jmp 0x14109
jmp 0x1410b
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x14048
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nop