// File: /workspace/github_c_makefile_star2_O0/neosploit[P]compiler/libfort/lib/fort.c
// Function: vector_swap
FT_INTERNAL
f_status vector_swap(f_vector_t *cur_vec, f_vector_t *mv_vec, size_t pos)
{
    assert(cur_vec);
    assert(mv_vec);
    assert(cur_vec != mv_vec);
    assert(cur_vec->m_item_size == mv_vec->m_item_size);

    size_t cur_sz = vector_size(cur_vec);
    size_t mv_sz = vector_size(mv_vec);
    if (mv_sz == 0) {
        return FT_SUCCESS;
    }

    size_t min_targ_size = pos + mv_sz;
    if (vector_capacity(cur_vec) < min_targ_size) {
        if (vector_reallocate_(cur_vec, min_targ_size) == -1)
            return FT_GEN_ERROR;
        cur_vec->m_capacity = min_targ_size;
    }

    size_t offset = pos * cur_vec->m_item_size;
    void *tmp = NULL;
    size_t new_mv_sz = 0;
    if (cur_sz > pos) {
        new_mv_sz = MIN(cur_sz - pos, mv_sz);
        tmp = F_MALLOC(cur_vec->m_item_size * new_mv_sz);
        if (tmp == NULL) {
            return FT_MEMORY_ERROR;
        }
    }

    if (tmp) {
        memcpy(tmp,
               (char *)cur_vec->m_data + offset,
               cur_vec->m_item_size * new_mv_sz);
    }

    memcpy((char *)cur_vec->m_data + offset,
           mv_vec->m_data,
           cur_vec->m_item_size * mv_sz);

    if (tmp) {
        memcpy(mv_vec->m_data,
               tmp,
               cur_vec->m_item_size * new_mv_sz);
    }

    cur_vec->m_size = MAX(cur_vec->m_size, min_targ_size);
    mv_vec->m_size = new_mv_sz;
    F_FREE(tmp);
    return FT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x1870d
jmp 0x1872c
leaq 0xb19e(%rip), %rdi      # 0x238b2
leaq 0xa47b(%rip), %rsi      # 0x22b96
movl $0x1cdf, %edx           # imm = 0x1CDF
leaq 0xb193(%rip), %rcx      # 0x238ba
callq 0x7120
cmpq $0x0, -0x18(%rbp)
je 0x18735
jmp 0x18754
leaq 0xb1c2(%rip), %rdi      # 0x238fe
leaq 0xa453(%rip), %rsi      # 0x22b96
movl $0x1ce0, %edx           # imm = 0x1CE0
leaq 0xb16b(%rip), %rcx      # 0x238ba
callq 0x7120
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x18760
jmp 0x1877f
leaq 0xb18c(%rip), %rdi      # 0x238f3
leaq 0xa428(%rip), %rsi      # 0x22b96
movl $0x1ce1, %edx           # imm = 0x1CE1
leaq 0xb140(%rip), %rcx      # 0x238ba
callq 0x7120
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jne 0x18793
jmp 0x187b2
leaq 0xb16b(%rip), %rdi      # 0x23905
leaq 0xa3f5(%rip), %rsi      # 0x22b96
movl $0x1ce2, %edx           # imm = 0x1CE2
leaq 0xb10d(%rip), %rcx      # 0x238ba
callq 0x7120
movq -0x10(%rbp), %rdi
callq 0x132b0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x132b0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x187df
movl $0x0, -0x4(%rbp)
jmp 0x1896a
movq -0x20(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x18980
cmpq -0x38(%rbp), %rax
jae 0x18824
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x189d0
cmpl $-0x1, %eax
jne 0x18818
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x1896a
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
imulq 0x18(%rcx), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jbe 0x188aa
movq -0x28(%rbp), %rax
subq -0x20(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x1886b
movq -0x28(%rbp), %rax
subq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x18873
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x50(%rbp)
movq 0x11b36(%rip), %rax     # 0x2a3b8
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rdi
imulq -0x50(%rbp), %rdi
callq *%rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x188a8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1896a
jmp 0x188aa
cmpq $0x0, -0x48(%rbp)
je 0x188d3
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
addq -0x40(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
imulq -0x50(%rbp), %rdx
callq 0x71d0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
addq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
imulq -0x30(%rbp), %rdx
callq 0x71d0
cmpq $0x0, -0x48(%rbp)
je 0x1891e
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x48(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
imulq -0x50(%rbp), %rdx
callq 0x71d0
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq -0x38(%rbp), %rax
jbe 0x18938
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x18940
movq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq 0x118cb(%rip), %rax     # 0x2a228
movq -0x48(%rbp), %rdi
callq *%rax
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)