// File: /workspace/github_cpp_makefile_star2_O3/adamiaonr[P]rid-analytics/src/rid-router.cpp
// Function: RID_Router::init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long, unsigned char, unsigned char, unsigned short, int)
int RID_Router::init(
    std::string router_id,
    uint64_t fwd_table_size,
    uint8_t iface_num,
    uint8_t req_size,
    uint16_t bf_size,
    int mode) {

    if (this->initialized)
        return 0;

    this->id = router_id;

    this->req_size = req_size;
    this->bf_size = bf_size;
    // fwd table parameters
    std::cout << "RID_Router::init() : [INFO] iface_num = " << (int) iface_num << std::endl;
    this->iface_num = iface_num;
    this->fwd_table_size = fwd_table_size;
    // initialize forwarding table w/ 1 row per iface
    this->fwd_table = std::vector<RID_Router::fwd_table_row>(iface_num);
    // blocked ifaces initialized to false
    this->blocked_ifaces = std::vector<bool>(iface_num, false);
    // initialize iface on fp tree of size t array
    this->iface_on_fptree = std::vector< std::vector<bool> >(this->iface_num, std::vector<bool>(req_size, false));

    // initialize router's probability module
    this->prob_mod = new Prob((__float080) this->bf_size, (__float080) this->req_size, this->iface_num);

    // mark the router as initialized
    this->initialized = true;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa0, %rsp
cmpb $0x0, 0x20(%rdi)
jne 0x1c05e
movl %r9d, %r12d
movl %r8d, %ebp
movl %ecx, %r14d
movq %rdx, %r15
movq %rdi, %rbx
callq 0x4230
movb %bpl, 0x21(%rbx)
movw %r12w, 0x22(%rbx)
movq 0x2312f(%rip), %r12     # 0x3efb8
leaq 0x147b1(%rip), %rsi     # 0x30641
movl $0x28, %edx
movq %r12, %rdi
callq 0x4400
movzbl %r14b, %r14d
movq %r12, %rdi
movl %r14d, %esi
callq 0x46d0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4370
movsbl %al, %esi
movq %r12, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x42a0
movb %r14b, 0x24(%rbx)
movq %r15, 0x28(%rbx)
leaq 0x80(%rsp), %r15
leaq 0x60(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1d4ae
movq 0x40(%rbx), %rax
movaps (%r15), %xmm0
movq 0x10(%r15), %rcx
movq %rcx, 0x40(%rbx)
movups 0x30(%rbx), %xmm1
movups %xmm0, 0x30(%rbx)
leaq 0x30(%rsp), %rdi
movaps %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
movq $0x0, 0x10(%r15)
callq 0x1d568
movq %r15, %rdi
callq 0x1d568
movb $0x0, (%r15)
leaq 0x30(%rsp), %rdi
leaq 0x80(%rsp), %rdx
leaq 0x60(%rsp), %rcx
movq %r14, %rsi
callq 0x1d598
leaq 0x60(%rbx), %r14
movq %r14, %rdi
callq 0x1e570
leaq 0x30(%rsp), %rdi
movq 0x20(%rdi), %rax
movq %rax, 0x20(%r14)
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
movzbl 0x24(%rbx), %r14d
movzbl %bpl, %esi
leaq 0x2b(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x2a(%rsp), %rcx
callq 0x1d598
leaq 0x60(%rsp), %rdi
leaq 0x30(%rsp), %rdx
leaq 0x29(%rsp), %rcx
movq %r14, %rsi
callq 0x1d600
movq 0x98(%rbx), %rax
leaq 0x60(%rsp), %r14
movaps (%r14), %xmm0
movq 0x10(%r14), %rcx
movq %rcx, 0x98(%rbx)
movups 0x88(%rbx), %xmm1
movups %xmm0, 0x88(%rbx)
leaq 0x80(%rsp), %rdi
movaps %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
callq 0x1d698
movq %r14, %rdi
callq 0x1d698
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1c01a
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x43a0
movl $0xc0, %edi
callq 0x4390
movq %rax, %r14
movzwl 0x22(%rbx), %eax
movl %eax, 0x2c(%rsp)
fildl 0x2c(%rsp)
movzbl 0x21(%rbx), %eax
movw %ax, 0x26(%rsp)
filds 0x26(%rsp)
movzbl 0x24(%rbx), %esi
fstpt 0x10(%rsp)
fstpt (%rsp)
movq %r14, %rdi
callq 0x1d6c8
movq %r14, 0xa0(%rbx)
movb $0x1, 0x20(%rbx)
xorl %eax, %eax
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0xc0, %esi
movq %r14, %rdi
callq 0x43a0
jmp 0x1c09e
movq %rax, %rbx
movq 0x30(%rsp), %rsi
testq %rsi, %rsi
je 0x1c09e
leaq 0x30(%rsp), %rdi
callq 0x5bae
jmp 0x1c09e
movq %rax, %rbx
movq %rbx, %rdi
callq 0x4700
movq %rax, %rdi
callq 0x18b87