// File: /workspace/github_c_makefile_star2_O1/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 0x1099d(%rip), %rdi     # 0x17650
callq 0x2220
testl %eax, %eax
jne 0x6efa
leaq 0x10979(%rip), %rbx     # 0x17640
movq %rbx, %rdi
callq 0x5be7
testl %eax, %eax
jne 0x6ec4
movq 0x10962(%rip), %r14     # 0x17640
cmpq %rbx, %r14
je 0x6e27
leaq 0x10942(%rip), %r13     # 0x17630
movq %r14, %rbp
movq (%r14), %r14
movl 0x8(%rbp), %edi
movq %rsp, %rsi
movl $0x10, %edx
callq 0xb8b8
movq 0x10925(%rip), %rax     # 0x17630
cmpq %r13, %rax
je 0x6d36
movl 0x8(%rbp), %edx
movq %r13, %r15
movq %rax, %r12
movq (%rax), %rax
cmpl 0x8(%r12), %edx
jne 0x6d2e
movzbl 0xc(%rbp), %ecx
cmpb 0xc(%r12), %cl
je 0x6dac
movq %r12, %r15
cmpq %r13, %rax
jne 0x6d16
cmpb $0x0, 0xd(%rbp)
movzbl 0xc(%rbp), %ecx
movl $0x3, %edi
je 0x6d5b
leaq 0x9f49(%rip), %rsi      # 0x10c95
movq %rsp, %rdx
xorl %eax, %eax
callq 0xd5b0
jmp 0x6df0
leaq 0x9f07(%rip), %rsi      # 0x10c69
movq %rsp, %rdx
xorl %eax, %eax
callq 0xd5b0
movl $0x10, %edi
movl $0x2be, %esi            # imm = 0x2BE
callq 0x5d3e
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%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 0x6f09
movq %r15, %rdi
movq %r13, %rsi
callq 0x5bb9
jmp 0x6df0
cmpb $0x1, 0xd(%rbp)
jne 0x6e16
movl $0x3, %edi
leaq 0x9e48(%rip), %rsi      # 0x10c06
movq %rsp, %rdx
xorl %eax, %eax
callq 0xd5b0
movq %r12, %rdi
movl $0x1, %esi
callq 0x6f09
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x5bcf
movq %r12, %rdi
movl $0x6a6, %esi            # imm = 0x6A6
callq 0x5f5b
movq %rbx, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x5bcf
movq %rbp, %rdi
movl $0x6a7, %esi            # imm = 0x6A7
callq 0x5f5b
cmpq %rbx, %r14
jne 0x6cee
jmp 0x6e27
movl $0x3, %edi
leaq 0x9e14(%rip), %rsi      # 0x10c36
jmp 0x6d4c
movq 0x107f2(%rip), %rdi     # 0x17620
testq %rdi, %rdi
je 0x6e3d
movl $0x6a5, %esi            # imm = 0x6A5
callq 0x5f5b
movb $0x0, 0x107e4(%rip)     # 0x17628
movq $0x0, 0x107d1(%rip) # 0x17620
leaq 0x107da(%rip), %rbx     # 0x17630
movq %rbx, %rdi
callq 0x5be7
testl %eax, %eax
setne %al
movq (%rbx), %r14
cmpq %rbx, %r14
sete %cl
orb %al, %cl
jne 0x6ec4
movq 0x107a9(%rip), %rdi     # 0x17620
movzbl 0x107aa(%rip), %eax     # 0x17628
leal (%rax,%rax,4), %esi
addl $0x5, %esi
movl $0xf, %edx
callq 0x5e6d
movq %rax, 0x1078b(%rip)     # 0x17620
movzbl 0x1078c(%rip), %ecx     # 0x17628
leaq (%rcx,%rcx,4), %rcx
movl 0x8(%r14), %edx
movl %edx, (%rax,%rcx)
movb 0xc(%r14), %al
movq 0x1076e(%rip), %rdx     # 0x17620
movb %al, 0x4(%rdx,%rcx)
incb 0x1076c(%rip)           # 0x17628
movq (%r14), %r14
cmpq %rbx, %r14
jne 0x6e70
leaq 0x10785(%rip), %rdi     # 0x17650
callq 0x22d0
testl %eax, %eax
je 0x6efa
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x9c47(%rip), %rsi      # 0x10b2e
leaq 0x9ddb(%rip), %rdx      # 0x10cc9
xorl %edi, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0xd5b0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq