// File: davidgfnet[P]dns-db/dns_block.cc
// Function: DNS_DB::DnsBlock::Iterator::Iterator(int, char const*, DNS_DB*)
DNS_DB::DnsBlock::Iterator::Iterator (int blkid, const char * domint, DNS_DB * dbref) : block_id(blkid), db(dbref) {
	DnsBlockPtr block = db->getBlock(blkid);

	if (domint) {
		int r = block->lookupEmptyDomainSpot(domint, &p);
		assert(r == ALREADY_EXISTS);
	}
	else
		p = 0;

	while (&block->blockptr[p] != block->endptr && 
		!( (block->blockptr[p].header & flagDomain) && (block->blockptr[p].header & flagUsed)) ) {

		p++;
	}

	assert(p >= 0 && p < numBlocks);
	assert(block->blockptr[p].header & flagDomain);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0xc(%rbp), %ecx
movl %ecx, 0x4(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rax), %rsi
movl -0xc(%rbp), %edx
leaq -0x30(%rbp), %rdi
callq 0x8650
cmpq $0x0, -0x18(%rbp)
je 0xbfc9
leaq -0x30(%rbp), %rdi
callq 0x8680
movq -0x40(%rbp), %rdx
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0xadc0
movl %eax, -0x34(%rbp)
cmpl $-0x2, -0x34(%rbp)
jne 0xbfa8
jmp 0xbfc7
leaq 0x779d(%rip), %rdi      # 0x1374c
leaq 0x7313(%rip), %rsi      # 0x132c9
movl $0x1ed, %edx            # imm = 0x1ED
leaq 0x779e(%rip), %rcx      # 0x13760
callq 0x41e0
jmp 0xbfd3
movq -0x40(%rbp), %rax
movl $0x0, (%rax)
jmp 0xbfd5
leaq -0x30(%rbp), %rdi
callq 0x8680
movq -0x40(%rbp), %rcx
movq (%rax), %rax
movslq (%rcx), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x8680
movq -0x50(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq 0x8(%rdx), %rcx
movb %al, -0x41(%rbp)
je 0xc075
leaq -0x30(%rbp), %rdi
callq 0x8680
movq -0x40(%rbp), %rcx
movq (%rax), %rax
movslq (%rcx), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movzbl (%rax), %ecx
movzbl 0x102d7(%rip), %eax     # 0x1c309
andl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x51(%rbp)
je 0xc06d
leaq -0x30(%rbp), %rdi
callq 0x8680
movq -0x40(%rbp), %rcx
movq (%rax), %rax
movslq (%rcx), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movzbl (%rax), %eax
movzbl 0x102a6(%rip), %ecx     # 0x1c308
andl %ecx, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
xorb $-0x1, %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0xc07e
jmp 0xc08e
movq -0x40(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xbfd5
movq -0x40(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, (%rcx)
movb %al, -0x52(%rbp)
jl 0xc0ae
movq -0x40(%rbp), %rax
movl (%rax), %eax
cmpl 0x10268(%rip), %eax     # 0x1c310
setb %al
movb %al, -0x52(%rbp)
movb -0x52(%rbp), %al
testb $0x1, %al
jne 0xc0b7
jmp 0xc0b9
jmp 0xc0d8
leaq 0x76e2(%rip), %rdi      # 0x137a2
leaq 0x7202(%rip), %rsi      # 0x132c9
movl $0x1f8, %edx            # imm = 0x1F8
leaq 0x768d(%rip), %rcx      # 0x13760
callq 0x41e0
leaq -0x30(%rbp), %rdi
callq 0x8680
movq -0x40(%rbp), %rcx
movq (%rax), %rax
movslq (%rcx), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movzbl (%rax), %eax
movzbl 0x1020d(%rip), %ecx     # 0x1c309
andl %ecx, %eax
cmpl $0x0, %eax
je 0xc105
jmp 0xc124
leaq 0x76ae(%rip), %rdi      # 0x137ba
leaq 0x71b6(%rip), %rsi      # 0x132c9
movl $0x1f9, %edx            # imm = 0x1F9
leaq 0x7641(%rip), %rcx      # 0x13760
callq 0x41e0
leaq -0x30(%rbp), %rdi
callq 0x5f20
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)