// File: /workspace/github_cpp_makefile_star2_O3/ynilu[P]elastic/simulator.cpp
// Function: main
int main(int argc, char *argv[])
{
    if( argc > 6 )
    {
        cout << "\nToo many arguments,EX: simulation labmda rquest_number" << "\n";
        return 1;
    }
    if( argc > 1 )
    {
        if( atoi( argv[ 1 ] ) > 0 )
        {
            traffic_lambda = atoi( argv[ 1 ] );
        }
        else
        {
            cout << "\nError parameter: 1" << "\n";
            return 1;
        }
    }
    if( argc > 2 )
    {
        if( atoi( argv[ 2 ] ) > 0 )
        {
            num_requests = atoi( argv[ 2 ] );
        }
        else
        {
            cout << "\nError parameter: 2" << "\n";
            return 1;
        }
    }
    if( argc > 3 )
    {
        if( atoi( argv[ 3 ] ) == 0 )
        {
            enable_OTDM = 0;
        }
    }
    if( argc > 4 )
    {
        if( atoi( argv[ 4 ] ) > 0 )
        {
            num_transceiver = atoi( argv[ 4 ] );
        }
        else
        {
            cout << "\nError parameter: 4" << "\n";
            return 1;
        }
    }
    if( argc > 5 )
    {
        switch( atoi( argv[5] ) )
        {
        case 1:
            graph_file = (char*) "USnet.txt";
            source_file = (char*) "USnet_source.txt";
            traffic_file = (char*) "USnet_traffic.txt";
            break;
        default:
            break;
        }
    }

    if(num_transceiver < 800)
    {
        OEO_weight = hop_limit;
    }

    if(enable_OTDM)
    {
        num_OFDM_transceiver = num_transceiver / 2;
        num_OTDM_transceiver = num_transceiver / 2;
    }
    else
    {
        num_OFDM_transceiver = num_transceiver;
        num_OTDM_transceiver = 0;
    }

    start_clk = clock();

    accepted_requests_BM.resize(num_batch, 0);
    blocked_requests_BM.resize(num_batch, 0);
    blocked_bandwidth_BM.resize(num_batch, 0);
    num_OEO_BM.resize(num_batch, 0);
    num_OFDM_lightpath_use_BM.resize(num_batch, 0);
    num_OTDM_lightpath_use_BM.resize(num_batch, 0);

    Graph_info g_info;
    g_info.graph_file = graph_file;
    g_info.num_slots = num_slots;
    g_info.num_OTDM_transceiver = num_OTDM_transceiver;
    g_info.num_OFDM_transceiver = num_OFDM_transceiver;
    g_info.slot_capacity = slot_capacity;
    g_info.transceiver_slot_limit = transceiver_slot_limit;
    g_info.transceiver_connection_limit = transceiver_connection_limit;
    g_info.transmission_distance_16QAM = transmission_distance_16QAM;
    g_info.transmission_distance_8QAM = transmission_distance_8QAM;
    g_info.transmission_distance_QPSK = transmission_distance_QPSK;

    Phy_graph p_graph(g_info);

    cout << "num_nodes : " << p_graph.node_list.size() << "\n";
    num_nodes = p_graph.node_list.size();

    Traffic_info t_info;
    t_info.source_file = source_file;
    t_info.traffic_file = traffic_file;
    t_info.num_nodes = p_graph.node_list.size();
    t_info.num_requests = num_requests;
    t_info.OC1_share = OC1_share;
    t_info.OC3_share = OC3_share;
    t_info.OC9_share = OC9_share;
    t_info.OC12_share = OC12_share;
    t_info.OC18_share = OC18_share;
    t_info.OC24_share = OC24_share;
    t_info.OC36_share = OC36_share;
    t_info.OC48_share = OC48_share;
    t_info.OC192_share = OC192_share;
    t_info.OC768_share = OC768_share;
    t_info.OC3072_share = OC3072_share;
    t_info.traffic_lambda = traffic_lambda;
    t_info.traffic_mu = traffic_mu;
    t_info.unicast_percentage = unicast_percentage;

    t_info.aTime_seed = aTime_seed;
    t_info.hTime_seed = hTime_seed;
    t_info.s_seed = s_seed;
    t_info.d_seed = d_seed;
    t_info.numD_seed = numD_seed;
    t_info.b_seed = b_seed;

    Traffic traffic (t_info);

    request2lightpath.resize(num_requests);

    Auxiliary_info a_info;
    a_info.num_nodes = num_nodes;
    a_info.num_slots = num_slots;
    a_info.transceiver_weight = transceiver_weight;
    a_info.used_transceiver_weight = used_transceiver_weight;
    a_info.OFDM_transceiver_weight = OFDM_transceiver_weight;
    a_info.used_OFDM_transceiver_weight = used_OFDM_transceiver_weight;
    a_info.OEO_weight = OEO_weight;
    Aux_graph a_graph(a_info);


    while( !traffic.empty() )
    {
        Event event = traffic.next_event();
        if(event.type == Event::arrival)
        {
            cout << "arrival :\nid = " << event.request_id << "\nsource = " << event.source << "\ndest = " << *event.destination.begin() << "\nbandwidth = " << event.bandwidth << "\narrivaltime = " << event.arrival_time << "\n\n";
            start_clk_construction = clock();
            construct_candidate_path(event, p_graph, a_graph);
            construct_exist_path(event, p_graph, a_graph);
            clk_construction += (double) ( clock() - start_clk_construction ) / CLOCKS_PER_SEC;
            start_clk_finding = clock();
            Aux_node* aux_source = a_graph.get_adding_node(event.source);
            Aux_node* aux_destination = a_graph.get_dropping_node(*(event.destination.begin()));
            Aux_node2Aux_link result = BellmanFordSP(aux_source);
            clk_finding += (double) ( clock() - start_clk_finding ) / CLOCKS_PER_SEC;
            start_clk_parsing = clock();
            if(result[aux_destination] != NULL) // Accepted
            {
                path_parsing(p_graph, result, aux_source, aux_destination, event);
                accepted_requests++;
                accepted_requests_BM[(int)event.request_id/(num_requests/num_batch)]++;
            }
            else
            {
                blocked_requests++;
                blocked_requests_BM[(int)event.request_id/(num_requests/num_batch)]++;
                blocked_bandwidth += event.bandwidth;
                blocked_bandwidth_BM[(int)event.request_id/(num_requests/num_batch)] += event.bandwidth;
            }
            clk_parsing += (double) ( clock() - start_clk_parsing ) / CLOCKS_PER_SEC;
            total_bandwidth += event.bandwidth;
            start_clk_construction = clock();
            reset_auxiliary_graph();
            clk_construction += (double) ( clock() - start_clk_construction ) / CLOCKS_PER_SEC;
        }
        else // if(event.type == Event::departure)
        {
            cout << "departure :\nid = " << event.request_id << "\nsource = " << event.source << "\ndest = " << *event.destination.begin() << "\nbandwidth = " << event.bandwidth << "\narrivaltime = " << event.arrival_time << "\n\n";
            for(auto &lp : request2lightpath[event.request_id])
            {
                lp->requests.erase(event.request_id);
                if(lp->requests.empty())
                {
                    int slot_st;
                    int slot_ed;
                    Path& path = lp->p_path;
                    switch(lp->type)
                    {
                    case LightPath::OTDM:
                        slot_st = lp->spectrum.slot_st;
                        slot_ed = lp->spectrum.slot_ed;

                        for(unsigned int node_i = 0; node_i < path.size() - 1; node_i++)
                        {
                            int from = path[node_i];
                            int to = path[node_i + 1];
                            Phy_link& link = p_graph.get_link(from, to);

                            for(int i = slot_st; i <= slot_ed; i++)
                            {
                                link.slot[i] = -1;
                            }
                        }

                        for(unsigned int i = 0; i < lp->transmitter_index.size(); i++)
                        {
                            if(lp->transmitter_index[i] != -1)
                            {
                                p_graph.get_node(path[i]).num_available_transmitter++;
                            }
                        }

                        for(unsigned int i = 0; i < lp->receiver_index.size(); i++)
                        {
                            if(lp->receiver_index[i] != -1)
                            {
                                p_graph.get_node(path[i]).num_available_receiver++;
                            }
                        }
                        delete lp;
                        exist_OTDM_light_path_list.remove(lp);
                        break;
                    case LightPath::OFDM_WOB:
                    case LightPath::OFDM_WB:
                    case LightPath::OFDM:
                        slot_st = lp->spectrum.slot_st;
                        slot_ed = lp->spectrum.slot_ed;

                        Phy_node& src_node = p_graph.get_node(path.front());
                        Phy_node& dst_node = p_graph.get_node(path.back());
                        src_node.OFDMtransmitter[lp->transmitter_index.front()].num_available_sub_transceiver++;
                        dst_node.OFDMreceiver[lp->receiver_index.back()].num_available_sub_transceiver++;

                        for(unsigned int node_i = 0; node_i < path.size() - 1; node_i++)
                        {
                            int from = path[node_i];
                            int to = path[node_i + 1];
                            Phy_link& link = p_graph.get_link(from, to);

                            for(int i = slot_st; i <= slot_ed; i++)
                            {
                                link.slot[i] = -1;
                            }
                        }

                        if(src_node.OFDMtransmitter[lp->transmitter_index.front()].num_available_sub_transceiver >= transceiver_connection_limit)
                        {
                            src_node.OFDMtransmitter[lp->transmitter_index.front()].spectrum.slot_st = -1;
                            src_node.OFDMtransmitter[lp->transmitter_index.front()].spectrum.slot_ed = -1;
                            src_node.OFDMtransmitter[lp->transmitter_index.front()].in_used = false;
                            src_node.OFDMtransmitter[lp->transmitter_index.front()].num_available_sub_transceiver = transceiver_connection_limit;
                            src_node.num_available_OFDM_transmitter++;
                        }

                        if(dst_node.OFDMreceiver[lp->receiver_index.back()].num_available_sub_transceiver >= transceiver_connection_limit)
                        {
                            dst_node.OFDMreceiver[lp->receiver_index.back()].spectrum.slot_st = -1;
                            dst_node.OFDMreceiver[lp->receiver_index.back()].spectrum.slot_ed = -1;
                            dst_node.OFDMreceiver[lp->receiver_index.back()].in_used = false;
                            dst_node.OFDMreceiver[lp->receiver_index.back()].num_available_sub_transceiver = transceiver_connection_limit;
                            dst_node.num_available_OFDM_receiver++;
                        }
                        delete lp;
                        exist_OFDM_light_path_list.remove(lp);
                        break;
                    }
                }
                else
                {
                    lp->available_bitrate += event.bandwidth;
                }
            }
            end_time = event.arrival_time;
        }
    }
    total_network_bandwidth = slot_capacity * num_slots * p_graph.link_list.size();
    print_result(traffic);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5c8, %rsp            # imm = 0x5C8
cmpl $0x7, %edi
jl 0x393a
movq 0x146a7(%rip), %rbx     # 0x17fd0
leaq 0xd7f0(%rip), %rsi      # 0x11120
movl $0x37, %edx
jmp 0x4549
movl %edi, %ebp
cmpl $0x2, %edi
jl 0x399c
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
callq 0x32f0
testl %eax, %eax
jle 0x4526
movl %eax, 0x14899(%rip)     # 0x181f4
cmpl $0x2, %ebp
je 0x399c
movq 0x10(%rbx), %rdi
callq 0x32f0
testl %eax, %eax
jle 0x4536
movl %eax, 0x14875(%rip)     # 0x181ec
cmpl $0x4, %ebp
jb 0x399c
movq 0x18(%rbx), %rdi
callq 0x32f0
testl %eax, %eax
jne 0x3993
movl $0x0, 0x14885(%rip)     # 0x18218
cmpl $0x4, %ebp
jne 0x457c
movl 0x1485a(%rip), %eax     # 0x181fc
cmpl $0x31f, %eax            # imm = 0x31F
jg 0x39b9
cvtsi2sdl 0x14833(%rip), %xmm0 # 0x181e4
movsd %xmm0, 0x14a57(%rip)    # 0x18410
movl 0x14859(%rip), %ecx     # 0x18218
movl %eax, %edx
shrl $0x1f, %edx
addl %eax, %edx
sarl %edx
testl %ecx, %ecx
cmovnel %edx, %eax
cmovel %ecx, %edx
movl %eax, 0x1482e(%rip)     # 0x18204
movl %edx, 0x14824(%rip)     # 0x18200
callq 0x3150
movq %rax, 0x148e0(%rip)     # 0x182c8
movslq 0x147f1(%rip), %rsi     # 0x181e0
xorl %ebp, %ebp
leaq 0x148(%rsp), %rbx
movl %ebp, (%rbx)
leaq 0x14936(%rip), %rdi     # 0x18338
movq %rbx, %rdx
callq 0x8998
movslq 0x147cf(%rip), %rsi     # 0x181e0
movl %ebp, (%rbx)
leaq 0x14936(%rip), %rdi     # 0x18350
leaq 0x148(%rsp), %rbx
movq %rbx, %rdx
callq 0x8998
movslq 0x147af(%rip), %rsi     # 0x181e0
movl %ebp, (%rbx)
leaq 0x1492e(%rip), %rdi     # 0x18368
leaq 0x148(%rsp), %rbx
movq %rbx, %rdx
callq 0x8998
movslq 0x1478f(%rip), %rsi     # 0x181e0
movl %ebp, (%rbx)
leaq 0x14926(%rip), %rdi     # 0x18380
leaq 0x148(%rsp), %rbx
movq %rbx, %rdx
callq 0x8998
movslq 0x1476f(%rip), %rsi     # 0x181e0
movl %ebp, (%rbx)
leaq 0x1491e(%rip), %rdi     # 0x18398
leaq 0x148(%rsp), %rbx
movq %rbx, %rdx
callq 0x8998
movslq 0x1474f(%rip), %rsi     # 0x181e0
movl %ebp, (%rbx)
leaq 0x14916(%rip), %rdi     # 0x183b0
leaq 0x148(%rsp), %rdx
callq 0x8998
movq 0x147ea(%rip), %rax     # 0x18298
leaq 0x3c0(%rsp), %rsi
movq %rax, (%rsi)
movl 0x14731(%rip), %eax     # 0x181f0
movl %eax, 0x8(%rsi)
movl 0x14738(%rip), %eax     # 0x18200
movl %eax, 0xc(%rsi)
movl 0x14733(%rip), %eax     # 0x18204
movl %eax, 0x10(%rsi)
movl 0x1472e(%rip), %eax     # 0x18208
movl %eax, 0x14(%rsi)
movl 0x14729(%rip), %eax     # 0x1820c
movl %eax, 0x18(%rsi)
movl 0x14724(%rip), %eax     # 0x18210
movl %eax, 0x1c(%rsi)
movl 0x1472b(%rip), %eax     # 0x18220
movl %eax, 0x20(%rsi)
movl 0x14726(%rip), %eax     # 0x18224
movl %eax, 0x24(%rsi)
movl 0x14721(%rip), %eax     # 0x18228
movl %eax, 0x28(%rsi)
leaq 0x80(%rsp), %rdi
callq 0xb0c2
movq 0x144b2(%rip), %rdi     # 0x17fd0
leaq 0xd69c(%rip), %rsi      # 0x111c1
movl $0xc, %edx
callq 0x3250
movq 0x90(%rsp), %rax
subq 0x88(%rsp), %rax
sarq $0x3, %rax
movabsq $-0x79435e50d79435e5, %rsi # imm = 0x86BCA1AF286BCA1B
imulq %rax, %rsi
movq 0x14478(%rip), %rdi     # 0x17fd0
callq 0x3160
leaq 0xd6ad(%rip), %rsi      # 0x11211
movl $0x1, %edx
movq %rax, %rdi
callq 0x3250
movq 0x90(%rsp), %rax
subq 0x88(%rsp), %rax
shrq $0x3, %rax
imull $0x286bca1b, %eax, %eax # imm = 0x286BCA1B
movl %eax, 0x1476f(%rip)     # 0x18300
movq 0x14708(%rip), %rcx     # 0x182a0
leaq 0x540(%rsp), %rsi
movq %rcx, (%rsi)
movq 0x146fe(%rip), %rcx     # 0x182a8
movq %rcx, 0x8(%rsi)
movl %eax, 0x10(%rsi)
movl 0x14635(%rip), %eax     # 0x181ec
movl %eax, 0x14(%rsi)
movl 0x14744(%rip), %eax     # 0x18304
movl %eax, 0x58(%rsi)
movl 0x1473f(%rip), %eax     # 0x18308
movl %eax, 0x5c(%rsi)
movl 0x1473a(%rip), %eax     # 0x1830c
movl %eax, 0x60(%rsi)
movl 0x14735(%rip), %eax     # 0x18310
movl %eax, 0x64(%rsi)
movl 0x14648(%rip), %eax     # 0x1822c
movl %eax, 0x68(%rsi)
movl 0x14643(%rip), %eax     # 0x18230
movl %eax, 0x6c(%rsi)
movl 0x1463e(%rip), %eax     # 0x18234
movl %eax, 0x70(%rsi)
movl 0x14639(%rip), %eax     # 0x18238
movl %eax, 0x74(%rsi)
movl 0x14634(%rip), %eax     # 0x1823c
movl %eax, 0x78(%rsi)
movl 0x1462f(%rip), %eax     # 0x18240
movl %eax, 0x7c(%rsi)
movl 0x1462a(%rip), %eax     # 0x18244
movl %eax, 0x80(%rsi)
movl 0x145ce(%rip), %eax     # 0x181f4
movl %eax, 0x18(%rsi)
movl 0x145c9(%rip), %eax     # 0x181f8
movl %eax, 0x1c(%rsi)
movss 0x145ae(%rip), %xmm0    # 0x181e8
movss %xmm0, 0x20(%rsi)
movq 0x14602(%rip), %rax     # 0x18248
movq %rax, 0x28(%rsi)
movq 0x145ff(%rip), %rax     # 0x18250
movq %rax, 0x30(%rsi)
movq 0x145fc(%rip), %rax     # 0x18258
movq %rax, 0x38(%rsi)
movq 0x145f9(%rip), %rax     # 0x18260
movq %rax, 0x40(%rsi)
movq 0x145f6(%rip), %rax     # 0x18268
movq %rax, 0x48(%rsi)
movq 0x145f3(%rip), %rax     # 0x18270
movq %rax, 0x50(%rsi)
leaq 0x148(%rsp), %rdi
callq 0xe680
movslq 0x14557(%rip), %rsi     # 0x181ec
leaq 0x147c4(%rip), %rdi     # 0x18460
callq 0x89cc
movl 0x14659(%rip), %eax     # 0x18300
leaq 0x390(%rsp), %rsi
movl %eax, 0x4(%rsi)
movl 0x14538(%rip), %eax     # 0x181f0
movl %eax, (%rsi)
movsd 0x1472e(%rip), %xmm0    # 0x183f0
movsd %xmm0, 0x8(%rsi)
movsd 0x14729(%rip), %xmm0    # 0x183f8
movsd %xmm0, 0x10(%rsi)
movsd 0x14724(%rip), %xmm0    # 0x18400
movsd %xmm0, 0x18(%rsi)
movsd 0x1471f(%rip), %xmm0    # 0x18408
movsd %xmm0, 0x20(%rsi)
movsd 0x1471a(%rip), %xmm0    # 0x18410
movsd %xmm0, 0x28(%rsi)
leaq 0x298(%rsp), %rdi
callq 0xff58
leaq 0x2c(%rsp), %r12
leaq 0x148(%rsp), %rbx
leaq 0x20(%rsp), %r14
movq 0x142af(%rip), %r15     # 0x17fd0
leaq 0x80(%rsp), %r13
leaq 0x298(%rsp), %rbp
movq %rbx, %rdi
callq 0xf098
testb %al, %al
jne 0x44b1
movq %r14, %rdi
movq %rbx, %rsi
callq 0xf0a4
cmpl $0x0, 0x28(%rsp)
je 0x41cc
movl $0x11, %edx
movq %r15, %rdi
leaq 0xd4ad(%rip), %rsi      # 0x11213
callq 0x3250
movl 0x2c(%rsp), %esi
movq %r15, %rdi
callq 0x3360
movq %rax, %rbx
movl $0xa, %edx
movq %rax, %rdi
leaq 0xd455(%rip), %rsi      # 0x111de
callq 0x3250
movl 0x30(%rsp), %esi
movq %rbx, %rdi
callq 0x3360
movq %rax, %rbx
movl $0x8, %edx
movq %rax, %rdi
leaq 0xd43d(%rip), %rsi      # 0x111e9
callq 0x3250
movq 0x50(%rsp), %rax
movl 0x20(%rax), %esi
movq %rbx, %rdi
callq 0x3360
movq %rax, %rbx
movl $0xd, %edx
movq %rax, %rdi
leaq 0xd41f(%rip), %rsi      # 0x111f2
callq 0x3250
movl 0x6c(%rsp), %esi
movq %rbx, %rdi
callq 0x3360
movq %rax, %rbx
movl $0xf, %edx
movq %rax, %rdi
leaq 0xd40a(%rip), %rsi      # 0x11200
callq 0x3250
cvtss2sd 0x70(%rsp), %xmm0
movq %rbx, %rdi
callq 0x3310
movl $0x2, %edx
movq %rax, %rdi
leaq 0xd3f8(%rip), %rsi      # 0x11210
callq 0x3250
movslq 0x2c(%rsp), %rax
movq 0x14637(%rip), %rcx     # 0x18460
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax,8), %rbp
movq 0x8(%rcx,%rax,8), %r14
cmpq %r14, %rbp
movq %r14, 0x10(%rsp)
je 0x41b6
movq (%rbp), %rbx
addq $0x10, %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xa18a
movq %rbx, %rdi
movq %rax, %rsi
callq 0xa208
movq (%rbp), %r15
cmpq $0x0, 0x38(%r15)
je 0x3e7a
movl 0x6c(%rsp), %eax
addl %eax, 0x44(%r15)
jmp 0x41a9
movl 0x8(%r15), %eax
leal -0x1(%rax), %ecx
cmpl $0x3, %ecx
jae 0x4049
movslq 0x58(%r15), %r14
movl 0x5c(%r15), %ebx
movq 0x68(%r15), %rax
movl (%rax), %esi
movq %r13, %rdi
callq 0xba88
movq %rax, (%rsp)
movq 0x70(%r15), %rax
movl -0x4(%rax), %esi
movq %r13, %rdi
callq 0xba88
movq %rax, %r8
movq (%rbp), %rdi
movq 0xc8(%rdi), %rdx
movslq (%rdx), %rax
movq (%rsp), %rcx
movq 0x68(%rcx), %rcx
imulq $0x58, %rax, %rax
incl 0xc(%rcx,%rax)
movq 0xe8(%rdi), %rax
movslq -0x4(%rax), %rax
movq 0x80(%r8), %rsi
imulq $0x58, %rax, %rax
incl 0xc(%rsi,%rax)
movq 0x68(%r15), %rax
movq 0x70(%r15), %rsi
subq %rax, %rsi
cmpq $0x4, %rsi
je 0x3f9e
movq %r8, 0x78(%rsp)
leaq (,%r14,4), %rcx
movq %rcx, 0x8(%rsp)
movl %ebx, %ecx
subl %r14d, %ecx
leaq 0x4(,%rcx,4), %r13
movl $0x1, %ecx
xorl %r12d, %r12d
movl (%rax,%r12,4), %esi
movl %ecx, %r12d
movl (%rax,%r12,4), %edx
leaq 0x80(%rsp), %rdi
callq 0xb0a6
cmpl %ebx, %r14d
jg 0x3f5d
movq 0x18(%rax), %rdi
addq 0x8(%rsp), %rdi
movl $0xff, %esi
movq %r13, %rdx
callq 0x3110
movq 0x68(%r15), %rax
movq 0x70(%r15), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
decq %rdx
leal 0x1(%r12), %ecx
cmpq %r12, %rdx
ja 0x3f2a
movq (%rbp), %rdi
movq 0xc8(%rdi), %rdx
movq (%rsp), %rax
movq 0x68(%rax), %rcx
leaq 0x2c(%rsp), %r12
leaq 0x80(%rsp), %r13
movq 0x78(%rsp), %r8
movslq (%rdx), %rax
imulq $0x58, %rax, %rax
movl 0x14265(%rip), %esi     # 0x18210
cmpl %esi, 0xc(%rcx,%rax)
jl 0x3fe4
addq %rcx, %rax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl %esi, 0x48(%rax)
movslq (%rdx), %rax
imulq $0x58, %rax, %rax
movl %esi, 0x4c(%rcx,%rax)
movslq (%rdx), %rax
imulq $0x58, %rax, %rax
movb $0x0, 0x8(%rcx,%rax)
movl 0x14237(%rip), %esi     # 0x18210
movl %esi, 0xc(%rcx,%rax)
movq (%rsp), %rax
incl 0x2c(%rax)
movq 0xe8(%rdi), %rcx
movslq -0x4(%rcx), %rdx
movq 0x80(%r8), %rax
imulq $0x58, %rdx, %rdx
cmpl %esi, 0xc(%rax,%rdx)
movq 0x10(%rsp), %r14
jl 0x4037
addq %rax, %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl %esi, 0x48(%rdx)
movslq -0x4(%rcx), %rdx
imulq $0x58, %rdx, %rdx
movl %esi, 0x4c(%rax,%rdx)
movslq -0x4(%rcx), %rcx
imulq $0x58, %rcx, %rcx
movb $0x0, 0x8(%rax,%rcx)
movl 0x141e1(%rip), %edx     # 0x18210
movl %edx, 0xc(%rax,%rcx)
incl 0x34(%r8)
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x14404(%rip), %rdi     # 0x18448
jmp 0x41a1
testl %eax, %eax
jne 0x41a9
movq 0x68(%r15), %rax
movq 0x70(%r15), %rcx
subq %rax, %rcx
movq %r15, %rdi
cmpq $0x4, %rcx
je 0x40f2
movl 0x5c(%r15), %r14d
movslq 0x58(%r15), %r12
movq %r12, %r13
shlq $0x2, %r13
movl %r14d, %ecx
subl %r12d, %ecx
leaq 0x4(,%rcx,4), %rcx
movq %rcx, 0x8(%rsp)
movl $0x1, %ecx
xorl %ebx, %ebx
movl (%rax,%rbx,4), %esi
movl %ecx, %ebx
movl (%rax,%rbx,4), %edx
leaq 0x80(%rsp), %rdi
callq 0xb0a6
cmpl %r12d, %r14d
jl 0x40c2
movq 0x18(%rax), %rdi
addq %r13, %rdi
movl $0xff, %esi
movq 0x8(%rsp), %rdx
callq 0x3110
movq 0x68(%r15), %rax
movq 0x70(%r15), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
decq %rdx
leal 0x1(%rbx), %ecx
cmpq %rbx, %rdx
ja 0x4092
movq (%rbp), %rdi
leaq 0x2c(%rsp), %r12
leaq 0x80(%rsp), %r13
movq 0x10(%rsp), %r14
movq 0xc8(%rdi), %rax
cmpq %rax, 0xd0(%rdi)
je 0x4143
movl $0x1, %ebx
xorl %ecx, %ecx
cmpl $-0x1, (%rax,%rcx,4)
je 0x4125
movq 0x68(%r15), %rax
movl (%rax,%rcx,4), %esi
movq %r13, %rdi
callq 0xba88
incl 0x28(%rax)
movq (%rbp), %rdi
movl %ebx, %ecx
movq 0xc8(%rdi), %rax
movq 0xd0(%rdi), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
incl %ebx
cmpq %rcx, %rdx
ja 0x4109
movq 0xe0(%rdi), %rax
cmpq %rax, 0xe8(%rdi)
je 0x4194
movl $0x1, %ebx
xorl %ecx, %ecx
cmpl $-0x1, (%rax,%rcx,4)
je 0x4176
movq 0x68(%r15), %rax
movl (%rax,%rcx,4), %esi
movq %r13, %rdi
callq 0xba88
incl 0x30(%rax)
movq (%rbp), %rdi
movl %ebx, %ecx
movq 0xe0(%rdi), %rax
movq 0xe8(%rdi), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
incl %ebx
cmpq %rcx, %rdx
ja 0x415a
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x1428f(%rip), %rdi     # 0x18430
movq %rbp, %rsi
callq 0x8a08
addq $0x8, %rbp
cmpq %r14, %rbp
jne 0x3e44
xorps %xmm0, %xmm0
cvtss2sd 0x70(%rsp), %xmm0
movsd %xmm0, 0x14221(%rip)    # 0x183e8
jmp 0x4488
movl $0xf, %edx
movq %r15, %rdi
leaq 0xcff3(%rip), %rsi      # 0x111ce
callq 0x3250
movl 0x2c(%rsp), %esi
movq %r15, %rdi
callq 0x3360
movq %rax, %rbx
movl $0xa, %edx
movq %rax, %rdi
leaq 0xcfe0(%rip), %rsi      # 0x111de
callq 0x3250
movl 0x30(%rsp), %esi
movq %rbx, %rdi
callq 0x3360
movq %rax, %rbx
movl $0x8, %edx
movq %rax, %rdi
leaq 0xcfc8(%rip), %rsi      # 0x111e9
callq 0x3250
movq 0x50(%rsp), %rax
movl 0x20(%rax), %esi
movq %rbx, %rdi
callq 0x3360
movq %rax, %rbx
movl $0xd, %edx
movq %rax, %rdi
leaq 0xcfaa(%rip), %rsi      # 0x111f2
callq 0x3250
movl 0x6c(%rsp), %esi
movq %rbx, %rdi
callq 0x3360
movq %rax, %rbx
movl $0xf, %edx
movq %rax, %rdi
leaq 0xcf95(%rip), %rsi      # 0x11200
callq 0x3250
cvtss2sd 0x70(%rsp), %xmm0
movq %rbx, %rdi
callq 0x3310
movl $0x2, %edx
movq %rax, %rdi
leaq 0xcf83(%rip), %rsi      # 0x11210
callq 0x3250
callq 0x3150
movq %rax, 0x14042(%rip)     # 0x182e0
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x467b
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x4746
callq 0x3150
subq 0x1401a(%rip), %rax     # 0x182e0
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0xcd32(%rip), %xmm0     # 0x11008
addsd 0x1400a(%rip), %xmm0    # 0x182e8
movsd %xmm0, 0x14002(%rip)    # 0x182e8
callq 0x3150
movq %rax, 0x13fde(%rip)     # 0x182d0
movl 0x30(%rsp), %esi
movq %rbp, %rdi
callq 0x109be
movq %rax, %rbx
movq 0x50(%rsp), %rax
movl 0x20(%rax), %esi
movq %rbp, %rdi
callq 0x109ca
movq %rax, 0x18(%rsp)
leaq 0x110(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4b6f
callq 0x3150
subq 0x13f9b(%rip), %rax     # 0x182d0
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0xccc3(%rip), %xmm0     # 0x11008
addsd 0x13f8b(%rip), %xmm0    # 0x182d8
movsd %xmm0, 0x13f83(%rip)    # 0x182d8
callq 0x3150
movq %rax, 0x13f8f(%rip)     # 0x182f0
movq %r14, %rdi
leaq 0x18(%rsp), %rsi
callq 0x9edc
cmpq $0x0, (%rax)
je 0x43a6
movl $0x1, %ebp
movq 0x18(%rsp), %rcx
movq %r13, %rdi
leaq 0x110(%rsp), %rsi
movq %rbx, %rdx
leaq 0x20(%rsp), %r8
callq 0x4d65
leaq 0x13f77(%rip), %rax     # 0x18314
leaq 0x13f94(%rip), %rdi     # 0x18338
jmp 0x43e2
incl 0x13f6c(%rip)           # 0x18318
movl 0x2c(%rsp), %ecx
movl 0x13e36(%rip), %eax     # 0x181ec
cltd
idivl 0x13e23(%rip)           # 0x181e0
movl %eax, %esi
movl %ecx, %eax
cltd
idivl %esi
cltq
movq 0x13f83(%rip), %rcx     # 0x18350
incl (%rcx,%rax,4)
movl 0x6c(%rsp), %ebp
leaq 0x13f41(%rip), %rax     # 0x1831c
leaq 0x13f86(%rip), %rdi     # 0x18368
addl %ebp, (%rax)
movl 0x2c(%rsp), %ecx
movl 0x13dfe(%rip), %eax     # 0x181ec
cltd
idivl 0x13deb(%rip)           # 0x181e0
movl %eax, %esi
movl %ecx, %eax
cltd
idivl %esi
cltq
movq (%rdi), %rcx
addl %ebp, (%rcx,%rax,4)
callq 0x3150
subq 0x13ee0(%rip), %rax     # 0x182f0
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd 0xcbe8(%rip), %xmm1     # 0x11008
divsd %xmm1, %xmm0
addsd 0x13ecc(%rip), %xmm0    # 0x182f8
movsd %xmm0, 0x13ec4(%rip)    # 0x182f8
movl 0x6c(%rsp), %eax
addl %eax, 0x13eee(%rip)     # 0x1832c
callq 0x3150
movq %rax, 0x13e96(%rip)     # 0x182e0
callq 0x5144
callq 0x3150
subq 0x13e85(%rip), %rax     # 0x182e0
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0xcb9d(%rip), %xmm0     # 0x11008
addsd 0x13e75(%rip), %xmm0    # 0x182e8
movsd %xmm0, 0x13e6d(%rip)    # 0x182e8
leaq 0x110(%rsp), %rdi
callq 0x8dcc
movq 0x13b41(%rip), %r15     # 0x17fd0
leaq 0x298(%rsp), %rbp
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0xf53a
leaq 0x148(%rsp), %rbx
jmp 0x3d31
movl 0x13d39(%rip), %eax     # 0x181f0
imull 0x13d4a(%rip), %eax     # 0x18208
imull 0xc8(%rsp), %eax
movl %eax, 0x13e64(%rip)     # 0x18330
leaq 0x3f0(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x8a9a
leaq 0x3f0(%rsp), %rdi
callq 0x527b
leaq 0x3f0(%rsp), %rdi
callq 0xf028
leaq 0x298(%rsp), %rdi
callq 0x10692
leaq 0x148(%rsp), %rdi
callq 0xf028
leaq 0x80(%rsp), %rdi
callq 0xb60e
xorl %eax, %eax
jmp 0x456a
movq 0x13aa3(%rip), %rbx     # 0x17fd0
leaq 0xcc24(%rip), %rsi      # 0x11158
jmp 0x4544
movq 0x13a93(%rip), %rbx     # 0x17fd0
leaq 0xcc28(%rip), %rsi      # 0x1116c
movl $0x13, %edx
movq %rbx, %rdi
callq 0x3250
leaq 0xccb9(%rip), %rsi      # 0x11211
movl $0x1, %edx
movq %rbx, %rdi
callq 0x3250
movl $0x1, %eax
addq $0x5c8, %rsp            # imm = 0x5C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rbx), %rdi
callq 0x32f0
testl %eax, %eax
jle 0x45d9
movl %eax, 0x13c6d(%rip)     # 0x181fc
cmpl $0x6, %ebp
jne 0x39a2
movq 0x28(%rbx), %rdi
callq 0x32f0
cmpl $0x1, %eax
jne 0x399c
leaq 0xcbe3(%rip), %rax      # 0x11194
movq %rax, 0x13ce0(%rip)     # 0x18298
leaq 0xcbdf(%rip), %rax      # 0x1119e
movq %rax, 0x13cda(%rip)     # 0x182a0
leaq 0xcbe2(%rip), %rax      # 0x111af
movq %rax, 0x13cd4(%rip)     # 0x182a8
jmp 0x399c
movq 0x139f0(%rip), %rbx     # 0x17fd0
leaq 0xcb99(%rip), %rsi      # 0x11180
jmp 0x4544
movq %rax, %rbx
leaq 0x3f0(%rsp), %rdi
callq 0xf028
jmp 0x464c
jmp 0x4628
jmp 0x4602
movq %rax, %rbx
jmp 0x4659
jmp 0x4609
movq %rax, %rbx
jmp 0x4666
jmp 0x463f
jmp 0x463f
jmp 0x463f
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x8dcc
jmp 0x4642
jmp 0x4628
movq %rax, %rbx
jmp 0x464c
jmp 0x463f
jmp 0x463f
jmp 0x463f
jmp 0x463f
jmp 0x463f
jmp 0x463f
jmp 0x463f
jmp 0x463f
jmp 0x463f
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xf53a
leaq 0x298(%rsp), %rdi
callq 0x10692
leaq 0x148(%rsp), %rdi
callq 0xf028
leaq 0x80(%rsp), %rdi
callq 0xb60e
movq %rbx, %rdi
callq 0x3370