// File: /workspace/github_cpp_makefile_star2_O1/ynilu[P]elastic/simulator.cpp
// Function: build_light_path(Phy_graph&, LightPath*, Aux_node*, Aux_node*, Event&)
void build_light_path(Phy_graph& p_graph, LightPath* candidate_path, Aux_node* aux_source, Aux_node* aux_destination, Event& event)
{
    Phy_node& src_node = p_graph.get_node(aux_source->phy_id);
    Phy_node& dst_node = p_graph.get_node(aux_destination->phy_id);
    LightPath* new_path = new LightPath();

    request2lightpath[event.request_id].push_back(new_path);
    new_path->requests.insert(event.request_id);
    new_path->modulation_level = candidate_path->modulation_level;
    new_path->available_bitrate = candidate_path->available_bitrate;
    new_path->weight = candidate_path->weight;
    new_path->spectrum = candidate_path->spectrum;
    new_path->p_path = candidate_path->p_path;
    new_path->type = candidate_path->type;


    int slot_st = new_path->spectrum.slot_st;
    int slot_ed = new_path->spectrum.slot_ed;
    Path& path = new_path->p_path;
    double used_bandwidth;
    double wasted_bandwidth;
    double guardband_bandwidth;
    double total_bandwidth;
    double num_links;

    switch(candidate_path->type)
    {
    case LightPath::OTDM:

        new_path->transmitter_index.resize(path.size(), -1);
        new_path->receiver_index.resize(path.size(), -1);
        new_path->transmitter_index.front() = 1;
        new_path->receiver_index.back() = 1;
        src_node.num_available_transmitter--;
        dst_node.num_available_receiver--;

        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);

            link.slot[slot_st] = 0;
            link.slot[slot_ed] = 0;

            for(int i = slot_st + 1; i <= slot_ed - 1; i++)
            {
                link.slot[i] = 1;
            }
        }
        exist_OTDM_light_path_list.push_back(new_path);
        num_OTDM_lightpath_use++;
        num_OTDM_lightpath_use_BM[(int)event.request_id/(num_requests/num_batch)]++;

        num_links = 1.0 * new_path->p_path.size() - 1;
        used_bandwidth = num_links * event.bandwidth / new_path->modulation_level;
        wasted_bandwidth = 0;
        guardband_bandwidth = num_links * 2 * slot_capacity;
        total_bandwidth = used_bandwidth + wasted_bandwidth + guardband_bandwidth;
        total_bandwidth_utilization += total_bandwidth * event.holding_time;
        used_bandwidth_utilization += used_bandwidth * event.holding_time;
        wasted_bandwidth_utilization += wasted_bandwidth * event.holding_time;
        guardband_bandwidth_utilization += guardband_bandwidth * event.holding_time;
        break;

    case LightPath:: OFDM:
        new_path->transmitter_index.resize(path.size(), -1);
        new_path->receiver_index.resize(path.size(), -1);
        new_path->transmitter_index.front() = get_available_OFDM_transceiver(src_node.OFDMtransmitter);
        src_node.num_available_OFDM_transmitter--;
        new_path->receiver_index.back() = get_available_OFDM_transceiver(dst_node.OFDMreceiver);
        dst_node.num_available_OFDM_receiver--;
        src_node.OFDMtransmitter[new_path->transmitter_index.front()].spectrum = candidate_path->spectrum;
        src_node.OFDMtransmitter[new_path->transmitter_index.front()].num_available_sub_transceiver--;
        src_node.OFDMtransmitter[new_path->transmitter_index.front()].in_used = true;
        dst_node.OFDMreceiver[new_path->receiver_index.back()].spectrum = candidate_path->spectrum;
        dst_node.OFDMreceiver[new_path->receiver_index.back()].num_available_sub_transceiver--;
        dst_node.OFDMreceiver[new_path->receiver_index.back()].in_used = true;

        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);

            link.slot[slot_st] = 0;
            link.slot[slot_ed] = 0;
            for(int i = slot_st + 1; i <= slot_ed - 1; i++)
            {
                link.slot[i] = 1;
            }
        }
        exist_OFDM_light_path_list.push_back(new_path);
        num_OFDM_lightpath_use++;
        num_OFDM_lightpath_use_BM[(int)event.request_id/(num_requests/num_batch)]++;

        num_links = 1.0 * new_path->p_path.size() - 1;
        used_bandwidth = num_links * event.bandwidth / new_path->modulation_level;
        wasted_bandwidth = num_links * (slot_capacity - (used_bandwidth - slot_capacity * ((int)used_bandwidth / slot_capacity)));
        guardband_bandwidth = num_links * 2 * slot_capacity;
        total_bandwidth = used_bandwidth + wasted_bandwidth + guardband_bandwidth;
        total_bandwidth_utilization += total_bandwidth * event.holding_time;
        used_bandwidth_utilization += used_bandwidth * event.holding_time;
        wasted_bandwidth_utilization += wasted_bandwidth * event.holding_time;
        guardband_bandwidth_utilization += guardband_bandwidth * event.holding_time;
        break;

    case LightPath:: OFDM_WB:
        new_path->transmitter_index = candidate_path->transmitter_index;
        new_path->receiver_index.resize(path.size(), -1);
        new_path->receiver_index.back() = get_available_OFDM_transceiver(dst_node.OFDMreceiver);
        dst_node.OFDMreceiver[new_path->receiver_index.back()].spectrum = candidate_path->spectrum;
        dst_node.OFDMreceiver[new_path->receiver_index.back()].num_available_sub_transceiver--;
        dst_node.OFDMreceiver[new_path->receiver_index.back()].in_used = true;
        dst_node.num_available_OFDM_receiver--;
        src_node.OFDMtransmitter[new_path->transmitter_index.front()].num_available_sub_transceiver--;
        if(src_node.OFDMtransmitter[new_path->transmitter_index.front()].spectrum.slot_st > slot_st)
        {
            src_node.OFDMtransmitter[new_path->transmitter_index.front()].spectrum.slot_st = slot_st;
        }
        if(src_node.OFDMtransmitter[new_path->transmitter_index.front()].spectrum.slot_ed < slot_ed)
        {
            src_node.OFDMtransmitter[new_path->transmitter_index.front()].spectrum.slot_ed = 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);

            link.slot[slot_st] = 0;
            link.slot[slot_ed] = 0;
            for(int i = slot_st + 1; i <= slot_ed - 1; i++)
            {
                link.slot[i] = 1;
            }
        }
        exist_OFDM_light_path_list.push_back(new_path);
        num_OFDM_lightpath_use++;
        num_OFDM_lightpath_use_BM[(int)event.request_id/(num_requests/num_batch)]++;

        num_links = 1.0 * new_path->p_path.size() - 1;
        used_bandwidth = num_links * event.bandwidth / new_path->modulation_level;
        wasted_bandwidth = num_links * (slot_capacity - (used_bandwidth - slot_capacity * ((int)used_bandwidth / slot_capacity)));
        guardband_bandwidth = num_links * slot_capacity;
        total_bandwidth = used_bandwidth + wasted_bandwidth + guardband_bandwidth;
        total_bandwidth_utilization += total_bandwidth * event.holding_time;
        used_bandwidth_utilization += used_bandwidth * event.holding_time;
        wasted_bandwidth_utilization += wasted_bandwidth * event.holding_time;
        guardband_bandwidth_utilization += guardband_bandwidth * event.holding_time;
        break;

    case LightPath:: OFDM_WOB:
        new_path->transmitter_index = candidate_path->transmitter_index;
        new_path->receiver_index = candidate_path->receiver_index;
        src_node.OFDMtransmitter[new_path->transmitter_index.front()].num_available_sub_transceiver--;
        dst_node.OFDMreceiver[new_path->receiver_index.back()].num_available_sub_transceiver--;
        if(src_node.OFDMtransmitter[new_path->transmitter_index.front()].spectrum.slot_st > slot_st)
        {
            src_node.OFDMtransmitter[new_path->transmitter_index.front()].spectrum.slot_st = slot_st;
        }
        if(src_node.OFDMtransmitter[new_path->transmitter_index.front()].spectrum.slot_ed < slot_ed)
        {
            src_node.OFDMtransmitter[new_path->transmitter_index.front()].spectrum.slot_ed = slot_ed;
        }
        if(dst_node.OFDMreceiver[new_path->receiver_index.back()].spectrum.slot_st > slot_st)
        {
            dst_node.OFDMreceiver[new_path->receiver_index.back()].spectrum.slot_st = slot_st;
        }
        if(dst_node.OFDMreceiver[new_path->receiver_index.back()].spectrum.slot_ed < slot_ed)
        {
            dst_node.OFDMreceiver[new_path->receiver_index.back()].spectrum.slot_ed = 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);

            link.slot[slot_st] = 0;
            link.slot[slot_ed] = 0;
            for(int i = slot_st + 1; i <= slot_ed - 1; i++)
            {
                link.slot[i] = 1;
            }
        }
        exist_OFDM_light_path_list.push_back(new_path);
        num_OFDM_lightpath_use++;
        num_OFDM_lightpath_use_BM[(int)event.request_id/(num_requests/num_batch)]++;

        num_links = 1.0 * new_path->p_path.size() - 1;
        used_bandwidth = num_links * event.bandwidth / new_path->modulation_level;
        wasted_bandwidth = num_links * (slot_capacity - (used_bandwidth - slot_capacity * ((int)used_bandwidth / slot_capacity)));
        guardband_bandwidth = num_links * slot_capacity;
        total_bandwidth = used_bandwidth + wasted_bandwidth + guardband_bandwidth;
        total_bandwidth_utilization += total_bandwidth * event.holding_time;
        used_bandwidth_utilization += used_bandwidth * event.holding_time;
        wasted_bandwidth_utilization += wasted_bandwidth * event.holding_time;
        guardband_bandwidth_utilization += guardband_bandwidth * event.holding_time;
        break;

    default:
        cerr << "light path type error\n";
        break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r14
