// File: hugosantos[P]dbeacon/dbeacon.cpp
// Function: CountSSMLeave(address const&, address const&)
static void CountSSMLeave(const address &group, const address &source) {
	address source_addr;
	char tmp[64], tmp2[64];

	GroupMap::iterator g = groupMap.find(group);
	assert(g != groupMap.end());
	source_addr.set_family(source.family());
	source_addr.copy_address(source);
	source_addr.set_port(0);
	SourceMap::iterator s = g->second.find(source_addr);
	assert(s != g->second.end());
	SourceSet::iterator ss = s->second.find(source);
	if (ss == s->second.end()) {
		return;
	}
	if (verbose)
		info("Removing beacon %s from (%s, %s)", source.to_string(tmp, sizeof(tmp)),
		     source_addr.to_string(tmp2, sizeof(tmp2)),
		     group.to_string(tmp2, sizeof(tmp2)));
	s->second.erase(ss);
	if (s->second.empty()) {
		if (verbose)
			info("No more beacons for (%s, %s), leaving group",
			     source_addr.to_string(tmp, sizeof(tmp)),
			     group.to_string(tmp2, sizeof(tmp2)));
		SSMLeave(ssmMcastSock,group, source_addr);
		g->second.erase(s);
	}
	if (g->second.empty()) {
		if (verbose)
			info("No more sources, unregistering group %s, ", group.to_string(tmp, sizeof(tmp)));
		groupMap.erase(g);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x17b40
movq -0x8(%rbp), %rsi
leaq 0x224b6(%rip), %rdi     # 0x29950
callq 0x107c0
movq %rax, -0x118(%rbp)
leaq 0x224a3(%rip), %rdi     # 0x29950
callq 0x10820
movq %rax, -0x120(%rbp)
leaq -0x118(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x12bc0
testb $0x1, %al
jne 0x74d2
jmp 0x74d4
jmp 0x74f3
leaq 0x1503a(%rip), %rdi     # 0x1c515
leaq 0x14d98(%rip), %rsi     # 0x1c27a
movl $0x489, %edx            # imm = 0x489
leaq 0x1503b(%rip), %rcx     # 0x1c529
callq 0x42b0
movq -0x10(%rbp), %rdi
callq 0x170e0
movl %eax, %esi
leaq -0x90(%rbp), %rdi
callq 0x17900
movq -0x10(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x18440
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
callq 0x18000
leaq -0x118(%rbp), %rdi
callq 0x10920
movq %rax, %rdi
addq $0x80, %rdi
leaq -0x90(%rbp), %rsi
callq 0x10940
movq %rax, -0x128(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x10920
movq %rax, %rdi
addq $0x80, %rdi
callq 0x109a0
movq %rax, -0x130(%rbp)
leaq -0x128(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x12bf0
testb $0x1, %al
jne 0x758c
jmp 0x758e
jmp 0x75ad
leaq 0x14fc9(%rip), %rdi     # 0x1c55e
leaq 0x14cde(%rip), %rsi     # 0x1c27a
movl $0x48e, %edx            # imm = 0x48E
leaq 0x14f81(%rip), %rcx     # 0x1c529
callq 0x42b0
leaq -0x128(%rbp), %rdi
callq 0x10aa0
movq %rax, %rdi
addq $0x80, %rdi
movq -0x10(%rbp), %rsi
callq 0x10ac0
movq %rax, -0x138(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x10aa0
movq %rax, %rdi
addq $0x80, %rdi
callq 0x10b30
movq %rax, -0x140(%rbp)
leaq -0x138(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x10b00
testb $0x1, %al
jne 0x760e
jmp 0x7613
jmp 0x781e
cmpl $0x0, 0x21fce(%rip)     # 0x295e8
je 0x769a
movq -0x10(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
movl $0x40, %edx
movl $0x1, %ecx
callq 0x18100
movq %rax, -0x180(%rbp)
leaq -0x110(%rbp), %rsi
leaq -0x90(%rbp), %rdi
movl $0x40, %edx
movl $0x1, %ecx
callq 0x18100
movq %rax, -0x178(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
movl $0x40, %edx
movl $0x1, %ecx
callq 0x18100
movq -0x180(%rbp), %rsi
movq -0x178(%rbp), %rdx
movq %rax, %rcx
leaq 0x14ee0(%rip), %rdi     # 0x1c573
movb $0x0, %al
callq 0x51b0
leaq -0x128(%rbp), %rdi
callq 0x10aa0
movq %rax, %rdi
addq $0x80, %rdi
movq -0x138(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rsi
callq 0x12c20
movq %rax, -0x150(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x10aa0
movq %rax, %rdi
addq $0x80, %rdi
callq 0x12c60
testb $0x1, %al
jne 0x76f5
jmp 0x77a1
cmpl $0x0, 0x21eec(%rip)     # 0x295e8
je 0x7754
leaq -0xd0(%rbp), %rsi
leaq -0x90(%rbp), %rdi
movl $0x40, %edx
movl $0x1, %ecx
callq 0x18100
movq %rax, -0x188(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
movl $0x40, %edx
movl $0x1, %ecx
callq 0x18100
movq -0x188(%rbp), %rsi
movq %rax, %rdx
leaq 0x14e47(%rip), %rdi     # 0x1c594
movb $0x0, %al
callq 0x51b0
movl 0x221ae(%rip), %edi     # 0x29908
movq -0x8(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x17220
leaq -0x118(%rbp), %rdi
callq 0x10920
movq %rax, %rdi
addq $0x80, %rdi
movq -0x128(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rsi
callq 0x12c80
movq %rax, -0x160(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x10920
movq %rax, %rdi
addq $0x80, %rdi
callq 0x12cc0
testb $0x1, %al
jne 0x77c2
jmp 0x781e
cmpl $0x0, 0x21e1f(%rip)     # 0x295e8
je 0x77f6
movq -0x8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
movl $0x40, %edx
movl $0x1, %ecx
callq 0x18100
movq %rax, %rsi
leaq 0x14dd1(%rip), %rdi     # 0x1c5c0
movb $0x0, %al
callq 0x51b0
movq -0x118(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rsi
leaq 0x2213e(%rip), %rdi     # 0x29950
callq 0x12ce0
movq %rax, -0x170(%rbp)
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
nopw (%rax,%rax)