LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/zmakebas/zmakebas.c
// Function: grok_hex
unsigned long grok_hex(unsigned char **ptrp,int textlinenum)
{
static char *hexits="0123456789abcdefABCDEF",*lookup;
unsigned char *ptr=*ptrp;
unsigned long v=0,n;

/* we know the number starts with "0x" and we're pointing to it */

ptr+=2;
if(strchr(hexits,*ptr)==NULL)
  {
  fprintf(stderr,"line %d: bad BIN 0x... number\n",textlinenum);
  exit(1);
  }

while(*ptr && (lookup=strchr(hexits,*ptr))!=NULL)
  {
  n=lookup-hexits;
  if(n>15) n-=6;
  v=v*16+n;
  ptr++;
  }

*ptrp=ptr;
return(v);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r15d
movq %rdi, %rbx
movq (%rdi), %r13
movb 0x2(%r13), %bpl
movzbl %bpl, %esi
leaq 0x1dd4(%rip), %r14      # 0x528e
pushq $0x17
popq %rdx
movq %r14, %rdi
callq 0x3120
testq %rax, %rax
je 0x3529
addq $0x2, %r13
xorl %r15d, %r15d
pushq $0x17
popq %r12
testb %bpl, %bpl
je 0x3514
movzbl %bpl, %esi
movq %r14, %rdi
movq %r12, %rdx
callq 0x3120
movq %rax, 0x5228(%rip)      # 0x8718
testq %rax, %rax
je 0x3514
subq %r14, %rax
leaq -0x6(%rax), %rcx
cmpq $0x10, %rax
cmovbq %rax, %rcx
shlq $0x4, %r15
addq %rcx, %r15
movb 0x1(%r13), %bpl
incq %r13
jmp 0x34d5
movq %r13, (%rbx)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4aa8(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
leaq 0x1d6b(%rip), %rsi      # 0x52a5
movl %r15d, %edx
xorl %eax, %eax
callq 0x3180
pushq $0x1
popq %rdi
callq 0x3140
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/zmakebas/zmakebas.c
// Function: grok_binary
unsigned long grok_binary(unsigned char **ptrp,int textlinenum)
{
unsigned long v=0;
unsigned char *ptr=*ptrp;

while(isspace(*ptr)) ptr++;

if(*ptr!='0' && *ptr!='1')
  {
  fprintf(stderr,"line %d: bad BIN number\n",textlinenum);
  exit(1);
  }

if(ptr[1]=='x' || ptr[1]=='X')
  {
  *ptrp=ptr;
  return(grok_hex(ptrp,textlinenum));
  }

while(*ptr=='0' || *ptr=='1')
  {
  v*=2;
  v+=*ptr-'0';
  ptr++;
  }

*ptrp=ptr;
return(v);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %r14
callq 0x3100
movq (%rax), %rax
decq %r14
movzbl 0x1(%r14), %ecx
incq %r14
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x3563
movl %ecx, %eax
andb $-0x2, %al
cmpb $0x30, %al
jne 0x35c0
movzbl 0x1(%r14), %eax
orl $0x20, %eax
cmpl $0x78, %eax
jne 0x3598
movq %r14, (%rbx)
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x3497
xorl %eax, %eax
movl %ecx, %edx
andb $-0x2, %dl
cmpb $0x30, %dl
jne 0x35b8
movzbl %cl, %ecx
leaq (%rcx,%rax,2), %rax
addq $-0x30, %rax
movb 0x1(%r14), %cl
incq %r14
jmp 0x359a
movq %r14, (%rbx)
popq %rbx
popq %r14
popq %rbp
retq
movq 0x4a11(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
leaq 0x1cf3(%rip), %rsi      # 0x52c4
movl %ebp, %edx
xorl %eax, %eax
callq 0x3180
pushq $0x1
popq %rdi
callq 0x3140
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/zmakebas/zmakebas.c
// Function: usage_help
void usage_help()
{
printf("zmakebas - public domain by Russell Marks.\n\n");

printf("usage: zmakebas [-hlr] [-a line] [-i incr] [-n speccy_filename]\n");
printf("                [-o output_file] [-s line] [input_file]\n\n");

printf("        -a      set auto-start line of basic file (default none).\n");
printf("        -h      give this usage help.\n");
printf("        -i      in labels mode, set line number incr. (default 2).\n");
printf("        -l      use labels rather than line numbers.\n");
printf("        -n      set Spectrum filename (to be given in tape header).");
printf("\n        -o      specify output file (default `%s').\n",
						DEFAULT_OUTPUT);
printf("        -r      output raw headerless file (default is .tap file).\n");
printf("        -s      in labels mode, set starting line number ");
printf("(default 10).\n");
}

// Assembly:
pushq %rax
leaq 0x22b2(%rip), %rdi      # 0x589c
callq 0x3190
leaq 0x22d2(%rip), %rdi      # 0x58c8
callq 0x3190
leaq 0x2306(%rip), %rdi      # 0x5908
callq 0x3190
leaq 0x2333(%rip), %rdi      # 0x5941
callq 0x3190
leaq 0x2369(%rip), %rdi      # 0x5983
callq 0x3190
leaq 0x2383(%rip), %rdi      # 0x59a9
callq 0x3190
leaq 0x23ba(%rip), %rdi      # 0x59ec
callq 0x3190
leaq 0x1c9f(%rip), %rdi      # 0x52dd
xorl %eax, %eax
callq 0x3030
leaq 0x1cd5(%rip), %rdi      # 0x5321
leaq 0x1d04(%rip), %rsi      # 0x5357
xorl %eax, %eax
callq 0x3030
leaq 0x23c0(%rip), %rdi      # 0x5a21
callq 0x3190
leaq 0x1cf2(%rip), %rdi      # 0x535f
xorl %eax, %eax
callq 0x3030
leaq 0x23e9(%rip), %rdi      # 0x5a64
popq %rax
jmp 0x3190
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/zmakebas/zmakebas.c
// Function: grok_block
int grok_block(unsigned char *ptr,int textlinenum)
{
static char *lookup[]=
  {
  "  ", " '", "' ", "''", " .", " :", "'.", "':",
  ". ", ".'", ": ", ":'", "..", ".:", ":.", "::",
  NULL
  };
char **lptr;
int f=128,v=-1;
            
for(lptr=lookup;*lptr!=NULL;lptr++,f++)
  {
  if(strncmp(ptr+1,*lptr,2)==0)
    {
    v=f;
    break;
    }
  }

if(v==-1)
  {
  fprintf(stderr,"line %d: invalid block graphics escape\n",textlinenum);
  exit(1);
  }

return(v);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
incq %r14
movl $0x80, %ebp
leaq 0x4417(%rip), %r12      # 0x7d20
pushq $0x2
popq %r15
cmpl $0x90, %ebp
je 0x393b
movq (%r12), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x3090
testl %eax, %eax
je 0x3930
addq $0x8, %r12
incl %ebp
jmp 0x390d
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x4696(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
leaq 0x1c27(%rip), %rsi      # 0x5573
movl %ebx, %edx
xorl %eax, %eax
callq 0x3180
pushq $0x1
popq %rdi
callq 0x3140
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/batman.c
// Function: get_gw_class
unsigned char get_gw_class(int down, int up)
{
	int mdown = 0, tdown, tup, difference = 0x0FFFFFFF;
	unsigned char gw_class = 0, sbit, part;


	/* test all downspeeds */
	for (sbit = 0; sbit < 2; sbit++) {

		for (part = 0; part < 16; part++) {

			tdown = 32 * (sbit + 2) * (1 << part);

			if ( abs(tdown - down) < difference) {

				gw_class = (sbit << 7) + (part << 3);
				difference = abs(tdown - down);
				mdown = tdown;

			}

		}

	}

	/* test all upspeeds */
	difference = 0x0FFFFFFF;

	for (part = 0; part < 8; part++) {

		tup = ((part + 1) * (mdown)) / 8;

		if (abs(tup - up) < difference) {

			gw_class = (gw_class & 0xF8) | part;
			difference = abs(tup - up);

		}

	}

	return gw_class;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movl $0xfffffff, %eax        # imm = 0xFFFFFFF
xorl %edx, %edx
xorl %r10d, %r10d
xorl %r9d, %r9d
xorl %r8d, %r8d
cmpl $0x2, %r10d
je 0x3337
movl %r10d, %r11d
shll $0x5, %r11d
orl $0x40, %r11d
xorl %ecx, %ecx
movl %edx, %ebx
cmpl $0x10, %ecx
je 0x332f
movl %r11d, %ebp
shll %cl, %ebp
movl %ebp, %r14d
subl %edi, %r14d
movl %r14d, %r15d
negl %r15d
cmovsl %r14d, %r15d
cmpl %eax, %r15d
cmovll %ebp, %r9d
cmovll %r15d, %eax
movzbl %bl, %ebx
movzbl %r8b, %r8d
cmovll %ebx, %r8d
incl %ecx
addb $0x8, %bl
jmp 0x32f8
incl %r10d
addb $-0x80, %dl
jmp 0x32e3
movl $0xfffffff, %edi        # imm = 0xFFFFFFF
xorl %r11d, %r11d
movl $0x8, %r10d
movl %r9d, %ecx
cmpl $0x8, %r11d
je 0x337f
movl %ecx, %eax
cltd
idivl %r10d
subl %esi, %eax
movl %eax, %edx
negl %edx
cmovsl %eax, %edx
movzbl %r8b, %eax
movl %eax, %r8d
andl $0xf8, %r8d
addl %r11d, %r8d
incl %r11d
cmpl %edi, %edx
cmovll %edx, %edi
cmovgel %eax, %r8d
addl %r9d, %ecx
jmp 0x3348
movl %r8d, %eax
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/batman.c
// Function: count_real_packets
static uint8_t count_real_packets(struct bat_packet *in, uint32_t neigh, struct batman_if *if_incoming)
{
	struct list_head *list_pos;
	struct orig_node *orig_node;
	struct neigh_node *tmp_neigh_node;
	uint8_t is_duplicate = 0;


	orig_node = get_orig_node( in->orig );

	/*char orig_str[ADDR_STR_LEN], neigh_str[ADDR_STR_LEN];

	addr_to_string( in->orig, orig_str, ADDR_STR_LEN );
	addr_to_string( neigh, neigh_str, ADDR_STR_LEN );

	debug_output( 3, "count_real_packets: orig = %s, neigh = %s, seq = %i, last seq = %i\n", orig_str, neigh_str, in->seqno, orig_node->last_real_seqno );*/

	list_for_each( list_pos, &orig_node->neigh_list ) {

		tmp_neigh_node = list_entry( list_pos, struct neigh_node, list );

		if ( !is_duplicate )
			is_duplicate = get_bit_status( tmp_neigh_node->real_bits, orig_node->last_real_seqno, in->seqno );

		if ( ( tmp_neigh_node->addr == neigh ) && ( tmp_neigh_node->if_incoming == if_incoming ) ) {

			bit_get_packet( tmp_neigh_node->real_bits, in->seqno - orig_node->last_real_seqno, 1 );
			/*debug_output( 3, "count_real_packets (yes): neigh = %s, is_new = %s, seq = %i, last seq = %i\n", neigh_str, ( is_new_seqno ? "YES" : "NO" ), in->seqno, orig_node->last_real_seqno );*/

		} else {

			bit_get_packet( tmp_neigh_node->real_bits, in->seqno - orig_node->last_real_seqno, 0 );
			/*debug_output( 3, "count_real_packets (no): neigh = %s, is_new = %s, seq = %i, last seq = %i\n", neigh_str, ( is_new_seqno ? "YES" : "NO" ), in->seqno, orig_node->last_real_seqno );*/

		}

		tmp_neigh_node->real_packet_count = bit_packet_count( tmp_neigh_node->real_bits );

	}

	if ( !is_duplicate ) {

		debug_output( 4, "updating last_seqno: old %d, new %d \n", orig_node->last_real_seqno, in->seqno );
		orig_node->last_real_seqno = in->seqno;

	}

	return is_duplicate;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, (%rsp)
movl %esi, %r12d
movq %rdi, %rbx
movl 0x8(%rdi), %edi
callq 0x4137
movq %rax, %r14
movq %rax, %r15
addq $0x48, %r15
xorl %ebp, %ebp
movq %r15, %r13
movq (%r13), %r13
cmpq %r15, %r13
je 0x3ff8
testb %bpl, %bpl
jne 0x3fbb
movq 0x20(%r13), %rdi
movzwl 0x42(%r14), %esi
movzwl 0x4(%rbx), %edx
callq 0x5cdc
movl %eax, %ebp
cmpl %r12d, 0x8(%r13)
jne 0x3fcb
movq (%rsp), %rax
cmpq %rax, 0x30(%r13)
je 0x3ff4
xorl %eax, %eax
movq 0x20(%r13), %rdi
movzwl 0x4(%rbx), %ecx
subw 0x42(%r14), %cx
movswl %cx, %esi
movzbl %al, %edx
callq 0x5dc5
movq 0x20(%r13), %rdi
callq 0x5ea9
movb %al, 0xc(%r13)
jmp 0x3f99
movb $0x1, %al
jmp 0x3fcd
testb %bpl, %bpl
jne 0x4020
movzwl 0x42(%r14), %edx
movzwl 0x4(%rbx), %ecx
leaq 0xaf2a(%rip), %rsi      # 0xef37
pushq $0x4
popq %rdi
xorl %eax, %eax
callq 0xcb1c
movzwl 0x4(%rbx), %eax
movw %ax, 0x42(%r14)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/originator.c
// Function: create_neighbor
struct neigh_node * create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node, uint32_t neigh, struct batman_if *if_incoming) {

	struct neigh_node *neigh_node;

	debug_output( 4, "Creating new last-hop neighbour of originator\n" );

	neigh_node = debugMalloc( sizeof(struct neigh_node), 403 );
	memset( neigh_node, 0, sizeof(struct neigh_node) );
	INIT_LIST_HEAD(&neigh_node->list);

	neigh_node->addr = neigh;
	neigh_node->orig_node = orig_neigh_node;
	neigh_node->if_incoming = if_incoming;

	neigh_node->tq_recv = debugMalloc(sizeof(uint16_t) * global_win_size, 406);
	memset(neigh_node->tq_recv, 0, sizeof(uint16_t) * global_win_size);

	neigh_node->real_bits = debugMalloc(sizeof(TYPE_OF_WORD) * num_words, 407);
	memset(neigh_node->real_bits, 0, sizeof(TYPE_OF_WORD) * num_words);

	list_add_tail(&neigh_node->list, &orig_node->neigh_list);

	return neigh_node;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r15
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %rbx
leaq 0xafab(%rip), %rsi      # 0xeff9
pushq $0x4
popq %rdi
xorl %eax, %eax
callq 0xcb1c
pushq $0x38
popq %rdi
movl $0x193, %esi            # imm = 0x193
callq 0x58c9
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movups %xmm0, 0x18(%rax)
movq %rax, (%rax)
movl %ebp, 0x8(%rax)
movq %r12, 0x28(%rax)
movq %r15, 0x30(%rax)
leaq 0x1320e(%rip), %r15     # 0x17296
movzbl (%r15), %edi
addl %edi, %edi
movl $0x196, %esi            # imm = 0x196
callq 0x58c9
movq %rax, 0x10(%r14)
movzbl (%r15), %edx
addl %edx, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x21c0
leaq 0x131e5(%rip), %r15     # 0x17298
movzbl (%r15), %edi
shll $0x3, %edi
movl $0x197, %esi            # imm = 0x197
callq 0x58c9
movq %rax, 0x20(%r14)
movzbl (%r15), %edx
shll $0x3, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x21c0
addq $0x48, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x574d
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/originator.c
// Function: choose_orig
int choose_orig( void *data, int32_t size ) {

	unsigned char *key= data;
	uint32_t hash = 0;
	size_t i;

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

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

	return (hash%size);

}

// Assembly:
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x4120
movzbl (%rdi,%rcx), %edx
addl %edx, %eax
imull $0x401, %eax, %edx      # imm = 0x401
movl %edx, %eax
shrl $0x6, %eax
xorl %edx, %eax
incq %rcx
jmp 0x4102
leal (%rax,%rax,8), %eax
movl %eax, %ecx
shrl $0xb, %ecx
xorl %eax, %ecx
imull $0x8001, %ecx, %eax     # imm = 0x8001
xorl %edx, %edx
divl %esi
movl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/allocate.c
// Function: checkIntegrity
void checkIntegrity(void)
{
	struct chunkHeader *walker;
	struct chunkTrailer *chunkTrailer;
	unsigned char *memory;


#if defined MEMORY_USAGE

	struct memoryUsage *memoryWalker;

	debug_output( 5, " \nMemory usage information:\n" );

	pthread_mutex_lock(&memory_mutex);
	for ( memoryWalker = memoryList; memoryWalker != NULL; memoryWalker = memoryWalker->next ) {

		if ( memoryWalker->counter != 0 )
			debug_output( 5, "   tag: %4i, num malloc: %4i, bytes per malloc: %4i, total: %6i\n", memoryWalker->tag, memoryWalker->counter, memoryWalker->length, memoryWalker->counter * memoryWalker->length );

	}
	pthread_mutex_unlock(&memory_mutex);

#endif

	pthread_mutex_lock(&chunk_mutex);

	for (walker = chunkList; walker != NULL; walker = walker->next)
	{
		if (walker->magicNumber != MAGIC_NUMBER)
		{
			debug_output( 0, "checkIntegrity - invalid magic number in header: %08x, malloc tag = %d\n", walker->magicNumber, walker->tag );
			pthread_mutex_unlock(&chunk_mutex);
			restore_and_exit(0);
		}

		memory = (unsigned char *)walker;

		chunkTrailer = (struct chunkTrailer *)(memory + sizeof(struct chunkHeader) + getHeaderPad() + walker->length + getTrailerPad(walker->length));

		if (chunkTrailer->magicNumber != MAGIC_NUMBER)
		{
			debug_output( 0, "checkIntegrity - invalid magic number in trailer: %08x, malloc tag = %d\n", chunkTrailer->magicNumber, walker->tag );
			pthread_mutex_unlock(&chunk_mutex);
			restore_and_exit(0);
		}
	}

	pthread_mutex_unlock(&chunk_mutex);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0x9ed3(%rip), %rsi      # 0xf663
pushq $0x5
popq %rbx
movl %ebx, %edi
xorl %eax, %eax
callq 0xcb1c
leaq 0x11d05(%rip), %rdi     # 0x174a8
callq 0x24c0
leaq 0x11cf1(%rip), %r15     # 0x174a0
leaq 0x9eca(%rip), %r14      # 0xf680
movq (%r15), %r15
testq %r15, %r15
je 0x57e3
movl 0xc(%r15), %ecx
testl %ecx, %ecx
je 0x57b6
movl 0x8(%r15), %r8d
movl 0x10(%r15), %edx
movl %r8d, %r9d
imull %ecx, %r9d
movl %ebx, %edi
movq %r14, %rsi
xorl %eax, %eax
callq 0xcb1c
jmp 0x57b6
leaq 0x11cbe(%rip), %rdi     # 0x174a8
callq 0x22d0
leaq 0x11cda(%rip), %rdi     # 0x174d0
callq 0x24c0
leaq 0x11c96(%rip), %rax     # 0x17498
pushq $0x8
popq %rcx
movq (%rax), %rax
testq %rax, %rax
je 0x5847
movl 0x10(%rax), %edx
cmpl $0x12345678, %edx       # imm = 0x12345678
jne 0x5858
movl 0x8(%rax), %edx
leaq (%rax,%rdx), %rsi
andl $0x7, %edx
movq %rcx, %rdi
subq %rdx, %rdi
testq %rdx, %rdx
cmoveq %rdx, %rdi
movl 0x18(%rdi,%rsi), %edx
cmpl $0x12345678, %edx       # imm = 0x12345678
je 0x5805
movl 0xc(%rax), %ecx
leaq 0x9ec4(%rip), %rsi      # 0xf709
jmp 0x5862
leaq 0x11c82(%rip), %rdi     # 0x174d0
popq %rbx
popq %r14
popq %r15
jmp 0x22d0
movl 0xc(%rax), %ecx
leaq 0x9e5f(%rip), %rsi      # 0xf6c1
xorl %edi, %edi
xorl %eax, %eax
callq 0xcb1c
leaq 0x11c5e(%rip), %rdi     # 0x174d0
callq 0x22d0
xorl %edi, %edi
callq 0xb4f2
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/allocate.c
// Function: checkLeak
void checkLeak(void)
{
	struct chunkHeader *walker;

	pthread_mutex_lock(&chunk_mutex);
	for (walker = chunkList; walker != NULL; walker = walker->next)
		debug_output( 0, "Memory leak detected, malloc tag = %d\n", walker->tag );

	pthread_mutex_unlock(&chunk_mutex);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x11c47(%rip), %rdi     # 0x174d0
callq 0x24c0
leaq 0x11c03(%rip), %r14     # 0x17498
leaq 0x9eb6(%rip), %rbx      # 0xf752
movq (%r14), %r14
testq %r14, %r14
je 0x58b6
movl 0xc(%r14), %edx
xorl %edi, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0xcb1c
jmp 0x589c
leaq 0x11c13(%rip), %rdi     # 0x174d0
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x22d0
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/allocate.c
// Function: debugMalloc
void *debugMalloc(uint32_t length, int32_t tag)
{
	unsigned char *memory;
	struct chunkHeader *chunkHeader;
	struct chunkTrailer *chunkTrailer;
	unsigned char *chunk;

/* 	printf("sizeof(struct chunkHeader) = %u, sizeof (struct chunkTrailer) = %u\n", sizeof (struct chunkHeader), sizeof (struct chunkTrailer)); */

	memory = malloc(length + sizeof(struct chunkHeader) + sizeof(struct chunkTrailer) + getHeaderPad() + getTrailerPad(length));

	if (memory == NULL)
	{
		debug_output( 0, "Cannot allocate %u bytes, malloc tag = %d\n", (unsigned int)(length + sizeof(struct chunkHeader) + sizeof(struct chunkTrailer)), tag );
		restore_and_exit(0);
	}

	chunkHeader = (struct chunkHeader *)memory;
	chunk = memory + sizeof(struct chunkHeader) + getHeaderPad();
	chunkTrailer = (struct chunkTrailer *)(memory + sizeof(struct chunkHeader) + length + getHeaderPad() + getTrailerPad(length));

	fillPadding((unsigned char*)chunkHeader + sizeof(struct chunkHeader), getHeaderPad());
	fillPadding(chunk + length, getTrailerPad(length));

	chunkHeader->length = length;
	chunkHeader->tag = tag;
	chunkHeader->magicNumber = MAGIC_NUMBER;

	chunkTrailer->magicNumber = MAGIC_NUMBER;

	pthread_mutex_lock(&chunk_mutex);
	chunkHeader->next = chunkList;
	chunkList = chunkHeader;
	pthread_mutex_unlock(&chunk_mutex);

#if defined MEMORY_USAGE

	addMemory( length, tag );

#endif

	return chunk;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
movl %edi, %r12d
movl %r12d, %eax
andl $0x7, %eax
pushq $0x8
popq %r15
subq %rax, %r15
testq %rax, %rax
cmoveq %rax, %r15
leaq (%r15,%r12), %rdi
addq $0x1c, %rdi
callq 0x22e0
testq %rax, %rax
je 0x59d2
movq %rax, %r14
movq %rax, %r13
addq %rax, %r12
addq $0x18, %r12
addq $0x18, %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x59f2
movq %r12, %rdi
movq %r15, %rsi
callq 0x59f2
movl %ebp, 0x8(%r13)
movl %ebx, 0xc(%r13)
movl $0x12345678, %eax       # imm = 0x12345678
movl %eax, 0x10(%r13)
movl %eax, (%r15,%r12)
leaq 0x11b89(%rip), %r15     # 0x174d0
movq %r15, %rdi
callq 0x24c0
movq 0x11b42(%rip), %rax     # 0x17498
movq %rax, (%r13)
movq %r13, 0x11b37(%rip)     # 0x17498
movq %r15, %rdi
callq 0x22d0
leaq 0x11b38(%rip), %rdi     # 0x174a8
callq 0x24c0
leaq 0x11b24(%rip), %rax     # 0x174a0
movq (%rax), %rax
testq %rax, %rax
je 0x598e
cmpl %ebx, 0x10(%rax)
jne 0x597c
incl 0xc(%rax)
jmp 0x59b4
pushq $0x18
popq %rdi
callq 0x22e0
movl %ebp, 0x8(%rax)
movl %ebx, 0x10(%rax)
movl $0x1, 0xc(%rax)
movq 0x11af6(%rip), %rcx     # 0x174a0
movq %rcx, (%rax)
movq %rax, 0x11aec(%rip)     # 0x174a0
leaq 0x11aed(%rip), %rdi     # 0x174a8
callq 0x22d0
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x1c, %r12
leaq 0x9d9c(%rip), %rsi      # 0xf779
xorl %edi, %edi
movl %r12d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0xcb1c
xorl %edi, %edi
callq 0xb4f2
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/allocate.c
// Function: fillPadding
static void fillPadding(unsigned char* padding, size_t length) {
	unsigned char c = 0x00;
	size_t i;

	for (i = 0; i < length; i++) {
		c += 0xA7;
		padding[i] = c;
	}
}

// Assembly:
movb $-0x59, %al
xorl %ecx, %ecx
cmpq %rcx, %rsi
je 0x5a05
movb %al, (%rdi,%rcx)
incq %rcx
addb $-0x59, %al
jmp 0x59f6
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/allocate.c
// Function: debugRealloc
void *debugRealloc(void *memoryParameter, uint32_t length, int32_t tag)
{
	unsigned char *memory;
	struct chunkHeader *chunkHeader=NULL;
	struct chunkTrailer *chunkTrailer;
	unsigned char *result;
	uint32_t copyLength;

	if (memoryParameter) { /* if memoryParameter==NULL, realloc() should work like malloc() !! */
		memory = memoryParameter;
		chunkHeader = (struct chunkHeader *)(memory - sizeof(struct chunkHeader) - getHeaderPad());

		if (chunkHeader->magicNumber != MAGIC_NUMBER)
		{
			debug_output( 0, "debugRealloc - invalid magic number in header: %08x, malloc tag = %d\n", chunkHeader->magicNumber, chunkHeader->tag );
			restore_and_exit(0);
		}

		if (checkPadding(memory - getHeaderPad(), getHeaderPad()) == 0) {
			debug_output( 0, "debugRealloc - invalid magic padding in header, malloc tag = %d\n", chunkHeader->tag );
			restore_and_exit(0);
		}

		chunkTrailer = (struct chunkTrailer *)(memory + chunkHeader->length + getTrailerPad(chunkHeader->length));

		if (chunkTrailer->magicNumber != MAGIC_NUMBER)
		{
			debug_output( 0, "debugRealloc - invalid magic number in trailer: %08x, malloc tag = %d\n", chunkTrailer->magicNumber, chunkHeader->tag );
			restore_and_exit(0);
		}

		if (checkPadding(memory + chunkHeader->length, getTrailerPad(chunkHeader->length)) == 0) {
			debug_output( 0, "debugRealloc - invalid magic padding in trailer, malloc tag = %d\n", chunkHeader->tag );
			restore_and_exit(0);
		}
	}


	result = debugMalloc(length, tag);
	if (memoryParameter) {
		copyLength = length;

		if (copyLength > chunkHeader->length)
			copyLength = chunkHeader->length;

		memcpy(result, memoryParameter, copyLength);
		debugFree(memoryParameter, 9999);
	}

	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
testq %rdi, %rdi
je 0x5a6d
movl -0x8(%rbx), %edx
cmpl $0x12345678, %edx       # imm = 0x12345678
jne 0x5ab5
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5afc
testl %eax, %eax
je 0x5ac1
movl -0x10(%rbx), %eax
leaq (%rbx,%rax), %rdi
andl $0x7, %eax
pushq $0x8
popq %rsi
subq %rax, %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movl (%rsi,%rdi), %edx
cmpl $0x12345678, %edx       # imm = 0x12345678
jne 0x5acd
callq 0x5afc
testl %eax, %eax
je 0x5ae2
leaq -0x18(%rbx), %r12
jmp 0x5a70
xorl %r12d, %r12d
movl %r14d, %edi
movl %ebp, %esi
callq 0x58c9
movq %rax, %r15
testq %rbx, %rbx
je 0x5aa9
movl 0x8(%r12), %eax
cmpl %r14d, %eax
cmovbl %eax, %r14d
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2290
movq %rbx, %rdi
movl $0x270f, %esi           # imm = 0x270F
callq 0x5b1a
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl -0xc(%rbx), %ecx
leaq 0x9ce5(%rip), %rsi      # 0xf7a4
jmp 0x5ad7
movl -0xc(%rbx), %edx
leaq 0x9d1f(%rip), %rsi      # 0xf7ea
jmp 0x5aec
movl -0xc(%rbx), %ecx
leaq 0x9d54(%rip), %rsi      # 0xf82b
xorl %edi, %edi
xorl %eax, %eax
callq 0xcb1c
jmp 0x5af5
movl -0xc(%rbx), %edx
leaq 0x9d86(%rip), %rsi      # 0xf872
xorl %edi, %edi
xorl %eax, %eax
callq 0xcb1c
xorl %edi, %edi
callq 0xb4f2
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/allocate.c
// Function: checkPadding
static int checkPadding(unsigned char* padding, size_t length) {
	unsigned char c = 0x00;
	size_t i;

	for (i = 0; i < length; i++) {
		c += 0xA7;
		if (padding[i] != c)
			return 0;
	}
	return 1;
}

// Assembly:
xorl %ecx, %ecx
pushq $0x1
popq %rax
xorl %edx, %edx
cmpq %rdx, %rsi
je 0x5b19
addb $-0x59, %cl
leaq 0x1(%rdx), %r8
cmpb (%rdi,%rdx), %cl
movq %r8, %rdx
je 0x5b03
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/bitarray.c
// Function: bit_shift
void bit_shift( TYPE_OF_WORD *seq_bits, int32_t n ) {
	int32_t word_offset, word_num;
	int32_t i;

/*	bit_print( seq_bits );*/
	if( n<=0 ) return;

	word_offset= n%WORD_BIT_SIZE;	/* shift how much inside each word */
	word_num   = n/WORD_BIT_SIZE;	/* shift over how much (full) words */

	for ( i=num_words-1; i>word_num; i-- ) {
		/* going from old to new, so we can't overwrite the data we copy from. *
 		 * left is high, right is low: FEDC BA98 7654 3210
		 *	                                  ^^ ^^
		 *                             vvvv
		 * ^^^^ = from, vvvvv =to, we'd have word_num==1 and
		 * word_offset==WORD_BIT_SIZE/2 ????? in this example. (=24 bits)
		 *
		 * our desired output would be: 9876 5432 1000 0000
		 * */

		seq_bits[i]=
			(seq_bits[i - word_num] << word_offset) +
					/* take the lower port from the left half, shift it left to its final position */
			(seq_bits[i - word_num - 1] >>	(WORD_BIT_SIZE-word_offset));
					/* and the upper part of the right half and shift it left to it's position */
		/* for our example that would be: word[0] = 9800 + 0076 = 9876 */
	}
	/* now for our last word, i==word_num, we only have the it's "left" half. that's the 1000 word in
	 * our example.*/

	seq_bits[i]= (seq_bits[i - word_num] << word_offset);

	/* pad the rest with 0, if there is anything */
	i--;

	for (; i>=0; i--) {
		seq_bits[i]= 0;
	}
/*	bit_print( seq_bits ); */
}

// Assembly:
testl %esi, %esi
jle 0x5dc4
pushq %r14
pushq %rbx
movl %esi, %eax
andl $0x3f, %eax
shrl $0x6, %esi
leaq 0x11552(%rip), %rcx     # 0x17298
movzbl (%rcx), %ecx
movl $0x40, %edx
subl %eax, %edx
leaq (%rdi,%rcx,8), %r9
addq $-0x8, %r9
leaq -0x1(%rcx), %r10
movl %ecx, %r8d
addl $-0x2, %r8d
movl %esi, %r11d
shll $0x3, %r11d
negq %r11
cmpq %rsi, %r10
jle 0x5d97
movq -0x8(%r9,%r11), %rbx
movq (%r9,%r11), %r14
movl %eax, %ecx
shlq %cl, %r14
movl %edx, %ecx
shrq %cl, %rbx
addq %r14, %rbx
movq %rbx, (%r9)
decl %r8d
addq $-0x8, %r9
decq %r10
jmp 0x5d6d
leal (,%rsi,8), %ecx
movq %r9, %rdx
subq %rcx, %rdx
movq (%rdx), %rdx
movl %eax, %ecx
shlq %cl, %rdx
movq %rdx, (%r9)
popq %rbx
popq %r14
testl %r8d, %r8d
js 0x5dc4
movl %r8d, %eax
andq $0x0, (%rdi,%rax,8)
decl %r8d
jmp 0x5db2
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x114b4(%rip), %r15     # 0x17297
movzbl (%r15), %eax
movl %eax, %ecx
negl %ecx
cmpl %ecx, %r14d
setl %sil
orb %dl, %sil
je 0x5e5c
cmpl %r14d, %eax
setl %dl
cmpl %r14d, %ecx
setg %cl
orb %dl, %cl
cmpb $0x1, %cl
jne 0x5e73
cmpl %r14d, %eax
jge 0x5e28
leal -0x1(%r14), %edx
leaq 0x9c83(%rip), %rsi      # 0xfa9d
pushq $0x4
popq %rdi
xorl %eax, %eax
callq 0xcb1c
movzbl (%r15), %eax
negl %r14d
cmpl %r14d, %eax
jge 0x5e41
leaq 0x9c92(%rip), %rsi      # 0xfac9
pushq $0x4
popq %rdi
xorl %eax, %eax
callq 0xcb1c
xorl %eax, %eax
leaq 0x1144e(%rip), %rcx     # 0x17298
movzbl (%rcx), %edx
cmpq %rdx, %rax
jae 0x5e90
andq $0x0, (%rbx,%rax,8)
incq %rax
jmp 0x5e4a
testb %bpl, %bpl
je 0x5e6f
negl %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x5d0a
xorl %eax, %eax
jmp 0x5e9e
movq %rbx, %rdi
movl %r14d, %esi
callq 0x5d2c
movb $0x1, %al
testb %bpl, %bpl
je 0x5e9e
cmpb $0x0, (%r15)
je 0x5e9e
orb $0x1, (%rbx)
jmp 0x5e9e
movb $0x1, %al
testb %bpl, %bpl
je 0x5e9e
movq $0x1, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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:
andl $0x0, 0x8(%rdi)
movslq 0xc(%rdi), %rax
xorl %ecx, %ecx
cmpq %rax, %rcx
jge 0x5f04
movq (%rdi), %rdx
andq $0x0, (%rdx,%rcx,8)
incq %rcx
jmp 0x5ef2
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rsi, %r14
movq %rdi, %rbx
xorl %r12d, %r12d
movslq 0xc(%rbx), %rax
cmpq %rax, %r12
jge 0x5f52
movq (%rbx), %rax
movq (%rax,%r12,8), %r15
testq %r15, %r15
je 0x5f4d
testq %r14, %r14
je 0x5f37
movq (%r15), %rdi
callq *%r14
movq 0x8(%r15), %r13
movq %r15, %rdi
movl $0x515, %esi            # imm = 0x515
callq 0x5b1a
movq %r13, %r15
jmp 0x5f27
incq %r12
jmp 0x5f17
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x5f63
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x20
popq %rdi
movl $0x12e, %esi            # imm = 0x12E
callq 0x58c9
testq %rax, %rax
je 0x60f2
movq %rax, %rbx
movl %ebp, 0xc(%rax)
shll $0x3, %ebp
movl %ebp, %edi
movl $0x12f, %esi            # imm = 0x12F
callq 0x58c9
movq %rax, (%rbx)
testq %rax, %rax
je 0x60e5
movq %rbx, %rdi
callq 0x5ee8
movq %r15, 0x10(%rbx)
movq %r14, 0x18(%rbx)
jmp 0x60f4
movq %rbx, %rdi
movl $0x519, %esi            # imm = 0x519
callq 0x5b1a
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
pushq $0x10
popq %rdi
movl $0x130, %esi            # imm = 0x130
callq 0x58c9
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x614d
movq %rax, %rbx
pushq $0x1
popq %rcx
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x615a
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jns 0x614f
movq %rbx, %rdi
movl $0x51b, %esi            # imm = 0x51B
callq 0x5b1a
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, (%rsp)
movq %rsi, %r15
movq %rdi, %r14
movl 0xc(%rdi), %esi
movq %r15, %rdi
callq *0x18(%r14)
movslq %eax, %r13
shlq $0x3, %r13
movq (%r14), %rcx
addq %r13, %rcx
xorl %eax, %eax
pushq $-0x1
popq %r12
movq (%rcx), %rbx
testq %rbx, %rbx
je 0x61b1
testl %ebp, %ebp
je 0x61a8
movq (%rbx), %rdi
movq %r15, %rsi
callq *0x10(%r14)
testl %eax, %eax
jne 0x61d9
leaq 0x8(%rbx), %rcx
movq %rbx, %rax
jmp 0x618e
movq (%rsp), %rcx
movq %r15, (%rcx)
andq $0x0, 0x8(%rcx)
testq %rax, %rax
je 0x61cb
addq $0x8, %rax
movq %rax, %r13
jmp 0x61ce
addq (%r14), %r13
movq %rcx, (%r13)
incl 0x8(%r14)
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/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)
movslq %eax, %r12
shlq $0x3, %r12
addq (%r14), %r12
xorl %r15d, %r15d
movq (%r12), %r12
testq %r12, %r12
je 0x6232
movq (%r12), %rdi
movq %rbx, %rsi
callq *0x10(%r14)
testl %eax, %eax
jne 0x622e
addq $0x8, %r12
jmp 0x6210
movq (%r12), %r15
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x6262
movq 0x8(%rdi), %rcx
movq %rcx, 0x8(%rax)
jmp 0x6276
movq 0x18(%rsi), %rax
testq %rax, %rax
je 0x6276
movq 0x8(%rdi), %rcx
movq %rcx, (%rax)
movq 0x8(%rsi), %rdi
movl $0x51a, %esi            # imm = 0x51A
callq 0x5b1a
decl 0x8(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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)
movslq %eax, %r12
leaq (,%r12,8), %rax
addq (%rbx), %rax
xorl %r15d, %r15d
xorl %r13d, %r13d
movq (%rax), %rbp
testq %rbp, %rbp
je 0x630e
movq (%rbp), %rdi
movq %r14, %rsi
callq *0x10(%rbx)
testl %eax, %eax
jne 0x62e2
leaq 0x8(%rbp), %rax
movq %rbp, %r13
jmp 0x62c3
leaq 0x8(%rsp), %rsi
movq %r13, 0x10(%rsi)
movq %rbp, 0x8(%rsi)
movq (%rbx), %rax
leaq (%rax,%r12,8), %rax
xorl %ecx, %ecx
cmpq (%rax), %rbp
cmoveq %rax, %rcx
movq %rcx, 0x18(%rsi)
movq %rbx, %rdi
callq 0x6241
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_O2/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 0x6095
movq %rax, %r14
testq %rax, %rax
je 0x637f
xorl %r15d, %r15d
movslq 0xc(%rbx), %rax
cmpq %rax, %r15
jl 0x6364
jmp 0x6375
movq 0x8(%rdx), %rcx
movq %rcx, (%rax,%r15,8)
movq (%rdx), %rsi
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x615a
movq (%rbx), %rax
movq (%rax,%r15,8), %rdx
testq %rdx, %rdx
jne 0x634f
incq %r15
jmp 0x6344
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5f05
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
pushq %rax
leaq 0x96f0(%rip), %rsi      # 0xfaf0
pushq $0x5
popq %rbx
movl %ebx, %edi
xorl %eax, %eax
callq 0xcb1c
pushq $0x18
popq %r15
leaq 0x110e9(%rip), %r12     # 0x17500
leaq 0x96e3(%rip), %r14      # 0xfb01
cmpq $0x138, %r15            # imm = 0x138
je 0x6488
cvtsi2ssq -0x10(%r15,%r12), %xmm0
divss 0x96b6(%rip), %xmm0     # 0xfaec
movq (%r15,%r12), %rcx
movq %rcx, %rdx
shrq %rdx
movl %ecx, %eax
andl $0x1, %eax
orq %rdx, %rax
testq %rcx, %rcx
js 0x6454
cvtsi2ss %rcx, %xmm2
jmp 0x645d
cvtsi2ss %rax, %xmm2
addss %xmm2, %xmm2
xorps %xmm1, %xmm1
je 0x646d
movaps %xmm0, %xmm1
divss %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
cvtss2sd %xmm0, %xmm0
movq -0x8(%r15,%r12), %rdx
movl %ebx, %edi
movq %r14, %rsi
movb $0x2, %al
callq 0xcb1c
addq $0x20, %r15
jmp 0x641e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/hna.c
// Function: hna_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 0x1113c(%rip), %rax     # 0x17630
movq %rax, 0x11135(%rip)     # 0x17630
movq %rax, 0x11136(%rip)     # 0x17638
leaq 0x11137(%rip), %rax     # 0x17640
movq %rax, 0x11130(%rip)     # 0x17640
movq %rax, 0x11131(%rip)     # 0x17648
leaq 0x11132(%rip), %rdi     # 0x17650
xorl %esi, %esi
callq 0x24a0
leaq 0x33(%rip), %rsi        # 0x655f
leaq 0x40(%rip), %rdx        # 0x6573
movl $0x80, %edi
callq 0x6095
movq %rax, 0x11134(%rip)     # 0x17678
testq %rax, %rax
je 0x654b
popq %rax
retq
leaq 0x988a(%rip), %rdi      # 0xfddc
callq 0x20c0
pushq $0x1
popq %rdi
callq 0x2440
// File: /workspace/github_c_makefile_star2_O2/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:
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x5, %rcx
je 0x6595
movzbl (%rdi,%rcx), %edx
addl %edx, %eax
imull $0x401, %eax, %edx      # imm = 0x401
movl %edx, %eax
shrl $0x6, %eax
xorl %edx, %eax
incq %rcx
jmp 0x6577
leal (%rax,%rax,8), %eax
movl %eax, %ecx
shrl $0xb, %ecx
xorl %eax, %ecx
imull $0x8001, %ecx, %eax     # imm = 0x8001
xorl %edx, %edx
divl %esi
movl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x10
popq %rdi
movl $0x2bd, %esi            # imm = 0x2BD
callq 0x58c9
movq %rax, %rbx
andq $0x0, 0x8(%rax)
movq %rax, (%rax)
movl %r15d, 0x8(%rax)
movb %r14b, 0xc(%rax)
movb %bpl, 0xd(%rax)
leaq 0x1106a(%rip), %rdi     # 0x17650
callq 0x24c0
testl %eax, %eax
je 0x6615
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x9547(%rip), %rsi      # 0xfb49
leaq 0x9578(%rip), %rdx      # 0xfb81
xorl %edi, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0xcb1c
leaq 0x11024(%rip), %rsi     # 0x17640
movq %rbx, %rdi
callq 0x574d
leaq 0x11025(%rip), %rdi     # 0x17650
callq 0x22d0
testl %eax, %eax
je 0x6664
callq 0x2070
movl (%rax), %edi
callq 0x2480
leaq 0x9550(%rip), %rsi      # 0xfb97
leaq 0x9533(%rip), %rdx      # 0xfb81
xorl %edi, %edi
movq %rax, %rcx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xcb1c
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/open-mesh-mirror[P]batmand/hna.c
// Function: hna_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
pushq $0x2f
popq %rsi
callq 0x2180
testq %rax, %rax
je 0x66f3
movq %rax, %r15
movb $0x0, (%rax)
pushq $0x2
popq %rdi
leaq 0xc(%rsp), %rdx
movq %rbx, %rsi
callq 0x22a0
testl %eax, %eax
jle 0x671c
callq 0x2070
movq %rax, %r12
andl $0x0, (%rax)
movq %r15, %rdi
incq %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x2280
movl (%r12), %edx
cmpl $0x22, %edx
je 0x66d9
movzwl %ax, %ecx
testl %edx, %edx
je 0x6746
testl %ecx, %ecx
jne 0x6746
movb $0x2f, (%r15)
testb %r14b, %r14b
jne 0x6739
leaq 0x954b(%rip), %rdi      # 0xfc34
callq 0x23e0
jmp 0x6799
testb %r14b, %r14b
je 0x677f
leaq 0x94ce(%rip), %rsi      # 0xfbd1
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xcb1c
movb $0x2f, (%r15)
testb %r14b, %r14b
je 0x6788
leaq 0x94d9(%rip), %rsi      # 0xfc05
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xcb1c
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 0x6760
testb %r14b, %r14b
je 0x67a1
leaq 0x94dd(%rip), %rsi      # 0xfc3b
jmp 0x672c
negb %cl
pushq $-0x1
popq %rdi
shll %cl, %edi
bswapl %edi
andl 0xc(%rsp), %edi
movl %edi, 0xc(%rsp)
movzwl %ax, %esi
movzbl %bpl, %edx
callq 0x65ac
jmp 0x6739
leaq 0x944b(%rip), %rdi      # 0xfbd1
jmp 0x678f
leaq 0x9476(%rip), %rdi      # 0xfc05
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2190
pushq $0x1
popq %rdi
callq 0x2440
leaq 0x9493(%rip), %rdi      # 0xfc3b
jmp 0x678f