movq %rcx, %rbx
movq %rsi, %r13
movq %rdi, %r15
movl 0xc(%rdx), %esi
callq 0xb390
movq %rax, %r12
movl 0xc(%rbx), %esi
movq %r15, 0x40(%rsp)
movq %r15, %rdi
callq 0xb390
movq %rax, %r15
movl $0xf8, %edi
callq 0x3220
movq %rax, %rbp
movq %rax, %rdi
callq 0x1036c
movq %rbp, 0x8(%rsp)
leaq 0xc(%r14), %rbx
movslq 0xc(%r14), %rax
movq 0x110dd(%rip), %rcx     # 0x18460
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x739f
movq %rbp, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x73a9
leaq 0x8(%rsp), %rdx
callq 0x9c9a
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
movq %rbx, %rsi
callq 0x9dd6
movl 0x40(%r13), %eax
movq 0x8(%rsp), %rdi
movl %eax, 0x40(%rdi)
movl 0x44(%r13), %eax
movl %eax, 0x44(%rdi)
movsd 0x48(%r13), %xmm0
movsd %xmm0, 0x48(%rdi)
movupd 0x58(%r13), %xmm0
movupd %xmm0, 0x58(%rdi)
leaq 0x68(%r13), %rsi
addq $0x68, %rdi
callq 0x88f4
movl 0x8(%r13), %eax
movq 0x8(%rsp), %rbp
movl %eax, 0x8(%rbp)
movl 0x8(%r13), %eax
cmpq $0x3, %rax
ja 0x7d03
movq %r12, 0x20(%rsp)
movq %r15, 0x28(%rsp)
leaq 0x58(%r13), %rdx
movl 0x58(%rbp), %r12d
movl 0x5c(%rbp), %ebx
movslq %r12d, %r15
movslq %ebx, %rcx
movq %rcx, 0x38(%rsp)
leaq 0x9c7f(%rip), %rcx      # 0x110b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movq %r14, 0x30(%rsp)
movl %r12d, 0x10(%rsp)
jmpq *%rax
leaq 0xc8(%rbp), %rdi
movq 0x70(%rbp), %rsi
subq 0x68(%rbp), %rsi
sarq $0x2, %rsi
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
leaq 0x14(%rsp), %r13
movl %r14d, (%r13)
movq %r13, %rdx
callq 0x85f6
movl $0xe0, %edi
addq 0x8(%rsp), %rdi
movq 0x70(%rbp), %rsi
subq 0x68(%rbp), %rsi
sarq $0x2, %rsi
movl %r14d, (%r13)
leaq 0x14(%rsp), %rdx
callq 0x85f6
movq 0x8(%rsp), %rax
movq 0xc8(%rax), %rcx
movl $0x1, %edx
movl %edx, (%rcx)
movq 0xe8(%rax), %rax
movl %edx, -0x4(%rax)
movq 0x20(%rsp), %rax
decl 0x28(%rax)
movq 0x28(%rsp), %rax
decl 0x30(%rax)
movq 0x68(%rbp), %rax
movq 0x70(%rbp), %rcx
subq %rax, %rcx
cmpq $0x4, %rcx
je 0x7535
decl %ebx
movslq %ebx, %r13
xorl %r14d, %r14d
xorl %ecx, %ecx
xorl %r12d, %r12d
movl (%rax,%rcx,4), %esi
incl %r12d
movl (%rax,%r12,4), %edx
movq 0x40(%rsp), %rdi
callq 0xa972
movq 0x18(%rax), %rax
movl %r14d, (%rax,%r15,4)
movq 0x38(%rsp), %rcx
movl %r14d, (%rax,%rcx,4)
cmpl %ebx, 0x10(%rsp)
jge 0x751b
movq %r15, %rcx
movl $0x1, 0x4(%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r13
jne 0x750b
movl %r12d, %ecx
movq 0x68(%rbp), %rax
movq 0x70(%rbp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
decq %rdx
cmpq %rcx, %rdx
ja 0x74dd
movl $0x18, %edi
callq 0x3220
movq 0x8(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10ee1(%rip), %rsi     # 0x18430
movq %rax, %rdi
callq 0x3050
incq 0x10ee2(%rip)           # 0x18440
incl 0x10dc4(%rip)           # 0x18328
movq 0x30(%rsp), %rdi
movl 0xc(%rdi), %ecx
movl 0x10c7a(%rip), %eax     # 0x181ec
cltd
idivl 0x10c67(%rip)           # 0x181e0
movl %eax, %esi
movl %ecx, %eax
cltd
idivl %esi
cltq
movq 0x10e27(%rip), %rcx     # 0x183b0
incl (%rcx,%rax,4)
movq 0x8(%rsp), %rax
movq 0x70(%rax), %rcx
subq 0x68(%rax), %rcx
sarq $0x2, %rcx
movq %rcx, %xmm0
punpckldq 0x9aa6(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x9aae(%rip), %xmm0     # 0x11060
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addsd 0x9a62(%rip), %xmm1     # 0x11028
xorps %xmm0, %xmm0
cvtsi2sdl 0x4c(%rdi), %xmm0
cvtsi2sdl 0x40(%rax), %xmm2
mulsd %xmm1, %xmm0
divsd %xmm2, %xmm0
xorps %xmm2, %xmm2
cvtsi2sdl 0x10c22(%rip), %xmm2 # 0x18208
addsd %xmm1, %xmm1
mulsd %xmm1, %xmm2
xorpd %xmm1, %xmm1
movapd %xmm0, %xmm3
addsd %xmm1, %xmm3
addsd %xmm2, %xmm3
cvtss2sd 0x54(%rdi), %xmm4
mulsd %xmm4, %xmm3
addsd 0x10db9(%rip), %xmm3    # 0x183c8
movsd %xmm3, 0x10db1(%rip)    # 0x183c8
mulsd %xmm4, %xmm0
addsd 0x10dad(%rip), %xmm0    # 0x183d0
movsd %xmm0, 0x10da5(%rip)    # 0x183d0
mulsd %xmm4, %xmm1
addsd 0x10da1(%rip), %xmm1    # 0x183d8
movsd %xmm1, 0x10d99(%rip)    # 0x183d8
mulsd %xmm4, %xmm2
addsd 0x10d95(%rip), %xmm2    # 0x183e0
movsd %xmm2, 0x10d8d(%rip)    # 0x183e0
jmp 0x7d1b
movl %ebx, 0x18(%rsp)
movl $0xc8, %edi
addq %rdi, %r13
addq %rbp, %rdi
movq %r13, %rsi
movq %rdx, %r14
callq 0x88f4
movl $0xe0, %edi
addq 0x8(%rsp), %rdi
movq 0x70(%rbp), %rsi
subq 0x68(%rbp), %rsi
sarq $0x2, %rsi
leaq 0x14(%rsp), %rdx
movl $0xffffffff, (%rdx)     # imm = 0xFFFFFFFF
callq 0x85f6
movq 0x28(%rsp), %rbx
movq %rbx, %rdi
subq $-0x80, %rdi
callq 0x7d42
movq 0x8(%rsp), %rcx
movq 0xe8(%rcx), %rdx
movl %eax, -0x4(%rdx)
cltq
movq 0x80(%rbx), %rdx
imulq $0x58, %rax, %rax
movupd (%r14), %xmm0
movupd %xmm0, 0x48(%rdx,%rax)
movq 0xe8(%rcx), %rax
movslq -0x4(%rax), %rdx
movq 0x80(%rbx), %rsi
imulq $0x58, %rdx, %rdx
decl 0xc(%rsi,%rdx)
movslq -0x4(%rax), %rax
imulq $0x58, %rax, %rax
movb $0x1, 0x8(%rsi,%rax)
decl 0x34(%rbx)
movq 0xc8(%rcx), %rcx
movslq (%rcx), %rdx
movq 0x20(%rsp), %rax
movq 0x68(%rax), %rax
imulq $0x58, %rdx, %rdx
decl 0xc(%rax,%rdx)
movslq (%rcx), %rdx
imulq $0x58, %rdx, %rdx
cmpl %r12d, 0x48(%rax,%rdx)
jle 0x772d
addq %rax, %rdx
addq $0x48, %rdx
movl %r12d, (%rdx)
movslq (%rcx), %rcx
imulq $0x58, %rcx, %rcx
movl 0x18(%rsp), %edx
cmpl %edx, 0x4c(%rax,%rcx)
jge 0x774b
addq %rcx, %rax
addq $0x4c, %rax
movl 0x18(%rsp), %ecx
movl %ecx, (%rax)
movq 0x68(%rbp), %rax
movq 0x70(%rbp), %rcx
subq %rax, %rcx
cmpq $0x4, %rcx
je 0x790d
movl 0x18(%rsp), %ecx
decl %ecx
movl %ecx, %ebx
movslq %ecx, %r13
xorl %r14d, %r14d
xorl %ecx, %ecx
xorl %r12d, %r12d
movl (%rax,%rcx,4), %esi
incl %r12d
movl (%rax,%r12,4), %edx
movq 0x40(%rsp), %rdi
callq 0xa972
movq 0x18(%rax), %rax
movl %r14d, (%rax,%r15,4)
movq 0x38(%rsp), %rcx
movl %r14d, (%rax,%rcx,4)
cmpl %ebx, 0x10(%rsp)
jge 0x77b1
movq %r15, %rcx
movl $0x1, 0x4(%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r13
jne 0x77a1
movl %r12d, %ecx
movq 0x68(%rbp), %rax
movq 0x70(%rbp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
decq %rdx
cmpq %rcx, %rdx
ja 0x7773
jmp 0x790d
movl $0xc8, %edi
leaq (%rdi,%r13), %rsi
addq %rbp, %rdi
callq 0x88f4
movl $0xe0, %edi
addq %rdi, %r13
addq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x88f4
movq 0x8(%rsp), %rax
movq 0xc8(%rax), %rsi
movslq (%rsi), %rcx
movq 0x20(%rsp), %rdx
movq 0x68(%rdx), %rdx
imulq $0x58, %rcx, %rcx
decl 0xc(%rdx,%rcx)
movq 0xe8(%rax), %rcx
movslq -0x4(%rcx), %rdi
movq 0x28(%rsp), %rax
movq 0x80(%rax), %rax
imulq $0x58, %rdi, %rdi
decl 0xc(%rax,%rdi)
movslq (%rsi), %rdi
imulq $0x58, %rdi, %rdi
cmpl %r12d, 0x48(%rdx,%rdi)
jle 0x784d
addq %rdx, %rdi
addq $0x48, %rdi
movl %r12d, (%rdi)
movslq (%rsi), %rsi
imulq $0x58, %rsi, %rsi
cmpl %ebx, 0x4c(%rdx,%rsi)
jge 0x7863
addq %rsi, %rdx
addq $0x4c, %rdx
movl %ebx, (%rdx)
movslq -0x4(%rcx), %rdx
imulq $0x58, %rdx, %rdx
cmpl %r12d, 0x48(%rax,%rdx)
jle 0x787c
addq %rax, %rdx
addq $0x48, %rdx
movl %r12d, (%rdx)
movslq -0x4(%rcx), %rcx
imulq $0x58, %rcx, %rcx
cmpl %ebx, 0x4c(%rax,%rcx)
jge 0x7893
addq %rcx, %rax
addq $0x4c, %rax
movl %ebx, (%rax)
movq 0x68(%rbp), %rax
movq 0x70(%rbp), %rcx
subq %rax, %rcx
cmpq $0x4, %rcx
je 0x790d
movl %ebx, %ecx
decl %ecx
movl %ecx, %ebx
movslq %ecx, %r13
xorl %r14d, %r14d
xorl %ecx, %ecx
xorl %r12d, %r12d
movl (%rax,%rcx,4), %esi
incl %r12d
movl (%rax,%r12,4), %edx
movq 0x40(%rsp), %rdi
callq 0xa972
movq 0x18(%rax), %rax
movl %r14d, (%rax,%r15,4)
movq 0x38(%rsp), %rcx
movl %r14d, (%rax,%rcx,4)
cmpl %ebx, 0x10(%rsp)
jge 0x78f3
movq %r15, %rcx
movl $0x1, 0x4(%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r13
jne 0x78e3
movl %r12d, %ecx
movq 0x68(%rbp), %rax
movq 0x70(%rbp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
decq %rdx
cmpq %rcx, %rdx
ja 0x78b5
movl $0x18, %edi
callq 0x3220
movq 0x8(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10b21(%rip), %rsi     # 0x18448
movq %rax, %rdi
callq 0x3050
incq 0x10b22(%rip)           # 0x18458
incl 0x109e8(%rip)           # 0x18324
movq 0x30(%rsp), %rdi
movl 0xc(%rdi), %ecx
movl 0x108a2(%rip), %eax     # 0x181ec
cltd
idivl 0x1088f(%rip)           # 0x181e0
movl %eax, %esi
movl %ecx, %eax
cltd
idivl %esi
cltq
movq 0x10a37(%rip), %rcx     # 0x18398
incl (%rcx,%rax,4)
movq 0x8(%rsp), %rax
movq 0x70(%rax), %rcx
subq 0x68(%rax), %rcx
sarq $0x2, %rcx
movq %rcx, %xmm1
punpckldq 0x96ce(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x96d6(%rip), %xmm1     # 0x11060
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
addsd 0x968a(%rip), %xmm0     # 0x11028
xorps %xmm1, %xmm1
cvtsi2sdl 0x4c(%rdi), %xmm1
mulsd %xmm0, %xmm1
cvtsi2sdl 0x40(%rax), %xmm2
divsd %xmm2, %xmm1
movl 0x1084f(%rip), %esi     # 0x18208
xorps %xmm2, %xmm2
cvtsi2sd %esi, %xmm2
cvttsd2si %xmm1, %ecx
movl %ecx, %eax
cltd
idivl %esi
subl %edx, %ecx
cvtsi2sd %ecx, %xmm3
subsd %xmm1, %xmm3
addsd %xmm2, %xmm3
mulsd %xmm0, %xmm3
mulsd %xmm2, %xmm0
movapd %xmm1, %xmm2
addsd %xmm3, %xmm2
addsd %xmm0, %xmm2
cvtss2sd 0x54(%rdi), %xmm4
mulsd %xmm4, %xmm2
addsd 0x109cc(%rip), %xmm2    # 0x183c8
movsd %xmm2, 0x109c4(%rip)    # 0x183c8
mulsd %xmm4, %xmm1
addsd 0x109c0(%rip), %xmm1    # 0x183d0
movsd %xmm1, 0x109b8(%rip)    # 0x183d0
mulsd %xmm4, %xmm3
addsd 0x109b4(%rip), %xmm3    # 0x183d8
movsd %xmm3, 0x109ac(%rip)    # 0x183d8
jmp 0x7ced
leaq 0xc8(%rbp), %rdi
movq 0x70(%rbp), %rsi
subq 0x68(%rbp), %rsi
sarq $0x2, %rsi
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
leaq 0x14(%rsp), %r13
movl %r14d, (%r13)
movq %rdx, 0x18(%rsp)
movq %r13, %rdx
callq 0x85f6
movl $0xe0, %edi
addq 0x8(%rsp), %rdi
movq 0x70(%rbp), %rsi
subq 0x68(%rbp), %rsi
sarq $0x2, %rsi
movl %r14d, (%r13)
leaq 0x14(%rsp), %rdx
callq 0x85f6
movq 0x20(%rsp), %r12
movq %r12, %rdi
addq $0x68, %rdi
callq 0x7d42
movq 0x8(%rsp), %rcx
movq 0xc8(%rcx), %rcx
movl %eax, (%rcx)
decl 0x2c(%r12)
movq 0x28(%rsp), %r14
movq %r14, %rdi
subq $-0x80, %rdi
callq 0x7d42
movq 0x8(%rsp), %rcx
movq 0xe8(%rcx), %rdx
movl %eax, -0x4(%rdx)
decl 0x34(%r14)
movq 0xc8(%rcx), %rax
movslq (%rax), %rax
movq 0x68(%r12), %rdx
imulq $0x58, %rax, %rax
movq 0x18(%rsp), %rdi
movups (%rdi), %xmm0
movups %xmm0, 0x48(%rdx,%rax)
movq 0xc8(%rcx), %rax
movslq (%rax), %rdx
movq 0x68(%r12), %rsi
imulq $0x58, %rdx, %rdx
decl 0xc(%rsi,%rdx)
movslq (%rax), %rax
imulq $0x58, %rax, %rax
movb $0x1, %dl
movb %dl, 0x8(%rsi,%rax)
movq 0xe8(%rcx), %rax
movslq -0x4(%rax), %rax
movq 0x80(%r14), %rsi
imulq $0x58, %rax, %rax
movups (%rdi), %xmm0
movups %xmm0, 0x48(%rsi,%rax)
movq 0xe8(%rcx), %rax
movslq -0x4(%rax), %rcx
movq 0x80(%r14), %rsi
imulq $0x58, %rcx, %rcx
decl 0xc(%rsi,%rcx)
movslq -0x4(%rax), %rax
imulq $0x58, %rax, %rax
movb %dl, 0x8(%rsi,%rax)
movq 0x68(%rbp), %rax
movq 0x70(%rbp), %rcx
subq %rax, %rcx
cmpq $0x4, %rcx
je 0x7bca
decl %ebx
movslq %ebx, %r13
xorl %r14d, %r14d
xorl %ecx, %ecx
xorl %r12d, %r12d
movl (%rax,%rcx,4), %esi
incl %r12d
movl (%rax,%r12,4), %edx
movq 0x40(%rsp), %rdi
callq 0xa972
movq 0x18(%rax), %rax
movl %r14d, (%rax,%r15,4)
movq 0x38(%rsp), %rcx
movl %r14d, (%rax,%rcx,4)
cmpl %ebx, 0x10(%rsp)
jge 0x7bb0
movq %r15, %rcx
movl $0x1, 0x4(%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r13
jne 0x7ba0
movl %r12d, %ecx
movq 0x68(%rbp), %rax
movq 0x70(%rbp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
decq %rdx
cmpq %rcx, %rdx
ja 0x7b72
movl $0x18, %edi
callq 0x3220
movq 0x8(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10864(%rip), %rsi     # 0x18448
movq %rax, %rdi
callq 0x3050
incq 0x10865(%rip)           # 0x18458
incl 0x1072b(%rip)           # 0x18324
movq 0x30(%rsp), %rdi
movl 0xc(%rdi), %ecx
movl 0x105e5(%rip), %eax     # 0x181ec
cltd
idivl 0x105d2(%rip)           # 0x181e0
movl %eax, %esi
movl %ecx, %eax
cltd
idivl %esi
cltq
movq 0x1077a(%rip), %rcx     # 0x18398
incl (%rcx,%rax,4)
movq 0x8(%rsp), %rax
movq 0x70(%rax), %rcx
subq 0x68(%rax), %rcx
sarq $0x2, %rcx
movq %rcx, %xmm1
punpckldq 0x9411(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x9419(%rip), %xmm1     # 0x11060
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
addsd 0x93cd(%rip), %xmm0     # 0x11028
xorps %xmm1, %xmm1
cvtsi2sdl 0x4c(%rdi), %xmm1
cvtsi2sdl 0x40(%rax), %xmm2
mulsd %xmm0, %xmm1
movl 0x10596(%rip), %esi     # 0x18208
cvtsi2sd %esi, %xmm3
divsd %xmm2, %xmm1
cvttsd2si %xmm1, %ecx
movl %ecx, %eax
cltd
idivl %esi
subl %edx, %ecx
xorps %xmm2, %xmm2
cvtsi2sd %ecx, %xmm2
subsd %xmm1, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm0, %xmm2
addsd %xmm0, %xmm0
mulsd %xmm3, %xmm0
movapd %xmm1, %xmm3
addsd %xmm2, %xmm3
addsd %xmm0, %xmm3
cvtss2sd 0x54(%rdi), %xmm4
mulsd %xmm4, %xmm3
addsd 0x1070b(%rip), %xmm3    # 0x183c8
movsd %xmm3, 0x10703(%rip)    # 0x183c8
mulsd %xmm4, %xmm1
addsd 0x106ff(%rip), %xmm1    # 0x183d0
movsd %xmm1, 0x106f7(%rip)    # 0x183d0
mulsd %xmm4, %xmm2
addsd 0x106f3(%rip), %xmm2    # 0x183d8
movsd %xmm2, 0x106eb(%rip)    # 0x183d8
mulsd %xmm4, %xmm0
addsd 0x106e7(%rip), %xmm0    # 0x183e0
movsd %xmm0, 0x106df(%rip)    # 0x183e0
jmp 0x7d1b
movq 0x102e6(%rip), %rdi     # 0x17ff0
leaq 0x94fe(%rip), %rsi      # 0x1120f
movl $0x16, %edx
callq 0x3250
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0xf8, %esi
movq %rbp, %rdi
callq 0x3230
movq %rbx, %rdi
callq 0x3370