LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/hash.c
// Function: hash_remove
void *hash_remove(struct hashtable_t *hash, void *data)
{
	struct hash_it_t hash_it_t;

	hash_it_t.index = hash->choose(data, hash->size);
	hash_it_t.bucket = hash->table[hash_it_t.index];
	hash_it_t.prev_bucket = NULL;

	while (hash_it_t.bucket != NULL) {
		if (hash->compare(hash_it_t.bucket->data, data)) {
			int bucket_same;
			bucket_same = (hash_it_t.bucket ==
				       hash->table[hash_it_t.index]);
			hash_it_t.first_bucket = (bucket_same ?
						  &hash->table[hash_it_t.index] :
						  NULL);
			return hash_remove_bucket(hash, &hash_it_t);
		}

		hash_it_t.prev_bucket = hash_it_t.bucket;
		hash_it_t.bucket = hash_it_t.bucket->next;
	}

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl 0xc(%rcx), %esi
callq *%rax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x8600
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rcx
movq (%rcx), %rdi
movq -0x18(%rbp), %rsi
callq *%rax
cmpl $0x0, %eax
je 0x85e7
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movslq -0x38(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x85c4
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
jmp 0x85cc
xorl %eax, %eax
movq %rax, -0x48(%rbp)
jmp 0x85cc
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x8480
movq %rax, -0x8(%rbp)
jmp 0x8608
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x8563
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/hash.c
// Function: hash_resize
struct hashtable_t *hash_resize(struct hashtable_t *hash, int size)
{
	struct hashtable_t *new_hash;
	struct element_t *bucket;
	int i;

	/* initialize a new hash with the new size */
	new_hash = hash_new(size, hash->compare, hash->choose);
	if (!new_hash)
		return NULL;

	/* copy the elements */
	for (i = 0; i < hash->size; i++) {
		while (hash->table[i]) {
			bucket = hash->table[i];
			hash->table[i] = bucket->next;
			hash_add_bucket(new_hash, bucket->data, bucket, 0);
		}
	}
	/* remove hash and eventual overflow buckets but not the
	 * content itself. */
	hash_delete(hash, NULL);
	return new_hash;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
callq 0x81d0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x865f
movq $0x0, -0x8(%rbp)
jmp 0x86ea
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x86d5
jmp 0x8674
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x2c(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x86c8
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x2c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rdx
xorl %ecx, %ecx
callq 0x8300
jmp 0x8674
jmp 0x86ca
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x8666
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7eb0
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/profile.c
// Function: prof_print
void prof_print(void) {

	int32_t index;

	debug_output( 5, " \nProfile data:\n" );

	for ( index = 0; index < PROF_COUNT; index++ ) {

		debug_output( 5, "   %30s: cpu time = %10.3f, calls = %10"PRId64", avg time per call = %4.10f \n", prof_container[index].name, (float)prof_container[index].total_time/CLOCKS_PER_SEC, prof_container[index].calls, ( prof_container[index].calls == 0 ? 0.0 : ( ( (float)prof_container[index].total_time/CLOCKS_PER_SEC ) / (float)prof_container[index].calls ) ) );

	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x5, %edi
leaq 0xd2dc(%rip), %rsi      # 0x15af0
movb $0x0, %al
callq 0x123f0
movl $0x0, -0x4(%rbp)
cmpl $0x9, -0x4(%rbp)
jge 0x895b
movslq -0x4(%rbp), %rcx
leaq 0x12d69(%rip), %rax     # 0x1b5a0
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x12d4f(%rip), %rax     # 0x1b5a0
shlq $0x5, %rcx
addq %rcx, %rax
cvtsi2ssq 0x8(%rax), %xmm0
movss 0xd286(%rip), %xmm1     # 0x15aec
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x12d22(%rip), %rax     # 0x1b5a0
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x12d08(%rip), %rax     # 0x1b5a0
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, 0x18(%rax)
jne 0x88b0
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x8928
movslq -0x4(%rbp), %rax
shlq $0x5, %rax
leaq 0x12ce1(%rip), %rcx     # 0x1b5a0
cvtsi2ssq 0x8(%rax,%rcx), %xmm0
movss 0xd21e(%rip), %xmm1     # 0x15aec
divss %xmm1, %xmm0
movss %xmm0, -0x34(%rbp)
movq 0x18(%rax,%rcx), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x30(%rbp)
testq %rax, %rax
movss %xmm0, -0x2c(%rbp)
js 0x8911
movss -0x30(%rbp), %xmm0
movss %xmm0, -0x2c(%rbp)
movss -0x34(%rbp), %xmm0
movss -0x2c(%rbp), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x10(%rbp), %rcx
movsd -0x18(%rbp), %xmm0
movq -0x20(%rbp), %rdx
movsd -0x28(%rbp), %xmm1
movl $0x5, %edi
leaq 0xd1bb(%rip), %rsi      # 0x15b01
movb $0x2, %al
callq 0x123f0
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x8822
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/ring_buffer.c
// Function: ring_buffer_avg
uint8_t ring_buffer_avg(uint8_t tq_recv[])
{
	uint8_t *ptr;
	uint16_t count = 0, i = 0;
	uint32_t sum = 0;

	ptr = tq_recv;

	while (i < global_win_size) {

		if (*ptr != 0) {
			count++;
			sum += *ptr;
		}

		i++;
		ptr++;

	}

	if (count == 0)
		return 0;

	return (uint8_t)(sum / count);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movw $0x0, -0x1a(%rbp)
movw $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movzwl -0x1c(%rbp), %eax
leaq 0x128c0(%rip), %rcx     # 0x1b2ae
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x8a34
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0x8a1a
movw -0x1a(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x1a(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movw -0x1c(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x89e3
movzwl -0x1a(%rbp), %eax
cmpl $0x0, %eax
jne 0x8a43
movb $0x0, -0x1(%rbp)
jmp 0x8a51
movl -0x20(%rbp), %eax
movzwl -0x1a(%rbp), %ecx
xorl %edx, %edx
divl %ecx
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/hna.c
// Function: hna_init
void hna_init(void)
{
	/* hna local */
	INIT_LIST_HEAD_FIRST(hna_list);
	INIT_LIST_HEAD_FIRST(hna_chg_list);

	pthread_mutex_init(&hna_chg_list_mutex, NULL);

	/* hna global */
	hna_global_hash = hash_new(128, compare_hna, choose_hna);

	if (hna_global_hash == NULL) {
		printf("Error - Could not create hna_global_hash (out of memory?)\n");
		exit(EXIT_FAILURE);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x12c65(%rip), %rax     # 0x1b6d0
movq %rax, 0x12c5e(%rip)     # 0x1b6d0
leaq 0x12c57(%rip), %rax     # 0x1b6d0
movq %rax, 0x12c58(%rip)     # 0x1b6d8
leaq 0x12c59(%rip), %rax     # 0x1b6e0
movq %rax, 0x12c52(%rip)     # 0x1b6e0
leaq 0x12c4b(%rip), %rax     # 0x1b6e0
movq %rax, 0x12c4c(%rip)     # 0x1b6e8
leaq 0x12c4d(%rip), %rdi     # 0x1b6f0
xorl %eax, %eax
movl %eax, %esi
callq 0x24c0
movl $0x80, %edi
leaq 0x38(%rip), %rsi        # 0x8af0
leaq 0x71(%rip), %rdx        # 0x8b30
callq 0x81d0
movq %rax, 0x12c4d(%rip)     # 0x1b718
cmpq $0x0, 0x12c45(%rip)     # 0x1b718
jne 0x8aed
leaq 0xd06d(%rip), %rdi      # 0x15b49
movb $0x0, %al
callq 0x21a0
movl $0x1, %edi
callq 0x2470
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/hna.c
// Function: choose_hna
static int choose_hna(void *data, int32_t size)
{
	unsigned char *key= data;
	uint32_t hash = 0;
	size_t i;

	for (i = 0; i < 5; i++) {
		hash += key[i];
		hash += (hash << 10);
		hash ^= (hash >> 6);
	}

	hash += (hash << 3);
	hash ^= (hash >> 11);
	hash += (hash << 15);

	return (hash % size);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
cmpq $0x5, -0x28(%rbp)
jae 0x8b91
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movzbl (%rax,%rcx), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
shll $0xa, %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
shrl $0x6, %eax
xorl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x8b52
movl -0x1c(%rbp), %eax
shll $0x3, %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
shrl $0xb, %eax
xorl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
shll $0xf, %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
xorl %edx, %edx
divl -0xc(%rbp)
movl %edx, %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/hna.c
// Function: hna_local_task_add_ip
void hna_local_task_add_ip(uint32_t ip_addr, uint16_t netmask, uint8_t route_action)
{
	struct hna_task *hna_task;

	hna_task = debugMalloc(sizeof(struct hna_task), 701);
	memset(hna_task, 0, sizeof(struct hna_task));
	INIT_LIST_HEAD(&hna_task->list);

	hna_task->addr = ip_addr;
	hna_task->netmask = netmask;
	hna_task->route_action = route_action;

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

	list_add_tail(&hna_task->list, &hna_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 $0x10, %rsp
movb %dl, %al
movw %si, %cx
movl %edi, -0x4(%rbp)
movw %cx, -0x6(%rbp)
movb %al, -0x7(%rbp)
movl $0x10, %edi
movl $0x2bd, %esi            # imm = 0x2BD
callq 0x7220
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x21e0
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl -0x4(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movw -0x6(%rbp), %ax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0xc(%rax)
movb -0x7(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0xd(%rax)
leaq 0x12ab3(%rip), %rdi     # 0x1b6f0
callq 0x24e0
cmpl $0x0, %eax
je 0x8c6d
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rcx
xorl %edi, %edi
leaq 0xcf25(%rip), %rsi      # 0x15b84
leaq 0xcf56(%rip), %rdx      # 0x15bbc
movb $0x0, %al
callq 0x123f0
movq -0x10(%rbp), %rdi
leaq 0x12a68(%rip), %rsi     # 0x1b6e0
callq 0x6e60
leaq 0x12a6c(%rip), %rdi     # 0x1b6f0
callq 0x2300
cmpl $0x0, %eax
je 0x8cb4
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rcx
xorl %edi, %edi
leaq 0xcf2c(%rip), %rsi      # 0x15bd2
leaq 0xcf0f(%rip), %rdx      # 0x15bbc
movb $0x0, %al
callq 0x123f0
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x8(%rbp), %rax
movb 0xc(%rax), %al
xorl %r8d, %r8d
leaq 0xcbe7(%rip), %r9       # 0x15d81
movzbl %al, %esi
movl %r8d, %edx
movl %r8d, %ecx
movl $0x41, (%rsp)
movl $0x1, 0x8(%rsp)
movsbl -0x9(%rbp), %eax
movl %eax, 0x10(%rsp)
callq 0xa420
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x8(%rbp), %rax
movb 0xc(%rax), %al
xorl %r8d, %r8d
leaq 0xcbaa(%rip), %r9       # 0x15d81
movzbl %al, %esi
movl %r8d, %edx
movl %r8d, %ecx
movl $0x42, (%rsp)
movl $0x1, 0x8(%rsp)
movsbl -0x9(%rbp), %eax
movl %eax, 0x10(%rsp)
callq 0xa420
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x8(%rbp), %rax
movb 0xc(%rax), %al
xorl %r8d, %r8d
leaq 0xcb6d(%rip), %r9       # 0x15d81
movzbl %al, %esi
movl %r8d, %edx
movl %r8d, %ecx
movl $0x43, (%rsp)
movl $0x1, 0x8(%rsp)
movsbl -0x9(%rbp), %eax
movl %eax, 0x10(%rsp)
callq 0xa420
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x8(%rbp), %rax
movb 0xc(%rax), %al
xorl %r8d, %r8d
leaq 0xcb30(%rip), %r9       # 0x15d81
movzbl %al, %esi
movl %r8d, %edx
movl %r8d, %ecx
movl $0x44, (%rsp)
movl $0x1, 0x8(%rsp)
movsbl -0x9(%rbp), %eax
movl %eax, 0x10(%rsp)
callq 0xa420
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x8(%rbp), %rax
movb 0xc(%rax), %al
movzbl %al, %esi
movsbl -0x9(%rbp), %edx
callq 0xc0b0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/hna.c
// Function: hna_local_buffer_fill
static void hna_local_buffer_fill(void)
{
	struct hna_local_entry *hna_local_entry;

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

	num_hna_local = 0;
	hna_buff_local = NULL;

	if (list_empty(&hna_list))
		return;

	list_for_each_entry(hna_local_entry, &hna_list, list) {
		hna_buff_local = debugRealloc(hna_buff_local, (num_hna_local + 1) * 5 * sizeof(unsigned char), 15);

		memmove(&hna_buff_local[num_hna_local * 5], (unsigned char *)&hna_local_entry->addr, 4);
		hna_buff_local[(num_hna_local * 5) + 4] = (unsigned char)hna_local_entry->netmask;
		num_hna_local++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
cmpq $0x0, 0x12410(%rip)     # 0x1b6c0
je 0x92c3
movq 0x12407(%rip), %rdi     # 0x1b6c0
movl $0x6a5, %esi            # imm = 0x6A5
callq 0x7720
movb $0x0, 0x123fe(%rip)     # 0x1b6c8
movq $0x0, 0x123eb(%rip) # 0x1b6c0
leaq 0x123f4(%rip), %rdi     # 0x1b6d0
callq 0x6f40
cmpl $0x0, %eax
je 0x92eb
jmp 0x9399
movq 0x123de(%rip), %rax     # 0x1b6d0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
leaq 0x123cf(%rip), %rcx     # 0x1b6d0
cmpq %rcx, %rax
je 0x9399
movq 0x123af(%rip), %rdi     # 0x1b6c0
movzbl 0x123b0(%rip), %eax     # 0x1b6c8
addl $0x1, %eax
imull $0x5, %eax, %eax
cltq
shlq $0x0, %rax
movl %eax, %esi
movl $0xf, %edx
callq 0x74c0
movq %rax, 0x12389(%rip)     # 0x1b6c0
movq 0x12382(%rip), %rax     # 0x1b6c0
movzbl 0x12383(%rip), %ecx     # 0x1b6c8
imull $0x5, %ecx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x8(%rbp), %rcx
addq $0x8, %rcx
movl (%rcx), %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movb 0xc(%rax), %dl
movq 0x12358(%rip), %rax     # 0x1b6c0
movzbl 0x12359(%rip), %ecx     # 0x1b6c8
imull $0x5, %ecx, %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movb 0x12347(%rip), %al      # 0x1b6c8
addb $0x1, %al
movb %al, 0x1233f(%rip)      # 0x1b6c8
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x92f6
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movzbl 0x12311(%rip), %eax     # 0x1b6c8
cmpl $0x1, %eax
jge 0x93c9
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x945c
movq 0x12300(%rip), %rax     # 0x1b6d0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
leaq 0x122f1(%rip), %rcx     # 0x1b6d0
cmpq %rcx, %rax
je 0x9454
movq -0x18(%rbp), %rax
movzwl (%rax), %ecx
addq $0x6, %rcx
movw %cx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movzwl (%rax), %esi
movl $0x6b, %edx
callq 0x74c0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movzwl (%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
addq $-0x6, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movl 0x8(%rcx), %ecx
movl %ecx, 0x2(%rax)
movq -0x20(%rbp), %rax
movb 0xc(%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x28(%rbp), %rax
movb $0x3, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x93d4
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x9cd4
movq -0x8(%rbp), %rax
movswl 0x40(%rax), %eax
cmpl $0x0, %eax
jne 0x9cd9
jmp 0x9d79
movq -0x8(%rbp), %rax
movswq 0x40(%rax), %rax
movl $0x5, %ecx
xorl %edx, %edx
divq %rcx
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x9d51
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x5, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
jle 0x9d44
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0x20, %eax
jg 0x9d44
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x9e50
jmp 0x9d46
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x9d02
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
movl $0x6ad, %esi            # imm = 0x6AD
callq 0x7720
movq -0x8(%rbp), %rax
movq $0x0, 0x38(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x40(%rax)
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/hna.c
// Function: hna_buff_delete
static int hna_buff_delete(struct hna_element *buf, int *buf_len, struct hna_element *e)
{
	int i;
	int num_elements;

	if (buf == NULL)
		return 0;

	/* align to multiple of sizeof(struct hna_element) */
	num_elements = *buf_len / sizeof(struct hna_element);

	for (i = 0; i < num_elements; i++) {

		if (memcmp(&buf[i], e, sizeof(struct hna_element)) == 0) {

			/* move last element forward */
			memmove(&buf[i], &buf[num_elements - 1], sizeof(struct hna_element));
			*buf_len -= sizeof(struct hna_element);

			return 1;
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x9da7
movl $0x0, -0x4(%rbp)
jmp 0x9e43
movq -0x18(%rbp), %rax
movslq (%rax), %rax
movl $0x5, %ecx
xorl %edx, %edx
divq %rcx
movl %eax, -0x28(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x9e3c
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rax
imulq $0x5, %rax, %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movl $0x5, %edx
callq 0x2270
cmpl $0x0, %eax
jne 0x9e2f
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x5, %rcx, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rdx
movl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x5, %rcx, %rcx
addq %rcx, %rdx
movl (%rdx), %ecx
movb 0x4(%rdx), %dl
movb %dl, 0x4(%rax)
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movslq (%rax), %rcx
subq $0x5, %rcx
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x9e43
jmp 0x9e31
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x9dc2
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq 0x11401(%rip), %rax     # 0x1b6d0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
leaq 0x113eb(%rip), %rax     # 0x1b6d0
cmpq %rax, -0x8(%rbp)
je 0xa324
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x9170
movq -0x18(%rbp), %rdi
movl $0x6a9, %esi            # imm = 0x6A9
callq 0x7720
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0xa2de
cmpq $0x0, 0x11394(%rip)     # 0x1b6c0
je 0xa33f
movq 0x1138b(%rip), %rdi     # 0x1b6c0
movl $0x6aa, %esi            # imm = 0x6AA
callq 0x7720
movb $0x0, 0x11382(%rip)     # 0x1b6c8
movq $0x0, 0x1136f(%rip) # 0x1b6c0
cmpq $0x0, 0x113bf(%rip)     # 0x1b718
je 0xa36e
movq 0x113b6(%rip), %rdi     # 0x1b718
leaq 0x17(%rip), %rsi        # 0xa380
callq 0x7eb0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
addq $0x10, %rcx
cmpq %rcx, %rax
je 0xa408
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
addq $0x10, %rdx
callq 0x6ed0
movq -0x18(%rbp), %rdi
movl $0x6ae, %esi            # imm = 0x6AE
callq 0x7720
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0xa3b3
movq -0x10(%rbp), %rdi
movl $0x6af, %esi            # imm = 0x6AF
callq 0x7720
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x24(%rbp)
leaq -0x1c(%rbp), %rdi
callq 0x2230
cmpl $0x0, %eax
jge 0xbe6b
movq -0x10(%rbp), %rax
movq %rax, -0x138(%rbp)
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq -0x138(%rbp), %rdx
movq %rax, %rcx
movl $0x3, %edi
leaq 0xa9b5(%rip), %rsi      # 0x1680d
movb $0x0, %al
callq 0x123f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xbf3a
leaq -0x130(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x21e0
movl $0x2, %edi
callq 0x21c0
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %edi
movl $0x2, %esi
callq 0x2180
movl -0x18(%rbp), %edi
callq 0x2210
movq -0x10(%rbp), %rdi
callq 0x2160
movl %eax, -0x14(%rbp)
movl -0x20(%rbp), %edi
movl $0x2, %esi
callq 0x2180
movl -0x20(%rbp), %edi
callq 0x2210
cmpl $0x0, -0x14(%rbp)
jl 0xbed7
movl -0x14(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
cmpl $0x0, %eax
je 0xbf2c
movl -0x1c(%rbp), %edi
leaq -0x130(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x2250
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rdx
movl $0x3, %edi
leaq 0xa93e(%rip), %rsi      # 0x1683c
movb $0x0, %al
callq 0x123f0
cmpl $0x0, -0x24(%rbp)
jle 0xbf25
leaq -0x130(%rbp), %rdx
movl $0x3, %edi
leaq 0xa948(%rip), %rsi      # 0x16866
movb $0x0, %al
callq 0x123f0
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movl -0x1c(%rbp), %edi
callq 0x2210
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
leaq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0xa47d(%rip), %rsi      # 0x163ee
movb $0x0, %al
callq 0x2460
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
callq 0xbfc0
leaq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0xa489(%rip), %rsi      # 0x16421
movb $0x0, %al
callq 0x2460
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
callq 0xbfc0
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
leaq 0xf3cf(%rip), %rax      # 0x1b3a8
cmpb $0x0, (%rax)
je 0xbfe0
jmp 0xc03a
leaq 0xf2cd(%rip), %rax      # 0x1b2b4
cmpl $-0x1, (%rax)
jne 0xc031
movsbl -0x9(%rbp), %ecx
leaq 0x8bcf(%rip), %rdx      # 0x14bc6
leaq 0xac02(%rip), %rax      # 0x16c00
cmpl $0x0, %ecx
cmoveq %rax, %rdx
movl $0x3, %edi
leaq 0xa863(%rip), %rsi      # 0x16874
movb $0x0, %al
callq 0x123f0
movq -0x8(%rbp), %rdx
movl $0x3, %edi
leaq 0xa88c(%rip), %rsi      # 0x168b4
movb $0x0, %al
callq 0x123f0
jmp 0xc03a
movq -0x8(%rbp), %rdi
callq 0xbe00
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
leaq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0xa425(%rip), %rsi      # 0x16486
movb $0x0, %al
callq 0x2460
leaq -0xa0(%rbp), %rdi
movl $0x1, %esi
callq 0xbfc0
leaq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0xa396(%rip), %rsi      # 0x16421
movb $0x0, %al
callq 0x2460
leaq -0xa0(%rbp), %rdi
movl $0x1, %esi
callq 0xbfc0
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movb %dl, %al
movb %sil, %cl
movl %edi, -0x4(%rbp)
movb %cl, -0x5(%rbp)
movb %al, -0x6(%rbp)
leaq -0x80(%rbp), %rdx
movl $0x2, %edi
leaq -0x4(%rbp), %rsi
movl $0x10, %ecx
callq 0x2030
movsbl -0x6(%rbp), %eax
cmpl $0x1, %eax
jne 0xc105
leaq -0x70(%rbp), %rdi
leaq -0x80(%rbp), %rdx
movzbl -0x5(%rbp), %ecx
leaq 0xa3bd(%rip), %rsi      # 0x164b9
movb $0x0, %al
callq 0x2460
jmp 0xc11f
leaq -0x70(%rbp), %rdi
leaq -0x80(%rbp), %rdx
movzbl -0x5(%rbp), %ecx
leaq 0xa3d3(%rip), %rsi      # 0x164eb
movb $0x0, %al
callq 0x2460
leaq -0x70(%rbp), %rdi
movsbl -0x6(%rbp), %esi
callq 0xbfc0
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movb %dil, %al
movb %al, -0x2(%rbp)
leaq 0xa3c8(%rip), %rdi      # 0x1651d
movl $0x2, %esi
movb $0x0, %al
callq 0x23d0
movl %eax, -0x8(%rbp)
cmpl $0x0, %eax
jge 0xc19f
cmpb $0x0, -0x2(%rbp)
je 0xc189
movq 0xee7a(%rip), %rax      # 0x1aff0
movq (%rax), %rdi
leaq 0xa3aa(%rip), %rsi      # 0x1652a
movb $0x0, %al
callq 0x22a0
jmp 0xc199
xorl %edi, %edi
leaq 0xa398(%rip), %rsi      # 0x1652a
movb $0x0, %al
callq 0x123f0
movb $0x0, -0x1(%rbp)
jmp 0xc1ab
movl -0x8(%rbp), %edi
callq 0x2210
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
movl -0x8(%rbp), %edi
movl $0x400454cb, %esi       # imm = 0x400454CB
xorl %edx, %edx
movb $0x0, %al
callq 0x21f0
cmpl $0x0, %eax
jge 0xc206
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0xa37c(%rip), %rsi      # 0x16575
movb $0x0, %al
callq 0x123f0
movb $-0x1, -0x1(%rbp)
jmp 0xc212
movl -0x8(%rbp), %edi
callq 0x2210
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x21e0
leaq -0x28(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x21e0
movl -0xc(%rbp), %eax
movl %eax, -0x24(%rbp)
movw $0x2, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0xf, %edx
callq 0x2090
movl -0x8(%rbp), %edi
movl $0x8916, %esi           # imm = 0x8916
leaq -0x50(%rbp), %rdx
movb $0x0, %al
callq 0x21f0
cmpl $0x0, %eax
jge 0xc73d
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0xa0ac(%rip), %rsi      # 0x167dc
movb $0x0, %al
callq 0x123f0
movb $-0x1, -0x1(%rbp)
jmp 0xc741
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl $0x3a, %esi
callq 0x2190
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0xc787
movq -0x88(%rbp), %rax
movb $0x0, (%rax)
leaq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0xa14e(%rip), %rsi      # 0x168e4
movb $0x0, %al
callq 0x2460
leaq -0x80(%rbp), %rdi
movl -0x4(%rbp), %esi
callq 0xc7d0
cmpq $0x0, -0x88(%rbp)
je 0xc7bd
movq -0x88(%rbp), %rax
movb $0x3a, (%rax)
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/linux/kernel.c
// Function: set_integer_file
static void set_integer_file(const char* filename, int32_t integer)
{
	FILE *f;

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

	fprintf(f, "%"PRId32, integer);
	fclose(f);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x83a6(%rip), %rsi      # 0x14b90
callq 0x2400
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0xc7fb
jmp 0xc819
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq 0x9d95(%rip), %rsi      # 0x1659e
movb $0x0, %al
callq 0x22a0
movq -0x18(%rbp), %rdi
callq 0x2120
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movl $0x3a, %esi
callq 0x2190
movq %rax, -0x78(%rbp)
cmpq $0x0, %rax
je 0xc855
movq -0x78(%rbp), %rax
movb $0x0, (%rax)
leaq -0x70(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0xa080(%rip), %rsi      # 0x168e4
movb $0x0, %al
callq 0x2460
leaq -0x70(%rbp), %rdi
callq 0xc8a0
movl %eax, -0xc(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0xc885
movq -0x78(%rbp), %rax
movb $0x3a, (%rax)
movl -0xc(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xa049(%rip), %rsi      # 0x16907
callq 0x2400
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0xc8d6
movl $0x0, -0x4(%rbp)
jmp 0xc911
movq -0x18(%rbp), %rdi
leaq 0x9cbd(%rip), %rsi      # 0x1659e
leaq -0x1c(%rbp), %rdx
movb $0x0, %al
callq 0x20c0
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2120
cmpl $0x0, -0x20(%rbp)
je 0xc904
cmpl $-0x1, -0x20(%rbp)
jne 0xc90b
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl $0x3a, %esi
callq 0x2190
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0xc957
movq -0x88(%rbp), %rax
movb $0x0, (%rax)
leaq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x9fa3(%rip), %rsi      # 0x16909
movb $0x0, %al
callq 0x2460
leaq -0x80(%rbp), %rdi
movl -0x4(%rbp), %esi
callq 0xc7d0
cmpq $0x0, -0x88(%rbp)
je 0xc98d
movq -0x88(%rbp), %rax
movb $0x3a, (%rax)
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movl $0x3a, %esi
callq 0x2190
movq %rax, -0x78(%rbp)
cmpq $0x0, %rax
je 0xc9d5
movq -0x78(%rbp), %rax
movb $0x0, (%rax)
leaq -0x70(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x9f25(%rip), %rsi      # 0x16909
movb $0x0, %al
callq 0x2460
leaq -0x70(%rbp), %rdi
callq 0xc8a0
movl %eax, -0xc(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0xca05
movq -0x78(%rbp), %rax
movb $0x3a, (%rax)
movl -0xc(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl $0x3a, %esi
callq 0x2190
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0xca8e
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
movl -0x8(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2130
movl -0x24(%rbp), %edi
movq -0x20(%rbp), %rcx
addq $0x1, %rax
movl %eax, %r8d
movl $0x1, %esi
movl $0x19, %edx
callq 0x20d0
cmpl $0x0, %eax
jge 0xcadb
cmpq $0x0, -0x18(%rbp)
je 0xcad5
movq -0x18(%rbp), %rax
movb $0x3a, (%rax)
movb $-0x1, -0x1(%rbp)
jmp 0xcaed
cmpq $0x0, -0x18(%rbp)
je 0xcae9
movq -0x18(%rbp), %rax
movb $0x3a, (%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x21e0
leaq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0xf, %edx
callq 0x2090
leaq -0x40(%rbp), %rdi
movl $0x3a, %esi
callq 0x2190
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0xcb50
movq -0x48(%rbp), %rax
movb $0x0, (%rax)
movl -0x14(%rbp), %edi
movl $0x8b01, %esi           # imm = 0x8B01
leaq -0x40(%rbp), %rdx
movb $0x0, %al
callq 0x21f0
cmpl $0x0, %eax
jl 0xcb71
movl $0x1, -0x4(%rbp)
jmp 0xcb78
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2130
cmpq $0xf, %rax
jbe 0xe6c4
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x8994(%rip), %rdi      # 0x17042
movb $0x0, %al
callq 0x21a0
callq 0xffb0
movl $0x1, %edi
callq 0x2470
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xeab0
cmpl $0x0, %eax
je 0xe6df
movq -0x8(%rbp), %rdi
callq 0xeb70
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0xccb1(%rip), %rax      # 0x1b3b0
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movl $0x10d2, %edi           # imm = 0x10D2
callq 0x2170
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x32(%rax)
movl $0x2, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x2500
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jge 0xe76a
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0x8913(%rip), %rsi      # 0x17067
movb $0x0, %al
callq 0x123f0
callq 0xffb0
movl $0x1, %edi
callq 0x2470
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
movq -0x10(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rsi
movl $0x10, %edx
callq 0x23a0
cmpl $0x0, %eax
jge 0xe7be
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0x88e7(%rip), %rsi      # 0x1708f
movb $0x0, %al
callq 0x123f0
callq 0xffb0
movl $0x1, %edi
callq 0x2470
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
movl $0x3, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0x20e0
movl %eax, -0x4(%rbp)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
movl -0x4(%rbp), %edx
orl $0x800, %edx            # imm = 0x800
movl $0x4, %esi
movb $0x0, %al
callq 0x20e0
movl $0x10d1, %edi           # imm = 0x10D1
callq 0x2170
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x32(%rax)
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
movq -0x10(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq 0x2be2(%rip), %rdx      # 0x11400
callq 0x23b0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)