// File: /workspace/github_c_makefile_star2_O2/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 0x10e91(%rip), %rdi     # 0x17650
callq 0x2220
testl %eax, %eax
jne 0x699e
leaq 0x10e6d(%rip), %rbx     # 0x17640
movq %rbx, %rdi
callq 0x5778
testl %eax, %eax
jne 0x6968
movq 0x10e56(%rip), %r14     # 0x17640
leaq 0x10e3f(%rip), %r15     # 0x17630
cmpq %rbx, %r14
je 0x6930
movq %r14, %r12
movq (%r14), %r14
movl 0x8(%r12), %edi
movq %rsp, %rsi
pushq $0x10
popq %rdx
callq 0xb04f
movq 0x10e19(%rip), %rax     # 0x17630
movq %r15, %rdx
cmpq %r15, %rax
je 0x6890
movq %rax, %r13
movq %rdx, %rbp
movq (%rax), %rax
movl 0x8(%r12), %ecx
movq %r13, %rdx
cmpl 0x8(%r13), %ecx
jne 0x681a
movzbl 0xc(%r12), %ecx
movq %r13, %rdx
cmpb 0xc(%r13), %cl
jne 0x681a
cmpb $0x1, 0xd(%r12)
jne 0x68fc
pushq $0x3
popq %rdi
leaq 0x9414(%rip), %rsi      # 0xfc6f
movq %rsp, %rdx
xorl %eax, %eax
callq 0xcb1c
movq %r13, %rdi
pushq $0x1
popq %rsi
callq 0x6a06
movq %rbp, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x5763
movq %r13, %rdi
movl $0x6a6, %esi            # imm = 0x6A6
callq 0x5b1a
jmp 0x6910
cmpb $0x0, 0xd(%r12)
movzbl 0xc(%r12), %ecx
pushq $0x3
popq %rdi
je 0x68aa
leaq 0x9456(%rip), %rsi      # 0xfcfe
jmp 0x6906
leaq 0x9421(%rip), %rsi      # 0xfcd2
movq %rsp, %rdx
xorl %eax, %eax
callq 0xcb1c
pushq $0x10
popq %rdi
movl $0x2be, %esi            # imm = 0x2BE
callq 0x58c9
movq %rax, %r13
andq $0x0, 0x8(%rax)
movq %rax, (%rax)
movl 0x8(%r12), %eax
movl %eax, 0x8(%r13)
movb 0xc(%r12), %al
movb %al, 0xc(%r13)
movq %r13, %rdi
xorl %esi, %esi
callq 0x6a06
movq %r13, %rdi
movq %r15, %rsi
callq 0x574d
jmp 0x6910
pushq $0x3
popq %rdi
leaq 0x9399(%rip), %rsi      # 0xfc9f
movq %rsp, %rdx
xorl %eax, %eax
callq 0xcb1c
movq %rbx, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x5763
movq %r12, %rdi
movl $0x6a7, %esi            # imm = 0x6A7
callq 0x5b1a
jmp 0x67f1
movq 0x10ce9(%rip), %rdi     # 0x17620
testq %rdi, %rdi
je 0x6946
movl $0x6a5, %esi            # imm = 0x6A5
callq 0x5b1a
movb $0x0, 0x10cdb(%rip)     # 0x17628
andq $0x0, 0x10ccb(%rip)     # 0x17620
leaq 0x10cd4(%rip), %rbx     # 0x17630
movq %rbx, %rdi
callq 0x5778
testl %eax, %eax
je 0x69ad
leaq 0x10ce1(%rip), %rdi     # 0x17650
callq 0x22d0
testl %eax, %eax
je 0x699e
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x920c(%rip), %rsi      # 0xfb97
leaq 0x93a0(%rip), %rdx      # 0xfd32
xorl %edi, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0xcb1c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0xf
popq %rbp
movq %rbx, %r14
movq (%r14), %r14
cmpq %rbx, %r14
je 0x6968
movq 0x10c5e(%rip), %rdi     # 0x17620
movzbl 0x10c5f(%rip), %eax     # 0x17628
leal (%rax,%rax,4), %esi
addl $0x5, %esi
movl %ebp, %edx
callq 0x5a06
movq %rax, 0x10c43(%rip)     # 0x17620
movzbl 0x10c44(%rip), %ecx     # 0x17628
leaq (%rcx,%rcx,4), %rcx
movl 0x8(%r14), %edx
movl %edx, (%rax,%rcx)
movb 0xc(%r14), %al
movq 0x10c26(%rip), %rdx     # 0x17620
movb %al, 0x4(%rdx,%rcx)
incb 0x10c24(%rip)           # 0x17628
jmp 0x69b3