// File: 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
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x78(%rbp)
leaq 0x1c286(%rip), %rax     # 0x42c68
movq %rax, (%rdi)
addq $0x8, %rdi
movq %rdi, -0x98(%rbp)
callq 0x1be40
movq -0x78(%rbp), %rdi
addq $0x20, %rdi
movq %rdi, -0x90(%rbp)
callq 0x28050
movq -0x78(%rbp), %rdi
addq $0x38, %rdi
movq %rdi, -0x70(%rbp)
callq 0x28070
movq -0x78(%rbp), %rdi
addq $0x50, %rdi
movq %rdi, -0x88(%rbp)
callq 0xaed0
movq -0x78(%rbp), %rdi
addq $0x68, %rdi
movq %rdi, -0x80(%rbp)
callq 0x28090
movq -0x78(%rbp), %rax
movq -0x70(%rbp), %rdi
movl $0x0, 0xe8(%rax)
movl $0x0, 0xec(%rax)
movl $0x0, 0xf0(%rax)
movl $0x0, 0xf4(%rax)
movl $0x0, 0xf8(%rax)
movl $0x0, 0xfc(%rax)
movl $0x0, 0x100(%rax)
movl $0x0, 0x104(%rax)
movl $0x0, 0x108(%rax)
movl $0x0, 0x10c(%rax)
movl $0x0, 0x110(%rax)
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
movl %ecx, 0x80(%rax)
movq -0x10(%rbp), %rcx
movl 0x14(%rcx), %ecx
movl %ecx, 0x84(%rax)
movq -0x10(%rbp), %rdx
movq %rdx, -0x68(%rbp)
movl 0x58(%rdx), %ecx
movl 0x5c(%rdx), %esi
addl %esi, %ecx
movl 0x60(%rdx), %esi
addl %esi, %ecx
movl 0x64(%rdx), %esi
addl %esi, %ecx
movl 0x68(%rdx), %esi
addl %esi, %ecx
movl 0x6c(%rdx), %esi
addl %esi, %ecx
movl 0x70(%rdx), %esi
addl %esi, %ecx
movl 0x74(%rdx), %esi
addl %esi, %ecx
movl 0x78(%rdx), %esi
addl %esi, %ecx
movl 0x7c(%rdx), %esi
addl %esi, %ecx
movl 0x80(%rdx), %edx
addl %edx, %ecx
movl %ecx, 0x88(%rax)
movq -0x10(%rbp), %rcx
cvtsi2sdl 0x58(%rcx), %xmm0
cvtsi2sdl 0x88(%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x90(%rax)
movsd 0x90(%rax), %xmm0
movq -0x10(%rbp), %rcx
cvtsi2sdl 0x5c(%rcx), %xmm1
cvtsi2sdl 0x88(%rax), %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x98(%rax)
movsd 0x98(%rax), %xmm0
movq -0x10(%rbp), %rcx
cvtsi2sdl 0x60(%rcx), %xmm1
cvtsi2sdl 0x88(%rax), %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0xa0(%rax)
movsd 0xa0(%rax), %xmm0
movq -0x10(%rbp), %rcx
cvtsi2sdl 0x64(%rcx), %xmm1
cvtsi2sdl 0x88(%rax), %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0xa8(%rax)
movsd 0xa8(%rax), %xmm0
movq -0x10(%rbp), %rcx
cvtsi2sdl 0x68(%rcx), %xmm1
cvtsi2sdl 0x88(%rax), %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0xb0(%rax)
movsd 0xb0(%rax), %xmm0
movq -0x10(%rbp), %rcx
cvtsi2sdl 0x6c(%rcx), %xmm1
cvtsi2sdl 0x88(%rax), %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0xb8(%rax)
movsd 0xb8(%rax), %xmm0
movq -0x10(%rbp), %rcx
cvtsi2sdl 0x70(%rcx), %xmm1
cvtsi2sdl 0x88(%rax), %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0xc0(%rax)
movsd 0xc0(%rax), %xmm0
movq -0x10(%rbp), %rcx
cvtsi2sdl 0x74(%rcx), %xmm1
cvtsi2sdl 0x88(%rax), %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0xc8(%rax)
movsd 0xc8(%rax), %xmm0
movq -0x10(%rbp), %rcx
cvtsi2sdl 0x78(%rcx), %xmm1
cvtsi2sdl 0x88(%rax), %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0xd0(%rax)
movsd 0xd0(%rax), %xmm0
movq -0x10(%rbp), %rcx
cvtsi2sdl 0x7c(%rcx), %xmm1
cvtsi2sdl 0x88(%rax), %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0xd8(%rax)
movsd 0xd8(%rax), %xmm0
movq -0x10(%rbp), %rcx
cvtsi2sdl 0x80(%rcx), %xmm1
cvtsi2sdl 0x88(%rax), %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0xe0(%rax)
movq -0x10(%rbp), %rcx
movl 0x18(%rcx), %ecx
movl %ecx, 0x114(%rax)
movq -0x10(%rbp), %rcx
movl 0x1c(%rcx), %ecx
movl %ecx, 0x118(%rax)
movq -0x10(%rbp), %rcx
movss 0x20(%rcx), %xmm0
movss %xmm0, 0x11c(%rax)
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq %rcx, 0x120(%rax)
movq -0x10(%rbp), %rcx
movq 0x30(%rcx), %rcx
movq %rcx, 0x128(%rax)
movq -0x10(%rbp), %rcx
movq 0x38(%rcx), %rcx
movq %rcx, 0x130(%rax)
movq -0x10(%rbp), %rcx
movq 0x40(%rcx), %rcx
movq %rcx, 0x138(%rax)
movq -0x10(%rbp), %rcx
movq 0x48(%rcx), %rcx
movq %rcx, 0x140(%rax)
movq -0x10(%rbp), %rcx
movq 0x50(%rcx), %rcx
movq %rcx, 0x148(%rax)
movslq 0x80(%rax), %rsi
callq 0x280b0
jmp 0x26d62
movq -0x78(%rbp), %rax
movq %rax, %rdi
addq $0x50, %rdi
movslq 0x80(%rax), %rsi
callq 0x28140
jmp 0x26d7b
movq -0x78(%rbp), %rax
movq %rax, %rdi
addq $0x20, %rdi
movslq 0x80(%rax), %rsi
callq 0x281d0
jmp 0x26d94
movq -0x78(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x28260
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x28290
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x282c0
testb $0x1, %al
jne 0x26dcd
jmp 0x26e47
leaq -0x30(%rbp), %rdi
callq 0x28300
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movslq 0x80(%rax), %rsi
callq 0x280b0
jmp 0x26df3
jmp 0x26df5
leaq -0x30(%rbp), %rdi
callq 0x28320
jmp 0x26dba
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x28420
movq -0x88(%rbp), %rdi
callq 0xaef0
movq -0x70(%rbp), %rdi
callq 0xd360
movq -0x90(%rbp), %rdi
callq 0xd3c0
movq -0x98(%rbp), %rdi
callq 0xd420
jmp 0x26f05
movq -0x78(%rbp), %rax
movq %rax, %rdi
addq $0x8, %rdi
movslq 0x80(%rax), %rsi
callq 0x1be60
jmp 0x26e60
movq -0x78(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x28340
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
callq 0x28370
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x283a0
testb $0x1, %al
jne 0x26e99
jmp 0x26ecc
leaq -0x50(%rbp), %rdi
callq 0x283e0
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movslq 0x80(%rax), %rsi
callq 0x28140
jmp 0x26ebf
jmp 0x26ec1
leaq -0x50(%rbp), %rdi
callq 0x28400
jmp 0x26e86
movq -0x78(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x26f10
jmp 0x26ede
movq -0x78(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x27140
jmp 0x26ef1
movq -0x78(%rbp), %rdi
callq 0x27360
jmp 0x26efc
addq $0xa0, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x3340
nop