// File: chhylp123[P]hifiasm/./Correct.h
// Function: add_cigar_record(char*, unsigned int, Cigar_record*, unsigned int)
inline void add_cigar_record(char* seq, uint32_t len, Cigar_record* dummy, uint32_t type)
{    
    if(type == 0)///match
    {
        ///add to existing cell, just increase length
        if((uint32_t)dummy->current_operation == type)
        {
            add_existing_cell_to_cigar_record(dummy, len, type);
        }
        else  ///add to new cell
        {
            add_new_cell_to_cigar_record(dummy, len, type);
        }

        dummy->new_read_length += len;
    }
    else if(type == 1)///mismatch
    {
        ///add to existing cell, just increase length
        ///and add different bases
        if((uint32_t)dummy->current_operation == type)
        {
            add_existing_cell_to_cigar_record_with_different_base(dummy, len, type, seq);
        }
        else
        {
            add_new_cell_to_cigar_record_with_different_base(dummy, len, type, seq);
        }

        dummy->new_read_length += len;
    }
    else if(type == 3)///deletion, the bases in previous read will be removed
    {
        ///add to existing cell, just increase length
        ///and add different bases
        if((uint32_t)dummy->current_operation == type)
        {
            add_existing_cell_to_cigar_record_with_different_base(dummy, len, type, seq);
        }
        else
        {
            add_new_cell_to_cigar_record_with_different_base(dummy, len, type, seq);
        }
    }
    else if(type == 2)///insertion
    {
        /**
        ///add to existing cell, just increase length
        if(dummy->current_operation == type)
        {
            add_existing_cell_to_cigar_record(dummy, len, type);
        }
        else  ///add to new cell
        {
            add_new_cell_to_cigar_record(dummy, len, type);
        }
        **/
       ///add to existing cell, just increase length
        ///and add different bases
        if((uint32_t)dummy->current_operation == type)
        {
            add_existing_cell_to_cigar_record_with_different_base(dummy, len, type, seq);
        }
        else
        {
            add_new_cell_to_cigar_record_with_different_base(dummy, len, type, seq);
        }

        dummy->new_read_length += len;
    }
    
    dummy->current_operation = type;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x1c6fa
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x1c6d9
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x1c(%rbp), %edx
callq 0x4cbf0
jmp 0x1c6e8
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x1c(%rbp), %edx
callq 0x4cb40
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
addl 0x20(%rax), %ecx
movl %ecx, 0x20(%rax)
jmp 0x1c7cf
cmpl $0x1, -0x1c(%rbp)
jne 0x1c746
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x1c721
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x1c(%rbp), %edx
movq -0x8(%rbp), %rcx
callq 0x4cdb0
jmp 0x1c734
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x1c(%rbp), %edx
movq -0x8(%rbp), %rcx
callq 0x4cc60
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
addl 0x20(%rax), %ecx
movl %ecx, 0x20(%rax)
jmp 0x1c7cd
cmpl $0x3, -0x1c(%rbp)
jne 0x1c782
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x1c76d
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x1c(%rbp), %edx
movq -0x8(%rbp), %rcx
callq 0x4cdb0
jmp 0x1c780
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x1c(%rbp), %edx
movq -0x8(%rbp), %rcx
callq 0x4cc60
jmp 0x1c7cb
cmpl $0x2, -0x1c(%rbp)
jne 0x1c7c9
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x1c7a9
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x1c(%rbp), %edx
movq -0x8(%rbp), %rcx
callq 0x4cdb0
jmp 0x1c7bc
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x1c(%rbp), %edx
movq -0x8(%rbp), %rcx
callq 0x4cc60
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
addl 0x20(%rax), %ecx
movl %ecx, 0x20(%rax)
jmp 0x1c7cb
jmp 0x1c7cd
jmp 0x1c7cf
movl -0x1c(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
addq $0x20, %rsp
popq %rbp
retq