// File: /workspace/github_cpp_makefile_star2_O2/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 0x6a68
testb %al, %al
je 0x48f1
leaq 0x60(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x4254
movq (%r14), %rcx
movq 0x18(%r14), %rsi
cltq
imulq $0x4a, %rax, %r13
movl 0x46(%rcx,%r13), %edx
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x7510
movq (%r12), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x60c8
testb %al, %al
jne 0x48d6
movl 0x20(%r14), %r15d
leal 0x1(%r15), %eax
movl %eax, 0x20(%r14)
movq 0x18(%r14), %rsi
movq %rsp, %rdi
movl %r15d, %edx
callq 0x7510
movq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movq %rsp, %rdx
callq 0x61e2
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 (%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x6342
leaq 0x30(%rsp), %rdx
leaq 0x90(%rsp), %rcx
movq %r14, %rdi
movl %r15d, %esi
callq 0x497e
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 0x4254
movq (%r14), %rcx
movq 0x18(%r14), %rsi
cltq
imulq $0x4a, %rax, %rax
movl 0x46(%rcx,%rax), %edx
leaq 0x20(%rsp), %rdi
callq 0x7510
leaq 0x10(%rsp), %r14
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x507e
leaq 0x28(%rsp), %rdi
callq 0x3f74
movq (%r14), %rdi
leaq 0x60(%rsp), %rsi
movq %rbx, %rdx
callq 0x60c8
testb %al, %al
je 0x490f
leaq 0x8(%rsp), %rdi
callq 0x3f74
leaq 0x18(%rsp), %rdi
callq 0x3f74
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0xa6d8(%rip), %rax      # 0xefd0
movq (%rax), %rcx
leaq 0x4893(%rip), %rdi      # 0x9195
pushq $0x11
popq %rsi
pushq $0x1
popq %rdx
callq 0x3490
jmp 0x48e0
leaq 0x4fda(%rip), %rdi      # 0x98f0
leaq 0x47fd(%rip), %rsi      # 0x911a
leaq 0x4883(%rip), %rcx      # 0x91a7
movl $0x9f, %edx
callq 0x31a0
jmp 0x4936
jmp 0x4936
jmp 0x4936
jmp 0x4945
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3f74
jmp 0x4948
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3f74
movq %rbx, %rdi
callq 0x3420