// File: hugosantos[P]dbeacon/dbeacon.cpp
// Function: send_report(int)
int send_report(int type) {
	int len;

	len = build_report(buffer, bufferLen, type == SSM_REPORT ? STATS_REPORT : type, true);
	if (len < 0)
		return len;

	int res;

	if (type == SSM_REPORT) {
		if ((res = sendto(mcastSock, buffer, len, 0, ssmProbeAddr.saddr(), ssmProbeAddr.addrlen())) < 0)
			d_log(LOG_DEBUG, "Failed to send SSM report: %s", strerror(errno));
		else
			bytesSent += res;
	} else {
		for (vector<address>::const_iterator i = redist.begin();
				i != redist.end(); ++i) {
			char tmp[64];

			if (verbose)
				d_log(LOG_DEBUG, "Sending Report to %s",
					i->to_string(tmp, sizeof(tmp)));

			if ((res = sendto(mcastSock, buffer, len, 0, i->saddr(),
					i->addrlen())) < 0)
				d_log(LOG_DEBUG, "Failed to send report to %s: %s",
					i->to_string(tmp, sizeof(tmp)), strerror(errno));
			else
				bytesSent += res;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movl %edi, -0x8(%rbp)
cmpl $0x53, -0x8(%rbp)
jne 0x63ce
movl $0x52, %eax
movl %eax, -0x74(%rbp)
jmp 0x63d4
movl -0x8(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %edx
leaq 0x235c2(%rip), %rdi     # 0x299a0
movl $0x2000, %esi           # imm = 0x2000
movl $0x1, %ecx
callq 0x18730
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0x6401
movl -0xc(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6607
cmpl $0x53, -0x8(%rbp)
jne 0x64a0
movl 0x234f3(%rip), %eax     # 0x29904
movl %eax, -0x8c(%rbp)
movslq -0xc(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq 0x2328f(%rip), %rdi     # 0x296b8
callq 0x17940
movq %rax, -0x80(%rbp)
leaq 0x2327f(%rip), %rdi     # 0x296b8
callq 0x17450
movl -0x8c(%rbp), %edi
movq -0x88(%rbp), %rdx
movq -0x80(%rbp), %r8
movl %eax, %r9d
leaq 0x23547(%rip), %rsi     # 0x299a0
xorl %ecx, %ecx
callq 0x4060
movl %eax, -0x10(%rbp)
cmpl $0x0, %eax
jge 0x648c
callq 0x4040
movl (%rax), %edi
callq 0x4170
movq %rax, %rdx
movl $0x7, %edi
leaq 0x16167(%rip), %rsi     # 0x1c5ea
movb $0x0, %al
callq 0x5020
jmp 0x649b
movl -0x10(%rbp), %eax
addl 0x25523(%rip), %eax     # 0x2b9b8
movl %eax, 0x2551d(%rip)     # 0x2b9b8
jmp 0x6600
leaq 0x23319(%rip), %rdi     # 0x297c0
callq 0xac80
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xacb0
leaq 0x232fc(%rip), %rdi     # 0x297c0
callq 0xad30
movq %rax, -0x28(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xacf0
testb $0x1, %al
jne 0x64e3
jmp 0x65fe
cmpl $0x0, 0x230fe(%rip)     # 0x295e8
je 0x6521
leaq -0x18(%rbp), %rdi
callq 0x13180
movq %rax, %rdi
leaq -0x70(%rbp), %rsi
movl $0x40, %edx
movl $0x1, %ecx
callq 0x18100
movq %rax, %rdx
movl $0x7, %edi
leaq 0x160ee(%rip), %rsi     # 0x1c608
movb $0x0, %al
callq 0x5020
movl 0x233dd(%rip), %eax     # 0x29904
movl %eax, -0xa4(%rbp)
movslq -0xc(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x13180
movq %rax, %rdi
callq 0x17440
movq %rax, -0x98(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x13180
movq %rax, %rdi
callq 0x17450
movl -0xa4(%rbp), %edi
movq -0xa0(%rbp), %rdx
movq -0x98(%rbp), %r8
movl %eax, %r9d
leaq 0x23421(%rip), %rsi     # 0x299a0
xorl %ecx, %ecx
callq 0x4060
movl %eax, -0x10(%rbp)
cmpl $0x0, %eax
jge 0x65df
leaq -0x18(%rbp), %rdi
callq 0x13180
movq %rax, %rdi
leaq -0x70(%rbp), %rsi
movl $0x40, %edx
movl $0x1, %ecx
callq 0x18100
movq %rax, -0xb0(%rbp)
callq 0x4040
movl (%rax), %edi
callq 0x4170
movq -0xb0(%rbp), %rdx
movq %rax, %rcx
movl $0x7, %edi
leaq 0x16047(%rip), %rsi     # 0x1c61d
movb $0x0, %al
callq 0x5020
jmp 0x65ee
movl -0x10(%rbp), %eax
addl 0x253d0(%rip), %eax     # 0x2b9b8
movl %eax, 0x253ca(%rip)     # 0x2b9b8
jmp 0x65f0
leaq -0x18(%rbp), %rdi
callq 0xad80
jmp 0x64bd
jmp 0x6600
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)