// File: /workspace/github_c_makefile_star2_O0/neosploit[P]compiler/libfort/lib/fort.c
// Function: vector_insert
FT_INTERNAL
int vector_insert(f_vector_t *vector, const void *item, size_t pos)
{
    assert(vector);
    assert(item);
    size_t needed_capacity = MAX(pos + 1, vector->m_size + 1);
    if (vector->m_capacity < needed_capacity) {
        if (vector_reallocate_(vector, needed_capacity) == -1)
            return FT_GEN_ERROR;
        vector->m_capacity = needed_capacity;
    }
    size_t offset = pos * vector->m_item_size;
    if (pos >= vector->m_size) {
        /* Data in the middle are not initialized */
        memcpy((char *)vector->m_data + offset, item, vector->m_item_size);
        vector->m_size = pos + 1;
        return FT_SUCCESS;
    } else {
        /* Shift following data by one position */
        memmove((char *)vector->m_data + offset + vector->m_item_size,
                (char *)vector->m_data + offset,
                vector->m_item_size * (vector->m_size - pos));
        memcpy((char *)vector->m_data + offset, item, vector->m_item_size);
        ++(vector->m_size);
        return FT_SUCCESS;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x13b5d
jmp 0x13b7c
leaq 0xfdcd(%rip), %rdi      # 0x23931
leaq 0xf02b(%rip), %rsi      # 0x22b96
movl $0x1c98, %edx           # imm = 0x1C98
leaq 0x10beb(%rip), %rcx     # 0x24762
callq 0x7120
cmpq $0x0, -0x18(%rbp)
je 0x13b85
jmp 0x13ba4
leaq 0xc6e3(%rip), %rdi      # 0x2026f
leaq 0xf003(%rip), %rsi      # 0x22b96
movl $0x1c99, %edx           # imm = 0x1C99
leaq 0x10bc3(%rip), %rcx     # 0x24762
callq 0x7120
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jbe 0x13bca
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x13bd9
movq -0x10(%rbp), %rax
movq (%rax), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x28(%rbp), %rax
jae 0x13c19
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x189d0
cmpl $-0x1, %eax
jne 0x13c0d
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x13cda
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
imulq 0x18(%rcx), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jb 0x13c6c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
addq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
callq 0x71d0
movq -0x20(%rbp), %rcx
addq $0x1, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x13cda
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
addq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
addq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
addq -0x30(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq -0x20(%rbp), %rax
imulq %rax, %rdx
callq 0x7200
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
addq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
callq 0x71d0
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)