// File: /workspace/github_c_makefile_star2_O3/open-mesh-mirror[P]batmand/hna.c
// Function: hna_local_task_exec
void hna_local_task_exec(void)
{
	struct list_head *list_pos, *list_pos_tmp, *prev_list_head;
	struct list_head *hna_pos, *hna_pos_tmp;
	struct hna_task *hna_task;
	struct hna_local_entry *hna_local_entry;
	char hna_addr_str[ADDR_STR_LEN];

	if (pthread_mutex_trylock(&hna_chg_list_mutex) != 0)
		return;

	if (list_empty(&hna_chg_list))
		goto unlock_chg_list;

	list_for_each_safe(list_pos, list_pos_tmp, &hna_chg_list) {

		hna_task = list_entry(list_pos, struct hna_task, list);
		addr_to_string(hna_task->addr, hna_addr_str, sizeof(hna_addr_str));

		hna_local_entry = NULL;
		prev_list_head = (struct list_head *)&hna_list;

		list_for_each_safe(hna_pos, hna_pos_tmp, &hna_list) {

			hna_local_entry = list_entry(hna_pos, struct hna_local_entry, list);

			if ((hna_task->addr == hna_local_entry->addr) && (hna_task->netmask == hna_local_entry->netmask)) {

				if (hna_task->route_action == ROUTE_DEL) {
					debug_output(3, "Deleting HNA from announce network list: %s/%i\n", hna_addr_str, hna_task->netmask);

					hna_local_update_routes(hna_local_entry, ROUTE_DEL);
					list_del(prev_list_head, hna_pos, &hna_list);
					debugFree(hna_local_entry, 1702);
				} else {
					debug_output(3, "Can't add HNA - already announcing network: %s/%i\n", hna_addr_str, hna_task->netmask);
				}

				break;

			}

			prev_list_head = &hna_local_entry->list;
			hna_local_entry = NULL;

		}

		if (hna_local_entry == NULL) {

			if (hna_task->route_action == ROUTE_ADD) {
				debug_output(3, "Adding HNA to announce network list: %s/%i\n", hna_addr_str, hna_task->netmask);

				/* add node */
				hna_local_entry = debugMalloc(sizeof(struct hna_local_entry), 702);
				memset(hna_local_entry, 0, sizeof(struct hna_local_entry));
				INIT_LIST_HEAD(&hna_local_entry->list);

				hna_local_entry->addr = hna_task->addr;
				hna_local_entry->netmask = hna_task->netmask;

				hna_local_update_routes(hna_local_entry, ROUTE_ADD);
				list_add_tail(&hna_local_entry->list, &hna_list);
			} else {
				debug_output(3, "Can't delete HNA - network is not announced: %s/%i\n", hna_addr_str, hna_task->netmask);
			}

		}

		list_del((struct list_head *)&hna_chg_list, list_pos, &hna_chg_list);
		debugFree(hna_task, 1703);

	}

	/* rewrite local buffer */
	hna_local_buffer_fill();

unlock_chg_list:
	if (pthread_mutex_unlock(&hna_chg_list_mutex) != 0)
		debug_output(0, "Error - could not unlock hna_chg_list mutex in %s(): %s \n", __func__, strerror(errno));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x10663(%rip), %rdi     # 0x17650
callq 0x2220
testl %eax, %eax
jne 0x7244
leaq 0x1063f(%rip), %rbx     # 0x17640
movq %rbx, %rdi
callq 0x5bfb
testl %eax, %eax
jne 0x720e
movq 0x10628(%rip), %r14     # 0x17640
cmpq %rbx, %r14
je 0x7167
leaq 0x10608(%rip), %r13     # 0x17630
movq %r14, %rbp
movq (%r14), %r14
movl 0x8(%rbp), %edi
movq %rsp, %rsi
movl $0x10, %edx
callq 0xbbac
movq 0x105eb(%rip), %rax     # 0x17630
cmpq %r13, %rax
je 0x7074
movl 0x8(%rbp), %edx
movq %r13, %r15
movq %rax, %r12
movq (%rax), %rax
cmpl 0x8(%r12), %edx
jne 0x706c
movzbl 0xc(%rbp), %ecx
cmpb 0xc(%r12), %cl
je 0x70ec
movq %r12, %r15
cmpq %r13, %rax
jne 0x7050
cmpb $0x0, 0xd(%rbp)
movzbl 0xc(%rbp), %ecx
movl $0x3, %edi
je 0x7099
leaq 0x9c90(%rip), %rsi      # 0x10d1a
movq %rsp, %rdx
xorl %eax, %eax
callq 0xd88c
jmp 0x7130
leaq 0x9c4e(%rip), %rsi      # 0x10cee
movq %rsp, %rdx
xorl %eax, %eax
callq 0xd88c
movl $0x10, %edi
movl $0x2be, %esi            # imm = 0x2BE
callq 0x5d52
movq %rax, %r15
movq $0x0, 0x8(%rax)
movq %rax, (%rax)
movl 0x8(%rbp), %eax
movl %eax, 0x8(%r15)
movb 0xc(%rbp), %al
movb %al, 0xc(%r15)
movq %r15, %rdi
xorl %esi, %esi
callq 0x7253
movq %r15, %rdi
movq %r13, %rsi
callq 0x5bcd
jmp 0x7130
cmpb $0x1, 0xd(%rbp)
jne 0x7156
movl $0x3, %edi
leaq 0x9b8d(%rip), %rsi      # 0x10c8b
movq %rsp, %rdx
xorl %eax, %eax
callq 0xd88c
movq %r12, %rdi
movl $0x1, %esi
callq 0x7253
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x5be3
movq %r12, %rdi
movl $0x6a6, %esi            # imm = 0x6A6
callq 0x628b
movq %rbx, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x5be3
movq %rbp, %rdi
movl $0x6a7, %esi            # imm = 0x6A7
callq 0x628b
cmpq %rbx, %r14
jne 0x7028
jmp 0x7167
movl $0x3, %edi
leaq 0x9b59(%rip), %rsi      # 0x10cbb
jmp 0x708a
movq 0x104b2(%rip), %rdi     # 0x17620
testq %rdi, %rdi
je 0x717d
movl $0x6a5, %esi            # imm = 0x6A5
callq 0x628b
movb $0x0, 0x104a4(%rip)     # 0x17628
movq $0x0, 0x10491(%rip) # 0x17620
leaq 0x1049a(%rip), %rbx     # 0x17630
movq %rbx, %rdi
callq 0x5bfb
testl %eax, %eax
setne %al
movq (%rbx), %r14
cmpq %rbx, %r14
sete %cl
orb %al, %cl
jne 0x720e
movb 0x10472(%rip), %al      # 0x17628
movq 0x10463(%rip), %rdi     # 0x17620
movzbl %al, %eax
leal (%rax,%rax,4), %esi
addl $0x5, %esi
movl $0xf, %edx
callq 0x61a0
movq %rax, 0x10449(%rip)     # 0x17620
movzbl 0x1044a(%rip), %ecx     # 0x17628
leaq (%rcx,%rcx,4), %rcx
movl 0x8(%r14), %edx
movl %edx, (%rax,%rcx)
movb 0xc(%r14), %al
movq 0x1042c(%rip), %rdx     # 0x17620
movb %al, 0x4(%rdx,%rcx)
movb 0x1042a(%rip), %al      # 0x17628
incb %al
movb %al, 0x10422(%rip)      # 0x17628
movq (%r14), %r14
cmpq %rbx, %r14
jne 0x71b6
leaq 0x1043b(%rip), %rdi     # 0x17650
callq 0x22d0
testl %eax, %eax
je 0x7244
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x9982(%rip), %rsi      # 0x10bb3
leaq 0x9b16(%rip), %rdx      # 0x10d4e
xorl %edi, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0xd88c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq