// File: SaadBazaz[P]RIP-Protocol-Simulation/ProxyRouter.cpp
// Function: sendTableToAllRouters(int)
void sendTableToAllRouters(int ignore_fd = -1){
	auto index_vec = findAllRowsByType("ROUTER");

	for (int i=0; i<index_vec.size(); i++){

		if (table[index_vec[i]].fd == ignore_fd)
			continue;

		cout<<"Index is "<<index_vec[i]<<endl;

		string table_string = serialize (table);
		auto router = table[index_vec[i]];
		auto to_send = constructNewMessage(TABLE, port, router.identifier, (void*)table_string.c_str());
		send (router.fd, to_send.c_str(), to_send.size(), 0);
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movl %edi, -0x4(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x3500
movq -0xe0(%rbp), %rdx
leaq 0x77ef(%rip), %rsi      # 0xc08b
leaq -0x40(%rbp), %rdi
callq 0x7980
jmp 0x48a7
leaq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x46d0
jmp 0x48b6
leaq -0x40(%rbp), %rdi
callq 0x31e0
leaq -0x41(%rbp), %rdi
callq 0x3380
movl $0x0, -0x58(%rbp)
movslq -0x58(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x7ba0
movq %rax, %rcx
movq -0xe8(%rbp), %rax
cmpq %rcx, %rax
jae 0x4afa
movslq -0x58(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x7bc0
movslq (%rax), %rsi
leaq 0xc9db(%rip), %rdi      # 0x112e8
callq 0x6eb0
movl 0x4(%rax), %eax
cmpl -0x4(%rbp), %eax
jne 0x4950
jmp 0x4a93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x4942
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x31e0
leaq -0x41(%rbp), %rdi
callq 0x3380
jmp 0x4b15
movq 0xc671(%rip), %rdi      # 0x10fc8
leaq 0x7734(%rip), %rsi      # 0xc092
callq 0x3310
movq %rax, -0xf0(%rbp)
jmp 0x496c
movslq -0x58(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x7bc0
movq -0xf0(%rbp), %rdi
movl (%rax), %esi
callq 0x34e0
movq %rax, -0xf8(%rbp)
jmp 0x4990
movq -0xf8(%rbp), %rdi
movq 0xc61a(%rip), %rsi      # 0x10fb8
callq 0x3350
jmp 0x49a5
leaq 0xc93c(%rip), %rsi      # 0x112e8
leaq -0x78(%rbp), %rdi
callq 0x39a0
jmp 0x49b7
movslq -0x58(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x7bc0
movslq (%rax), %rsi
leaq 0xc91a(%rip), %rdi      # 0x112e8
callq 0x6eb0
movq %rax, %rsi
leaq -0xb8(%rbp), %rdi
callq 0x7be0
jmp 0x49e4
movl 0xc916(%rip), %eax      # 0x11300
movl %eax, -0x100(%rbp)
movl -0xb8(%rbp), %eax
movl %eax, -0xfc(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x3130
movl -0x100(%rbp), %edx
movl -0xfc(%rbp), %ecx
movq %rax, %r8
leaq -0xd8(%rbp), %rdi
movl $0x1, %esi
callq 0x3c70
jmp 0x4a27
movl -0xb4(%rbp), %eax
movl %eax, -0x10c(%rbp)
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x3130
movq -0x118(%rbp), %rdi
movq %rax, -0x108(%rbp)
callq 0x3220
movl -0x10c(%rbp), %edi
movq -0x108(%rbp), %rsi
movq %rax, %rdx
xorl %ecx, %ecx
callq 0x3170
jmp 0x4a72
leaq -0xd8(%rbp), %rdi
callq 0x31e0
leaq -0xb8(%rbp), %rdi
callq 0x77e0
leaq -0x78(%rbp), %rdi
callq 0x31e0
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x48cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x4b0c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x4aef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x4ae3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x31e0
leaq -0xb8(%rbp), %rdi
callq 0x77e0
leaq -0x78(%rbp), %rdi
callq 0x31e0
jmp 0x4b0c
leaq -0x20(%rbp), %rdi
callq 0x7b40
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
leaq -0x20(%rbp), %rdi
callq 0x7b40
movq -0x50(%rbp), %rdi
callq 0x34f0
nop