// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/chnroute.c
// Function: feedback_net_list
static int feedback_net_list(chnroute_ctx ctx, chnroute_list_t* list)
{
	net_list_t* netlist = ctx;

	netlist->entries = 0;
	netlist->entries6 = 0;

	netlist->nets = calloc(list->net_num, sizeof(net_mask_t));
	if (netlist->nets == NULL) {
		loge("calloc\n");
		return -1;
	}

	netlist->nets6 = calloc(list->net6_num, sizeof(net_mask6_t));
	if (netlist->nets6 == NULL) {
		loge("calloc\n");
		free(netlist->nets);
		return -1;
	}

	{
		dlitem_t* curr, * next;
		chnroute_item_t* item;

		dllist_foreach(&list->items, curr, next, chnroute_item_t, item, entry) {
			if (item->is_ipv6) {
				netlist->nets6[netlist->entries6++] = item->net6;
			}
			else {
				netlist->nets[netlist->entries++] = item->net;
			}
		}
	}

	qsort(netlist->nets, netlist->entries, sizeof(net_mask_t), cmp_net_mask);

	qsort(netlist->nets6, netlist->entries6, sizeof(net_mask6_t), cmp_net_mask6);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x18(%rbp), %rax
movslq 0x10(%rax), %rdi
movl $0x8, %esi
callq 0x3260
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1c0b7
jmp 0x1c077
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x1c0a9
movl $0x3, %edi
leaq 0x1adcb(%rip), %rsi     # 0x36e5a
leaq 0x1ae7e(%rip), %rdx     # 0x36f14
movl $0x14d, %ecx            # imm = 0x14D
leaq 0x1adf4(%rip), %r8      # 0x36e96
movb $0x0, %al
callq 0x243b0
jmp 0x1c0ab
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1c243
movq -0x18(%rbp), %rax
movslq 0x14(%rax), %rdi
movl $0x20, %esi
callq 0x3260
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x1c12e
jmp 0x1c0e1
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x1c113
movl $0x3, %edi
leaq 0x1ad61(%rip), %rsi     # 0x36e5a
leaq 0x1ae14(%rip), %rdx     # 0x36f14
movl $0x153, %ecx            # imm = 0x153
leaq 0x1ad8a(%rip), %r8      # 0x36e96
movb $0x0, %al
callq 0x243b0
jmp 0x1c115
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3460
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1c243
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq %rcx, %rax
sete %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1c165
jmp 0x1c1fb
movq -0x38(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x1c1b5
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rdx
movl 0x10(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x10(%rdx)
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq -0x38(%rbp), %rcx
movq 0x14(%rcx), %rdx
movq %rdx, (%rax)
movq 0x1c(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x24(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x2c(%rcx), %rcx
movq %rcx, 0x18(%rax)
jmp 0x1c1d9
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rdx
movl (%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, (%rdx)
movslq %ecx, %rcx
movq -0x38(%rbp), %rdx
movq 0x14(%rdx), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x1c1db
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x1c14c
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rax
movslq (%rax), %rsi
movl $0x8, %edx
leaq -0x9c6(%rip), %rcx      # 0x1b850
callq 0x3650
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movslq 0x10(%rax), %rsi
movl $0x20, %edx
leaq -0x827(%rip), %rcx      # 0x1ba10
callq 0x3650
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)