// File: /workspace/github_cpp_makefile_star2_O1/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 $0x90, %rsp
cmpb $0x0, 0x20(%rdi)
jne 0x1c579
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 0x23c6f(%rip), %r12     # 0x3ffb8
leaq 0x15511(%rip), %rsi     # 0x31861
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 0x70(%rsp), %r15
leaq 0x58(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1d944
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x30(%rbx), %rax
movups 0x38(%rbx), %xmm0
movq (%r15), %rcx
movq %rcx, 0x30(%rbx)
movq 0x8(%r15), %rcx
movq %rcx, 0x38(%rbx)
movq 0x10(%r15), %rcx
movq %rcx, 0x40(%rbx)
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rsi
movq %rax, (%rdi)
movups %xmm0, 0x8(%rdi)
movq %rcx, (%r15)
movq %rdx, 0x8(%r15)
movq %rsi, 0x10(%r15)
callq 0x1da1a
movq %r15, %rdi
callq 0x1da1a
movb $0x0, (%r15)
leaq 0x30(%rsp), %rdi
leaq 0x70(%rsp), %rdx
leaq 0x58(%rsp), %rcx
movq %r14, %rsi
callq 0x1da4a
leaq 0x60(%rbx), %r14
movq %r14, %rdi
callq 0x1e9f2
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)
xorl %eax, %eax
movl %eax, 0x8(%rdi)
movq $0x0, 0x10(%rdi)
movl %eax, 0x18(%rdi)
movzbl 0x24(%rbx), %r14d
movzbl %bpl, %esi
leaq 0x2b(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x2a(%rsp), %rcx
callq 0x1da4a
leaq 0x58(%rsp), %rdi
leaq 0x30(%rsp), %rdx
leaq 0x29(%rsp), %rcx
movq %r14, %rsi
callq 0x1dab2
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x88(%rbx), %rax
movups 0x90(%rbx), %xmm0
leaq 0x58(%rsp), %r14
movq (%r14), %rcx
movq %rcx, 0x88(%rbx)
movq 0x8(%r14), %rcx
movq %rcx, 0x90(%rbx)
movq 0x10(%r14), %rcx
movq %rcx, 0x98(%rbx)
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rsi
movq %rax, (%rdi)
movups %xmm0, 0x8(%rdi)
movq %rcx, (%r14)
movq %rdx, 0x8(%r14)
movq %rsi, 0x10(%r14)
callq 0x1db4a
movq %r14, %rdi
callq 0x1db4a
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1c535
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x43a0
xorl %eax, %eax
movq %rax, 0x30(%rsp)
movl %eax, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movl %eax, 0x48(%rsp)
movq %rax, 0x50(%rsp)
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 0x1db7a
movq %r14, 0xa0(%rbx)
movb $0x1, 0x20(%rbx)
xorl %eax, %eax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0xc0, %esi
movq %r14, %rdi
callq 0x43a0
jmp 0x1c5b9
movq %rax, %rbx
movq 0x30(%rsp), %rsi
testq %rsi, %rsi
je 0x1c5b9
leaq 0x30(%rsp), %rdi
callq 0x59a0
jmp 0x1c5b9
movq %rax, %rbx
movq %rbx, %rdi
callq 0x4700
movq %rax, %rdi
callq 0x1903b
nop