// File: /workspace/github_cpp_makefile_star2_O2/ynilu[P]elastic/traffic.cpp
// Function: Traffic::Traffic(Traffic_info&)
Traffic::Traffic(Traffic_info& t_info)
{
    num_nodes = t_info.num_nodes;
    num_requests = t_info.num_requests;
    total_OCx_share =
        t_info.OC1_share +
        t_info.OC3_share +
        t_info.OC9_share +
        t_info.OC12_share +
        t_info.OC18_share +
        t_info.OC24_share +
        t_info.OC36_share +
        t_info.OC48_share +
        t_info.OC192_share +
        t_info.OC768_share +
        t_info.OC3072_share;
    OC1_ratio = 1.0 * t_info.OC1_share / total_OCx_share;
    OC3_ratio = OC1_ratio + 1.0 * t_info.OC3_share / total_OCx_share;
    OC9_ratio = OC3_ratio + 1.0 * t_info.OC9_share / total_OCx_share;
    OC12_ratio = OC9_ratio + 1.0 * t_info.OC12_share / total_OCx_share;
    OC18_ratio = OC12_ratio + 1.0 * t_info.OC18_share / total_OCx_share;
    OC24_ratio = OC18_ratio + 1.0 * t_info.OC24_share / total_OCx_share;
    OC36_ratio = OC24_ratio + 1.0 * t_info.OC36_share / total_OCx_share;
    OC48_ratio = OC36_ratio + 1.0 * t_info.OC48_share / total_OCx_share;
    OC192_ratio = OC48_ratio + 1.0 * t_info.OC192_share / total_OCx_share;
    OC768_ratio = OC192_ratio + 1.0 * t_info.OC768_share / total_OCx_share;
    OC3072_ratio = OC768_ratio + 1.0 * t_info.OC3072_share / total_OCx_share;


    traffic_lambda = t_info.traffic_lambda;
    traffic_mu = t_info.traffic_mu;
    unicast_percentage = t_info.unicast_percentage;
    aTime_seed = t_info.aTime_seed;
    hTime_seed = t_info.hTime_seed;
    s_seed = t_info.s_seed;
    d_seed = t_info.d_seed;
    numD_seed = t_info.numD_seed;
    b_seed = t_info.b_seed;

    // resize the containers for the data read from file
    source_matrix.resize(num_nodes);
    num_dest_matrix.resize(num_nodes);
    traffic_matrix.resize(num_nodes);
    for(auto &element : traffic_matrix)
    {
        element.resize(num_nodes);
    }

    total_dest_count.resize(num_nodes);
    for(auto &element : total_dest_count)
    {
        element.resize(num_nodes);
    }

    read_source_file(t_info.source_file);
    read_traffic_file(t_info.traffic_file);

    generate_traffic();

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
leaq 0xba44(%rip), %rax      # 0x17c70
movq %rax, (%rdi)
leaq 0x68(%rdi), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x28(%rdi)
movups %xmm0, 0x38(%rdi)
movups %xmm0, 0x48(%rdi)
movups %xmm0, 0x58(%rdi)
movq %rax, 0x70(%rdi)
movq %rax, 0x18(%rsp)
movq %rax, 0x68(%rdi)
andq $0x0, 0x78(%rdi)
movq %rsi, %r15
movups %xmm0, 0xe8(%rdi)
movups %xmm0, 0xf8(%rdi)
movups %xmm0, 0x104(%rdi)
movq 0x10(%rsi), %rax
movq %rax, 0x20(%rsp)
movq %rax, 0x80(%rdi)
movl 0x58(%rsi), %ebp
movl 0x5c(%rsi), %r13d
movl 0x60(%rsi), %r12d
movl 0x64(%rsi), %r11d
leal (%r12,%r11), %edx
addl %r13d, %edx
addl %ebp, %edx
movl 0x68(%rsi), %ebx
movl 0x6c(%rsi), %r9d
leal (%rbx,%r9), %eax
movl 0x70(%rsi), %r8d
addl %r8d, %eax
addl %edx, %eax
movl 0x74(%rsi), %edi
movl 0x78(%rsi), %esi
leal (%rdi,%rsi), %r10d
movl 0x7c(%r15), %edx
addl %edx, %r10d
movl 0x80(%r15), %ecx
addl %ecx, %r10d
addl %eax, %r10d
cvtsi2sd %ebp, %xmm1
cvtsi2sd %r13d, %xmm2
cvtsi2sd %r12d, %xmm3
cvtsi2sd %r11d, %xmm4
cvtsi2sd %ebx, %xmm5
cvtsi2sd %r9d, %xmm6
cvtsi2sd %r8d, %xmm7
cvtsi2sd %r10d, %xmm0
movl %r10d, 0x88(%r14)
divsd %xmm0, %xmm1
movsd %xmm1, 0x90(%r14)
divsd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x98(%r14)
divsd %xmm0, %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, 0xa0(%r14)
divsd %xmm0, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, 0xa8(%r14)
divsd %xmm0, %xmm5
addsd %xmm4, %xmm5
movsd %xmm5, 0xb0(%r14)
divsd %xmm0, %xmm6
addsd %xmm5, %xmm6
movsd %xmm6, 0xb8(%r14)
divsd %xmm0, %xmm7
addsd %xmm6, %xmm7
cvtsi2sd %edi, %xmm1
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movsd %xmm7, 0xc0(%r14)
divsd %xmm0, %xmm1
addsd %xmm7, %xmm1
cvtsi2sd %esi, %xmm2
leaq 0x20(%r14), %rax
movq %rax, 0x10(%rsp)
movsd %xmm1, 0xc8(%r14)
divsd %xmm0, %xmm2
addsd %xmm1, %xmm2
cvtsi2sd %edx, %xmm1
leaq 0x38(%r14), %rbp
movsd %xmm2, 0xd0(%r14)
divsd %xmm0, %xmm1
addsd %xmm2, %xmm1
cvtsi2sd %ecx, %xmm2
movsd %xmm1, 0xd8(%r14)
divsd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0xe0(%r14)
movq 0x18(%r15), %rax
movq %rax, 0x114(%r14)
leaq 0x50(%r14), %r12
movss 0x20(%r15), %xmm0
movss %xmm0, 0x11c(%r14)
movups 0x28(%r15), %xmm0
movups %xmm0, 0x120(%r14)
movups 0x38(%r15), %xmm0
movups %xmm0, 0x130(%r14)
movups 0x48(%r15), %xmm0
movups %xmm0, 0x140(%r14)
movslq 0x20(%rsp), %rsi
movq %rbp, %rdi
callq 0xce68
movslq 0x80(%r14), %rsi
movq %r12, %rdi
callq 0xce9a
movslq 0x80(%r14), %rsi
movq 0x10(%rsp), %rdi
callq 0xcecc
movq 0x20(%r14), %rbx
movq 0x28(%r14), %r13
movslq 0x80(%r14), %rsi
cmpq %r13, %rbx
je 0xc470
movq %rbx, %rdi
callq 0xce68
addq $0x18, %rbx
jmp 0xc456
movq 0x8(%rsp), %rdi
callq 0x9c96
movq 0x8(%r14), %rbx
movq 0x10(%r14), %r13
cmpq %r13, %rbx
je 0xc49c
movslq 0x80(%r14), %rsi
movq %rbx, %rdi
callq 0xce9a
addq $0x18, %rbx
jmp 0xc482
movq (%r15), %rsi
movq %r14, %rdi
callq 0xc508
movq 0x8(%r15), %rsi
movq %r14, %rdi
callq 0xc63e
movq %r14, %rdi
callq 0xc77c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc4ce
jmp 0xc4ce
movq %rax, %r14
movq 0x18(%rsp), %rdi
callq 0x7384
movq %r12, %rdi
callq 0x6f54
movq %rbp, %rdi
callq 0x6ebe
movq 0x10(%rsp), %rdi
callq 0x6bf6
movq 0x8(%rsp), %rdi
callq 0x6c18
movq %r14, %rdi
callq 0x2320
nop