LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/hna.c
// Function: hna_local_update_routes
void hna_local_update_routes(struct hna_local_entry *hna_local_entry, int8_t route_action)
{
	/* add / delete throw routing entries for own hna */
	add_del_route(hna_local_entry->addr, hna_local_entry->netmask, 0, 0, 0, "unknown", BATMAN_RT_TABLE_NETWORKS, ROUTE_TYPE_THROW, route_action);
	add_del_route(hna_local_entry->addr, hna_local_entry->netmask, 0, 0, 0, "unknown", BATMAN_RT_TABLE_HOSTS, ROUTE_TYPE_THROW, route_action);
	add_del_route(hna_local_entry->addr, hna_local_entry->netmask, 0, 0, 0, "unknown", BATMAN_RT_TABLE_UNREACH, ROUTE_TYPE_THROW, route_action);
	add_del_route(hna_local_entry->addr, hna_local_entry->netmask, 0, 0, 0, "unknown", BATMAN_RT_TABLE_TUNNEL, ROUTE_TYPE_THROW, route_action);

	/* do not NAT HNA networks automatically */
	hna_local_update_nat(hna_local_entry->addr, hna_local_entry->netmask, route_action);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl 0x8(%rdi), %edi
movzbl 0xc(%r14), %esi
subq $0x8, %rsp
pushq $0x1
popq %r12
leaq 0x931c(%rip), %r15      # 0xfd46
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r15, %r9
pushq %rbx
pushq %r12
pushq $0x41
callq 0x745c
addq $0x20, %rsp
movl 0x8(%r14), %edi
movzbl 0xc(%r14), %esi
subq $0x8, %rsp
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r15, %r9
pushq %rbx
pushq %r12
pushq $0x42
callq 0x745c
addq $0x20, %rsp
movl 0x8(%r14), %edi
movzbl 0xc(%r14), %esi
subq $0x8, %rsp
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r15, %r9
pushq %rbx
pushq %r12
pushq $0x43
callq 0x745c
addq $0x20, %rsp
movl 0x8(%r14), %edi
movzbl 0xc(%r14), %esi
subq $0x8, %rsp
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r15, %r9
pushq %rbx
pushq %r12
pushq $0x44
callq 0x745c
addq $0x20, %rsp
movl 0x8(%r14), %edi
movzbl 0xc(%r14), %esi
movl %ebx, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x8819
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/hna.c
// Function: hna_local_update_vis_packet
unsigned char *hna_local_update_vis_packet(unsigned char *vis_packet, uint16_t *vis_packet_size)
{
	struct hna_local_entry *hna_local_entry;
	struct vis_data *vis_data;

	if (num_hna_local < 1)
		return vis_packet;

	list_for_each_entry(hna_local_entry, &hna_list, list) {
		*vis_packet_size += sizeof(struct vis_data);

		vis_packet = debugRealloc(vis_packet, *vis_packet_size, 107);
		vis_data = (struct vis_data *)(vis_packet + *vis_packet_size - sizeof(struct vis_data));

		memcpy(&vis_data->ip, (unsigned char *)&hna_local_entry->addr, 4);

		vis_data->data = hna_local_entry->netmask;
		vis_data->type = DATA_TYPE_HNA;
	}

	return vis_packet;
}

// Assembly:
movq %rdi, %rax
cmpb $0x0, 0x10b52(%rip)     # 0x17628
je 0x6b31
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x10b47(%rip), %r14     # 0x17630
pushq $0x6b
popq %rbp
movq %r14, %r15
movq (%r15), %r15
cmpq %r14, %r15
je 0x6b27
movzwl (%rbx), %ecx
addl $0x6, %ecx
movw %cx, (%rbx)
movzwl %cx, %esi
movq %rax, %rdi
movl %ebp, %edx
callq 0x5a06
movzwl (%rbx), %ecx
movl 0x8(%r15), %edx
movl %edx, -0x4(%rax,%rcx)
movb 0xc(%r15), %dl
movb %dl, -0x5(%rax,%rcx)
movb $0x3, -0x6(%rax,%rcx)
jmp 0x6aef
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/hna.c
// Function: hna_global_add
void hna_global_add(struct orig_node *orig_node, unsigned char *new_hna, int16_t new_hna_len)
{
	struct hna_element *e, *buff;
	int i, num_elements;
	char hna_str[ADDR_STR_LEN];

	if ((new_hna == NULL) || (new_hna_len == 0)) {
		orig_node->hna_buff = NULL;
		orig_node->hna_buff_len = 0;
		return;
	}

	orig_node->hna_buff = debugMalloc(new_hna_len, 705);
	orig_node->hna_buff_len = new_hna_len;
	memcpy(orig_node->hna_buff, new_hna, new_hna_len);

	/* add new routes */
	num_elements = orig_node->hna_buff_len / sizeof(struct hna_element);
	buff = (struct hna_element *)orig_node->hna_buff;

	debug_output(4, "HNA information received (%i HNA network%s): \n", num_elements, (num_elements > 1 ? "s": ""));

	for (i = 0; i < num_elements; i++) {
		e = &buff[i];
		addr_to_string(e->addr, hna_str, sizeof(hna_str));

		if ((e->netmask > 0 ) && (e->netmask < 33))
			debug_output(4, "hna: %s/%i\n", hna_str, e->netmask);
		else
			debug_output(4, "hna: %s/%i -> ignoring (invalid netmask) \n", hna_str, e->netmask);

		if ((e->netmask > 0) && (e->netmask <= 32))
			_hna_global_add(orig_node, e);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebp
movq %rdi, %rbx
testq %rsi, %rsi
setne %al
testw %bp, %bp
setne %cl
testb %cl, %al
jne 0x6b6e
andq $0x0, 0x38(%rbx)
andw $0x0, 0x40(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %r14
movswl %bp, %edi
movl $0x2c1, %esi            # imm = 0x2C1
callq 0x58c9
movq %rax, 0x38(%rbx)
movw %bp, 0x40(%rbx)
movswq %bp, %rdx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2290
movswq 0x40(%rbx), %rax
pushq $0x5
popq %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %r15
movq %rbx, 0x8(%rsp)
movq 0x38(%rbx), %r14
cmpl $0x2, %r15d
leaq 0xb5b9(%rip), %rax      # 0x12172
leaq 0x780e(%rip), %rcx      # 0xe3ce
cmovgeq %rax, %rcx
leaq 0x9183(%rip), %rsi      # 0xfd4e
pushq $0x4
popq %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xcb1c
testl %r15d, %r15d
movl $0x0, %r13d
cmovgl %r15d, %r13d
leaq 0x10(%rsp), %r15
pushq $0x10
popq %r12
leaq 0x9188(%rip), %rbx      # 0xfd7d
leaq 0x918d(%rip), %rbp      # 0xfd89
subq $0x1, %r13
jb 0x6b5f
movl (%r14), %edi
movq %r15, %rsi
movl %r12d, %edx
callq 0xb04f
movzbl 0x4(%r14), %ecx
leal -0x1(%rcx), %eax
cmpb $0x20, %al
movq %rbp, %rsi
cmovbq %rbx, %rsi
pushq $0x4
popq %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xcb1c
movb 0x4(%r14), %al
decb %al
cmpb $0x1f, %al
ja 0x6c49
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x6c4f
addq $0x5, %r14
jmp 0x6bfc
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/hna.c
// Function: hna_global_del
void hna_global_del(struct orig_node *orig_node)
{
	struct hna_element *e, *buff;
	int i, num_elements;

	if ((orig_node->hna_buff == NULL) || (orig_node->hna_buff_len == 0))
		return;

	/* delete routes */
	num_elements = orig_node->hna_buff_len / sizeof(struct hna_element);
	buff = (struct hna_element *)orig_node->hna_buff;

	for (i = 0; i < num_elements; i++) {
		e = &buff[i];

		/* not found / deleted, need to add this new route */
		if ((e->netmask > 0) && (e->netmask <= 32))
			_hna_global_del(orig_node, e);
	}

	debugFree(orig_node->hna_buff, 1709);
	orig_node->hna_buff = NULL;
	orig_node->hna_buff_len = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x38(%rdi), %r14
testq %r14, %r14
je 0x711e
movq %rdi, %rbx
movswq 0x40(%rdi), %rax
testq %rax, %rax
je 0x711e
xorl %r15d, %r15d
pushq $0x5
popq %rcx
xorl %edx, %edx
divq %rcx
testl %eax, %eax
cmovgl %eax, %r15d
subq $0x1, %r15
jb 0x7106
movb 0x4(%r14), %al
decb %al
cmpb $0x1f, %al
ja 0x7100
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7124
addq $0x5, %r14
jmp 0x70e5
movq 0x38(%rbx), %rdi
movl $0x6ad, %esi            # imm = 0x6AD
callq 0x5b1a
andq $0x0, 0x38(%rbx)
andw $0x0, 0x40(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/hna.c
// Function: hna_free
void hna_free(void)
{
	struct list_head *list_pos, *list_pos_tmp;
	struct hna_local_entry *hna_local_entry;

	/* hna local */
	list_for_each_safe(list_pos, list_pos_tmp, &hna_list) {
		hna_local_entry = list_entry(list_pos, struct hna_local_entry, list);
		hna_local_update_routes(hna_local_entry, ROUTE_DEL);

		debugFree(hna_local_entry, 1705);
	}

	if (hna_buff_local != NULL)
		debugFree(hna_buff_local, 1706);

	num_hna_local = 0;
	hna_buff_local = NULL;

	/* hna global */
	if (hna_global_hash != NULL)
		hash_delete(hna_global_hash, _hna_global_hash_del);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x102ac(%rip), %r14     # 0x17630
leaq 0x102a5(%rip), %r15     # 0x17630
pushq $0x1
popq %rbx
cmpq %r15, %r14
je 0x73b2
movq (%r14), %r12
movq %r14, %rdi
movl %ebx, %esi
callq 0x6a06
movq %r14, %rdi
movl $0x6a9, %esi            # imm = 0x6A9
callq 0x5b1a
movq %r12, %r14
jmp 0x738e
movq 0x10267(%rip), %rdi     # 0x17620
testq %rdi, %rdi
je 0x73c8
movl $0x6aa, %esi            # imm = 0x6AA
callq 0x5b1a
andq $0x0, 0x10250(%rip)     # 0x17620
movb $0x0, 0x10251(%rip)     # 0x17628
movq 0x1029a(%rip), %rdi     # 0x17678
testq %rdi, %rdi
je 0x73fa
leaq 0x1c(%rip), %rsi        # 0x7406
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x5f05
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/hna.c
// Function: hna_global_hash_del
static void _hna_global_hash_del(void *data)
{
	struct hna_global_entry *hna_global_entry = data;
	struct hna_orig_ptr *hna_orig_ptr = NULL;
	struct list_head *list_pos, *list_pos_tmp;

	list_for_each_safe(list_pos, list_pos_tmp, &hna_global_entry->orig_list) {

		hna_orig_ptr = list_entry(list_pos, struct hna_orig_ptr, list);

		list_del((struct list_head *)&hna_global_entry->orig_list, list_pos, &hna_global_entry->orig_list);
		debugFree(hna_orig_ptr, 1710);
	}

	debugFree(hna_global_entry, 1711);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
movq 0x10(%rdi), %r15
cmpq %r14, %r15
je 0x7441
movq (%r15), %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x5763
movq %r15, %rdi
movl $0x6ae, %esi            # imm = 0x6AE
callq 0x5b1a
movq %r12, %r15
jmp 0x7419
movq %rbx, %rdi
movl $0x6af, %esi            # imm = 0x6AF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x5b1a
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/tun.c
// Function: run_cmd
static int run_cmd(const char *cmd) {
	int error, pipes[2], stderr = -1, ret = 0;
	char error_log[256];

	if (pipe(pipes) < 0) {
		debug_output(3, "Warning - could not create a pipe to '%s': %s\n", cmd, strerror(errno));
		return -1;
	}

	memset(error_log, 0, 256);

	/* save stderr */
	stderr = dup(STDERR_FILENO);

	/* connect the commands output with the pipe for later logging */
	dup2(pipes[1], STDERR_FILENO);
	close(pipes[1]);

	error = system(cmd);

	/* copy stderr back */
	dup2(stderr, STDERR_FILENO);
	close(stderr);

	if ((error < 0) || (WEXITSTATUS(error) != 0)) {
		ret = read(pipes[0], error_log, sizeof(error_log));
		debug_output(3, "Warning - command '%s' returned an error\n", cmd);

		if (ret > 0)
			debug_output(3, "          %s\n", error_log);

		ret = -1;
	}

	close(pipes[0]);
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2210
testl %eax, %eax
js 0x86ba
leaq 0x10(%rsp), %rdi
xorl %ebp, %ebp
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x21c0
pushq $0x2
popq %r14
movl %r14d, %edi
callq 0x21b0
movl %eax, %r15d
movl 0xc(%rsp), %edi
movl %r14d, %esi
callq 0x2170
movl 0xc(%rsp), %edi
callq 0x21f0
movq %rbx, %rdi
callq 0x2160
movl %eax, %r12d
movl %r15d, %edi
movl %r14d, %esi
callq 0x2170
movl %r15d, %edi
callq 0x21f0
testl $0x8000ff00, %r12d      # imm = 0x8000FF00
je 0x86af
movl 0x8(%rsp), %edi
leaq 0x10(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x2230
movq %rax, %r14
leaq 0x81fe(%rip), %rsi      # 0x10882
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xcb1c
pushq $-0x1
popq %rbp
testl %r14d, %r14d
jle 0x86af
leaq 0x820c(%rip), %rsi      # 0x108ac
pushq $0x3
popq %rdi
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0xcb1c
movl 0x8(%rsp), %edi
callq 0x21f0
jmp 0x86e0
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x8186(%rip), %rsi      # 0x10853
pushq $0x3
popq %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xcb1c
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/tun.c
// Function: add_nat_rule
void add_nat_rule(char *dev) {
	char cmd[150];

	sprintf(cmd, IPTABLES_ADD_MASQ, dev);
	exec_iptables_rule(cmd, ROUTE_ADD);

	sprintf(cmd, IPTABLES_ADD_MSS, dev);
	exec_iptables_rule(cmd, ROUTE_ADD);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
leaq 0x7d35(%rip), %rsi      # 0x1043b
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2430
movq %r14, %rdi
xorl %esi, %esi
callq 0x8749
leaq 0x7d47(%rip), %rsi      # 0x1046e
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2430
movq %r14, %rdi
xorl %esi, %esi
callq 0x8749
addq $0x98, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/tun.c
// Function: exec_iptables_rule
static void exec_iptables_rule(const char *cmd, int8_t route_action) {
	if (disable_client_nat)
		return;

	if (nat_tool_avail == -1) {
		debug_output(3, "Warning - could not %sactivate NAT: iptables binary not found!\n", (route_action == ROUTE_ADD ? "" : "de"));
		debug_output(3, "          You may need to run this command: %s\n", cmd);
		return;
	}

	run_cmd(cmd);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
leaq 0xebb5(%rip), %rax      # 0x17308
cmpb $0x0, (%rax)
je 0x875f
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rdi, %rbx
leaq 0xeb33(%rip), %rax      # 0x1729c
cmpl $-0x1, (%rax)
je 0x877c
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x85e5
testb %sil, %sil
leaq 0x5c48(%rip), %rax      # 0xe3ce
leaq 0x6439(%rip), %rdx      # 0xebc6
cmoveq %rax, %rdx
leaq 0x8122(%rip), %rsi      # 0x108ba
pushq $0x3
popq %rbp
movl %ebp, %edi
xorl %eax, %eax
callq 0xcb1c
leaq 0x814f(%rip), %rsi      # 0x108fa
movl %ebp, %edi
movq %rbx, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xcb1c
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/tun.c
// Function: del_nat_rule
void del_nat_rule(char *dev) {
	char cmd[150];

	sprintf(cmd, IPTABLES_DEL_MASQ, dev);
	exec_iptables_rule(cmd, ROUTE_DEL);

	sprintf(cmd, IPTABLES_ADD_MSS, dev);
	exec_iptables_rule(cmd, ROUTE_DEL);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movq %rdi, %rbx
leaq 0x7d01(%rip), %rsi      # 0x104d3
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2430
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x8749
leaq 0x7c78(%rip), %rsi      # 0x1046e
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2430
movq %r14, %rdi
movl %ebp, %esi
callq 0x8749
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/tun.c
// Function: hna_local_update_nat
void hna_local_update_nat(uint32_t hna_ip, uint8_t netmask, int8_t route_action) {
	char cmd[100], ip_addr[16];

	inet_ntop(AF_INET, &hna_ip, ip_addr, sizeof(ip_addr));

	if (route_action == ROUTE_DEL)
		sprintf(cmd, IPTABLES_DEL_ACC, ip_addr, netmask);
	else
		sprintf(cmd, IPTABLES_ADD_ACC, ip_addr, netmask);

	exec_iptables_rule(cmd, route_action);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl %edx, %ebx
movl %esi, %ebp
leaq 0xc(%rsp), %rsi
movl %edi, (%rsi)
pushq $0x2
popq %rdi
leaq 0x10(%rsp), %r14
pushq $0x10
popq %rcx
movq %r14, %rdx
callq 0x2030
cmpb $0x1, %bl
leaq 0x7cb8(%rip), %rax      # 0x10506
leaq 0x7ce3(%rip), %rsi      # 0x10538
cmoveq %rax, %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2430
movq %r15, %rdi
movl %ebx, %esi
callq 0x8749
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/tun.c
// Function: probe_tun
int8_t probe_tun(uint8_t print_to_stderr) {

	int32_t fd;

	if ( ( fd = open( "/dev/net/tun", O_RDWR ) ) < 0 ) {

		if (print_to_stderr)
			fprintf( stderr, "Error - could not open '/dev/net/tun' ! Is the tun kernel module loaded ?\n" );
		else
			debug_output( 0, "Error - could not open '/dev/net/tun' ! Is the tun kernel module loaded ?\n" );

		return 0;

	}

	close( fd );

	return 1;

}

// Assembly:
pushq %rbx
movl %edi, %ebx
leaq 0x7cdb(%rip), %rdi      # 0x1056a
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x23a0
testl %eax, %eax
js 0x88a8
movl %eax, %edi
callq 0x21f0
movb $0x1, %bl
jmp 0x88be
testb %bl, %bl
jne 0x88c2
leaq 0x7cc4(%rip), %rsi      # 0x10577
xorl %ebx, %ebx
xorl %edi, %edi
xorl %eax, %eax
callq 0xcb1c
movl %ebx, %eax
popq %rbx
retq
movq 0xe727(%rip), %rax      # 0x16ff0
movq (%rax), %rcx
leaq 0x7ca4(%rip), %rdi      # 0x10577
pushq $0x4a
popq %rsi
pushq $0x1
popq %rdx
callq 0x2460
xorl %ebx, %ebx
jmp 0x88be
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/tun.c
// Function: del_dev_tun
int8_t del_dev_tun( int32_t fd ) {

	if ( ioctl( fd, TUNSETPERSIST, 0 ) < 0 ) {

		debug_output( 0, "Error - can't delete tun device: %s\n", strerror(errno) );
		return -1;

	}

	close( fd );

	return 1;

}

// Assembly:
pushq %rbx
movl %edi, %ebx
movl $0x400454cb, %esi       # imm = 0x400454CB
xorl %edx, %edx
xorl %eax, %eax
callq 0x21d0
testl %eax, %eax
js 0x8902
movl %ebx, %edi
callq 0x21f0
movb $0x1, %al
jmp 0x8923
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x7cad(%rip), %rsi      # 0x105c2
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0xcb1c
movb $-0x1, %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/tun.c
// Function: set_tun_addr
int8_t set_tun_addr( int32_t fd, uint32_t tun_addr, char *tun_dev ) {

	struct sockaddr_in addr;
	struct ifreq ifr_tun;


	memset( &ifr_tun, 0, sizeof(ifr_tun) );
	memset( &addr, 0, sizeof(addr) );

	addr.sin_addr.s_addr = tun_addr;
	addr.sin_family = AF_INET;
	memcpy( &ifr_tun.ifr_addr, &addr, sizeof(struct sockaddr) );

	strncpy( ifr_tun.ifr_name, tun_dev, IFNAMSIZ - 1 );

	if ( ioctl( fd, SIOCSIFADDR, &ifr_tun) < 0 ) {

		debug_output( 0, "Error - can't set tun address (SIOCSIFADDR): %s\n", strerror(errno) );
		return -1;

	}

	return 1;

}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %edi, %ebx
xorps %xmm0, %xmm0
movq %rsp, %r14
movups %xmm0, 0x8(%r14)
movups %xmm0, 0x18(%r14)
movw $0x2, 0x10(%r14)
movl %esi, 0x14(%r14)
pushq $0xf
popq %rax
movq %r14, %rdi
movq %rdx, %rsi
movq %rax, %rdx
callq 0x2090
movl $0x8916, %esi           # imm = 0x8916
movl %ebx, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x21d0
movl %eax, %ecx
movb $0x1, %al
testl %ecx, %ecx
jns 0x8cb2
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x7b7e(%rip), %rsi      # 0x10822
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0xcb1c
movb $-0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/kernel.c
// Function: set_rp_filter
void set_rp_filter(int32_t state, const char* dev)
{
	char filename[100], *colon_ptr;

	/* if given interface is an alias use parent interface */
	if ((colon_ptr = strchr(dev, ':')) != NULL)
		*colon_ptr = '\0';

	sprintf(filename, "/proc/sys/net/ipv4/conf/%s/rp_filter", dev);
	set_integer_file(filename, state);

	if (colon_ptr != NULL)
		*colon_ptr = ':';
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movl %edi, %ebx
pushq $0x3a
popq %rsi
movq %r14, %rdi
callq 0x2180
testq %rax, %rax
je 0x8d09
movq %rax, %r15
movb $0x0, (%rax)
leaq 0x7c52(%rip), %rsi      # 0x1093b
movq %rsp, %r12
movq %r12, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2430
movq %r12, %rdi
movl %ebx, %esi
callq 0x8d36
movb $0x3a, (%r15)
jmp 0x8d2a
leaq 0x7c2b(%rip), %rsi      # 0x1093b
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2430
movq %r15, %rdi
movl %ebx, %esi
callq 0x8d36
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/kernel.c
// Function: get_rp_filter
int32_t get_rp_filter(const char *dev)
{
	int32_t state = 0;
	char filename[100], *colon_ptr;

	/* if given interface is an alias use parent interface */
	if ((colon_ptr = strchr(dev, ':')) != NULL)
		*colon_ptr = '\0';

	sprintf(filename, "/proc/sys/net/ipv4/conf/%s/rp_filter", dev);
	state = get_integer_file(filename);

	if (colon_ptr != NULL)
		*colon_ptr = ':';

	return state;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, %r14
pushq $0x3a
popq %rsi
callq 0x2180
movq %rax, %rbx
testq %rax, %rax
je 0x8d99
movb $0x0, (%rbx)
leaq 0x7b9b(%rip), %rsi      # 0x1093b
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2430
movq %r15, %rdi
callq 0x8dca
testq %rbx, %rbx
je 0x8dc0
movb $0x3a, (%rbx)
addq $0x70, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/kernel.c
// Function: get_integer_file
static int get_integer_file(const char* filename)
{
	FILE *f;
	int32_t integer = 0;
	int n;

	if((f = fopen(filename, "r")) == NULL)
		return 0;

	n = fscanf(f, "%"SCNd32, &integer);
	fclose(f);

	if (n == 0 || n == EOF)
		integer = 0;

	return integer;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
andl $0x0, 0xc(%rsp)
leaq 0x7b80(%rip), %rsi      # 0x1095e
callq 0x23d0
testq %rax, %rax
je 0x8e1a
movq %rax, %r14
leaq 0x7bb6(%rip), %rsi      # 0x109a8
xorl %ebx, %ebx
leaq 0xc(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x20b0
movl %eax, %ebp
movq %r14, %rdi
callq 0x2120
incl %ebp
cmpl $0x2, %ebp
jb 0x8e1c
movl 0xc(%rsp), %ebx
jmp 0x8e1c
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/kernel.c
// Function: set_send_redirects
void set_send_redirects(int32_t state, const char* dev)
{
	char filename[100], *colon_ptr;

	/* if given interface is an alias use parent interface */
	if ((colon_ptr = strchr(dev, ':')) != NULL)
		*colon_ptr = '\0';

	sprintf(filename, "/proc/sys/net/ipv4/conf/%s/send_redirects", dev);
	set_integer_file(filename, state);

	if (colon_ptr != NULL)
		*colon_ptr = ':';
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movl %edi, %ebx
pushq $0x3a
popq %rsi
movq %r14, %rdi
callq 0x2180
testq %rax, %rax
je 0x8e74
movq %rax, %r15
movb $0x0, (%rax)
leaq 0x7b0c(%rip), %rsi      # 0x10960
movq %rsp, %r12
movq %r12, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2430
movq %r12, %rdi
movl %ebx, %esi
callq 0x8d36
movb $0x3a, (%r15)
jmp 0x8e95
leaq 0x7ae5(%rip), %rsi      # 0x10960
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2430
movq %r15, %rdi
movl %ebx, %esi
callq 0x8d36
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/kernel.c
// Function: get_send_redirects
int32_t get_send_redirects(const char *dev)
{
	int32_t state = 0;
	char filename[100], *colon_ptr;

	/* if given interface is an alias use parent interface */
	if ((colon_ptr = strchr(dev, ':')) != NULL)
		*colon_ptr = '\0';

	sprintf(filename, "/proc/sys/net/ipv4/conf/%s/send_redirects", dev);
	state = get_integer_file(filename);

	if (colon_ptr != NULL)
		*colon_ptr = ':';

	return state;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, %r14
pushq $0x3a
popq %rsi
callq 0x2180
movq %rax, %rbx
testq %rax, %rax
je 0x8ec0
movb $0x0, (%rbx)
leaq 0x7a99(%rip), %rsi      # 0x10960
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2430
movq %r15, %rdi
callq 0x8dca
testq %rbx, %rbx
je 0x8ee7
movb $0x3a, (%rbx)
addq $0x70, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/kernel.c
// Function: bind_to_iface
int8_t bind_to_iface(int32_t sock, const char *dev)
{
	char *colon_ptr;

	/* if given interface is an alias bind to parent interface */
	if ((colon_ptr = strchr(dev, ':')) != NULL)
		*colon_ptr = '\0';

	if (setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, dev, strlen(dev) + 1) < 0) {

		if (colon_ptr != NULL)
			*colon_ptr = ':';

		return -1;

	}

	if (colon_ptr != NULL)
		*colon_ptr = ':';

	return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movl %edi, %ebp
pushq $0x3a
popq %rsi
movq %r14, %rdi
callq 0x2180
movq %rax, %rbx
testq %rax, %rax
je 0x8f2a
movb $0x0, (%rbx)
movq %r14, %rdi
callq 0x2130
leal 0x1(%rax), %r8d
pushq $0x1
popq %rsi
pushq $0x19
popq %rdx
movl %ebp, %edi
movq %r14, %rcx
callq 0x20d0
testq %rbx, %rbx
je 0x8f4e
movb $0x3a, (%rbx)
sarl $0x1f, %eax
orb $0x1, %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/linux/kernel.c
// Function: is_wifi_interface
int is_wifi_interface(char *dev, int fd)
{
	struct ifreq int_req;
	char *colon_ptr;

	memset(&int_req, 0, sizeof (struct ifreq));
	strncpy(int_req.ifr_name, dev, IFNAMSIZ - 1);

	if ((colon_ptr = strchr(int_req.ifr_name, ':')) != NULL)
		*colon_ptr = '\0';

	if (ioctl(fd, SIOCGIWNAME, &int_req) >= 0)
		return 1;

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebx
movq %rdi, %rsi
xorps %xmm0, %xmm0
movq %rsp, %r14
movups %xmm0, 0x18(%r14)
movups %xmm0, 0x8(%r14)
pushq $0xf
popq %rdx
movq %r14, %rdi
callq 0x2090
pushq $0x3a
popq %rsi
movq %r14, %rdi
callq 0x2180
testq %rax, %rax
je 0x8f92
movb $0x0, (%rax)
movq %rsp, %rdx
movl $0x8b01, %esi           # imm = 0x8B01
movl %ebx, %edi
xorl %eax, %eax
callq 0x21d0
notl %eax
shrl $0x1f, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/init.c
// Function: init_interface
void init_interface(struct batman_if *batman_if)
{
	if (strlen( batman_if->dev ) > IFNAMSIZ - 1) {
		printf("Error - interface name too long: %s\n", batman_if->dev);
		restore_defaults();
		exit(EXIT_FAILURE);
	}

	if (is_interface_up(batman_if->dev))
		activate_interface(batman_if);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movq %r14, %rdi
callq 0x2130
cmpq $0x10, %rax
jae 0xa2fe
movq %r14, %rdi
callq 0xa512
testl %eax, %eax
je 0xa2f6
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xa59b
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x6ce7(%rip), %rdi      # 0x10fec
movq %r14, %rsi
xorl %eax, %eax
callq 0x2190
callq 0xb3a3
pushq $0x1
popq %rdi
callq 0x2440
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/init.c
// Function: init_interface_gw
void init_interface_gw (void) {

	int32_t sock_opts;
	struct batman_if *batman_if = (struct batman_if *)if_list.next;

	batman_if->addr.sin_port = htons(GW_PORT);

	batman_if->udp_tunnel_sock = socket(PF_INET, SOCK_DGRAM, 0);

	if (batman_if->udp_tunnel_sock < 0) {

		debug_output( 0, "Error - can't create tunnel socket: %s\n", strerror(errno) );
		restore_defaults();
		exit(EXIT_FAILURE);

	}

	if ( bind( batman_if->udp_tunnel_sock, (struct sockaddr *)&batman_if->addr, sizeof(struct sockaddr_in) ) < 0 ) {

		debug_output( 0, "Error - can't bind tunnel socket: %s\n", strerror(errno) );
		restore_defaults();
		exit(EXIT_FAILURE);

	}

	/* make udp socket non blocking */
	sock_opts = fcntl( batman_if->udp_tunnel_sock, F_GETFL, 0 );
	fcntl( batman_if->udp_tunnel_sock, F_SETFL, sock_opts | O_NONBLOCK );

	batman_if->addr.sin_port = htons(PORT);

	pthread_create( &batman_if->listen_thread_id, NULL, &gw_listen, batman_if );
}

// Assembly:
pushq %rbx
leaq 0xcfec(%rip), %rax      # 0x17310
movq (%rax), %rbx
movw $0xd210, 0x32(%rbx)     # imm = 0xD210
pushq $0x2
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x24e0
movl %eax, 0x18(%rbx)
testl %eax, %eax
js 0xa391
leaq 0x30(%rbx), %rsi
pushq $0x10
popq %rdx
movl %eax, %edi
callq 0x2370
testl %eax, %eax
js 0xa3a6
movl 0x18(%rbx), %edi
pushq $0x3
popq %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x20e0
movl 0x18(%rbx), %edi
orl $0x800, %eax            # imm = 0x800
pushq $0x4
popq %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x20e0
movw $0xd110, 0x32(%rbx)     # imm = 0xD110
leaq 0x28(%rbx), %rdi
leaq 0x1d9e(%rip), %rdx      # 0xc124
xorl %esi, %esi
movq %rbx, %rcx
popq %rbx
jmp 0x2380
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x6c6d(%rip), %rsi      # 0x11011
jmp 0xa3b9
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x6c80(%rip), %rsi      # 0x11039
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0xcb1c
callq 0xb3a3
pushq $0x1
popq %rdi
callq 0x2440
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/init.c
// Function: interface_listen_sockets
void interface_listen_sockets(void)
{
	struct list_head *list_pos;
	struct batman_if *batman_if;

	FD_ZERO(&receive_wait_set);
	receive_max_sock = 0;

	list_for_each(list_pos, &if_list) {
		batman_if = list_entry(list_pos, struct batman_if, list);

		if (batman_if->if_active) {
			if (batman_if->udp_recv_sock > receive_max_sock)
				receive_max_sock = batman_if->udp_recv_sock;

			FD_SET(batman_if->udp_recv_sock, &receive_wait_set);
		}
	}
}

// Assembly:
pushq %rbx
xorl %eax, %eax
leaq 0xcfac(%rip), %rsi      # 0x17388
cmpq $0x10, %rax
je 0xa3ec
andq $0x0, (%rsi,%rax,8)
incq %rax
jmp 0xa3dc
leaq 0xcef5(%rip), %rdi      # 0x172e8
andl $0x0, (%rdi)
leaq 0xcf13(%rip), %r8       # 0x17310
xorl %r11d, %r11d
movl $0x40, %r9d
movabsq $0x1, %r10
movq %r8, %rbx
movq (%rbx), %rbx
cmpq %r8, %rbx
je 0xa448
cmpb $0x0, 0x1d(%rbx)
je 0xa413
movl 0x14(%rbx), %ecx
cmpl %r11d, %ecx
jle 0xa42e
movl %ecx, (%rdi)
movl %ecx, %r11d
movl %ecx, %eax
cltd
idivl %r9d
movslq %eax, %rdx
shll $0x6, %eax
subl %eax, %ecx
movq %r10, %rax
shlq %cl, %rax
orq %rax, (%rsi,%rdx,8)
jmp 0xa413
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/init.c
// Function: deactivate_interface
void deactivate_interface(struct batman_if *batman_if)
{
	if (batman_if->udp_recv_sock != 0)
		close(batman_if->udp_recv_sock);

	if (batman_if->udp_send_sock != 0)
		close(batman_if->udp_send_sock);

	batman_if->udp_recv_sock = 0;
	batman_if->udp_send_sock = 0;

	if ((batman_if->netaddr > 0) && (batman_if->netmask > 0)) {

		add_del_rule(batman_if->netaddr, batman_if->netmask, BATMAN_RT_TABLE_HOSTS, BATMAN_RT_PRIO_DEFAULT + batman_if->if_num, 0, RULE_TYPE_DST, RULE_DEL);
		add_del_rule(batman_if->netaddr, batman_if->netmask, BATMAN_RT_TABLE_UNREACH, BATMAN_RT_PRIO_UNREACH + batman_if->if_num, 0, RULE_TYPE_DST, RULE_DEL);

	}

	batman_if->if_active = 0;
	active_ifs--;

	if (batman_if->if_rp_filter_old > -1)
		set_rp_filter(batman_if->if_rp_filter_old, batman_if->dev);

	if (batman_if->if_send_redirects_old > -1)
		set_send_redirects(batman_if->if_send_redirects_old, batman_if->dev);

	batman_if->if_rp_filter_old = -1;
	batman_if->if_send_redirects_old = -1;

	interface_listen_sockets();
	debug_output(3, "Interface deactivated: %s\n", batman_if->dev);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x14(%rdi), %edi
testl %edi, %edi
je 0xa45c
callq 0x21f0
movl 0x10(%rbx), %edi
testl %edi, %edi
je 0xa468
callq 0x21f0
andq $0x0, 0x10(%rbx)
movl 0x50(%rbx), %edi
testl %edi, %edi
je 0xa4be
movb 0x54(%rbx), %al
testb %al, %al
je 0xa4be
movzbl 0x1c(%rbx), %ecx
addl $0x19c8, %ecx           # imm = 0x19C8
pushq $0x1
popq %rbp
movl %ebp, (%rsp)
movzbl %al, %esi
pushq $0x42
popq %rdx
xorl %r8d, %r8d
movl %ebp, %r9d
callq 0x7a5a
movl 0x50(%rbx), %edi
movzbl 0x54(%rbx), %esi
movzbl 0x1c(%rbx), %ecx
addl $0x1a2c, %ecx           # imm = 0x1A2C
movl %ebp, (%rsp)
pushq $0x43
popq %rdx
xorl %r8d, %r8d
movl %ebp, %r9d
callq 0x7a5a
movb $0x0, 0x1d(%rbx)
leaq 0xce1c(%rip), %rax      # 0x172e5
decb (%rax)
movsbl 0x24(%rbx), %edi
testl %edi, %edi
js 0xa4dc
movq 0x8(%rbx), %rsi
callq 0x8cbc
movsbl 0x25(%rbx), %edi
testl %edi, %edi
js 0xa4ed
movq 0x8(%rbx), %rsi
callq 0x8e27
orw $-0x1, 0x24(%rbx)
callq 0xa3d2
movq 0x8(%rbx), %rdx
leaq 0x6acf(%rip), %rsi      # 0x10fd1
pushq $0x3
popq %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xcb1c
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/init.c
// Function: is_interface_up
static int is_interface_up(char *dev)
{
	struct ifreq int_req;
	int sock;

	if ((sock = socket(PF_INET, SOCK_DGRAM, 0)) < 0)
		return 0;

	memset(&int_req, 0, sizeof (struct ifreq));
	strncpy(int_req.ifr_name, dev, IFNAMSIZ - 1);

	if (ioctl(sock, SIOCGIFFLAGS, &int_req) < 0)
		goto failure;

	if (!(int_req.ifr_flags & IFF_UP))
		goto failure;

	if (ioctl(sock, SIOCGIFADDR, &int_req) < 0)
		goto failure;

	close(sock);
	return 1;

failure:
	close(sock);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
pushq $0x2
popq %rdi
xorl %ebp, %ebp
movl %edi, %esi
xorl %edx, %edx
callq 0x24e0
testl %eax, %eax
js 0xa58e
movl %eax, %ebx
xorps %xmm0, %xmm0
movq %rsp, %r15
movups %xmm0, 0x18(%r15)
movups %xmm0, 0x8(%r15)
pushq $0xf
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x2090
xorl %ebp, %ebp
movl $0x8913, %esi           # imm = 0x8913
movl %ebx, %edi
movq %r15, %rdx
xorl %eax, %eax
callq 0x21d0
testl %eax, %eax
js 0xa587
testb $0x1, 0x10(%rsp)
je 0xa587
movq %rsp, %rdx
movl $0x8915, %esi           # imm = 0x8915
movl %ebx, %edi
xorl %eax, %eax
callq 0x21d0
testl %eax, %eax
js 0xa587
pushq $0x1
popq %rbp
movl %ebx, %edi
callq 0x21f0
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/init.c
// Function: check_inactive_interfaces
void check_inactive_interfaces(void)
{
	struct list_head *list_pos;
	struct batman_if *batman_if;

	/* all available interfaces are active */
	if (found_ifs == active_ifs)
		return;

	list_for_each(list_pos, &if_list) {
		batman_if = list_entry(list_pos, struct batman_if, list);

		if ((!batman_if->if_active) && (is_interface_up(batman_if->dev)))
			activate_interface(batman_if);
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0xc98e(%rip), %rax      # 0x172e4
movb (%rax), %al
leaq 0xc986(%rip), %rcx      # 0x172e5
cmpb (%rcx), %al
jne 0xa96b
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xc99e(%rip), %r14      # 0x17310
movq %r14, %rbx
movq (%rbx), %rbx
cmpq %r14, %rbx
je 0xa963
cmpb $0x0, 0x1d(%rbx)
jne 0xa975
movq 0x8(%rbx), %rdi
callq 0xa512
testl %eax, %eax
je 0xa975
movq %rbx, %rdi
callq 0xa59b
jmp 0xa975
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/init.c
// Function: check_active_interfaces
void check_active_interfaces(void)
{
	struct list_head *list_pos;
	struct batman_if *batman_if;

	/* all available interfaces are deactive */
	if (active_ifs == 0)
		return;

	list_for_each(list_pos, &if_list) {
		batman_if = list_entry(list_pos, struct batman_if, list);

		if ((batman_if->if_active) && (!is_interface_up(batman_if->dev)))
			deactivate_interface(batman_if);
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0xc940(%rip), %rax      # 0x172e5
cmpb $0x0, (%rax)
je 0xa9d9
leaq 0xc95f(%rip), %r14      # 0x17310
movq %r14, %rbx
movq (%rbx), %rbx
cmpq %r14, %rbx
je 0xa9d9
cmpb $0x0, 0x1d(%rbx)
je 0xa9b4
movq 0x8(%rbx), %rdi
callq 0xa512
testl %eax, %eax
jne 0xa9b4
movq %rbx, %rdi
callq 0xa44a
jmp 0xa9b4
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/posix.c
// Function: get_time_msec
uint32_t get_time_msec(void)
{
	uint32_t time;

	pthread_mutex_lock(&batman_clock_mutex);
	update_internal_clock();
	time = (uint32_t)(((float)(batman_clock_ticks) * 1000) / system_tick);
	pthread_mutex_unlock(&batman_clock_mutex);

	return time;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0xcca1(%rip), %rbx      # 0x17690
movq %rbx, %rdi
callq 0x24c0
callq 0xaa4f
leaq 0xc8fd(%rip), %rax      # 0x17300
movq (%rax), %rax
testq %rax, %rax
js 0xaa12
cvtsi2ss %rax, %xmm0
jmp 0xaa27
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
mulss 0x6959(%rip), %xmm0     # 0x11388
divss 0xcc81(%rip), %xmm0     # 0x176b8
cvttss2si %xmm0, %r14
movq %rbx, %rdi
callq 0x22d0
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/posix.c
// Function: get_time_msec64
uint64_t get_time_msec64(void)
{
	uint64_t time;

	pthread_mutex_lock(&batman_clock_mutex);
	update_internal_clock();
	time = (uint64_t)(((float)(batman_clock_ticks) * 1000) / system_tick);
	pthread_mutex_unlock(&batman_clock_mutex);

	return time;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0xcc13(%rip), %rbx      # 0x17690
movq %rbx, %rdi
callq 0x24c0
callq 0xaa4f
leaq 0xc86f(%rip), %rax      # 0x17300
movq (%rax), %rax
testq %rax, %rax
js 0xaaa0
cvtsi2ss %rax, %xmm0
jmp 0xaab5
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
mulss 0x68cb(%rip), %xmm0     # 0x11388
divss 0xcbf3(%rip), %xmm0     # 0x176b8
cvttss2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subss 0x68b3(%rip), %xmm0     # 0x1138c
cvttss2si %xmm0, %r14
andq %rcx, %r14
orq %rax, %r14
movq %rbx, %rdi
callq 0x22d0
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/posix.c
// Function: bat_wait
static void bat_wait( int32_t T, int32_t t ) {

	struct timeval time;

	time.tv_sec = T;
	time.tv_usec = ( t * 10000 );

	select( 0, NULL, NULL, NULL, &time );

	return;

}

// Assembly:
subq $0x18, %rsp
movl %edi, %eax
leaq 0x8(%rsp), %r8
movq %rax, (%r8)
imull $0x2710, %esi, %eax     # imm = 0x2710
movq %rax, 0x8(%r8)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x22c0
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/posix.c
// Function: sym_print
static void sym_print( char x, char y, const char *z ) {

	char i = 0, Z;

	do{

		BAT_LOGO_PRINT( 25 + (int)x + (int)i, (int)y, z[(int)i] );

		switch ( z[(int)i] ) {

			case 92:
				Z = 47;   /* "\" --> "/" */
				break;

			case 47:
				Z = 92;   /* "/" --> "\" */
				break;

			case 41:
				Z = 40;   /* ")" --> "(" */
				break;

			default:
				Z = z[(int)i];
				break;

		}

		BAT_LOGO_PRINT( 24 - (int)x - (int)i, (int)y, Z );
		i++;

	} while( z[(int)i - 1] );

	return;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movl %edi, %r14d
incl %ebp
xorl %r12d, %r12d
leaq 0x65e3(%rip), %r15      # 0x115bd
movsbl %r12b, %r12d
leal (%r12,%r14), %edx
addl $0x19, %edx
movsbq %r12b, %r13
movsbl (%rbx,%r13), %ecx
movq %r15, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x2190
movzbl (%rbx,%r13), %eax
cmpl $0x29, %eax
je 0xb015
pushq $0x2f
popq %rcx
cmpl $0x5c, %eax
je 0xb01d
cmpl $0x2f, %eax
jne 0xb01a
pushq $0x5c
jmp 0xb017
pushq $0x28
popq %rcx
jmp 0xb01d
movsbl %al, %ecx
leal (%r12,%r14), %eax
pushq $0x18
popq %rdx
subl %eax, %edx
movq %r15, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x2190
incb %r12b
movsbq %r12b, %rax
cmpb $0x0, -0x1(%rbx,%rax)
jne 0xafda
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/posix.c
// Function: add_default_route
void add_default_route(void)
{
	struct curr_gw_data *curr_gw_data;

	if (tunnel_running) {
		debug_output(3, "Error - couldn't create tunnel: old tunnel is still active\n");
		return;
	}

	curr_gw_data = debugMalloc( sizeof(struct curr_gw_data), 207 );
	curr_gw_data->orig = curr_gateway->orig_node->orig;
	curr_gw_data->gw_node = curr_gateway;
	curr_gw_data->batman_if = curr_gateway->orig_node->batman_if;

	tunnel_running = 1;

	if (pthread_create(&curr_gateway_thread_id, NULL, &client_to_gw_tun, curr_gw_data) != 0) {

		debug_output(0, "Error - couldn't spawn thread: %s\n", strerror(errno));
		debugFree(curr_gw_data, 1213);
		curr_gateway = NULL;
		tunnel_running = 0;

	} else {

		pthread_detach(curr_gateway_thread_id);

	}

}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpb $0x0, 0xc5db(%rip)      # 0x17688
je 0xb0c5
leaq 0x6382(%rip), %rsi      # 0x11438
pushq $0x3
popq %rdi
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0xcb1c
pushq $0x18
popq %rdi
movl $0xcf, %esi
callq 0x58c9
movq %rax, %rbx
leaq 0xc1e4(%rip), %r15      # 0x172c0
movq (%r15), %rax
movq 0x8(%rax), %rcx
movl (%rcx), %edx
movl %edx, (%rbx)
movq %rax, 0x8(%rbx)
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rbx)
movb $0x1, 0xc58e(%rip)      # 0x17688
leaq 0xc1c7(%rip), %r14      # 0x172c8
leaq 0x693(%rip), %rdx       # 0xb79b
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x2380
testl %eax, %eax
je 0xb156
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x6348(%rip), %rsi      # 0x11474
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0xcb1c
movq %rbx, %rdi
movl $0x4bd, %esi            # imm = 0x4BD
callq 0x5b1a
andq $0x0, (%r15)
movb $0x0, 0xc538(%rip)      # 0x17688
popq %rbx
popq %r14
popq %r15
retq
movq (%r14), %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2300
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/posix.c
// Function: send_udp_packet
int8_t send_udp_packet(unsigned char *packet_buff, int32_t packet_buff_len, struct sockaddr_in *broad, int32_t send_sock, struct batman_if *batman_if)
{
	if ((batman_if != NULL) && (!batman_if->if_active))
		return 0;

	if ( sendto( send_sock, packet_buff, packet_buff_len, 0, (struct sockaddr *)broad, sizeof(struct sockaddr_in) ) < 0 ) {

		if ( errno == 1 ) {

			debug_output(0, "Error - can't send udp packet: %s.\nDoes your firewall allow outgoing packets on port %i ?\n", strerror(errno), ntohs(broad->sin_port));

		} else {

			debug_output(0, "Error - can't send udp packet: %s\n", strerror(errno));

		}

		return -1;

	}

	return 0;

}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %rax
testq %r8, %r8
je 0xb2f2
cmpb $0x0, 0x1d(%r8)
je 0xb343
movslq %esi, %rdx
xorl %ebp, %ebp
pushq $0x10
popq %r9
movl %ecx, %edi
movq %rax, %rsi
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x21e0
testq %rax, %rax
jns 0xb362
callq 0x2070
movl (%rax), %edi
cmpl $0x1, %edi
jne 0xb347
pushq $0x1
popq %rdi
callq 0x2480
movzwl 0x2(%rbx), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
leaq 0x61af(%rip), %rsi      # 0x114e4
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0xcb1c
jmp 0xb35f
xorl %ebp, %ebp
jmp 0xb362
callq 0x2480
leaq 0x61ec(%rip), %rsi      # 0x1153f
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0xcb1c
movb $-0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/posix.c
// Function: del_gw_interface
void del_gw_interface(void)
{
	struct batman_if *batman_if = (struct batman_if *)if_list.next;

	if (batman_if->udp_tunnel_sock > 0) {

		if (batman_if->listen_thread_id != 0) {
			pthread_join(batman_if->listen_thread_id, NULL);
		}

		close(batman_if->udp_tunnel_sock);

		batman_if->listen_thread_id = 0;
		batman_if->udp_tunnel_sock = 0;

	}
}

// Assembly:
pushq %rbx
leaq 0xbf9d(%rip), %rax      # 0x17310
movq (%rax), %rbx
movl 0x18(%rbx), %edi
testl %edi, %edi
jle 0xb3a1
movq 0x28(%rbx), %rax
testq %rax, %rax
je 0xb393
movq %rax, %rdi
xorl %esi, %esi
callq 0x2470
movl 0x18(%rbx), %edi
callq 0x21f0
andq $0x0, 0x28(%rbx)
andl $0x0, 0x18(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/posix.c
// Function: restore_defaults
void restore_defaults(void) {

	struct list_head *if_pos, *if_pos_tmp;
	struct batman_if *batman_if;

	stop = 1;

	if ( routing_class > 0 )
		add_del_interface_rules(RULE_DEL);

	del_gw_interface();

	list_for_each_safe( if_pos, if_pos_tmp, &if_list ) {

		batman_if = list_entry( if_pos, struct batman_if, list );

		deactivate_interface(batman_if);

		list_del( (struct list_head *)&if_list, if_pos, &if_list );
		debugFree( if_pos, 1214 );

	}

	/* delete rule for hna networks */
	add_del_rule(0, 0, BATMAN_RT_TABLE_NETWORKS, BATMAN_RT_PRIO_UNREACH - 1, 0, RULE_TYPE_DST, RULE_DEL);

	/* delete unreachable routing table entry */
	add_del_route(0, 0, 0, 0, 0, "unknown", BATMAN_RT_TABLE_UNREACH, ROUTE_TYPE_UNREACHABLE, ROUTE_DEL);

	if ( ( routing_class != 0 ) && ( curr_gateway != NULL ) )
		del_default_route();

	if ( vis_if.sock )
		close( vis_if.sock );

	if ( unix_if.unix_sock )
		close( unix_if.unix_sock );

	if ( unix_if.listen_thread_id != 0 ) {
		pthread_join( unix_if.listen_thread_id, NULL );
		unix_if.listen_thread_id = 0;
	}

	if ( debug_level == 0 )
		closelog();

	if (policy_routing_script != NULL) {
		close(policy_routing_pipe);
		waitpid(policy_routing_script_pid, NULL, 0);
	}

}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0xc2cd(%rip), %rax      # 0x17680
movb $0x1, (%rax)
leaq 0xbefd(%rip), %r12      # 0x172ba
cmpb $0x0, (%r12)
je 0xb3cc
pushq $0x1
popq %rdi
callq 0x7df2
pushq $0x1
popq %rbx
callq 0xb36b
leaq 0xbf35(%rip), %r14      # 0x17310
movq (%r14), %r15
cmpq %r14, %r15
je 0xb40e
movq (%r15), %r13
movq %r15, %rdi
callq 0xa44a
movq %r14, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x5763
movq %r15, %rdi
movl $0x4be, %esi            # imm = 0x4BE
callq 0x5b1a
movq %r13, %r15
jmp 0xb3de
subq $0x8, %rsp
pushq $0x41
popq %rdx
xorl %edi, %edi
xorl %esi, %esi
movl $0x1a2b, %ecx           # imm = 0x1A2B
xorl %r8d, %r8d
movl %ebx, %r9d
pushq %rbx
callq 0x7a5a
popq %rax
popq %rcx
subq $0x8, %rsp
leaq 0x490f(%rip), %r9       # 0xfd46
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
pushq %rbx
pushq $0x2
pushq $0x43
callq 0x745c
addq $0x20, %rsp
cmpb $0x0, (%r12)
je 0xb468
leaq 0xbe62(%rip), %rax      # 0x172c0
cmpq $0x0, (%rax)
je 0xb468
andq $0x0, (%rax)
leaq 0xbef1(%rip), %rax      # 0x17360
movl (%rax), %edi
testl %edi, %edi
je 0xb47a
callq 0x21f0
leaq 0xbf87(%rip), %rbx      # 0x17408
movl (%rbx), %edi
testl %edi, %edi
je 0xb48c
callq 0x21f0
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0xb4a1
xorl %esi, %esi
callq 0x2470
andq $0x0, 0x8(%rbx)
leaq 0xbe10(%rip), %rax      # 0x172b8
cmpb $0x0, (%rax)
jne 0xb4b2
callq 0x2060
leaq 0xbe1f(%rip), %rax      # 0x172d8
cmpq $0x0, (%rax)
je 0xb4e8
leaq 0xbe1a(%rip), %rax      # 0x172e0
movl (%rax), %edi
callq 0x21f0
leaq 0xbeac(%rip), %rax      # 0x17380
movl (%rax), %edi
xorl %esi, %esi
xorl %edx, %edx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x2390
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/posix.c
// Function: restore_and_exit
void restore_and_exit( uint8_t is_sigsegv ) {

	struct orig_node *orig_node;
	struct hash_it_t *hashit = NULL;

	if ( !unix_client ) {

		/* remove tun interface first */
		stop = 1;

		del_gw_interface();

		if ( ( routing_class != 0 ) && ( curr_gateway != NULL ) )
			del_default_route();

		/* all rules and routes were purged in segmentation_fault() */
		if ( !is_sigsegv ) {

			while ( NULL != ( hashit = hash_iterate( orig_hash, hashit ) ) ) {

				orig_node = hashit->bucket->data;

				update_routes( orig_node, NULL, NULL, 0 );

			}

		}

		restore_defaults();

	}

	if (is_sigsegv)
		raise(SIGSEGV);

	/* call exit always even if it will not be reached to make the compiler happy */
	exit(EXIT_FAILURE);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edi, %ebx
leaq 0xbdec(%rip), %rax      # 0x172ec
cmpb $0x0, (%rax)
jne 0xb56b
leaq 0xc174(%rip), %rax      # 0x17680
movb $0x1, (%rax)
callq 0xb36b
leaq 0xbd9f(%rip), %rax      # 0x172ba
cmpb $0x0, (%rax)
je 0xb531
leaq 0xbd99(%rip), %rax      # 0x172c0
cmpq $0x0, (%rax)
je 0xb531
andq $0x0, (%rax)
testb %bl, %bl
jne 0xb566
xorl %r14d, %r14d
leaq 0xbdf1(%rip), %r15      # 0x17330
movq (%r15), %rdi
movq %r14, %rsi
callq 0x5f8c
testq %rax, %rax
je 0xb566
movq %rax, %r14
movq 0x8(%rax), %rax
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2f26
jmp 0xb53f
callq 0xb3a3
testb %bl, %bl
je 0xb577
pushq $0xb
popq %rdi
callq 0x2040
pushq $0x1
popq %rdi
callq 0x2440
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/posix/posix.c
// Function: segmentation_fault
void segmentation_fault(int32_t BATMANUNUSED(sig)) {

	signal(SIGSEGV, SIG_DFL);

	debug_output( 0, "Error - SIGSEGV received, trying to clean up ... \n" );

	flush_routes_rules(0);
	flush_routes_rules(1);

	restore_and_exit(1);
}

// Assembly:
pushq %rbx
pushq $0xb
popq %rdi
xorl %esi, %esi
callq 0x2260
leaq 0x5fd1(%rip), %rsi      # 0x11562
xorl %edi, %edi
xorl %eax, %eax
callq 0xcb1c
xorl %edi, %edi
callq 0x816c
pushq $0x1
popq %rbx
movl %ebx, %edi
callq 0x816c
movl %ebx, %edi
callq 0xb4f2