// File: chhylp123[P]hifiasm/Hash_Table.cpp
// Function: add_fake_cigar(Fake_Cigar*, unsigned int, int, void*)
void add_fake_cigar(Fake_Cigar* x, uint32_t gap_site, int32_t gap_shift, void *km)
{
    if(x->length + 1 > x->size)
    {
        x->size = x->length + 1;
        kroundup32(x->size);
        if(!km) {
            REALLOC(x->buffer, x->size);
        } else {
            KREALLOC(km, x->buffer, x->size);
        }
        // x->buffer = (uint64_t*)realloc(x->buffer, sizeof(uint64_t) * x->size);
    }

    x->buffer[x->length] = gap_site;
    x->buffer[x->length] = x->buffer[x->length] << 32;

    if(gap_shift < 0)
    {
        gap_shift = gap_shift * -1;
        gap_site = gap_shift;
        gap_site = gap_site << 1;
        gap_site = gap_site | ((uint32_t)1);
    }
    else
    {
        gap_site = gap_shift;
        gap_site = gap_site << 1;
    }

    x->buffer[x->length] = x->buffer[x->length] | ((uint32_t)gap_site);

    x->length++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movq -0x8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jbe 0x1e610
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
shrl %ecx
movq -0x8(%rbp), %rax
orl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
shrl $0x2, %ecx
movq -0x8(%rbp), %rax
orl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
shrl $0x4, %ecx
movq -0x8(%rbp), %rax
orl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
shrl $0x8, %ecx
movq -0x8(%rbp), %rax
orl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
shrl $0x10, %ecx
movq -0x8(%rbp), %rax
orl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
cmpq $0x0, -0x18(%rbp)
jne 0x1e5e7
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, %esi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1e60e
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, %edx
shlq $0x3, %rdx
callq 0x30e740
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1e610
movl -0xc(%rbp), %eax
movl %eax, %edx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq %rdx, (%rax,%rcx,8)
cmpl $0x0, -0x10(%rbp)
jge 0x1e675
imull $-0x1, -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
shll %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
orl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1e683
movl -0x10(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
shll %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq (%rax,%rcx,8), %rdx
movl -0xc(%rbp), %eax
orq %rax, %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
addq $0x20, %rsp
popq %rbp
retq