// File: /workspace/github_cpp_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
cmpb $0x0, 0x20(%rdi)
jne 0x17bc5
movl %r9d, %r12d
movl %r8d, %ebp
movl %ecx, %r14d
movq %rdx, %r15
movq %rdi, %rbx
callq 0x4250
movb %bpl, 0x21(%rbx)
movw %r12w, 0x22(%rbx)
movq 0x2351c(%rip), %rdi     # 0x3afb0
leaq 0x12d66(%rip), %rsi     # 0x2a801
callq 0x43a0
movzbl %r14b, %r14d
movq %rax, %rdi
movl %r14d, %esi
callq 0x46d0
movq %rax, %rdi
callq 0x41e0
movb %r14b, 0x24(%rbx)
movq %r15, 0x28(%rbx)
leaq 0x50(%rsp), %r15
leaq 0x38(%rsp), %r12
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x18a32
leaq 0x30(%rbx), %rdi
movq %r15, %rsi
callq 0x19e1a
movq %r15, %rdi
callq 0x18a84
xorl %r13d, %r13d
movb %r13b, (%r12)
leaq 0x50(%rsp), %r15
leaq 0x38(%rsp), %rdx
leaq 0x2f(%rsp), %r12
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x18aa6
leaq 0x60(%rbx), %rdi
movq %r15, %rsi
callq 0x18b0a
movq %r15, %rdi
callq 0x18b5c
movzbl 0x24(%rbx), %r14d
movzbl %bpl, %esi
movb %r13b, (%r12)
leaq 0x50(%rsp), %rdi
leaq 0x2f(%rsp), %rdx
leaq 0x33(%rsp), %rcx
callq 0x18aa6
leaq 0x38(%rsp), %rdi
leaq 0x50(%rsp), %rdx
leaq 0x32(%rsp), %rcx
movq %r14, %rsi
callq 0x18b6c
leaq 0x88(%rbx), %rdi
leaq 0x38(%rsp), %r14
movq %r14, %rsi
callq 0x1a1aa
movq %r14, %rdi
callq 0x18bc2
leaq 0x50(%rsp), %rdi
callq 0x18b5c
movl $0xc0, %edi
callq 0x43c0
movq %rax, %r14
movzwl 0x22(%rbx), %eax
movl %eax, 0x34(%rsp)
fildl 0x34(%rsp)
movzbl 0x21(%rbx), %eax
movw %ax, 0x30(%rsp)
filds 0x30(%rsp)
movzbl 0x24(%rbx), %esi
fstpt 0x10(%rsp)
fstpt (%rsp)
movq %r14, %rdi
callq 0x18be4
movq %r14, 0xa0(%rbx)
movb $0x1, 0x20(%rbx)
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0xc0, %esi
movq %r14, %rdi
callq 0x43d0
jmp 0x17bfa
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x18b5c
jmp 0x17bfa
movq %rax, %rbx
movq %rbx, %rdi
callq 0x4700