LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/open-mesh-mirror[P]batmand/bitarray.c
// Function: bit_get_packet
char bit_get_packet( TYPE_OF_WORD *seq_bits, int16_t seq_num_diff, int8_t set_mark ) {

	int i;

	/* we already got a sequence number higher than this one, so we just mark it. this should wrap around the integer just fine */
	if ((seq_num_diff < 0) && (seq_num_diff >= -local_win_size)) {

		if ( set_mark )
			bit_mark( seq_bits, -seq_num_diff );

		return 0;

	}

	if ((seq_num_diff > local_win_size) || (seq_num_diff < -local_win_size)) {        /* it seems we missed a lot of packets or the other host restarted */

		if (seq_num_diff > local_win_size)
			debug_output(4, "It seems we missed a lot of packets (%i) !\n",  seq_num_diff-1);

		if (-seq_num_diff > local_win_size)
			debug_output(4, "Other host probably restarted !\n");

		for (i=0; i<num_words; i++)
			seq_bits[i]= 0;

		if ( set_mark )
			seq_bits[0] = 1;  /* we only have the latest packet */

	} else {

		bit_shift(seq_bits, seq_num_diff);

		if ( set_mark )
			bit_mark(seq_bits, 0);

	}

	return 1;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rdi, %rbx
movswl %si, %r14d
testw %r14w, %r14w
setns %dl
leaq 0x10d4c(%rip), %r15     # 0x17297
movzbl (%r15), %eax
movl %eax, %ecx
negl %ecx
cmpl %ecx, %r14d
setl %sil
orb %dl, %sil
je 0x65e6
cmpl %r14d, %eax
setl %dl
cmpl %r14d, %ecx
setg %cl
orb %dl, %cl
cmpb $0x1, %cl
jne 0x6613
cmpl %r14d, %eax
jge 0x659a
leal -0x1(%r14), %edx
leaq 0xa531(%rip), %rsi      # 0x10abb
movl $0x4, %edi
xorl %eax, %eax
callq 0xd88c
movzbl (%r15), %eax
negl %r14d
cmpl %r14d, %eax
jge 0x65b5
leaq 0xa53e(%rip), %rsi      # 0x10ae7
movl $0x4, %edi
xorl %eax, %eax
callq 0xd88c
leaq 0x10cdc(%rip), %rax     # 0x17298
cmpb $0x0, (%rax)
je 0x65d6
xorl %ecx, %ecx
movq $0x0, (%rbx,%rcx,8)
incq %rcx
movzbl (%rax), %edx
cmpq %rdx, %rcx
jb 0x65c3
movb $0x1, %al
testb %bpl, %bpl
je 0x6608
movq $0x1, (%rbx)
jmp 0x6608
testb %bpl, %bpl
je 0x6606
negl %r14d
cmpl %r14d, %eax
jbe 0x6606
movl $0x1, %eax
movl %r14d, %ecx
shlq %cl, %rax
shrl $0x6, %r14d
orq %rax, (%rbx,%r14,8)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movl %r14d, %esi
callq 0x6494
movb $0x1, %al
testb %bpl, %bpl
je 0x6608
cmpb $0x0, (%r15)
je 0x6608
orb $0x1, (%rbx)
jmp 0x6608
// File: /workspace/github_c_makefile_star2_O3/open-mesh-mirror[P]batmand/hash.c
// Function: hash_init
void hash_init(struct hashtable_t *hash)
{
	int i;

	hash->elements = 0;

	for (i = 0; i < hash->size; i++)
		hash->table[i] = NULL;
}

// Assembly:
movl $0x0, 0x8(%rdi)
movslq 0xc(%rdi), %rax
testq %rax, %rax
jle 0x669d
xorl %ecx, %ecx
movq (%rdi), %rdx
movq $0x0, (%rdx,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x668a
retq
// File: /workspace/github_c_makefile_star2_O3/open-mesh-mirror[P]batmand/hash.c
// Function: hash_delete
void hash_delete(struct hashtable_t *hash, hashdata_free_cb free_cb)
{
	struct element_t *bucket, *last_bucket;
	int i;

	for (i = 0; i < hash->size; i++) {

		bucket = hash->table[i];
		while (bucket != NULL) {

			if (free_cb != NULL)
				free_cb(bucket->data);

			last_bucket = bucket;
			bucket = bucket->next;
			debugFree(last_bucket, 1301);

		}

	}

	hash_destroy(hash);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl 0xc(%rdi), %eax
testl %eax, %eax
jle 0x66f5
movq %rsi, %r14
xorl %r12d, %r12d
movq (%rbx), %rcx
movq (%rcx,%r12,8), %r15
testq %r15, %r15
je 0x66ea
testq %r14, %r14
je 0x66ce
movq (%r15), %rdi
callq *%r14
movq 0x8(%r15), %r13
movq %r15, %rdi
movl $0x515, %esi            # imm = 0x515
callq 0x628b
movq %r13, %r15
testq %r13, %r13
jne 0x66c3
movl 0xc(%rbx), %eax
incq %r12
movslq %eax, %rcx
cmpq %rcx, %r12
jl 0x66b7
movq (%rbx), %rdi
movl $0x516, %esi            # imm = 0x516
callq 0x628b
movq %rbx, %rdi
movl $0x517, %esi            # imm = 0x517
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x628b
// File: /workspace/github_c_makefile_star2_O3/open-mesh-mirror[P]batmand/hash.c
// Function: hash_new
struct hashtable_t *hash_new(int size, hashdata_compare_cb compare,
			     hashdata_choose_cb choose)
{
	struct hashtable_t *hash;

	hash = debugMalloc(sizeof(struct hashtable_t), 302);
	if (!hash)
		return NULL;

	hash->size = size;
	hash->table = debugMalloc(sizeof(struct element_t *)*size, 303);

	if (!hash->table) {
		debugFree(hash, 1305);
		return NULL;
	}

	hash_init(hash);
	hash->compare = compare;
	hash->choose = choose;
	return hash;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
movl $0x20, %edi
movl $0x12e, %esi            # imm = 0x12E
callq 0x5d52
testq %rax, %rax
je 0x68e0
movq %rax, %rbx
movl %ebp, 0xc(%rax)
shll $0x3, %ebp
movl %ebp, %edi
movl $0x12f, %esi            # imm = 0x12F
callq 0x5d52
movq %rax, (%rbx)
testq %rax, %rax
je 0x68d3
movl $0x0, 0x8(%rbx)
movslq 0xc(%rbx), %rax
testq %rax, %rax
jle 0x68c9
xorl %ecx, %ecx
movq (%rbx), %rdx
movq $0x0, (%rdx,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x68b6
movq %r15, 0x10(%rbx)
movq %r14, 0x18(%rbx)
jmp 0x68e2
movq %rbx, %rdi
movl $0x519, %esi            # imm = 0x519
callq 0x628b
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/open-mesh-mirror[P]batmand/hash.c
// Function: hash_add
int hash_add(struct hashtable_t *hash, void *data)
{
	int ret;
	struct element_t *bucket;

	/* found the tail of the list, add new element */
	bucket = debugMalloc(sizeof(struct element_t), 304);

	if (!bucket)
		return -1;

	ret = hash_add_bucket(hash, data, bucket, 1);
	if (ret < 0)
		debugFree(bucket, 1307);

	return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x10, %edi
movl $0x130, %esi            # imm = 0x130
callq 0x5d52
movq %rax, %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rbx, %rbx
je 0x6944
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movl $0x1, %ecx
callq 0x694a
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jns 0x6944
movq %rbx, %rdi
movl $0x51b, %esi            # imm = 0x51B
callq 0x628b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/open-mesh-mirror[P]batmand/hash.c
// Function: hash_add_bucket
static int hash_add_bucket(struct hashtable_t *hash, void *data,
			   struct element_t *bucket, int check_duplicate)
{
	int index;
	struct element_t *bucket_it, *prev_bucket = NULL;

	index = hash->choose(data, hash->size);
	bucket_it = hash->table[index];

	while (bucket_it != NULL) {
		if (check_duplicate &&
		    hash->compare(bucket_it->data, data))
			return -1;

		prev_bucket = bucket_it;
		bucket_it = bucket_it->next;
	}

	/* init the new bucket */
	bucket->data = data;
	bucket->next = NULL;

	/* and link it */
	if (prev_bucket == NULL)
		hash->table[index] = bucket;
	else
		prev_bucket->next = bucket;

	hash->elements++;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movl 0xc(%rdi), %esi
movq %r15, %rdi
callq *0x18(%r14)
movq (%r14), %rcx
movslq %eax, %r12
movq (%rcx,%r12,8), %rax
testq %rax, %rax
je 0x69a7
movq %rax, %r12
testl %ebp, %ebp
je 0x698c
movq (%r12), %rdi
movq %r15, %rsi
callq *0x10(%r14)
testl %eax, %eax
jne 0x69c5
movq 0x8(%r12), %rax
testq %rax, %rax
jne 0x6976
movq %r15, (%rbx)
movq $0x0, 0x8(%rbx)
addq $0x8, %r12
jmp 0x69b9
movq %r15, (%rbx)
movq $0x0, 0x8(%rbx)
shlq $0x3, %r12
addq (%r14), %r12
movq %rbx, (%r12)
incl 0x8(%r14)
xorl %eax, %eax
jmp 0x69ca
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/open-mesh-mirror[P]batmand/hash.c
// Function: hash_find
void *hash_find(struct hashtable_t *hash, void *keydata)
{
	int index;
	struct element_t *bucket;

	index = hash->choose(keydata , hash->size);
	bucket = hash->table[index];

	while (bucket != NULL) {
		if (hash->compare(bucket->data, keydata))
			return bucket->data;

		bucket = bucket->next;
	}

	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0xc(%rdi), %esi
movq %rbx, %rdi
callq *0x18(%r14)
movq (%r14), %rcx
cltq
movq (%rcx,%rax,8), %r12
xorl %r15d, %r15d
testq %r12, %r12
je 0x6a16
movq (%r12), %rdi
movq %rbx, %rsi
callq *0x10(%r14)
testl %eax, %eax
jne 0x6a12
movq 0x8(%r12), %r12
jmp 0x69f7
movq (%r12), %r15
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/open-mesh-mirror[P]batmand/hash.c
// Function: hash_remove_bucket
void *hash_remove_bucket(struct hashtable_t *hash, struct hash_it_t *hash_it_t)
{
	void *data_save;

	/* save the pointer to the data */
	data_save = hash_it_t->bucket->data;

	if (hash_it_t->prev_bucket != NULL)
		hash_it_t->prev_bucket->next = hash_it_t->bucket->next;
	else if (hash_it_t->first_bucket != NULL)
		(*hash_it_t->first_bucket) = hash_it_t->bucket->next;

	debugFree(hash_it_t->bucket, 1306);

	hash->elements--;
	return data_save;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rsi), %rdi
movq 0x10(%rsi), %rax
movq (%rdi), %r14
testq %rax, %rax
je 0x6a46
movq 0x8(%rdi), %rcx
movq %rcx, 0x8(%rax)
jmp 0x6a5a
movq 0x18(%rsi), %rax
testq %rax, %rax
je 0x6a5a
movq 0x8(%rdi), %rcx
movq %rcx, (%rax)
movq 0x8(%rsi), %rdi
movl $0x51a, %esi            # imm = 0x51A
callq 0x628b
decl 0x8(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl 0xc(%rdi), %esi
movq %r14, %rdi
callq *0x18(%rbx)
movl %eax, 0x8(%rsp)
movq (%rbx), %rcx
movslq %eax, %r12
movq (%rcx,%r12,8), %r13
testq %r13, %r13
je 0x6ab4
movq (%r13), %rdi
movq %r14, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x6ab9
xorl %ecx, %ecx
jmp 0x6adc
xorl %r15d, %r15d
jmp 0x6b08
xorl %r15d, %r15d
movq %r13, %rbp
movq 0x8(%rbp), %r13
testq %r13, %r13
je 0x6b08
movq (%r13), %rdi
movq %r14, %rsi
callq *0x10(%rbx)
movq %rbp, %rcx
movq %r13, %rbp
testl %eax, %eax
je 0x6abf
leaq 0x8(%rsp), %rsi
movq %rcx, 0x10(%rsi)
movq %r13, 0x8(%rsi)
movq (%rbx), %rax
leaq (%rax,%r12,8), %rax
xorl %ecx, %ecx
cmpq (%rax), %r13
cmoveq %rax, %rcx
movq %rcx, 0x18(%rsi)
movq %rbx, %rdi
callq 0x6a25
movq %rax, %r15
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
movl %esi, %eax
movq %rdi, %rbx
movq 0x10(%rdi), %rsi
movq 0x18(%rdi), %rdx
movl %eax, %edi
callq 0x6864
movq %rax, %r14
testq %rax, %rax
je 0x6b90
movl 0xc(%rbx), %ecx
testl %ecx, %ecx
jle 0x6b86
movq (%rbx), %rax
xorl %r15d, %r15d
movq (%rax,%r15,8), %rdx
testq %rdx, %rdx
je 0x6b7b
leaq (%rax,%r15,8), %rcx
movq 0x8(%rdx), %rax
movq %rax, (%rcx)
movq (%rdx), %rsi
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x694a
movq (%rbx), %rax
leaq (%rax,%r15,8), %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
jne 0x6b55
movl 0xc(%rbx), %ecx
incq %r15
movslq %ecx, %rdx
cmpq %rdx, %r15
jl 0x6b48
movq %rbx, %rdi
xorl %esi, %esi
callq 0x669e
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
leaq 0x9efb(%rip), %rsi      # 0x10b0c
movl $0x5, %edi
xorl %eax, %eax
callq 0xd88c
movl $0x18, %r14d
leaq 0x108d6(%rip), %r15     # 0x17500
leaq 0x9eec(%rip), %rbx      # 0x10b1d
xorps %xmm0, %xmm0
cvtsi2ssq -0x10(%r14,%r15), %xmm0
divss 0x9ec5(%rip), %xmm0     # 0x10b08
movq (%r14,%r15), %rcx
movq %rcx, %rdx
shrq %rdx
movl %ecx, %eax
andl $0x1, %eax
orq %rdx, %rax
testq %rcx, %rcx
js 0x6c64
xorps %xmm2, %xmm2
cvtsi2ss %rcx, %xmm2
jmp 0x6c70
xorps %xmm2, %xmm2
cvtsi2ss %rax, %xmm2
addss %xmm2, %xmm2
xorps %xmm1, %xmm1
je 0x6c80
movaps %xmm0, %xmm1
divss %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
cvtss2sd %xmm0, %xmm0
movq -0x8(%r14,%r15), %rdx
movl $0x5, %edi
movq %rbx, %rsi
movb $0x2, %al
callq 0xd88c
addq $0x20, %r14
cmpq $0x138, %r14            # imm = 0x138
jne 0x6c31
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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 %rax
leaq 0x10920(%rip), %rax     # 0x17630
movq %rax, 0x10919(%rip)     # 0x17630
movq %rax, 0x1091a(%rip)     # 0x17638
leaq 0x1091b(%rip), %rax     # 0x17640
movq %rax, 0x10914(%rip)     # 0x17640
movq %rax, 0x10915(%rip)     # 0x17648
leaq 0x10916(%rip), %rdi     # 0x17650
xorl %esi, %esi
callq 0x24a0
leaq 0x35(%rip), %rsi        # 0x6d7d
leaq 0x43(%rip), %rdx        # 0x6d92
movl $0x80, %edi
callq 0x6864
movq %rax, 0x10918(%rip)     # 0x17678
testq %rax, %rax
je 0x6d67
popq %rax
retq
leaq 0xa08a(%rip), %rdi      # 0x10df8
callq 0x20c0
movl $0x1, %edi
callq 0x2440
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r14d
movl %edi, %r15d
movl $0x10, %edi
movl $0x2bd, %esi            # imm = 0x2BD
callq 0x5d52
movq %rax, %rbx
movq $0x0, 0x8(%rax)
movq %rax, (%rax)
movl %r15d, 0x8(%rax)
movb %r14b, 0xc(%rax)
movb %bpl, 0xd(%rax)
leaq 0x10841(%rip), %rdi     # 0x17650
callq 0x24c0
testl %eax, %eax
je 0x6e3e
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x9d3a(%rip), %rsi      # 0x10b65
leaq 0x9d6b(%rip), %rdx      # 0x10b9d
xorl %edi, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0xd88c
leaq 0x107fb(%rip), %rsi     # 0x17640
movq %rbx, %rdi
callq 0x5bcd
leaq 0x107fc(%rip), %rdi     # 0x17650
callq 0x22d0
testl %eax, %eax
je 0x6e8d
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x9d43(%rip), %rsi      # 0x10bb3
leaq 0x9d26(%rip), %rdx      # 0x10b9d
xorl %edi, %edi
movq %rax, %rcx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xd88c
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/open-mesh-mirror[P]batmand/hna.c
// Function: hna_local_task_add_str
void hna_local_task_add_str(char *hna_string, uint8_t route_action, uint8_t runtime)
{
	struct in_addr tmp_ip_holder;
	uint16_t netmask;
	char *slash_ptr;

	if ((slash_ptr = strchr(hna_string, '/')) == NULL) {

		if (runtime) {
			debug_output(3, "Invalid announced network (netmask is missing): %s\n", hna_string);
			return;
		}

		printf("Invalid announced network (netmask is missing): %s\n", hna_string);
		exit(EXIT_FAILURE);
	}

	*slash_ptr = '\0';

	if (inet_pton(AF_INET, hna_string, &tmp_ip_holder) < 1) {

		*slash_ptr = '/';

		if (runtime) {
			debug_output(3, "Invalid announced network (IP is invalid): %s\n", hna_string);
			return;
		}

		printf("Invalid announced network (IP is invalid): %s\n", hna_string);
		exit(EXIT_FAILURE);
	}

	errno = 0;
	netmask = strtol(slash_ptr + 1, NULL, 10);

	if ((errno == ERANGE) || (errno != 0 && netmask == 0)) {

		*slash_ptr = '/';

		if (runtime)
			return;

		perror("strtol");
		exit(EXIT_FAILURE);
	}

	if (netmask < 1 || netmask > 32) {

		*slash_ptr = '/';

		if (runtime) {
			debug_output(3, "Invalid announced network (netmask is invalid): %s\n", hna_string);
			return;
		}

		printf("Invalid announced network (netmask is invalid): %s\n", hna_string);
		exit(EXIT_FAILURE);
	}

	*slash_ptr = '/';

	tmp_ip_holder.s_addr = (tmp_ip_holder.s_addr & htonl(0xFFFFFFFF << (32 - netmask)));
	hna_local_task_add_ip(tmp_ip_holder.s_addr, netmask, route_action);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
movl $0x2f, %esi
callq 0x2180
testq %rax, %rax
je 0x6f19
movq %rax, %r15
movb $0x0, (%rax)
leaq 0xc(%rsp), %rdx
movl $0x2, %edi
movq %rbx, %rsi
callq 0x22a0
testl %eax, %eax
jle 0x6f44
callq 0x2070
movq %rax, %r12
movl $0x0, (%rax)
movq %r15, %rdi
incq %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x2280
movl (%r12), %edx
cmpl $0x22, %edx
je 0x6f0b
movzwl %ax, %ecx
testl %edx, %edx
je 0x6f70
testl %ecx, %ecx
jne 0x6f70
movb $0x2f, (%r15)
testb %r14b, %r14b
jne 0x6f63
callq 0x2aa2
testb %r14b, %r14b
je 0x6fab
leaq 0x9cc4(%rip), %rsi      # 0x10bed
movl $0x3, %edi
movq %rbx, %rdx
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xd88c
movb $0x2f, (%r15)
testb %r14b, %r14b
je 0x6fb4
leaq 0x9ccd(%rip), %rsi      # 0x10c21
movl $0x3, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xd88c
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leal -0x21(%rcx), %edx
movb $0x2f, (%r15)
cmpl $-0x21, %edx
ja 0x6f8a
testb %r14b, %r14b
je 0x6fcf
leaq 0x9ccf(%rip), %rsi      # 0x10c57
jmp 0x6f54
negb %cl
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
shll %cl, %edi
bswapl %edi
andl 0xc(%rsp), %edi
movl %edi, 0xc(%rsp)
movzwl %ax, %esi
movzbl %bpl, %edx
callq 0x6dd0
jmp 0x6f63
leaq 0x9c3b(%rip), %rdi      # 0x10bed
jmp 0x6fbb
leaq 0x9c66(%rip), %rdi      # 0x10c21
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2190
movl $0x1, %edi
callq 0x2440
leaq 0x9c81(%rip), %rdi      # 0x10c57
jmp 0x6fbb
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x1, %r12d
leaq 0x9ae9(%rip), %r15      # 0x10d62
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r15, %r9
pushq %rbx
pushq %r12
pushq $0x41
callq 0x7cd4
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 0x7cd4
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 0x7cd4
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 0x7cd4
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 0x9160
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rax
cmpb $0x0, 0x102fe(%rip)     # 0x17628
sete %cl
leaq 0x102fc(%rip), %r14     # 0x17630
movq (%r14), %r15
cmpq %r14, %r15
sete %dl
orb %cl, %dl
jne 0x737d
movq %rsi, %rbx
movzwl (%rbx), %ecx
addl $0x6, %ecx
movw %cx, (%rbx)
movzwl %cx, %esi
movq %rax, %rdi
movl $0x6b, %edx
callq 0x61a0
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)
movq (%r15), %r15
cmpq %r14, %r15
jne 0x7344
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 $0x18, %rsp
movl %edx, %ebp
movq %rdi, %rbx
testq %rsi, %rsi
setne %al
testw %bp, %bp
setne %cl
testb %cl, %al
jne 0x73b9
movq $0x0, 0x38(%rbx)
movw $0x0, 0x40(%rbx)
jmp 0x7494
movq %rsi, %r14
movswl %bp, %edi
movl $0x2c1, %esi            # imm = 0x2C1
callq 0x5d52
movq %rax, 0x38(%rbx)
movw %bp, 0x40(%rbx)
movswq %bp, %rdx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2290
movswq 0x40(%rbx), %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
mulq %rcx
movq %rdx, %r14
shrq $0x2, %r14
movq 0x38(%rbx), %r15
cmpl $0x2, %r14d
leaq 0xbd8a(%rip), %rax      # 0x13192
leaq 0x7fbf(%rip), %rcx      # 0xf3ce
cmovgeq %rax, %rcx
leaq 0x9950(%rip), %rsi      # 0x10d6a
movl $0x4, %edi
movl %r14d, %edx
xorl %eax, %eax
callq 0xd88c
testl %r14d, %r14d
jle 0x7494
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movq %rsp, %r12
leaq 0x995a(%rip), %r13      # 0x10d99
leaq 0x995f(%rip), %rbp      # 0x10da5
movl (%r15), %edi
movq %r12, %rsi
movl $0x10, %edx
callq 0xbbac
movzbl 0x4(%r15), %ecx
leal -0x1(%rcx), %eax
cmpb $0x20, %al
movq %rbp, %rsi
cmovbq %r13, %rsi
movl $0x4, %edi
movq %r12, %rdx
xorl %eax, %eax
callq 0xd88c
movb 0x4(%r15), %al
decb %al
cmpb $0x1f, %al
ja 0x748b
movq %rbx, %rdi
movq %r15, %rsi
callq 0x74a3
addq $0x5, %r15
decq %r14
jne 0x7446
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x7977
movq %rdi, %rbx
movswq 0x40(%rdi), %rax
testq %rax, %rax
je 0x7977
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
mulq %rcx
movq %rdx, %r15
shrq $0x2, %r15
testl %r15d, %r15d
jle 0x795c
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movb 0x4(%r14), %al
decb %al
cmpb $0x1f, %al
ja 0x794f
movq %rbx, %rdi
movq %r14, %rsi
callq 0x797d
addq $0x5, %r14
decq %r15
jne 0x793a
movq 0x38(%rbx), %r14
movq %r14, %rdi
movl $0x6ad, %esi            # imm = 0x6AD
callq 0x628b
movq $0x0, 0x38(%rbx)
movw $0x0, 0x40(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
movq 0xfa2f(%rip), %rbx      # 0x17630
leaq 0xfa28(%rip), %r14      # 0x17630
cmpq %r14, %rbx
je 0x7c32
movq (%rbx), %r15
movq %rbx, %rdi
movl $0x1, %esi
callq 0x7253
movq %rbx, %rdi
movl $0x6a9, %esi            # imm = 0x6A9
callq 0x628b
movq %r15, %rbx
cmpq %r14, %r15
jne 0x7c0d
movq 0xf9e7(%rip), %rdi      # 0x17620
testq %rdi, %rdi
je 0x7c48
movl $0x6aa, %esi            # imm = 0x6AA
callq 0x628b
movb $0x0, 0xf9d9(%rip)      # 0x17628
movq $0x0, 0xf9c6(%rip) # 0x17620
movq 0xfa17(%rip), %rdi      # 0x17678
testq %rdi, %rdi
je 0x7c77
leaq 0x10(%rip), %rsi        # 0x7c7d
popq %rbx
popq %r14
popq %r15
jmp 0x669e
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x7cbb
movq (%r15), %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x5be3
movq %r15, %rdi
movl $0x6ae, %esi            # imm = 0x6AE
callq 0x628b
movq %r12, %r15
cmpq %r14, %r12
jne 0x7c95
movq %rbx, %rdi
movl $0x6af, %esi            # imm = 0x6AF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x628b
nop
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2210
testl %eax, %eax
js 0x900c
leaq 0x10(%rsp), %rdi
xorl %ebp, %ebp
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x21c0
movl $0x2, %edi
callq 0x21b0
movl %eax, %r14d
movl 0xc(%rsp), %edi
movl $0x2, %esi
callq 0x2170
movl 0xc(%rsp), %edi
callq 0x21f0
movq %rbx, %rdi
callq 0x2160
movl %eax, %r15d
movl %r14d, %edi
movl $0x2, %esi
callq 0x2170
movl %r14d, %edi
callq 0x21f0
testl $0x8000ff00, %r15d      # imm = 0x8000FF00
je 0x9001
movl 0x8(%rsp), %edi
leaq 0x10(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x2230
movq %rax, %r14
leaq 0x88d2(%rip), %rsi      # 0x118a2
movl $0x3, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xd88c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %r14d, %r14d
jle 0x9001
leaq 0x88dc(%rip), %rsi      # 0x118cc
leaq 0x10(%rsp), %rdx
movl $0x3, %edi
xorl %eax, %eax
callq 0xd88c
movl 0x8(%rsp), %edi
callq 0x21f0
jmp 0x9036
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x8854(%rip), %rsi      # 0x11873
movl $0x3, %edi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xd88c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8401(%rip), %rsi      # 0x1145b
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2430
movq %r14, %rdi
xorl %esi, %esi
callq 0x909d
leaq 0x8413(%rip), %rsi      # 0x1148e
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2430
movq %r14, %rdi
xorl %esi, %esi
callq 0x909d
addq $0x98, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
leaq 0xe263(%rip), %rax      # 0x17308
cmpb $0x0, (%rax)
je 0x90ac
popq %rbx
retq
movq %rdi, %rbx
leaq 0xe1e6(%rip), %rax      # 0x1729c
cmpl $-0x1, (%rax)
je 0x90c4
movq %rbx, %rdi
popq %rbx
jmp 0x8f31
testb %sil, %sil
leaq 0x6300(%rip), %rax      # 0xf3ce
leaq 0x6af1(%rip), %rdx      # 0xfbc6
cmoveq %rax, %rdx
leaq 0x87fa(%rip), %rsi      # 0x118da
movl $0x3, %edi
xorl %eax, %eax
callq 0xd88c
leaq 0x8827(%rip), %rsi      # 0x1191a
movl $0x3, %edi
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
jmp 0xd88c
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
leaq 0x83dc(%rip), %rsi      # 0x114f3
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2430
movq %r14, %rdi
movl $0x1, %esi
callq 0x909d
leaq 0x8353(%rip), %rsi      # 0x1148e
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2430
movq %r14, %rdi
movl $0x1, %esi
callq 0x909d
addq $0x98, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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)
leaq 0x10(%rsp), %r14
movl $0x2, %edi
movq %r14, %rdx
movl $0x10, %ecx
callq 0x2030
cmpb $0x1, %bl
leaq 0x838d(%rip), %rax      # 0x11526
leaq 0x83b8(%rip), %rsi      # 0x11558
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 0x909d
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x83b0(%rip), %rdi      # 0x1158a
movl $0x2, %esi
xorl %eax, %eax
callq 0x23a0
testl %eax, %eax
js 0x91f5
movl %eax, %edi
callq 0x21f0
movb $0x1, %bl
jmp 0x920b
testb %bl, %bl
jne 0x920f
leaq 0x8397(%rip), %rsi      # 0x11597
xorl %ebx, %ebx
xorl %edi, %edi
xorl %eax, %eax
callq 0xd88c
movl %ebx, %eax
popq %rbx
retq
callq 0x2ab7
xorl %ebx, %ebx
jmp 0x920b
// File: /workspace/github_c_makefile_star2_O3/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 0x9238
movl %ebx, %edi
callq 0x21f0
movb $0x1, %al
jmp 0x9259
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x8397(%rip), %rsi      # 0x115e2
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0xd88c
movb $-0x1, %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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
movq %rdx, %rax
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)
movl $0xf, %edx
movq %r14, %rdi
movq %rax, %rsi
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 0x95fc
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x8254(%rip), %rsi      # 0x11842
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0xd88c
movb $-0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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
movq %rsi, %rdi
movl $0x3a, %esi
callq 0x2180
testq %rax, %rax
je 0x9653
movq %rax, %r15
movb $0x0, (%rax)
leaq 0x8328(%rip), %rsi      # 0x1195b
movq %rsp, %r12
movq %r12, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2430
movq %r12, %rdi
movl %ebx, %esi
callq 0x9680
movb $0x3a, (%r15)
jmp 0x9674
leaq 0x8301(%rip), %rsi      # 0x1195b
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2430
movq %r15, %rdi
movl %ebx, %esi
callq 0x9680
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x3a, %esi
callq 0x2180
movq %rax, %rbx
testq %rax, %rax
je 0x96e5
movb $0x0, (%rbx)
leaq 0x826f(%rip), %rsi      # 0x1195b
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2430
movq %r15, %rdi
callq 0x9716
testq %rbx, %rbx
je 0x970c
movb $0x3a, (%rbx)
addq $0x70, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x0, 0xc(%rsp)
leaq 0x8251(%rip), %rsi      # 0x1197e
callq 0x23d0
testq %rax, %rax
je 0x9769
movq %rax, %r14
leaq 0x8287(%rip), %rsi      # 0x119c8
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 0x976b
movl 0xc(%rsp), %ebx
jmp 0x976b
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
movq %rsi, %rdi
movl $0x3a, %esi
callq 0x2180
testq %rax, %rax
je 0x97c5
movq %rax, %r15
movb $0x0, (%rax)
leaq 0x81db(%rip), %rsi      # 0x11980
movq %rsp, %r12
movq %r12, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2430
movq %r12, %rdi
movl %ebx, %esi
callq 0x9680
movb $0x3a, (%r15)
jmp 0x97e6
leaq 0x81b4(%rip), %rsi      # 0x11980
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2430
movq %r15, %rdi
movl %ebx, %esi
callq 0x9680
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x3a, %esi
callq 0x2180
movq %rax, %rbx
testq %rax, %rax
je 0x9813
movb $0x0, (%rbx)
leaq 0x8166(%rip), %rsi      # 0x11980
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2430
movq %r15, %rdi
callq 0x9716
testq %rbx, %rbx
je 0x983a
movb $0x3a, (%rbx)
addq $0x70, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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
movq %rsi, %rdi
movl $0x3a, %esi
callq 0x2180
movq %rax, %rbx
testq %rax, %rax
je 0x987f
movb $0x0, (%rbx)
movq %r14, %rdi
callq 0x2130
leal 0x1(%rax), %r8d
movl %ebp, %edi
movl $0x1, %esi
movl $0x19, %edx
movq %r14, %rcx
callq 0x20d0
testq %rbx, %rbx
je 0x98a7
movb $0x3a, (%rbx)
sarl $0x1f, %eax
orb $0x1, %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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)
movl $0xf, %edx
movq %r14, %rdi
callq 0x2090
movq %r14, %rdi
movl $0x3a, %esi
callq 0x2180
testq %rax, %rax
je 0x98ef
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
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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 0xac8a
movq %r14, %rdi
callq 0xaed3
testl %eax, %eax
je 0xac82
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xaf65
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x737b(%rip), %rdi      # 0x1200c
movq %r14, %rsi
xorl %eax, %eax
callq 0x2190
callq 0xbf24
movl $0x1, %edi
callq 0x2440
// File: /workspace/github_c_makefile_star2_O3/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 0xc65e(%rip), %rax      # 0x17310
movq (%rax), %rbx
movw $0xd210, 0x32(%rbx)     # imm = 0xD210
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x24e0
movl %eax, 0x18(%rbx)
testl %eax, %eax
js 0xad2a
leaq 0x30(%rbx), %rsi
movl %eax, %edi
movl $0x10, %edx
callq 0x2370
testl %eax, %eax
js 0xad3f
movl 0x18(%rbx), %edi
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x20e0
movl 0x18(%rbx), %edi
orl $0x800, %eax            # imm = 0x800
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x20e0
movw $0xd110, 0x32(%rbx)     # imm = 0xD110
leaq 0x28(%rbx), %rdi
leaq 0x2091(%rip), %rdx      # 0xcdb0
xorl %esi, %esi
movq %rbx, %rcx
popq %rbx
jmp 0x2380
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x72f4(%rip), %rsi      # 0x12031
jmp 0xad52
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x7307(%rip), %rsi      # 0x12059
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0xd88c
callq 0xbf24
movl $0x1, %edi
callq 0x2440