// File: chhylp123[P]hifiasm/Purge_Dups.cpp
// Function: calculate_pair_hap_similarity_advance(hap_candidates*, unsigned long*, unsigned int, unsigned int, ma_utg_t*, ma_utg_t*, ma_hit_t_alloc*, ma_hit_t_alloc*, asg_t*, R_to_U*, ma_sub_t*, float, int, int, int, unsigned long, kvec_asg_arc_t_offset*, kvec_t_i32_warp*, kvec_t_i32_warp*, hap_cov_t*, long long*, long long*, long long*, long long*, float*)
uint32_t calculate_pair_hap_similarity_advance(hap_candidates* hap_can, 
uint64_t* position_index, uint32_t xUid, uint32_t yUid, ma_utg_t* xReads, ma_utg_t* yReads,
ma_hit_t_alloc* sources, ma_hit_t_alloc* reverse_sources, asg_t *read_g, R_to_U* ruIndex, ma_sub_t *coverage_cut, 
float Hap_rate, int is_local, int max_hang, int min_ovlp, uint64_t cov_threshold, kvec_asg_arc_t_offset* u_buffer, 
kvec_t_i32_warp* tailIndex, kvec_t_i32_warp* prevIndex, hap_cov_t *cov, long long* r_x_pos_beg, long long* r_x_pos_end, 
long long* r_y_pos_beg, long long* r_y_pos_end, float *sim)
{
    uint32_t max_count = 0, min_count = 0, flag;
    uint32_t xLen = xReads->n, xIndex;
    uint32_t yLen = yReads->n, yIndex;
    uint32_t xLeftBeg, xLeftLen, yLeftBeg, yLeftLen;
    uint32_t xRightBeg, xRightLen, yRightBeg, yRightLen;
    double xLeftMatch = 0, xLeftTotal = 0, yLeftMatch = 0, yLeftTotal = 0;
    double xRightMatch = 0, xRightTotal = 0, yRightMatch = 0, yRightTotal = 0;
    asg_arc_t* arch = NULL;
    

    arch = &(hap_can->t);
    xIndex = (uint32_t)(position_index[arch->ul>>33]);
    yIndex = (uint32_t)(position_index[arch->v>>1]);
    
    if(hap_can->rev == 0)
    {
        xLeftBeg = 0; xLeftLen = xIndex; xRightBeg = xIndex; xRightLen = xLen - xRightBeg;
        yLeftBeg = 0; yLeftLen = yIndex; yRightBeg = yIndex; yRightLen = yLen - yRightBeg;
    }
    else
    {
        xLeftBeg = 0; xLeftLen = xIndex; xRightBeg = xIndex; xRightLen = xLen - xRightBeg;

        yLeftBeg = yIndex + 1; yLeftLen = yLen - yLeftBeg;
        yRightBeg = 0; yRightLen = yIndex + 1;
    }

    flag = Get_type(*hap_can);


    if(flag == XCY)
    {
        get_pair_hap_similarity(yReads->a, yLen, xUid, reverse_sources, read_g, ruIndex, 
        &yLeftMatch, &yLeftTotal);
        max_count = yLeftMatch;
        min_count = yLeftTotal;
    }
    else if(flag == YCX)
    {
        get_pair_hap_similarity(xReads->a, xLen, yUid, reverse_sources, read_g, ruIndex, 
        &xLeftMatch, &xLeftTotal);
        max_count = xLeftMatch;
        min_count = xLeftTotal;
    }
    else if(flag == X2Y)
    {
        get_pair_hap_similarity(yReads->a+yLeftBeg, yLeftLen, xUid, reverse_sources, read_g, ruIndex,
        &yLeftMatch, &yLeftTotal);
        get_pair_hap_similarity(xReads->a+xRightBeg, xRightLen, yUid, reverse_sources, read_g, ruIndex, 
        &xRightMatch, &xRightTotal);
        max_count = yLeftMatch + xRightMatch;
        min_count = yLeftTotal + xRightTotal;
    }
    else if(flag == Y2X)
    {
        get_pair_hap_similarity(xReads->a+xLeftBeg, xLeftLen, yUid, reverse_sources, read_g, ruIndex, 
        &xLeftMatch, &xLeftTotal);
        get_pair_hap_similarity(yReads->a+yRightBeg, yRightLen, xUid, reverse_sources, read_g, ruIndex,
        &yRightMatch, &yRightTotal);
        max_count = xLeftMatch + yRightMatch;
        min_count = xLeftTotal + yRightTotal;
    } else abort();

    hap_can->weight = hap_can->index_beg = 0;
    if(min_count == 0) return NON_PLOID;
    if((max_count > min_count*Hap_rate) || is_local)
    {
        long long r_x_interval_beg, r_x_interval_end, r_y_interval_beg, r_y_interval_end;
        uint64_t ploid_coverage = 0;

        ///for containment, don't need to do anything
        get_hap_alignment_boundary(xReads, yReads, flag, xLeftMatch, xLeftTotal, 
        yLeftMatch, yLeftTotal, xRightMatch, xRightTotal, yRightMatch, yRightTotal,
        xLeftBeg, xLeftLen, yLeftBeg, yLeftLen, xRightBeg, xRightLen, yRightBeg, yRightLen,
        xUid, yUid, Hap_rate, is_local, position_index, reverse_sources, read_g, ruIndex, 
        hap_can->rev, &r_x_interval_beg, &r_x_interval_end, &r_y_interval_beg, &r_y_interval_end);

        if(r_x_interval_beg < 0 || r_x_interval_end < 0 || r_y_interval_beg < 0 || r_y_interval_end < 0)
        {
            return NON_PLOID;
        }

        get_pair_hap_similarity(xReads->a + r_x_interval_beg, r_x_interval_end + 1 - r_x_interval_beg, 
        yUid, reverse_sources, read_g, ruIndex, &xLeftMatch, &xLeftTotal);
        if(xLeftMatch == 0 || xLeftTotal == 0 || (is_local == 0 && xLeftMatch <= xLeftTotal*Hap_rate))
        {
            return NON_PLOID;
        }
                
        
        hap_can->weight = xLeftMatch;
        hap_can->index_beg = xLeftTotal;
        hap_can->index_end = flag;
        hap_can->x_beg_pos = r_x_interval_beg;
        hap_can->x_end_pos = r_x_interval_end;
        hap_can->y_beg_pos = r_y_interval_beg;
        hap_can->y_end_pos = r_y_interval_end;
        hap_can->index_end = determine_hap_overlap_type_advance(hap_can, xReads, yReads,
        ruIndex, reverse_sources, coverage_cut, read_g, position_index, max_hang, min_ovlp, 
        xUid, yUid, u_buffer, tailIndex, prevIndex, r_x_pos_beg, r_x_pos_end, r_y_pos_beg, 
        r_y_pos_end);
        if(hap_can->index_end == XCY && yReads->len > (xReads->len*2)) return NON_PLOID;
        if(hap_can->index_end == YCX && xReads->len > (yReads->len*2)) return NON_PLOID;
        if(hap_can->index_end == (uint32_t)-1) return NON_PLOID;

        ploid_coverage = get_pair_purge_coverage(xReads, *r_x_pos_beg, *r_x_pos_end, 
        yReads, *r_y_pos_beg, *r_y_pos_end, hap_can->rev, read_g, cov);

        if(cov_threshold > 0 && ploid_coverage >= cov_threshold) return NON_PLOID;

        get_pair_hap_similarity_by_base(xReads, read_g, yUid, reverse_sources, ruIndex, 
        *r_x_pos_beg, *r_x_pos_end, &xLeftMatch, &xLeftTotal);
        (*sim) = (xLeftTotal== 0? 0:((double)xLeftMatch)/((double)xLeftTotal));

        // adjust_hap_overlaps_score(xReads, sim, &(hap_can->score), xUid, yUid, (*r_x_pos_beg), (*r_x_pos_end));

        if(xLeftMatch == 0 || xLeftTotal == 0 || (*sim) <= Hap_rate)
        {
            return NON_PLOID;
        }

        return PLOID;
    } 
	return NON_PLOID;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq 0x98(%rbp), %rax
movq 0x90(%rbp), %rax
movq 0x88(%rbp), %rax
movq 0x80(%rbp), %rax
movq 0x78(%rbp), %rax
movq 0x70(%rbp), %rax
movq 0x68(%rbp), %rax
movq 0x60(%rbp), %rax
movq 0x58(%rbp), %rax
movq 0x50(%rbp), %rax
movl 0x48(%rbp), %eax
movl 0x40(%rbp), %eax
movl 0x38(%rbp), %eax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x38(%rbp)
movq %rsi, -0x40(%rbp)
movl %edx, -0x44(%rbp)
movl %ecx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
movss %xmm0, -0x5c(%rbp)
movl $0x0, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movq -0x50(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x6c(%rbp)
movq -0x58(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x74(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xa0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xa8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xb0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xb8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xc0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xc8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xd0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xd8(%rbp)
movq $0x0, -0xe0(%rbp)
movq -0x38(%rbp), %rax
addq $0x30, %rax
movq %rax, -0xe0(%rbp)
movq -0x40(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rcx), %rcx
shrq $0x21, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x70(%rbp)
movq -0x40(%rbp), %rax
movq -0xe0(%rbp), %rcx
movl 0x8(%rcx), %ecx
shrl %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x78(%rbp)
movq -0x38(%rbp), %rax
movzbl 0x28(%rax), %eax
cmpl $0x0, %eax
jne 0x178065
movl $0x0, -0x7c(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x6c(%rbp), %eax
subl -0x8c(%rbp), %eax
movl %eax, -0x90(%rbp)
movl $0x0, -0x84(%rbp)
movl -0x78(%rbp), %eax
movl %eax, -0x88(%rbp)
movl -0x78(%rbp), %eax
movl %eax, -0x94(%rbp)
movl -0x74(%rbp), %eax
subl -0x94(%rbp), %eax
movl %eax, -0x98(%rbp)
jmp 0x1780bb
movl $0x0, -0x7c(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x6c(%rbp), %eax
subl -0x8c(%rbp), %eax
movl %eax, -0x90(%rbp)
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
movl -0x74(%rbp), %eax
subl -0x84(%rbp), %eax
movl %eax, -0x88(%rbp)
movl $0x0, -0x94(%rbp)
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
movq -0x38(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x68(%rbp)
cmpl $0x2, -0x68(%rbp)
jne 0x17811f
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rdi
movl -0x74(%rbp), %esi
movl -0x44(%rbp), %edx
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %r8
movq 0x28(%rbp), %r9
movq %rsp, %rax
leaq -0xb8(%rbp), %r10
movq %r10, 0x8(%rax)
leaq -0xb0(%rbp), %r10
movq %r10, (%rax)
callq 0x1711f0
cvttsd2si -0xb0(%rbp), %rax
movl %eax, -0x60(%rbp)
cvttsd2si -0xb8(%rbp), %rax
movl %eax, -0x64(%rbp)
jmp 0x178319
cmpl $0x3, -0x68(%rbp)
jne 0x178179
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rdi
movl -0x6c(%rbp), %esi
movl -0x48(%rbp), %edx
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %r8
movq 0x28(%rbp), %r9
movq %rsp, %rax
leaq -0xa8(%rbp), %r10
movq %r10, 0x8(%rax)
leaq -0xa0(%rbp), %r10
movq %r10, (%rax)
callq 0x1711f0
cvttsd2si -0xa0(%rbp), %rax
movl %eax, -0x60(%rbp)
cvttsd2si -0xa8(%rbp), %rax
movl %eax, -0x64(%rbp)
jmp 0x178317
cmpl $0x0, -0x68(%rbp)
jne 0x178248
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x84(%rbp), %ecx
leaq (%rax,%rcx,8), %rdi
movl -0x88(%rbp), %esi
movl -0x44(%rbp), %edx
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %r8
movq 0x28(%rbp), %r9
movq %rsp, %rax
leaq -0xb8(%rbp), %r10
movq %r10, 0x8(%rax)
leaq -0xb0(%rbp), %r10
movq %r10, (%rax)
callq 0x1711f0
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x8c(%rbp), %ecx
leaq (%rax,%rcx,8), %rdi
movl -0x90(%rbp), %esi
movl -0x48(%rbp), %edx
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %r8
movq 0x28(%rbp), %r9
movq %rsp, %rax
leaq -0xc8(%rbp), %r10
movq %r10, 0x8(%rax)
leaq -0xc0(%rbp), %r10
movq %r10, (%rax)
callq 0x1711f0
movsd -0xb0(%rbp), %xmm0
movsd -0xc0(%rbp), %xmm1
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x60(%rbp)
movsd -0xb8(%rbp), %xmm0
movsd -0xc8(%rbp), %xmm1
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x64(%rbp)
jmp 0x178315
cmpl $0x1, -0x68(%rbp)
jne 0x17830e
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x7c(%rbp), %ecx
leaq (%rax,%rcx,8), %rdi
movl -0x80(%rbp), %esi
movl -0x48(%rbp), %edx
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %r8
movq 0x28(%rbp), %r9
movq %rsp, %rax
leaq -0xa8(%rbp), %r10
movq %r10, 0x8(%rax)
leaq -0xa0(%rbp), %r10
movq %r10, (%rax)
callq 0x1711f0
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x94(%rbp), %ecx
leaq (%rax,%rcx,8), %rdi
movl -0x98(%rbp), %esi
movl -0x44(%rbp), %edx
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %r8
movq 0x28(%rbp), %r9
movq %rsp, %rax
leaq -0xd8(%rbp), %r10
movq %r10, 0x8(%rax)
leaq -0xd0(%rbp), %r10
movq %r10, (%rax)
callq 0x1711f0
movsd -0xa0(%rbp), %xmm0
movsd -0xd0(%rbp), %xmm1
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x60(%rbp)
movsd -0xa8(%rbp), %xmm0
movsd -0xd8(%rbp), %xmm1
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x64(%rbp)
jmp 0x178313
callq 0x2110
jmp 0x178315
jmp 0x178317
jmp 0x178319
movq -0x38(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
cmpl $0x0, -0x64(%rbp)
jne 0x178341
movl $0x1, -0x2c(%rbp)
jmp 0x1789e4
movl -0x60(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x64(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x5c(%rbp), %xmm1
ucomiss %xmm1, %xmm0
ja 0x178365
cmpl $0x0, 0x38(%rbp)
je 0x1789dd
movq $0x0, -0x108(%rbp)
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl -0x68(%rbp), %edx
cvttsd2si -0xa0(%rbp), %rax
movl %eax, %ecx
cvttsd2si -0xa8(%rbp), %rax
movl %eax, %r8d
cvttsd2si -0xb0(%rbp), %rax
movl %eax, %r9d
cvttsd2si -0xb8(%rbp), %rax
movl %eax, -0x158(%rbp)
cvttsd2si -0xc0(%rbp), %rax
movl %eax, -0x154(%rbp)
cvttsd2si -0xc8(%rbp), %rax
movl %eax, -0x150(%rbp)
cvttsd2si -0xd0(%rbp), %rax
movl %eax, -0x14c(%rbp)
cvttsd2si -0xd8(%rbp), %rax
movl %eax, -0x148(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x144(%rbp)
movl -0x80(%rbp), %eax
movl %eax, -0x140(%rbp)
movl -0x84(%rbp), %eax
movl %eax, -0x13c(%rbp)
movl -0x88(%rbp), %eax
movl %eax, -0x138(%rbp)
movl -0x8c(%rbp), %eax
movl %eax, -0x134(%rbp)
movl -0x90(%rbp), %eax
movl %eax, -0x130(%rbp)
movl -0x94(%rbp), %eax
movl %eax, -0x12c(%rbp)
movl -0x98(%rbp), %eax
movl %eax, -0x128(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x124(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x120(%rbp)
movss -0x5c(%rbp), %xmm0
movl 0x38(%rbp), %eax
movl %eax, -0x11c(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x118(%rbp)
movq 0x18(%rbp), %r13
movq 0x20(%rbp), %r12
movq 0x28(%rbp), %r15
movq -0x38(%rbp), %rax
movzbl 0x28(%rax), %r14d
leaq -0xe8(%rbp), %rbx
leaq -0xf0(%rbp), %r11
leaq -0xf8(%rbp), %r10
leaq -0x100(%rbp), %rax
movq %rax, -0x110(%rbp)
movl -0x158(%rbp), %eax
movl %eax, (%rsp)
movl -0x154(%rbp), %eax
movl %eax, 0x8(%rsp)
movl -0x150(%rbp), %eax
movl %eax, 0x10(%rsp)
movl -0x14c(%rbp), %eax
movl %eax, 0x18(%rsp)
movl -0x148(%rbp), %eax
movl %eax, 0x20(%rsp)
movl -0x144(%rbp), %eax
movl %eax, 0x28(%rsp)
movl -0x140(%rbp), %eax
movl %eax, 0x30(%rsp)
movl -0x13c(%rbp), %eax
movl %eax, 0x38(%rsp)
movl -0x138(%rbp), %eax
movl %eax, 0x40(%rsp)
movl -0x134(%rbp), %eax
movl %eax, 0x48(%rsp)
movl -0x130(%rbp), %eax
movl %eax, 0x50(%rsp)
movl -0x12c(%rbp), %eax
movl %eax, 0x58(%rsp)
movl -0x128(%rbp), %eax
movl %eax, 0x60(%rsp)
movl -0x124(%rbp), %eax
movl %eax, 0x68(%rsp)
movl -0x120(%rbp), %eax
movl %eax, 0x70(%rsp)
movl -0x11c(%rbp), %eax
movl %eax, 0x78(%rsp)
movq -0x118(%rbp), %rax
movq %rax, 0x80(%rsp)
movq -0x110(%rbp), %rax
movq %r13, 0x88(%rsp)
movq %r12, 0x90(%rsp)
movq %r15, 0x98(%rsp)
movl %r14d, 0xa0(%rsp)
movq %rbx, 0xa8(%rsp)
movq %r11, 0xb0(%rsp)
movq %r10, 0xb8(%rsp)
movq %rax, 0xc0(%rsp)
callq 0x171cc0
cmpq $0x0, -0xe8(%rbp)
jl 0x1785c8
cmpq $0x0, -0xf0(%rbp)
jl 0x1785c8
cmpq $0x0, -0xf8(%rbp)
jl 0x1785c8
cmpq $0x0, -0x100(%rbp)
jge 0x1785d4
movl $0x1, -0x2c(%rbp)
jmp 0x1789e4
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0xe8(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0xf0(%rbp), %rax
addq $0x1, %rax
subq -0xe8(%rbp), %rax
movl %eax, %esi
movl -0x48(%rbp), %edx
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %r8
movq 0x28(%rbp), %r9
leaq -0xa0(%rbp), %r10
leaq -0xa8(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1711f0
movsd -0xa0(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x17863e
jp 0x17863e
jmp 0x17867c
movsd -0xa8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x178653
jp 0x178653
jmp 0x17867c
cmpl $0x0, 0x38(%rbp)
jne 0x178688
movsd -0xa0(%rbp), %xmm1
movsd -0xa8(%rbp), %xmm0
movss -0x5c(%rbp), %xmm2
cvtss2sd %xmm2, %xmm2
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x178688
movl $0x1, -0x2c(%rbp)
jmp 0x1789e4
movsd -0xa0(%rbp), %xmm0
movsd 0x209960(%rip), %xmm2   # 0x381ff8
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rdx, %rax
orq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
cvttsd2si -0xa8(%rbp), %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x18(%rax)
movl -0x68(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0xe8(%rbp), %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0xf0(%rbp), %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0xf8(%rbp), %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x100(%rbp), %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x38(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq 0x28(%rbp), %rcx
movq 0x18(%rbp), %r8
movq 0x30(%rbp), %r9
movq 0x20(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x178(%rbp)
movl 0x40(%rbp), %eax
movl %eax, -0x16c(%rbp)
movl 0x48(%rbp), %eax
movl %eax, -0x168(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x164(%rbp)
movl -0x48(%rbp), %r13d
movq 0x58(%rbp), %r12
movq 0x60(%rbp), %r15
movq 0x68(%rbp), %r14
movq 0x78(%rbp), %rbx
movq 0x80(%rbp), %r11
movq 0x88(%rbp), %r10
movq 0x90(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x180(%rbp), %rax
movq %rax, (%rsp)
movq -0x178(%rbp), %rax
movq %rax, 0x8(%rsp)
movl -0x16c(%rbp), %eax
movl %eax, 0x10(%rsp)
movl -0x168(%rbp), %eax
movl %eax, 0x18(%rsp)
movl -0x164(%rbp), %eax
movl %eax, 0x20(%rsp)
movq -0x160(%rbp), %rax
movl %r13d, 0x28(%rsp)
movq %r12, 0x30(%rsp)
movq %r15, 0x38(%rsp)
movq %r14, 0x40(%rsp)
movq %rbx, 0x48(%rsp)
movq %r11, 0x50(%rsp)
movq %r10, 0x58(%rsp)
movq %rax, 0x60(%rsp)
callq 0x177300
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x38(%rbp), %rax
cmpl $0x2, 0x1c(%rax)
jne 0x178837
movq -0x58(%rbp), %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0x50(%rbp), %rcx
movl (%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
shll %ecx
cmpl %ecx, %eax
jle 0x178837
movl $0x1, -0x2c(%rbp)
jmp 0x1789e4
movq -0x38(%rbp), %rax
cmpl $0x3, 0x1c(%rax)
jne 0x17886a
movq -0x50(%rbp), %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0x58(%rbp), %rcx
movl (%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
shll %ecx
cmpl %ecx, %eax
jle 0x17886a
movl $0x1, -0x2c(%rbp)
jmp 0x1789e4
movq -0x38(%rbp), %rax
cmpl $-0x1, 0x1c(%rax)
jne 0x178880
movl $0x1, -0x2c(%rbp)
jmp 0x1789e4
movq -0x50(%rbp), %rdi
movq 0x78(%rbp), %rax
movq (%rax), %rsi
movq 0x80(%rbp), %rax
movq (%rax), %rdx
movq -0x58(%rbp), %rcx
movq 0x88(%rbp), %rax
movq (%rax), %r8
movq 0x90(%rbp), %rax
movq (%rax), %r9
movq -0x38(%rbp), %rax
movzbl 0x28(%rax), %r11d
movq 0x20(%rbp), %r10
movq 0x70(%rbp), %rax
movl %r11d, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x170a50
movq %rax, -0x108(%rbp)
cmpq $0x0, 0x50(%rbp)
jbe 0x1788f8
movq -0x108(%rbp), %rax
cmpq 0x50(%rbp), %rax
jb 0x1788f8
movl $0x1, -0x2c(%rbp)
jmp 0x1789e4
movq -0x50(%rbp), %rdi
movq 0x20(%rbp), %rsi
movl -0x48(%rbp), %edx
movq 0x18(%rbp), %rcx
movq 0x28(%rbp), %r8
movq 0x78(%rbp), %rax
movq (%rax), %r9
movq 0x80(%rbp), %rax
movq (%rax), %r11
leaq -0xa0(%rbp), %r10
leaq -0xa8(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x170f80
movsd -0xa8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x17895d
jp 0x17895d
xorps %xmm0, %xmm0
movsd %xmm0, -0x188(%rbp)
jmp 0x178975
movsd -0xa0(%rbp), %xmm0
divsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x188(%rbp)
movsd -0x188(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x98(%rbp), %rax
movss %xmm0, (%rax)
movsd -0xa0(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x1789a1
jp 0x1789a1
jmp 0x1789cb
movsd -0xa8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x1789b6
jp 0x1789b6
jmp 0x1789cb
movq 0x98(%rbp), %rax
movss (%rax), %xmm1
movss -0x5c(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jb 0x1789d4
movl $0x1, -0x2c(%rbp)
jmp 0x1789e4
movl $0x0, -0x2c(%rbp)
jmp 0x1789e4
movl $0x1, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)