// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]dns-db/dns_index.cc
// Function: DNS_DB::DnsIndex::addIp4Record(char const*, IPv4_Record const&)
void DNS_DB::DnsIndex::addIp4Record(const char * domain, const IPv4_Record & record) {
	char domint[MAX_DNS_SIZE];
	if (!domain2idom(domain, domint)) {
		fprintf(stderr, "Domain too long!\n");
		return;
	}

	int n = lookupNode(domint);
	DNS_DB::DnsBlockPtr blk = database->getBlock(nodes[n].dnsblock_id);

	if (!blk->addDomainIpv4(domint, record)) {
		// Ops, just split the Block in two, must be full
		unsigned int nwblk_id = this->current_id++;
		DnsBlockPtr newblk = database->getBlock(nwblk_id);
		blk->splitBlock(domint, newblk);

		char nodemax[MAX_DNS_SIZE];
		char dommax [MAX_DNS_SIZE];
		getBlkMax(n, nodemax);
		newblk->getMinDomain(dommax);

		// Set new block boundaries
		addBlock(nwblk_id, dommax, nodemax);

		// Just recalculate the max for the other block
		setBlkMinMax(n, 0, dommax);

		// Redo
		n = lookupNode(domint);
		blk = database->getBlock(nodes[n].dnsblock_id);

		bool r = blk->addDomainIpv4(domint, record);
		assert(r);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc0, %rsp
movq %rdx, %rbx
movq %rsi, %rax
movq %rdi, %r14
leaq 0x60(%rsp), %rsi
movq %rax, %rdi
callq 0x73ac
testb %al, %al
je 0x5063
leaq 0x60(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x4928
movq (%r14), %rcx
movq 0x18(%r14), %rsi
cltq
imulq $0x4a, %rax, %r13
movl 0x46(%rcx,%r13), %edx
movq %rsp, %r12
movq %r12, %rdi
callq 0x7e88
movq (%r12), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x6954
testb %al, %al
jne 0x5043
movl 0x20(%r14), %r15d
leal 0x1(%r15), %eax
movl %eax, 0x20(%r14)
movq 0x18(%r14), %rsi
leaq 0x10(%rsp), %rdi
movl %r15d, %edx
callq 0x7e88
movq (%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x6a76
movq (%r14), %rax
movl 0x42(%rax,%r13), %ecx
movl %ecx, 0xaf(%rsp)
movups 0x23(%rax,%r13), %xmm0
movups 0x33(%rax,%r13), %xmm1
movaps %xmm1, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x6bcc
leaq 0x30(%rsp), %rdx
leaq 0x90(%rsp), %rcx
movq %r14, %rdi
movl %r15d, %esi
callq 0x50e4
movq (%r14), %rax
movl 0x4f(%rsp), %ecx
movl %ecx, 0x42(%rax,%r13)
movaps 0x30(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
movups %xmm1, 0x33(%rax,%r13)
movups %xmm0, 0x23(%rax,%r13)
leaq 0x60(%rsp), %rsi
movq %r14, %rdi
callq 0x4928
movq (%r14), %rcx
movq 0x18(%r14), %rsi
cltq
imulq $0x4a, %rax, %rax
movl 0x46(%rcx,%rax), %edx
leaq 0x20(%rsp), %rdi
callq 0x7e88
movaps 0x20(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x20(%rsp)
movq 0x8(%rsp), %rdi
movaps %xmm0, (%rsp)
testq %rdi, %rdi
je 0x501f
callq 0x4628
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x501f
callq 0x4628
movq (%rsp), %rdi
leaq 0x60(%rsp), %rsi
movq %rbx, %rdx
callq 0x6954
testb %al, %al
je 0x506a
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x5043
callq 0x4628
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x5052
callq 0x4628
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0x35b7
jmp 0x5052
leaq 0x58af(%rip), %rdi      # 0xa920
leaq 0x50d2(%rip), %rsi      # 0xa14a
leaq 0x5158(%rip), %rcx      # 0xa1d7
movl $0x9f, %edx
callq 0x3180
jmp 0x5091
jmp 0x5091
jmp 0x5091
jmp 0x50a5
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x50a8
callq 0x4628
jmp 0x50a8
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x50b7
callq 0x4628
movq %rbx, %rdi
callq 0x3400
nop