// File: chhylp123[P]hifiasm/Correct.cpp
// Function: cluster_advance(char*, long long, long long, overlap_region_alloc*, Correct_dumy*, All_reads*, haplotype_evdience_alloc*, UC_Read*, int)
void cluster_advance(char* r_string, long long window_start, long long window_end, 
overlap_region_alloc* overlap_list, Correct_dumy* dumy, All_reads* R_INF, 
haplotype_evdience_alloc* hap, UC_Read* overlap_read, int snp_threshold)
{
    window_list* beg_cigar;
    window_list* end_cigar;
    ///window_start, window_end, and useful_length correspond to x, instead of y
    long long useful_length = window_end - window_start + 1;
    long long x_start, x_length, ll = hap->length, lr;
    char* x_string;
    char* y_string;
    long long i;
    long long y_start, y_length;
    long long overlapID, windowID;

    long long correct_x_pos_s;


    ///all overlaps related to the current window [window_start, window_end]
    ///first mark all snp pos
    for (i = 0; i < (long long)dumy->length; i++)
    {
        ///overlap id, instead of the window id or the y id
        overlapID = dumy->overlapID[i];

        ///overlap_list->list[overlapID].x_pos_s is the begining of the whole overlap
        correct_x_pos_s = (overlap_list->list[overlapID].x_pos_s / WINDOW) * WINDOW;
        ///window_start is the begining of this window in the whole x_read
        windowID = (window_start - correct_x_pos_s) / WINDOW;

        ///skip if this window is not matched
        if (overlap_list->list[overlapID].w_list.a[windowID].y_end == -1)
        {
            continue;
        }
        
        ///both x_start and y_start are the offsets of the whole x_read and y_read
        ///instead of the offsets of window
        x_start = overlap_list->list[overlapID].w_list.a[windowID].x_start;
        x_length = overlap_list->list[overlapID].w_list.a[windowID].x_end + 1
                - overlap_list->list[overlapID].w_list.a[windowID].x_start;

        y_start = overlap_list->list[overlapID].w_list.a[windowID].y_start;
        y_length = overlap_list->list[overlapID].w_list.a[windowID].y_end + 1
                - overlap_list->list[overlapID].w_list.a[windowID].y_start;

        beg_cigar = end_cigar = NULL;
        
        if(windowID >= 1)
        {
            beg_cigar = &(overlap_list->list[overlapID].boundary_cigars.a[windowID-1]);
        }

        if(windowID < (long long)(overlap_list->list[overlapID].w_list.n) - 1)
        {
            end_cigar = &(overlap_list->list[overlapID].boundary_cigars.a[windowID]);
        }
            

        markSNP_advance(window_start, x_start, x_length, y_start, y_length, 
        &(overlap_list->list[overlapID].w_list.a[windowID]), &(overlap_list->list[overlapID].w_list),
        beg_cigar, &(overlap_list->list[overlapID].boundary_cigars),
        end_cigar, &(overlap_list->list[overlapID].boundary_cigars), hap, NULL, 
        overlap_list->list[overlapID].y_pos_strand, overlap_list->list[overlapID].y_id);
    }


    /****************************may have bugs********************************/
    long long last_snp = -1;
    long long first_snp = -1;
    for (i = 0, lr = 0; i < useful_length; i++)
    {
        if(hap->flag[i] != 0)
        {
            last_snp = i;
            if(first_snp == -1)
            {
                first_snp = i;
            }
        }
        ///for a real snp, the coverage should be at least 2
        if(hap->flag[i] > snp_threshold)
        {
            // hap->snp++; 
            hap->nn_snp++;
            lr++;
        }
    }
    ///if there are any >0 elements, both first_snp and last_snp should be != -1
    if(first_snp == -1 || last_snp == -1)
    {
        first_snp = 0;
        last_snp = -1;
    }
    /****************************may have bugs********************************/



    ///add the information related to snp to haplotype_evdience_alloc
    for (i = 0; i < (long long)dumy->length; i++)
    {
        ///overlap ID, instead of the window ID
        overlapID = dumy->overlapID[i];

        ///overlap_list->list[overlapID].x_pos_s is the begining of the whole overlap
        correct_x_pos_s = (overlap_list->list[overlapID].x_pos_s / WINDOW) * WINDOW;
        ///window_start is the begining of this window in the whole x_read
        windowID = (window_start - correct_x_pos_s) / WINDOW;

        ///skip if this window is not matched
        if (overlap_list->list[overlapID].w_list.a[windowID].y_end == -1)
        {
            continue;
        }
        
        ///both x_start and y_start are the offsets of the whole x_read and y_read
        ///instead of the offsets of window
        x_start = overlap_list->list[overlapID].w_list.a[windowID].x_start;
        x_length = overlap_list->list[overlapID].w_list.a[windowID].x_end 
                - overlap_list->list[overlapID].w_list.a[windowID].x_start + 1;

        y_start = overlap_list->list[overlapID].w_list.a[windowID].y_start;
        y_length = overlap_list->list[overlapID].w_list.a[windowID].y_end
                - overlap_list->list[overlapID].w_list.a[windowID].y_start + 1;


        if(overlap_list->list[overlapID].y_pos_strand == 0)
        {
            recover_UC_Read(overlap_read, R_INF, overlap_list->list[overlapID].y_id);
        }
        else
        {
            recover_UC_Read_RC(overlap_read, R_INF, overlap_list->list[overlapID].y_id);
        }
        
        x_string = r_string;
        y_string = overlap_read->seq;


        beg_cigar = end_cigar = NULL;
        if(windowID >= 1)
        {
            beg_cigar = &(overlap_list->list[overlapID].boundary_cigars.a[windowID-1]);
        }
        if(windowID < (long long)(overlap_list->list[overlapID].w_list.n) - 1)
        {
            end_cigar = &(overlap_list->list[overlapID].boundary_cigars.a[windowID]);
        }


        addSNPtohaplotype_advance(window_start, overlapID, x_start, x_length, y_start, y_length, 
        &(overlap_list->list[overlapID].w_list.a[windowID]), &(overlap_list->list[overlapID].w_list),
        beg_cigar, &(overlap_list->list[overlapID].boundary_cigars), 
        end_cigar, &(overlap_list->list[overlapID].boundary_cigars), 
        hap, snp_threshold, x_string, y_string, NULL, overlap_list->list[overlapID].y_pos_strand, 
        overlap_list->list[overlapID].y_id, NULL);                
    }

    RsetInitHaplotypeEvdienceFlag(hap, first_snp, last_snp + 1 - first_snp);

    if(hap->length - ll > 1 && lr > 1) radix_sort_haplotype_evdience_srt(hap->list+ll, hap->list + hap->length);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
movq -0x40(%rbp), %rax
subq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
movq 0x10(%rbp), %rax
movl 0x10(%rax), %eax
movq %rax, -0x88(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq -0x50(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jge 0x3ca3c
movq -0x50(%rbp), %rax
movq 0x28(%rax), %rax
movq -0xa8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xc0(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl $0x177, %ecx            # imm = 0x177
xorl %edx, %edx
divl %ecx
imull $0x177, %eax, %eax      # imm = 0x177
movl %eax, %eax
movq %rax, -0xd0(%rbp)
movq -0x38(%rbp), %rax
subq -0xd0(%rbp), %rax
movl $0x177, %ecx            # imm = 0x177
cqto
idivq %rcx
movq %rax, -0xc8(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $-0x1, 0xc(%rax)
jne 0x3c74d
jmp 0x3ca25
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0xc0(%rbp), %rdx
addq %rdx, %rcx
movq 0x58(%rcx), %rcx
movq -0xc8(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
subl (%rcx), %eax
cltq
movq %rax, -0x80(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x8(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
addl $0x1, %eax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0xc0(%rbp), %rdx
addq %rdx, %rcx
movq 0x58(%rcx), %rcx
movq -0xc8(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
subl 0x8(%rcx), %eax
cltq
movq %rax, -0xb8(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
cmpq $0x1, -0xc8(%rbp)
jl 0x3c8b5
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x88(%rax), %rax
movq -0xc8(%rbp), %rcx
subq $0x1, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0xc8(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0xc0(%rbp), %rdx
addq %rdx, %rcx
movq 0x48(%rcx), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jge 0x3c90c
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x88(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rdx
movq -0xb0(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xb8(%rbp), %r8
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %r9
movq -0xc8(%rbp), %rax
shlq $0x5, %rax
addq %rax, %r9
movq -0x48(%rbp), %rax
movq (%rax), %r13
imulq $0xa8, -0xc0(%rbp), %rax
addq %rax, %r13
addq $0x48, %r13
movq -0x60(%rbp), %r12
movq -0x48(%rbp), %rax
movq (%rax), %r15
imulq $0xa8, -0xc0(%rbp), %rax
addq %rax, %r15
addq $0x78, %r15
movq -0x68(%rbp), %r14
movq -0x48(%rbp), %rax
movq (%rax), %rbx
imulq $0xa8, -0xc0(%rbp), %rax
addq %rax, %rbx
addq $0x78, %rbx
movq 0x10(%rbp), %r11
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movl 0x1c(%rax), %r10d
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq -0xf0(%rbp), %rcx
movl 0x10(%rax), %eax
movl %eax, -0xe4(%rbp)
xorl %eax, %eax
movl -0xe4(%rbp), %eax
movq %r13, (%rsp)
movq %r12, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
movq %r11, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
movl %r10d, 0x38(%rsp)
movl %eax, 0x40(%rsp)
callq 0x3b960
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x3c6a0
movq $-0x1, -0xd8(%rbp)
movq $-0x1, -0xe0(%rbp)
movq $0x0, -0xa8(%rbp)
movq $0x0, -0x90(%rbp)
movq -0xa8(%rbp), %rax
cmpq -0x70(%rbp), %rax
jge 0x3cb09
movq 0x10(%rbp), %rax
movq -0xa8(%rbp), %rcx
movzbl 0x18(%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x3cab6
movq -0xa8(%rbp), %rax
movq %rax, -0xd8(%rbp)
cmpq $-0x1, -0xe0(%rbp)
jne 0x3cab4
movq -0xa8(%rbp), %rax
movq %rax, -0xe0(%rbp)
jmp 0x3cab6
movq 0x10(%rbp), %rax
movq -0xa8(%rbp), %rcx
movzbl 0x18(%rax,%rcx), %eax
cmpl 0x20(%rbp), %eax
jle 0x3caf0
movq 0x10(%rbp), %rax
movl 0x230(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x230(%rax)
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x3caf2
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x3ca68
cmpq $-0x1, -0xe0(%rbp)
je 0x3cb1d
cmpq $-0x1, -0xd8(%rbp)
jne 0x3cb33
movq $0x0, -0xe0(%rbp)
movq $-0x1, -0xd8(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq -0x50(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jge 0x3cfce
movq -0x50(%rbp), %rax
movq 0x28(%rax), %rax
movq -0xa8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xc0(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl $0x177, %ecx            # imm = 0x177
xorl %edx, %edx
divl %ecx
imull $0x177, %eax, %eax      # imm = 0x177
movl %eax, %eax
movq %rax, -0xd0(%rbp)
movq -0x38(%rbp), %rax
subq -0xd0(%rbp), %rax
movl $0x177, %ecx            # imm = 0x177
cqto
idivq %rcx
movq %rax, -0xc8(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $-0x1, 0xc(%rax)
jne 0x3cbeb
jmp 0x3cfb7
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0xc0(%rbp), %rdx
addq %rdx, %rcx
movq 0x58(%rcx), %rcx
movq -0xc8(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
subl (%rcx), %eax
addl $0x1, %eax
cltq
movq %rax, -0x80(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x8(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0xc0(%rbp), %rdx
addq %rdx, %rcx
movq 0x58(%rcx), %rcx
movq -0xc8(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
subl 0x8(%rcx), %eax
addl $0x1, %eax
cltq
movq %rax, -0xb8(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
cmpl $0x0, 0x1c(%rax)
jne 0x3cd4b
movq 0x18(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, %edx
callq 0xa380
jmp 0x3cd72
movq 0x18(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, %edx
callq 0xa500
movq -0x30(%rbp), %rax
movq %rax, -0x98(%rbp)
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
cmpq $0x1, -0xc8(%rbp)
jl 0x3cdd7
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x88(%rax), %rax
movq -0xc8(%rbp), %rcx
subq $0x1, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0xc8(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0xc0(%rbp), %rdx
addq %rdx, %rcx
movq 0x48(%rcx), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jge 0x3ce2e
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x88(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rdi
movq -0xc0(%rbp), %rax
movl %eax, %esi
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0xb0(%rbp), %r8
movq -0xb8(%rbp), %r9
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x118(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
addq $0x48, %rax
movq %rax, -0x110(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
addq $0x78, %rax
movq %rax, -0x100(%rbp)
movq -0x68(%rbp), %r13
movq -0x48(%rbp), %rax
movq (%rax), %r12
imulq $0xa8, -0xc0(%rbp), %rax
addq %rax, %r12
addq $0x78, %r12
movq 0x10(%rbp), %r15
movl 0x20(%rbp), %r14d
movq -0x98(%rbp), %rbx
movq -0xa0(%rbp), %r11
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movl 0x1c(%rax), %r10d
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq -0x120(%rbp), %rcx
movl 0x10(%rax), %eax
movl %eax, -0xf4(%rbp)
xorl %eax, %eax
movq -0x118(%rbp), %rax
movq %rax, (%rsp)
movq -0x110(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0x108(%rbp), %rax
movq %rax, 0x10(%rsp)
movq -0x100(%rbp), %rax
movq %rax, 0x18(%rsp)
movl -0xf4(%rbp), %eax
movq %r13, 0x20(%rsp)
movq %r12, 0x28(%rsp)
movq %r15, 0x30(%rsp)
movl %r14d, 0x38(%rsp)
movq %rbx, 0x40(%rsp)
movq %r11, 0x48(%rsp)
movq $0x0, 0x50(%rsp)
movl %r10d, 0x58(%rsp)
movl %eax, 0x60(%rsp)
movq $0x0, 0x68(%rsp)
callq 0x3c050
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x3cb3e
movq 0x10(%rbp), %rdi
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdx
addq $0x1, %rdx
subq -0xe0(%rbp), %rdx
callq 0xa0fe0
movq 0x10(%rbp), %rax
movl 0x10(%rax), %eax
subq -0x88(%rbp), %rax
cmpq $0x1, %rax
jle 0x3d03a
cmpq $0x1, -0x90(%rbp)
jle 0x3d03a
movq 0x10(%rbp), %rax
movq (%rax), %rdi
imulq $0x18, -0x88(%rbp), %rax
addq %rax, %rdi
movq 0x10(%rbp), %rax
movq (%rax), %rsi
movq 0x10(%rbp), %rax
movl 0x10(%rax), %eax
imulq $0x18, %rax, %rax
addq %rax, %rsi
callq 0x2df30
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)