// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
leaq 0x12841(%rip), %rdi     # 0x1b6f0
callq 0x2240
cmpl $0x0, %eax
je 0x8ebe
jmp 0x9161
leaq 0x1281b(%rip), %rdi     # 0x1b6e0
callq 0x6f40
cmpl $0x0, %eax
je 0x8ed4
jmp 0x912a
movq 0x12805(%rip), %rax     # 0x1b6e0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
leaq 0x127ef(%rip), %rax     # 0x1b6e0
cmpq %rax, -0x8(%rbp)
je 0x9125
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %edi
leaq -0x50(%rbp), %rsi
movl $0x10, %edx
callq 0xfa90
movq $0x0, -0x38(%rbp)
leaq 0x127a9(%rip), %rax     # 0x1b6d0
movq %rax, -0x18(%rbp)
movq 0x1279e(%rip), %rax     # 0x1b6d0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
leaq 0x12788(%rip), %rax     # 0x1b6d0
cmpq %rax, -0x20(%rbp)
je 0x9029
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x38(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x9001
movq -0x30(%rbp), %rax
movzbl 0xc(%rax), %eax
movq -0x38(%rbp), %rcx
movzbl 0xc(%rcx), %ecx
cmpl %ecx, %eax
jne 0x9001
movq -0x30(%rbp), %rax
movzbl 0xd(%rax), %eax
cmpl $0x1, %eax
jne 0x8fe0
leaq -0x50(%rbp), %rdx
movq -0x30(%rbp), %rax
movzbl 0xc(%rax), %ecx
movl $0x3, %edi
leaq 0xcd03(%rip), %rsi      # 0x15caa
movb $0x0, %al
callq 0x123f0
movq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x9170
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq 0x12705(%rip), %rdx     # 0x1b6d0
callq 0x6ed0
movq -0x38(%rbp), %rdi
movl $0x6a6, %esi            # imm = 0x6A6
callq 0x7720
jmp 0x8fff
leaq -0x50(%rbp), %rdx
movq -0x30(%rbp), %rax
movzbl 0xc(%rax), %ecx
movl $0x3, %edi
leaq 0xcce2(%rip), %rsi      # 0x15cda
movb $0x0, %al
callq 0x123f0
jmp 0x9029
movq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x8f41
cmpq $0x0, -0x38(%rbp)
jne 0x90ec
movq -0x30(%rbp), %rax
movzbl 0xd(%rax), %eax
cmpl $0x0, %eax
jne 0x90cb
leaq -0x50(%rbp), %rdx
movq -0x30(%rbp), %rax
movzbl 0xc(%rax), %ecx
movl $0x3, %edi
leaq 0xccb0(%rip), %rsi      # 0x15d0d
movb $0x0, %al
callq 0x123f0
movl $0x10, %edi
movl $0x2be, %esi            # imm = 0x2BE
callq 0x7220
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x21e0
movq -0x38(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x30(%rbp), %rax
movb 0xc(%rax), %cl
movq -0x38(%rbp), %rax
movb %cl, 0xc(%rax)
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x9170
movq -0x38(%rbp), %rdi
leaq 0x1260c(%rip), %rsi     # 0x1b6d0
callq 0x6e60
jmp 0x90ea
leaq -0x50(%rbp), %rdx
movq -0x30(%rbp), %rax
movzbl 0xc(%rax), %ecx
movl $0x3, %edi
leaq 0xcc56(%rip), %rsi      # 0x15d39
movb $0x0, %al
callq 0x123f0
jmp 0x90ec
movq -0x8(%rbp), %rsi
leaq 0x125e9(%rip), %rdx     # 0x1b6e0
movq %rdx, %rdi
callq 0x6ed0
movq -0x30(%rbp), %rdi
movl $0x6a7, %esi            # imm = 0x6A7
callq 0x7720
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x8eea
callq 0x92a0
leaq 0x125bf(%rip), %rdi     # 0x1b6f0
callq 0x2300
cmpl $0x0, %eax
je 0x9161
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rcx
xorl %edi, %edi
leaq 0xca7f(%rip), %rsi      # 0x15bd2
leaq 0xcc13(%rip), %rdx      # 0x15d6d
movb $0x0, %al
callq 0x123f0
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)