// File: davidgfnet[P]dns-db/dns_block.cc
// Function: DNS_DB::DnsBlock::getIpsv4(int) const
std::vector <IPv4_Record> DNS_DB::DnsBlock::getIpsv4(int p) const {
	std::vector <IPv4_Record> ret;
	const DNS_DB::DnsBlock::InternalBlock * ptr = &blockptr[p];
	if (ptr == 0)
		return ret;

	assert((ptr->header & DNS_DB::DnsBlock::flagDomain) != 0);
	assert((ptr->header & DNS_DB::DnsBlock::flagUsed) != 0);

	do {
		if (ptr->header & DNS_DB::DnsBlock::flagDomain) {
			for (int i = 0; i < 2; i++)
				if (ptr->data.domain.records[i].ip != 0)
					ret.push_back(ptr->data.domain.records[i]);
		}
		else {
			for (int i = 0; i < 5; i++)
				if (ptr->data.records.records[i].ip != 0)
					ret.push_back(ptr->data.records.records[i]);
		}
		ptr++;
	} while (ptr != endptr && !(ptr->header & DNS_DB::DnsBlock::flagDomain) && (ptr->header & DNS_DB::DnsBlock::flagUsed));

	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x50(%rbp)
movq %rdi, %rax
movq %rax, -0x48(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movb $0x0, -0x15(%rbp)
callq 0xc6b0
movq -0x40(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xaf6c
movb $0x1, -0x15(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0xb11f
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movzbl 0x1138f(%rip), %ecx     # 0x1c309
andl %ecx, %eax
cmpl $0x0, %eax
je 0xaf83
jmp 0xafa2
leaq 0x8481(%rip), %rdi      # 0x1340b
leaq 0x8338(%rip), %rsi      # 0x132c9
movl $0x58, %edx
leaq 0x84a0(%rip), %rcx      # 0x1343d
callq 0x41e0
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movzbl 0x11358(%rip), %ecx     # 0x1c308
andl %ecx, %eax
cmpl $0x0, %eax
je 0xafb9
jmp 0xafd8
leaq 0x84bc(%rip), %rdi      # 0x1347c
leaq 0x8302(%rip), %rsi      # 0x132c9
movl $0x59, %edx
leaq 0x846a(%rip), %rcx      # 0x1343d
callq 0x41e0
jmp 0xafda
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movzbl 0x11321(%rip), %ecx     # 0x1c309
andl %ecx, %eax
cmpl $0x0, %eax
je 0xb060
movl $0x0, -0x28(%rbp)
cmpl $0x2, -0x28(%rbp)
jge 0xb05e
movq -0x20(%rbp), %rax
addq $0x1, %rax
addq $0x23, %rax
movslq -0x28(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x8(%rax)
je 0xb051
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq 0x24(%rax,%rcx,4), %rsi
callq 0xc6d0
jmp 0xb035
jmp 0xb051
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0xc740
jmp 0xb138
jmp 0xb053
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xaff6
jmp 0xb0b7
movl $0x0, -0x38(%rbp)
cmpl $0x5, -0x38(%rbp)
jge 0xb0b5
movq -0x20(%rbp), %rax
addq $0x1, %rax
addq $0x3, %rax
movslq -0x38(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x8(%rax)
je 0xb0a8
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq 0x4(%rax,%rcx,4), %rsi
callq 0xc6d0
jmp 0xb0a6
jmp 0xb0a8
jmp 0xb0aa
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xb067
jmp 0xb0b7
movq -0x20(%rbp), %rax
addq $0x40, %rax
movq %rax, -0x20(%rbp)
movq -0x40(%rbp), %rdx
movq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpq 0x8(%rdx), %rcx
movb %al, -0x51(%rbp)
je 0xb109
movq -0x20(%rbp), %rax
movzbl (%rax), %ecx
movzbl 0x11225(%rip), %eax     # 0x1c309
andl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x51(%rbp)
jne 0xb109
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movzbl 0x1120a(%rip), %ecx     # 0x1c308
andl %ecx, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0xafda
movb $0x1, -0x15(%rbp)
movl $0x1, -0x24(%rbp)
testb $0x1, -0x15(%rbp)
jne 0xb12e
movq -0x50(%rbp), %rdi
callq 0xc740
movq -0x48(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x44f0
nopw %cs:(%rax,%rax)