LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/shifengbin[P]bishe/SockTool/sockutils.c
// Function: write_timeout
int write_timeout( int fd, int sec )
{
	fd_set fds;
	int ret;
	struct timeval t;	
	
	if ( sec <= 0)
		return 0;

	FD_ZERO(&fds);
	FD_SET( fd , &fds);
	
	t.tv_sec = sec;
	t.tv_usec = 0;
	
	do
	{
		ret = select( fd+1, NULL , &fds, NULL , &t);
	}while(ret < 0 && errno == EINTR);
		
	if (ret < 0)
	{
		return -1;
	}
	else if ( ret == 0)
	{
		errno = ETIMEDOUT;
		return -1;
	}
	return 0;
}

// Assembly:
testl %esi, %esi
jle 0xac25
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movl %edi, %ebx
xorps %xmm0, %xmm0
leaq -0xb0(%rbp), %r14
movaps %xmm0, 0x70(%r14)
movaps %xmm0, 0x60(%r14)
movaps %xmm0, 0x50(%r14)
movaps %xmm0, 0x40(%r14)
movaps %xmm0, 0x30(%r14)
movaps %xmm0, 0x20(%r14)
leal 0x3f(%rbx), %eax
testl %edi, %edi
cmovnsl %edi, %eax
movl %eax, %edx
andl $-0x40, %edx
movl %edi, %ecx
subl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
sarl $0x6, %eax
cltq
orq %rdx, -0xb0(%rbp,%rax,8)
movl %esi, %eax
leaq -0x28(%rbp), %r15
movq %rax, (%r15)
movq $0x0, 0x8(%r15)
incl %ebx
movl %ebx, %edi
xorl %esi, %esi
movq %r14, %rdx
xorl %ecx, %ecx
movq %r15, %r8
callq 0x82e0
testl %eax, %eax
jns 0xac28
callq 0x8050
cmpl $0x4, (%rax)
je 0xac04
jmp 0xac39
xorl %eax, %eax
retq
je 0xac2e
xorl %eax, %eax
jmp 0xac3e
callq 0x8050
movl $0x6e, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/shifengbin[P]bishe/SockTool/sockutils.c
// Function: accept_timeout
int accept_timeout( int fd , struct sockaddr_in *addr , int sec)
{
	fd_set fds;
	struct timeval t;
	int ret;
	socklen_t len = sizeof( struct sockaddr_in);
	
	if ( sec <= 0 )
		return 0;

	FD_ZERO(&fds);
	FD_SET(fd,&fds);
	
	t.tv_sec = sec;
	t.tv_usec = 0;

	do
	{
		ret = select( fd +1, &fds, NULL , NULL ,&t);
	}while( ret < 0 && errno == EINTR);

	if ( ret < 0)
	{
		return -1;
	}
	else if ( ret == 0)
	{
		errno = ETIMEDOUT;
		return -1;
	}
		
	memset( addr , 0 , sizeof( struct sockaddr_in));
	if ( (ret = accept( fd , (struct sockaddr*) addr,&len)) < 0 )
		return -1;
	 
	return ret;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl $0x10, -0x2c(%rbp)
testl %edx, %edx
jle 0xad06
movq %rsi, %rbx
movl %edi, %r14d
xorps %xmm0, %xmm0
leaq -0xc0(%rbp), %r15
movaps %xmm0, 0x70(%r15)
movaps %xmm0, 0x60(%r15)
movaps %xmm0, 0x50(%r15)
movaps %xmm0, 0x40(%r15)
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
leal 0x3f(%r14), %eax
testl %edi, %edi
cmovnsl %edi, %eax
movl %eax, %esi
andl $-0x40, %esi
movl %edi, %ecx
subl %esi, %ecx
movl $0x1, %esi
shlq %cl, %rsi
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
sarl $0x6, %eax
cltq
orq %rsi, -0xc0(%rbp,%rax,8)
movl %edx, %eax
leaq -0x40(%rbp), %r12
movq %rax, (%r12)
movq $0x0, 0x8(%r12)
leal 0x1(%r14), %r13d
movl %r13d, %edi
movq %r15, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r12, %r8
callq 0x82e0
testl %eax, %eax
jns 0xad0a
callq 0x8050
cmpl $0x4, (%rax)
je 0xace4
jmp 0xad3a
xorl %eax, %eax
jmp 0xad3f
je 0xad2f
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
leaq -0x2c(%rbp), %rdx
movl %r14d, %edi
movq %rbx, %rsi
callq 0x80c0
movl %eax, %ecx
testl %eax, %eax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnsl %ecx, %eax
jmp 0xad3f
callq 0x8050
movl $0x6e, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/shifengbin[P]bishe/SockTool/sockutils.c
// Function: connect_timeout
int connect_timeout( int fd , struct sockaddr_in *addr, int sec)
{
	fd_set fds;
	int ret;
	struct timeval t;
	
	if ( sec <= 0)
		return 0;	
	
	setnonblock(fd);

	ret = connect( fd , (struct sockaddr*) addr , sizeof( struct sockaddr_in));
	if ( ret < 0  && errno == EINPROGRESS)
	{
		FD_ZERO(&fds);
		FD_SET(fd,&fds);
		
		t.tv_sec = sec;
		t.tv_usec = 0;
		
		do
		{
			ret = select( fd+1 , NULL , &fds, NULL , &t);
		}while(ret < 0 && errno == EINTR );	
		
		if ( ret > 0)
		{
			int err;
			int len;
			if ( getsockopt( fd , SOL_SOCKET, SO_ERROR ,(void *)&err , &len) == 0 )
				ret = 0;
			else
				ret =  -1;
		}
		else if ( ret == 0)
		{
			errno = ETIMEDOUT;
			ret = -1;
		}
		else
		{
			ret = -1;
		}
		
	}

	setblock(fd);	

	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
testl %edx, %edx
jle 0xae38
movl %edx, %r15d
movq %rsi, %r14
movl %edi, %ebx
callq 0xaa38
movl %ebx, %edi
movq %r14, %rsi
movl $0x10, %edx
callq 0x8240
movl %eax, %r12d
testl %eax, %eax
jns 0xae6f
callq 0x8050
cmpl $0x73, (%rax)
jne 0xae6f
movq %rax, %r14
xorps %xmm0, %xmm0
leaq -0xc0(%rbp), %r12
movaps %xmm0, 0x70(%r12)
movaps %xmm0, 0x60(%r12)
movaps %xmm0, 0x50(%r12)
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
leal 0x3f(%rbx), %eax
testl %ebx, %ebx
cmovnsl %ebx, %eax
movl %eax, %edx
andl $-0x40, %edx
movl %ebx, %ecx
subl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
sarl $0x6, %eax
cltq
orq %rdx, -0xc0(%rbp,%rax,8)
movl %r15d, %eax
leaq -0x40(%rbp), %r15
movq %rax, (%r15)
movq $0x0, 0x8(%r15)
leal 0x1(%rbx), %r13d
movl %r13d, %edi
xorl %esi, %esi
movq %r12, %rdx
xorl %ecx, %ecx
movq %r15, %r8
callq 0x82e0
testl %eax, %eax
jns 0xae3d
cmpl $0x4, (%r14)
je 0xae1a
jmp 0xae69
xorl %r12d, %r12d
jmp 0xae76
je 0xae62
leaq -0x30(%rbp), %rcx
leaq -0x2c(%rbp), %r8
movl %ebx, %edi
movl $0x1, %esi
movl $0x4, %edx
callq 0x81f0
xorl %r12d, %r12d
negl %eax
sbbl %r12d, %r12d
jmp 0xae6f
movl $0x6e, (%r14)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %ebx, %edi
callq 0xaa76
movl %r12d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/shifengbin[P]bishe/SockTool/sockutils.c
// Function: readn
int readn( int fd , void *buf ,int bufsize, int size)
{
	int leftn = size;
	char *p = buf;
	int ret;
	
	if ( buf == NULL || bufsize < size || size < 0)
		return -1;

	if (size == 0 )
		return 0;

	while(leftn > 0)
	{
		ret = read( fd , p ,leftn);
		if ( ret <0 && errno == EINTR)
		{
			continue;
		}
		else if ( ret == 0 )
		{
			break;
		}
		else
		{
			leftn -= ret;
			p += ret;
		}
	
	}
	return size - leftn;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0xaf0b
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
cmpl %ecx, %edx
setl %sil
testl %ecx, %ecx
sets %dl
orb %sil, %dl
jne 0xaefd
testl %ecx, %ecx
je 0xaefb
movl %edi, %r15d
movl %ecx, -0x2c(%rbp)
movl %ecx, %ebx
movl %ebx, %r13d
movl %r15d, %edi
movq %r14, %rsi
movq %r13, %rdx
callq 0x8430
movq %rax, %r12
testl %r12d, %r12d
jns 0xaee7
callq 0x8050
cmpl $0x4, (%rax)
je 0xaec5
jmp 0xaee9
je 0xaef4
movslq %r12d, %rax
addq %rax, %r14
subl %r12d, %ebx
jg 0xaec2
movl -0x2c(%rbp), %eax
subl %ebx, %eax
jmp 0xaefd
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/shifengbin[P]bishe/SockTool/sockutils.c
// Function: writen
int writen( int fd , void * buf , int size)
{
	int leftn = size;
	char *p = buf;
	int ret;
	
	if ( buf == NULL || size < 0 )
		return -1;
	
	if ( size == 0)
		return 0;	

	while( leftn > 0)
	{
		ret = write( fd , p , leftn);
		if ( ret < 0 && errno == EINTR)
		{
			continue;
		}
		else 
		{
			leftn -= ret;
			p += ret;	
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
sete %al
testl %edx, %edx
sets %cl
orb %al, %cl
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jne 0xaf6b
movl %edx, %ebx
xorl %r12d, %r12d
testl %edx, %edx
je 0xaf6b
movq %rsi, %r14
movl %edi, %r15d
movl %ebx, %ebx
movl %r15d, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x80f0
movq %rax, %r13
testl %r13d, %r13d
jns 0xaf60
callq 0x8050
cmpl $0x4, (%rax)
je 0xaf40
movslq %r13d, %rax
addq %rax, %r14
subl %r13d, %ebx
jg 0xaf3e
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_O3/shifengbin[P]bishe/SockTool/sockutils.c
// Function: readline
int readline( int fd , void *buf , int bufsize)
{
	int leftn = bufsize;
	char *p = buf;
	char *t = NULL;
	int ret;
	int readlen;
	if (buf == NULL)
		return -1;

	while( leftn > 0 )
	{
		ret = recv( fd , p , leftn , MSG_PEEK );
		if ( ret < 0 && errno == EINTR)
		{
			continue;
		}
		else if ( ret == 0 )
		{
			return -1;
		}
		
		if ( (t = strchr( p , '\n')) != NULL)
		{
			
			readlen = readn( fd, p , t - p +1, t -p +1);
			p[readlen] = '\0';	
			return 0;
		}

		readn( fd , p , ret , ret);
		leftn -= ret;
		p += ret;
	}
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
sete %al
testl %edx, %edx
setle %cl
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
orb %al, %cl
jne 0xb025
movl %edx, %r12d
movq %rsi, %rbx
movl %edi, %r14d
movl %r12d, %r12d
movl %r14d, %edi
movq %rbx, %rsi
movq %r12, %rdx
movl $0x2, %ecx
callq 0x80d0
movq %rax, %r13
testl %r13d, %r13d
jns 0xafd7
callq 0x8050
cmpl $0x4, (%rax)
je 0xafb0
jmp 0xafd9
je 0xb025
movq %rbx, %rdi
movl $0xa, %esi
callq 0x8100
testq %rax, %rax
jne 0xb009
movl %r14d, %edi
movq %rbx, %rsi
movl %r13d, %edx
movl %r13d, %ecx
callq 0xae8b
movslq %r13d, %rax
addq %rax, %rbx
subl %r13d, %r12d
jg 0xafad
jmp 0xb025
subl %ebx, %eax
incl %eax
movl %r14d, %edi
movq %rbx, %rsi
movl %eax, %edx
movl %eax, %ecx
callq 0xae8b
cltq
movb $0x0, (%rbx,%rax)
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/shifengbin[P]bishe/TaskControl/threadpool.c
// Function: initThreadPool
int initThreadPool( ThreadPool **tp , int poolsize)
{
	ThreadPool_t *p;
	int i;
	if (tp == NULL || poolsize < 1)
	{
		return -1;
	}

	p = (ThreadPool_t *)malloc( sizeof( ThreadPool_t) + sizeof(pthread_t)*poolsize);

	if ( p == NULL)
	{
		return -1;
	}
	
//	p->lock = PTHREAD_MUTEX_INITIALIZER;
//	p->cond = PTHREAD_COND_INITIALIZER;
	pthread_mutex_init(&(p->lock),NULL);
	pthread_cond_init(&(p->cond),NULL);
	p->ids = (pthread_t*)(p + 1);
	p->count = 0;
	p->head.next = NULL;
	p->isdestroy = 0;
	
	for( i = 0 ; i < poolsize ; i++ )
	{
		pthread_create( &(p->ids[i]) , NULL , work , p);
		pthread_detach( p->ids[i] );
	}

	*tp = p;
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testl %esi, %esi
setle %cl
orb %al, %cl
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jne 0x76dc9
movq %rdi, %rbx
movl %esi, %r12d
leaq 0x88(,%r12,8), %rdi
callq 0x83f0
testq %rax, %rax
je 0x76dc9
movq %rax, %r14
xorl %r13d, %r13d
movq %rax, %rdi
xorl %esi, %esi
callq 0x8480
leaq 0x28(%r14), %rdi
xorl %esi, %esi
callq 0x8370
movq %r14, %rax
addq $0x88, %rax
movq %rax, 0x58(%r14)
movl %r13d, 0x60(%r14)
movq $0x0, 0x78(%r14)
movl %r13d, 0x80(%r14)
shlq $0x3, %r12
leaq 0x42(%rip), %r15        # 0x76ddb
movq 0x58(%r14), %rdi
addq %r13, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0x8540
movq 0x58(%r14), %rax
movq (%rax,%r13), %rdi
callq 0x81b0
addq $0x8, %r13
cmpq %r13, %r12
jne 0x76d99
movq %r14, (%rbx)
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/shifengbin[P]bishe/TaskControl/threadpool.c
// Function: work
static void *work( void* arg)
{
	ThreadPool_t * pool = ( ThreadPool_t*)arg;
	ThreadPoolTask *t;	
//	printf("start:%x\n",pthread_self());
	while(1)
	{
		pthread_mutex_lock(&(pool->lock));
		while(pool->head.next== NULL && !pool->isdestroy)
		{
			pthread_cond_wait(&(pool->cond),&(pool->lock));
		}
		pool->count++;
		if( pool->isdestroy)
		{
			pthread_mutex_unlock(&(pool->lock));
			break;
		}
		

		t = pool->head.next;
		pool->head.next = t->next;

		pthread_mutex_unlock(&(pool->lock));
		
		//printf("Task:%x\n",pthread_self());
		// run task
		t->task(t->arg);
		if ( t != NULL )
		{
			free(t);
		}
		//task end
		pthread_mutex_lock( &(pool->lock) );
		pool->count--;
		pthread_mutex_unlock( &(pool->lock ) );
	}
//	printf("threadend:%x\n",pthread_self());
	return (void*)0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x28(%rdi), %r14
movq %rbx, %rdi
callq 0x8450
movq 0x78(%rbx), %r15
testq %r15, %r15
jne 0x76e13
cmpl $0x0, 0x80(%rbx)
jne 0x76e53
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8490
jmp 0x76df4
incl 0x60(%rbx)
cmpl $0x0, 0x80(%rbx)
jne 0x76e56
movq 0x10(%r15), %rax
movq %rax, 0x78(%rbx)
movq %rbx, %rdi
callq 0x8200
movq 0x8(%r15), %rdi
callq *(%r15)
movq %r15, %rdi
callq 0x8360
movq %rbx, %rdi
callq 0x8450
decl 0x60(%rbx)
movq %rbx, %rdi
callq 0x8200
jmp 0x76dec
incl 0x60(%rbx)
movq %rbx, %rdi
callq 0x8200
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/shifengbin[P]bishe/TaskControl/threadpool.c
// Function: destroyThreadPool
int destroyThreadPool( ThreadPool **tp  )
{
	ThreadPool_t *p = (ThreadPool_t *)*tp;
	int i;
	if ( tp == NULL )
		return -1;
	if ( p == NULL)
		return 0;
	p->isdestroy = 1;
	pthread_cond_broadcast(&(p->cond));
	
/*	for( i = 0; i < p->count; i++)
	{
		pthread_join(p->ids[i],NULL);
	}
*/
	pthread_mutex_destroy(&(p->lock));
	pthread_cond_destroy(&(p->cond));
	if ( p != NULL )
	{
		free(p);
		*tp = NULL;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %r14
testq %r14, %r14
je 0x76eb6
movq %rdi, %rbx
movl $0x1, 0x80(%r14)
leaq 0x28(%r14), %r15
movq %r15, %rdi
callq 0x80e0
movq %r14, %rdi
callq 0x8340
movq %r15, %rdi
callq 0x8550
movq %r14, %rdi
callq 0x8360
movq $0x0, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/shifengbin[P]bishe/TaskControl/threadpool.c
// Function: addTask
int addTask( ThreadPool *tp , void (*func)(void*) , void*arg)
{
	ThreadPool_t *p = (ThreadPool_t*) tp;
	ThreadPoolTask *mtask,*t;
	if ( p == NULL || func == NULL )
		return -1;

	t = (ThreadPoolTask*)malloc(sizeof(ThreadPoolTask));
	if ( t  == NULL)
		return -1;
	t->task = func;
	t->arg = arg;

	mtask = &(p->head);
	pthread_mutex_lock(&(p->lock));
	while(	mtask->next != NULL)
	{
		mtask = mtask->next;
	}
	t->next = NULL;
	mtask->next = t;
	pthread_mutex_unlock(&(p->lock));
	
	pthread_cond_signal(&(p->cond));
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jne 0x76f44
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movl $0x18, %edi
callq 0x83f0
testq %rax, %rax
je 0x76f44
movq %rax, %r14
movq %r12, (%rax)
movq %r15, 0x8(%rax)
leaq 0x68(%rbx), %r15
movq %rbx, %rdi
callq 0x8450
movq %r15, %rax
movq 0x10(%r15), %r15
testq %r15, %r15
jne 0x76f15
movq $0x0, 0x10(%r14)
movq %r14, 0x10(%rax)
movq %rbx, %rdi
callq 0x8200
addq $0x28, %rbx
movq %rbx, %rdi
callq 0x8030
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/theandrew168[P]skylark/src/op_test.c
// Function: test_operation_CLS_00E0
bool
test_operation_CLS_00E0(void)
{
    struct chip8 chip8 = { 0 };
    chip8_init(&chip8);

    struct instruction inst = {
        .opcode = OPCODE_CLS_00E0,
    };

    // manually turn on all pixels
    for (long i = 0; i < CHIP8_DISPLAY_WIDTH * CHIP8_DISPLAY_HEIGHT; i++) {
        chip8.display[i] = true;
    }

    uint16_t pc_before = chip8.pc;
    int rc = operation_CLS_00E0(&chip8, &inst);
    if (rc != CHIP8_OK) {
        fprintf(stderr, "operation_CLS_00E0 returned an error: %s\n", operation_error_message(rc));
        return false;
    }

    for (long i = 0; i < CHIP8_DISPLAY_WIDTH * CHIP8_DISPLAY_HEIGHT; i++) {
        if (chip8.display[i] == true) {
            fprintf(stderr, "operation_CLS_00E0 failed to clear all pixels\n");
            return false;
        }
    }

    if (chip8.pc != pc_before + 2) {
        fprintf(stderr, "operation_CLS_00E0 failed to increment program counter\n");
        return false;
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x1848, %rsp           # imm = 0x1848
movq %rsp, %rbx
movl $0x1848, %edx           # imm = 0x1848
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1050
movq %rbx, %rdi
callq 0x1c7c
leaq 0x1046(%rsp), %rbx
movzwl -0x34(%rbx), %ebp
movl $0x800, %edx            # imm = 0x800
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1050
addl $0x2, %ebp
movw %bp, -0x34(%rbx)
movl $0x1046, %eax           # imm = 0x1046
cmpb $0x1, (%rsp,%rax)
je 0x14e3
incq %rax
cmpq $0x1846, %rax           # imm = 0x1846
jne 0x14bf
movzwl %bp, %ecx
movb $0x1, %al
cmpl %ecx, %ebp
jne 0x14ea
addq $0x1848, %rsp           # imm = 0x1848
popq %rbx
popq %rbp
retq
callq 0x1102
jmp 0x14ef
callq 0x10e0
xorl %eax, %eax
jmp 0x14d9
// File: /workspace/github_c_makefile_star2_O3/theandrew168[P]skylark/src/main_test.c
// Function: main
int
main(int argc, char* argv[])
{
    long num_tests = sizeof(TESTS) / sizeof(*TESTS);

    long successful_tests = 0;
    long failed_tests = 0;

    for (long i = 0; i < num_tests; i++) {
        test_func test = TESTS[i];
        if (test()) {
            successful_tests++;
        } else {
            failed_tests++;
        }
    }

    printf("%ld successful %s, %ld failed %s\n",
        successful_tests,
        successful_tests == 1 ? "test" : "tests",
        failed_tests,
        failed_tests == 1 ? "test" : "tests");

    return failed_tests == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
xorl %r15d, %r15d
leaq 0x3753(%rip), %r12      # 0x4dc0
xorl %r14d, %r14d
xorl %ebx, %ebx
callq *(%r15,%r12)
movzbl %al, %ecx
xorb $0x1, %al
movzbl %al, %eax
addq %rax, %rbx
addq %rcx, %r14
addq $0x8, %r15
cmpq $0x30, %r15
jne 0x1672
cmpq $0x1, %r14
leaq 0xe97(%rip), %rax       # 0x2530
leaq 0xe95(%rip), %r8        # 0x2535
movq %r8, %rdx
cmoveq %rax, %rdx
cmpq $0x1, %rbx
cmoveq %rax, %r8
leaq 0xe58(%rip), %rdi       # 0x250e
movq %r14, %rsi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1030
xorl %eax, %eax
testq %rbx, %rbx
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/videolan[P]bitstream/examples/dvb_print_si.c
// Function: handle_pmt_es
static void handle_pmt_es(uint8_t *p_pmt, bool b_select)
{
    pmt_each_es(p_pmt, p_es) {
        uint16_t i_pid = pmtn_get_pid(p_es);
        uint8_t i_type = pmtn_get_streamtype(p_es);

        switch (i_type) {
            case PMT_STREAMTYPE_PRIVATE_PSI:
                pmtn_each_desc(p_es, p_desc) {
                    uint8_t tag = desc_get_tag(p_desc);

                    switch (tag) {
                        case 0x6f:
                            if (b_select)
                                p_pids[i_pid].i_psi_refcount++;
                            else
                                p_pids[i_pid].i_psi_refcount--;
                            break;
                        default:
                            break;
                    }
                }
                break;
            case PMT_STREAMTYPE_SCTE_35:
                if (b_select)
                    p_pids[i_pid].i_psi_refcount++;
                else
                    p_pids[i_pid].i_psi_refcount--;
                break;
            default:
                break;
        }
    }
}

// Assembly:
movzbl 0x1(%rdi), %eax
movzbl 0x2(%rdi), %ecx
andl $0xf, %eax
shll $0x8, %eax
leal (%rcx,%rax), %edx
decl %edx
movzbl 0xa(%rdi), %eax
movzbl 0xb(%rdi), %ecx
andl $0xf, %eax
shll $0x8, %eax
movzwl %dx, %edx
leaq (%rax,%rcx), %r8
addq $0xc, %r8
cmpq %rdx, %r8
jge 0x7e93
pushq %rbx
orq %rcx, %rax
addq %rdi, %rax
addq $0xc, %rax
movzbl %sil, %ecx
decl %ecx
orl $0x1, %ecx
movzbl 0x1(%rdi), %edx
movzbl 0x2(%rdi), %esi
andl $0xf, %edx
shll $0x8, %edx
addl %esi, %edx
decl %edx
movzwl %dx, %edx
leaq 0x1538f(%rip), %rsi     # 0x1d150
movzbl 0x1(%rax), %r8d
movzbl 0x2(%rax), %r9d
andl $0x1f, %r8d
shll $0x8, %r8d
orq %r9, %r8
movzbl (%rax), %r9d
cmpl $0x86, %r9d
je 0x7e4c
cmpl $0x5, %r9d
jne 0x7e58
movzbl 0x3(%rax), %r9d
movzbl 0x4(%rax), %r10d
andl $0xf, %r9d
shll $0x8, %r9d
orl %r10d, %r9d
cmpl $0x2, %r9d
jb 0x7e58
leaq 0x5(%rax), %r9
leaq (%r8,%r8,2), %r8
leaq (%rsi,%r8,8), %r8
movzbl 0x3(%rax), %r10d
movzbl 0x4(%rax), %r11d
andl $0xf, %r10d
shll $0x8, %r10d
orq %r11, %r10
addq %r9, %r10
cmpb $0x6f, (%r9)
jne 0x7e31
addl %ecx, (%r8)
movzbl 0x1(%r9), %r11d
leaq (%r9,%r11), %rbx
addq $0x4, %rbx
addq %r11, %r9
addq $0x2, %r9
cmpq %r10, %rbx
jbe 0x7e28
jmp 0x7e58
movzwl %r8w, %r8d
leaq (%r8,%r8,2), %r8
addl %ecx, (%rsi,%r8,8)
movq %rax, %r8
subq %rdi, %r8
addq $0x5, %r8
cmpq %rdx, %r8
jg 0x7e92
movzbl 0x3(%rax), %r8d
movzbl 0x4(%rax), %r9d
andl $0xf, %r8d
shll $0x8, %r8d
orq %r9, %r8
addq %r8, %rax
addq $0x5, %rax
movq %rax, %r8
subq %rdi, %r8
cmpq %rdx, %r8
jl 0x7dc1
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/videolan[P]bitstream/examples/./bitstream/mpeg/psi/descriptors.h
// Function: desc_print_begin
static inline void desc_print_begin(const uint8_t *p_desc, f_print pf_print,
                                    void *opaque, print_type_t i_print_type)
{

    switch (i_print_type) {
    case PRINT_XML:
    {
        uint8_t i, i_length = desc_get_length(p_desc);
        char psz_value[2 * i_length + 1];

        for (i = 0; i < i_length; i++)
            sprintf(psz_value + 2 * i, "%2.2hhx", p_desc[2 + i]);
        psz_value[2 * i] = '\0';

        pf_print(opaque, "<DESC id=\"0x%02x\" length=\"%u\" value=\"%s\">",
                 desc_get_tag(p_desc), i_length, psz_value);
        break;
    }
    default:
        break;
    }
}

// Assembly:
cmpl $0x1, %esi
jne 0xf95e
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq %rsp, %r15
movzbl 0x1(%rdi), %r14d
leal 0x10(,%r14,2), %eax
andl $-0x10, %eax
movq %rsp, %r8
subq %rax, %r8
movq %r8, %rsp
testl %r14d, %r14d
je 0xf932
movq %r15, -0x38(%rbp)
leaq 0x2472(%rip), %r12      # 0x11d6d
movq %r8, -0x30(%rbp)
movq %r8, %r13
xorl %r15d, %r15d
movzbl 0x2(%rbx,%r15), %edx
movq %r13, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x21e0
incq %r15
addq $0x2, %r13
cmpq %r15, %r14
jne 0xf905
leal (%r14,%r14), %eax
movq -0x38(%rbp), %r15
movq -0x30(%rbp), %r8
jmp 0xf934
xorl %eax, %eax
movb $0x0, (%r8,%rax)
movzbl (%rbx), %edx
leaq 0x2432(%rip), %rsi      # 0x11d75
movl %r14d, %ecx
xorl %eax, %eax
callq 0x7e94
movq %r15, %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/videolan[P]bitstream/examples/./bitstream/mpeg/psi/descriptors.h
// Function: desc46_print
static inline uint8_t *desc_check(const uint8_t *p_desc,
                                  const uint8_t *p_desc_n,
                                  uint8_t size)
{
    if (!p_desc || !p_desc_n ||
        p_desc_n < p_desc + DESC_HEADER_SIZE ||
        p_desc_n + size > p_desc + DESC_HEADER_SIZE + desc_get_length(p_desc))
        return NULL;
    return (uint8_t *)p_desc_n;
}

// Assembly:
cmpb $0x5, 0x1(%rdi)
jb 0xfc49
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
leaq 0x2(%rdi), %r13
leaq 0x7(%rdi), %rbp
leaq 0x53d8(%rip), %r15      # 0x14f1a
leaq 0x537e(%rip), %r12      # 0x14ec7
leaq -0x5(%rbp), %rax
movzbl (%r14), %edx
cmpl $0x1, %ebx
jne 0xfb88
cmpl $0x46, %edx
leaq 0x535d(%rip), %rdx      # 0x14ebd
leaq 0x5352(%rip), %rcx      # 0x14eb9
cmoveq %rcx, %rdx
movzbl -0x2(%rbp), %edi
movl %edi, %r8d
shrl $0x3, %r8d
cmpl $0x28, %edi
jae 0xfbb6
leaq 0xd21e(%rip), %rcx      # 0x1cda0
movq (%rcx,%r8,8), %r9
jmp 0xfbcc
cmpl $0x46, %edx
movq %r15, %rcx
leaq 0x5381(%rip), %rsi      # 0x14f16
cmoveq %rsi, %rcx
movzbl -0x2(%rbp), %edi
movl %edi, %r9d
shrl $0x3, %r9d
cmpl $0x28, %edi
jae 0xfbee
leaq 0xd1f0(%rip), %rsi      # 0x1cda0
movq (%rsi,%r9,8), %r10
jmp 0xfc04
cmpb $0x5, %r8b
leaq 0x261e(%rip), %r9       # 0x121df
leaq 0x53b8(%rip), %rcx      # 0x14f80
cmoveq %rcx, %r9
andl $0x7, %edi
movzbl -0x1(%rbp), %r10d
leaq 0x5292(%rip), %rsi      # 0x14e6d
movq %rax, %rcx
xorl %eax, %eax
pushq %r10
pushq %rdi
callq 0x7e94
addq $0x10, %rsp
jmp 0xfc26
cmpb $0x5, %r9b
leaq 0x25e6(%rip), %r10      # 0x121df
leaq 0x5380(%rip), %rsi      # 0x14f80
cmoveq %rsi, %r10
andl $0x7, %edi
movzbl -0x1(%rbp), %r11d
subq $0x8, %rsp
movq %r12, %rsi
movq %rax, %r8
xorl %eax, %eax
pushq %r11
pushq %rdi
pushq %r10
callq 0x7e94
addq $0x20, %rsp
movzbl 0x1(%r14), %eax
addq %r13, %rax
addq $0x5, %rbp
cmpq %rax, %rbp
jbe 0xfb49
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/videolan[P]bitstream/examples/./bitstream/dvb/si/desc_7f06.h
// Function: desc7f06_print
static inline void desc7f06_print(const uint8_t *p_desc, f_print pf_print,
                                  void *opaque, print_type_t i_print_type)
{
    uint8_t language_code_present = desc7f06_get_language_code_present(p_desc);
    char language_code[4];
    if (language_code_present) {
        uint32_t v = desc7f06_opt_get_language_code(p_desc);
        language_code[0] = v >> 16;
        language_code[1] = v >> 8;
        language_code[2] = v;
        language_code[3] = '\0';
    } else {
        language_code[0] = '\0';
    }

    switch (i_print_type) {
    case PRINT_XML:
        pf_print(opaque,
                 "<SUPPLEMENTARY_AUDIO_DESC"
                 " mix_type=\"%u\""
                 " editorial_classification=\"%u\""
                 ">",
                 desc7f06_get_mix_type(p_desc),
                 desc7f06_get_editorial_classification(p_desc)
                );
        if (language_code_present)
            pf_print(opaque,
                     "<SUPPLEMENTARY_AUDIO_LANG code=\"%s\"/>",
                     language_code
                    );
        pf_print(opaque, "</SUPPLEMENTARY_AUDIO_DESC>");
        break;
    default:
        pf_print(opaque,
                 "    - desc 7f06 supplementary_audio"
                 " mix_type=%u"
                 " editorial_classification=%u",
                 desc7f06_get_mix_type(p_desc),
                 desc7f06_get_editorial_classification(p_desc)
                );
        if (language_code_present)
            pf_print(opaque,
                     "        - language code=\"%s\"", language_code);
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movzbl 0x3(%rdi), %ebx
testb $0x1, %bl
jne 0xfea2
movb $0x0, 0xc(%rsp)
jmp 0xfeb7
movzwl 0x4(%rdi), %eax
movb 0x6(%rdi), %cl
movw %ax, 0xc(%rsp)
movb %cl, 0xe(%rsp)
movb $0x0, 0xf(%rsp)
movl %ebx, %edx
shrl $0x7, %edx
movl %ebx, %eax
shrb $0x2, %al
andb $0x1f, %al
movzbl %al, %ecx
cmpl $0x1, %esi
jne 0xff01
leaq 0x815c(%rip), %rsi      # 0x1802e
xorl %eax, %eax
callq 0x7e94
testb $0x1, %bl
je 0xfef1
leaq 0x8190(%rip), %rsi      # 0x18075
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x7e94
leaq 0x81a3(%rip), %rsi      # 0x1809b
xorl %eax, %eax
callq 0x7e94
jmp 0xff27
leaq 0x81af(%rip), %rsi      # 0x180b7
xorl %eax, %eax
callq 0x7e94
testb $0x1, %bl
je 0xff27
leaq 0x81e8(%rip), %rsi      # 0x18103
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x7e94
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/videolan[P]bitstream/examples/./bitstream/dvb/si/desc_7f15.h
// Function: desc7f15_validate
static inline bool desc7f15_validate(const uint8_t *p_desc)
{
    uint8_t size = DESC7F15_HEADER_SIZE - DESC_HEADER_SIZE;
    if (desc_get_length(p_desc) < size)
        return false;
    if (desc7f15_get_ac4_config_flag(p_desc))
        size += 1;
    if (desc7f15_get_ac4_toc_flag(p_desc))
        size += 1;
    if (desc_get_length(p_desc) < size)
        return false;
    size += desc7f15_get_ac4_toc_len(p_desc);
    return desc_get_length(p_desc) >= size;
}

// Assembly:
movb 0x1(%rdi), %al
cmpb $0x2, %al
jb 0xff4d
movzbl 0x3(%rdi), %edx
movl %edx, %ecx
notb %cl
shrb $0x7, %cl
xorb $0x3, %cl
btl $0x6, %edx
adcb $0x0, %cl
cmpb %cl, %al
jae 0xff50
xorl %eax, %eax
retq
testb $0x40, %dl
jne 0xff59
xorl %edx, %edx
jmp 0xff63
shrb $0x7, %dl
movzbl %dl, %edx
movb 0x4(%rdi,%rdx), %dl
addb %cl, %dl
cmpb %dl, %al
setae %al
retq
// File: /workspace/github_c_makefile_star2_O3/videolan[P]bitstream/examples/./bitstream/dvb/si/desc_7f15.h
// Function: desc7f15_print
static inline void desc7f15_print(const uint8_t *p_desc, f_print pf_print,
                                  void *opaque, print_type_t i_print_type)
{
    uint8_t config = desc7f15_get_ac4_config_flag(p_desc);

    switch (i_print_type) {
    case PRINT_XML:
        pf_print(opaque, "<AC4_DESC ac4_toc=\"%u\">",
                 desc7f15_get_ac4_toc_flag(p_desc));
        if (config)
            pf_print(opaque,
                     "<AC4_CONFIG"
                     " ac4_dialog_enhancement_enabled=\"%u\""
                     " ac4_channel_mode=\"%s\"/>",
                     desc7f15_get_ac4_dialog_enhancement_enabled(p_desc),
                     desc7f15_ac4_channel_mode_str(
                         desc7f15_get_ac4_channel_mode(p_desc))
                    );
        pf_print(opaque, "</AC4_DESC>");
        break;
    default:
        pf_print(opaque, "    - desc 7f15 ac-4%s",
                 desc7f15_get_ac4_toc_flag(p_desc) ?  " ac4_toc" : "");
        if (config)
            pf_print(opaque, "        - config%s ac4_channel_mode=\"%s\"",
                     desc7f15_get_ac4_dialog_enhancement_enabled(p_desc) ?
                     " ac4_dialog_enhancement_enabled" : "",
                     desc7f15_ac4_channel_mode_str(
                         desc7f15_get_ac4_channel_mode(p_desc)));
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movzbl 0x3(%rdi), %ebp
cmpl $0x1, %esi
jne 0xffc9
movl %ebp, %edx
shrl $0x6, %edx
andl $0x1, %edx
leaq 0x8196(%rip), %rsi      # 0x18120
xorl %eax, %eax
callq 0x7e94
testb %bpl, %bpl
jns 0xffb7
leaq 0x8258(%rip), %rcx      # 0x181f5
cmpb $0x0, 0x3(%r14)
js 0x1001a
xorl %eax, %eax
movzbl %al, %edx
leaq 0x8188(%rip), %rsi      # 0x18138
xorl %eax, %eax
callq 0x7e94
leaq 0x81c2(%rip), %rsi      # 0x18180
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x7e94
testb $0x40, %bpl
leaq 0x8d4e(%rip), %rbx      # 0x18d22
leaq 0x81c8(%rip), %rdx      # 0x181a3
cmoveq %rbx, %rdx
leaq 0x81a6(%rip), %rsi      # 0x1818c
xorl %eax, %eax
callq 0x7e94
testb %bpl, %bpl
js 0xfff7
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x81f7(%rip), %rcx      # 0x181f5
cmpb $0x0, 0x3(%r14)
js 0x10046
leaq 0x81a0(%rip), %rsi      # 0x181ac
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x7e94
movzbl 0x4(%r14), %edx
movl %edx, %eax
shrb $0x7, %al
shrl $0x5, %edx
andl $0x3, %edx
leaq 0x157b(%rip), %rsi      # 0x115ac
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
leaq 0x81b9(%rip), %rcx      # 0x181fa
jmp 0xffa6
movb 0x4(%r14), %al
testb %al, %al
leaq 0x8ccf(%rip), %rdx      # 0x18d22
leaq 0x817b(%rip), %rbx      # 0x181d5
cmovnsq %rdx, %rbx
shrb $0x5, %al
andb $0x3, %al
movzbl %al, %eax
leaq 0x152f(%rip), %rdx      # 0x1159c
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
leaq 0x817d(%rip), %rcx      # 0x181fa
jmp 0x10005
leaq 0x817b(%rip), %rcx      # 0x18201
jmp 0xffa6
leaq 0x816f(%rip), %rcx      # 0x18201
jmp 0x10005
leaq 0x216a(%rip), %rcx      # 0x12208
jmp 0xffa6
leaq 0x215e(%rip), %rcx      # 0x12208
jmp 0x10005
// File: /workspace/github_c_makefile_star2_O3/videolan[P]bitstream/examples/./bitstream/dvb/si/desc_7f19.h
// Function: desc7f19_validate
static inline bool desc7f19_validate(const uint8_t *p_desc)
{
    uint8_t size = DESC7F19_HEADER_SIZE - DESC_HEADER_SIZE;
    uint8_t desc_length = desc_get_length(p_desc);
    if (size > desc_length)
        return false;
    desc7f19_each_presel(p_desc, p_desc_n)
        size += desc7f19_presel_get_length(p_desc_n);
    return size == desc_length;
}

// Assembly:
movzbl 0x1(%rdi), %eax
cmpq $0x2, %rax
jae 0x100bc
xorl %eax, %eax
retq
pushq %rbp
pushq %r14
pushq %rbx
movb $0x2, %cl
cmpb $0x4, %al
jb 0x10195
movl $0x4, %edx
xorl %esi, %esi
leaq (%rdi,%rdx), %r10
movzbl 0x1(%rdi,%rdx), %r11d
xorl %r8d, %r8d
testb $0x8, %r11b
setne %r8b
leal (%r8,%r8,2), %ebp
addl $0x2, %ebp
movl %r11d, %r9d
shrl $0x2, %r9d
andl $0x1, %r9d
movl %r11d, %ebx
andb $0x1, %bl
btl $0x1, %r11d
movl %r9d, %r8d
adcb %bl, %r8b
addb %bpl, %r8b
testb $0x2, %r11b
jne 0x10137
testb %bl, %bl
je 0x10165
addq $0x2, %r10
testb $0x8, %r11b
movq %r10, %rbx
cmoveq %rsi, %rbx
addq $0x3, %rbx
testb $0x8, %r11b
cmoveq %r10, %rbx
movb (%rbx,%r9), %r9b
jmp 0x10172
addq $0x2, %r10
testb $0x8, %r11b
movl $0x0, %r14d
cmovneq %r10, %r14
addq $0x3, %r14
testb $0x8, %r11b
cmoveq %r10, %r14
movzbl (%r14,%r9), %r10d
shrl $0x5, %r10d
addb %r10b, %r8b
testb %bl, %bl
jne 0x1016a
addb %r8b, %cl
jmp 0x1017f
addq %r9, %r14
movb 0x1(%r14,%r10), %r9b
andb $0x1f, %r9b
addb %r8b, %cl
addb %r9b, %cl
addb %r9b, %r8b
movzbl %r8b, %r8d
addq %r8, %rdx
cmpq $0x2, %rdx
jb 0x10195
cmpq %rax, %rdx
jbe 0x100d1
cmpb %al, %cl
sete %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-emit.c
// Function: emit_file
ULONG emit_file(UBYTE * bytes, LONG length)
{
    static UBYTE buffer[EMIT_FILEBUF_SIZE];
    static ULONG position;

    if( length==EMIT_FILE_INIT ) {
        position = 0;
        return 1;

    } else if( length>0 ) {
        while( (position+length) >= EMIT_FILEBUF_SIZE ) { // if we have to flush buffer
            length -= (EMIT_FILEBUF_SIZE-position);

            while( position < EMIT_FILEBUF_SIZE ) { // fill buffer to the end, if possible
                buffer[position++] = *(bytes++);
            }

            if( EMIT_FILEBUF_SIZE!=fwrite(buffer, 1, EMIT_FILEBUF_SIZE, wrk.file_out) ) {
                printf("mhmt-emit.c:emit_file() can't write to file!\n");
                return 0;
            }

            position=0;
        }

        while( length-- ) { // if something left that does not need flushing
            buffer[position++] = *(bytes++);
        }

        return 1;

    } else if( length==EMIT_FILE_FINISH ) {
        if( position>0 ) { // do we have anything to flush?
            if( position!=fwrite(buffer, 1, position, wrk.file_out) ) {
                printf("mhmt-emit.c:emit_file() can't write to file!\n");
                return 0;
            }
        }

        return 1;

    } else {
        printf("mhmt-emit.c:emit_file() encountered invalid arguments!\n");
        return 0;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
cmpl $-0x1, %esi
je 0x16d4
movl %esi, %r14d
testl %esi, %esi
jle 0x16e5
movq %rdi, %rbx
movl 0x9be7(%rip), %r12d     # 0xb200
leal (%r12,%r14), %eax
cmpl $0x1000, %eax           # imm = 0x1000
jb 0x16a9
leaq 0x8bd1(%rip), %r15      # 0xa200
leaq 0x9cea(%rip), %r13      # 0xb320
cmpl $0xfff, %r12d           # imm = 0xFFF
ja 0x165f
movl %r12d, %eax
movb (%rbx), %cl
incq %rbx
movb %cl, (%rax,%r15)
incq %rax
cmpl $0x1000, %eax           # imm = 0x1000
jne 0x1642
movl $0x1000, 0x9ba1(%rip)   # imm = 0x1000
movq 0x38(%r13), %rcx
movl $0x1, %esi
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rdi
callq 0x1130
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x1725
addl %r12d, %r14d
addl $0xfffff000, %r14d      # imm = 0xFFFFF000
movl $0x0, 0x9b6b(%rip)      # 0xb200
xorl %r12d, %r12d
cmpl $0xfff, %r14d           # imm = 0xFFF
ja 0x1636
xorl %r12d, %r12d
testl %r14d, %r14d
je 0x16de
movl %r14d, %edx
movl %r12d, %eax
xorl %ecx, %ecx
leaq 0x8b48(%rip), %rsi      # 0xa200
leal (%rax,%rcx), %edi
movb (%rbx,%rcx), %r8b
movb %r8b, (%rdi,%rsi)
incq %rcx
cmpl %ecx, %edx
jne 0x16b8
addl %ecx, %eax
movl %eax, 0x9b2e(%rip)      # 0xb200
jmp 0x16de
movl $0x0, 0x9b22(%rip)      # 0xb200
movl $0x1, %ebx
jmp 0x1733
je 0x16f0
leaq 0x4a9c(%rip), %rdi      # 0x618a
jmp 0x172c
movl 0x9b09(%rip), %r14d     # 0xb200
movl $0x1, %ebx
testq %r14, %r14
je 0x1733
leaq 0x9c18(%rip), %rax      # 0xb320
movq 0x38(%rax), %rcx
leaq 0x8aed(%rip), %rdi      # 0xa200
movl $0x1, %esi
movq %r14, %rdx
callq 0x1130
cmpq %r14, %rax
je 0x1733
leaq 0x4a95(%rip), %rdi      # 0x61c1
callq 0x1120
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-emit.c
// Function: emit_byte
ULONG emit_byte(UBYTE byte, ULONG operation)
{
    static UBYTE buffer[EMIT_BYTEBUF_SIZE];
    static ULONG in_pos, out_pos;
    ULONG success;

    switch( operation ) {
    case EMIT_BYTE_INIT:
        in_pos  = 0;
        out_pos = 0;
        return 1;

    case EMIT_BYTE_ADD:
#ifdef DBG
        printf("<%02x>",byte&0x00FF);
#endif
        buffer[in_pos] = byte;
        in_pos = (in_pos+1) & (EMIT_BYTEBUF_SIZE-1);

        if( in_pos==out_pos ) { // overflow!
            printf("mhmt-emit.c:emit_byte() buffer overflow!\n");
            return 0;
        }

        return 1;

    case EMIT_BYTE_FLUSH:
        if( in_pos==out_pos ) // nothing to do?
            return 1;

        else if( in_pos>out_pos ) { // no index wraparound
            success = emit_file( &buffer[out_pos], in_pos-out_pos );

        } else { // in_pos<out_pos - wraparound
            success = emit_file( &buffer[out_pos], EMIT_BYTEBUF_SIZE-out_pos );

            if( in_pos )
                success = success && emit_file( &buffer[0], in_pos );
        }

        out_pos=in_pos;
        return success;

    default:
        printf("mhmt-emit.c:emit_byte() encountered invalid arguments!\n");
        return 0;
    }
}

// Assembly:
pushq %rax
cmpl $0x2, %esi
je 0x1791
cmpl $0x1, %esi
je 0x1766
testl %esi, %esi
jne 0x17c3
xorl %eax, %eax
movl %eax, 0x9bba(%rip)      # 0xb310
movl %eax, 0x9bb8(%rip)      # 0xb314
movl $0x1, %eax
jmp 0x1805
movl 0x9ba4(%rip), %esi      # 0xb310
movl 0x9ba2(%rip), %ecx      # 0xb314
movl $0x1, %eax
cmpl %ecx, %esi
je 0x1805
leaq 0x9a8a(%rip), %rdi      # 0xb210
addq %rcx, %rdi
cmpl %ecx, %esi
jbe 0x17d3
subl %ecx, %esi
jmp 0x17f4
movl 0x9b79(%rip), %eax      # 0xb310
leaq 0x9a72(%rip), %rcx      # 0xb210
movb %dil, (%rax,%rcx)
incl %eax
movzbl %al, %ecx
movl %ecx, 0x9b63(%rip)      # 0xb310
movl $0x1, %eax
cmpl 0x9b5c(%rip), %ecx      # 0xb314
jne 0x1805
leaq 0x4a2d(%rip), %rdi      # 0x61ee
jmp 0x17ca
leaq 0x4a4d(%rip), %rdi      # 0x6217
callq 0x1120
xorl %eax, %eax
jmp 0x1805
movl $0x100, %esi            # imm = 0x100
subl %ecx, %esi
callq 0x15f2
movl 0x9b2b(%rip), %esi      # 0xb310
testl %esi, %esi
je 0x17f9
testl %eax, %eax
je 0x1807
leaq 0x9a1c(%rip), %rdi      # 0xb210
callq 0x15f2
movl 0x9b11(%rip), %ecx      # 0xb310
movl %ecx, 0x9b0f(%rip)      # 0xb314
popq %rcx
retq
xorl %eax, %eax
jmp 0x17f9
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-emit.c
// Function: emit_bits_flush
ULONG emit_bits_flush(ULONG bits)
{
    UBYTE store_byte;
    ULONG success = 1;

    if( wrk.wordbit ) { // 16bits
        if( wrk.bigend ) { // big endian
            store_byte = 0x00FF & (bits >> 8);
            success = success && emit_file( &store_byte, 1);
            store_byte = 0x00FF & bits;
            success = success && emit_file( &store_byte, 1);

        } else { // little endian
            store_byte = 0x00FF & bits;
            success = success && emit_file( &store_byte, 1);
            store_byte = 0x00FF & (bits >> 8);
            success = success && emit_file( &store_byte, 1);
        }

    } else { // 8bits
        store_byte = 0x00FF & bits;
        success = success && emit_file( &store_byte, 1);
    }

    return success;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0x8c32(%rip), %rax      # 0xb320
cmpl $0x0, 0x10(%rax)
je 0x2715
cmpl $0x0, 0x14(%rax)
je 0x271b
movb %bh, 0x7(%rsp)
leaq 0x7(%rsp), %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0x15f2
movb %bl, (%r14)
jmp 0x2730
movb %bl, 0x7(%rsp)
jmp 0x2734
leaq 0x7(%rsp), %rdi
movb %bl, (%rdi)
movl $0x1, %esi
callq 0x15f2
movb %bh, 0x7(%rsp)
testl %eax, %eax
je 0x2745
leaq 0x7(%rsp), %rdi
movl $0x1, %esi
callq 0x15f2
jmp 0x2747
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-globals.c
// Function: free_globals
void free_globals(void)
{
    if( wrk.indata ) free( wrk.indata );

    if( wrk.file_out ) fclose( wrk.file_out );

    if( wrk.file_in )  fclose( wrk.file_in );

    if( wrk.fname_out ) free( wrk.fname_out );

    if( wrk.fname_in )  free( wrk.fname_in );
}

// Assembly:
pushq %rax
movq 0x8bc9(%rip), %rdi      # 0xb360
testq %rdi, %rdi
je 0x27a1
callq 0x10c0
movq 0x8bb0(%rip), %rdi      # 0xb358
testq %rdi, %rdi
je 0x27b2
callq 0x1080
movq 0x8b97(%rip), %rdi      # 0xb350
testq %rdi, %rdi
je 0x27c3
callq 0x1080
movq 0x8b7e(%rip), %rdi      # 0xb348
testq %rdi, %rdi
je 0x27d4
callq 0x10c0
movq 0x8b65(%rip), %rdi      # 0xb340
testq %rdi, %rdi
je 0x27e6
popq %rax
jmp 0x10c0
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-hash.c
// Function: build_hash
UBYTE * build_hash(UBYTE * data, ULONG length)
{
    UBYTE * hash;
    ULONG i;
    UBYTE *src,*dst;
    UBYTE curr,prev,prev2;

    if( !length )
        return NULL;

    hash=(UBYTE *)malloc( length );

    if( !hash )
        return NULL;

    prev=curr=0;
    i=length;
    src = data;
    dst = hash;

    do {
        prev2 = (UBYTE)( (prev>>1) | (prev<<7) );
        prev  = (UBYTE)( (curr>>1) | (curr<<7) );
        curr  = *(src++);
        *(dst++) = curr^prev^prev2;
    } while( --i );

    return hash;
}

// Assembly:
testl %esi, %esi
je 0x282a
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, %r14d
movq %r14, %rdi
callq 0x10e0
testq %rax, %rax
je 0x282d
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
movl %edx, %edi
rorb %dil
movb (%rbx,%rcx), %dl
rorb %sil
xorb %dil, %sil
xorb %dl, %sil
movb %sil, (%rax,%rcx)
incq %rcx
movl %edi, %esi
cmpl %ecx, %r14d
jne 0x2809
jmp 0x282f
xorl %eax, %eax
retq
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-lz.c
// Function: get_lz_price_hrum
ULONG get_lz_price_hrum(ULONG position, struct lzcode * lzcode)
{
    ULONG varlen;
    LONG length,disp;
    length = lzcode->length;
    disp   = lzcode->disp;

    if( length==1 ) {
        if( disp==0 )
            return 9;

        else if( (-8)<=disp && disp<=(-1) )
            return 6;

        else
            goto INVALID_CODE_HRUM;

    } else if( length==2 ) {
        if( (-256)<=disp && disp<=(-1) )
            return 11;

        else
            goto INVALID_CODE_HRUM;

    } else if (3<=length && length<=255) {
        varlen = 3;

        if( 4<=length && length<=15 ) {
            varlen = 5;

            if( length>=6 ) varlen += 2;

            if( length>=9 ) varlen += 2;

            if( length>=12) varlen += 2;

        } else if( 15<length && length<=255 ) {
            varlen = 13;
        }

        if( (-256)<=disp && disp<=(-1) )
            varlen += 9;

        else if( (-4096)<=disp && disp<(-256) )
            varlen += 13;

        else
            goto INVALID_CODE_HRUM;

        return varlen;

    } else {
INVALID_CODE_HRUM:
        printf("mhmt-lz.c:get_lz_price_hrum(): Found invalid code length=%d, displacement=%d\n",length, disp);
        return 0;
    }
}

// Assembly:
pushq %rbx
movq %rsi, %rax
movl (%rsi), %esi
movl 0x4(%rax), %edx
cmpl $0x2, %esi
je 0x2c45
cmpl $0x1, %esi
jne 0x2c54
testl %edx, %edx
je 0x2c8a
movl $0x6, %ebx
cmpl $-0x9, %edx
jbe 0x2cc0
jmp 0x2cd0
movl $0xb, %ebx
cmpl $0xfffffeff, %edx       # imm = 0xFFFFFEFF
jbe 0x2cc0
jmp 0x2cd0
leal -0x3(%rsi), %eax
cmpl $0xfc, %eax
ja 0x2cc0
leal -0x4(%rsi), %eax
cmpl $0xb, %eax
ja 0x2c91
xorl %eax, %eax
cmpl $0x6, %esi
setae %al
leal 0x5(,%rax,2), %ecx
cmpl $0x9, %esi
leal 0x7(%rax,%rax), %eax
cmovbl %ecx, %eax
leal 0x2(%rax), %ebx
cmpl $0xc, %esi
cmovbl %eax, %ebx
jmp 0x2ca1
movl $0x9, %ebx
jmp 0x2cd0
cmpl $0x10, %esi
movl $0xd, %eax
movl $0x3, %ebx
cmovael %eax, %ebx
cmpl $0xffffff00, %edx       # imm = 0xFFFFFF00
jb 0x2cae
addl $0x9, %ebx
jmp 0x2cd0
leal 0x1000(%rdx), %eax
cmpl $0xeff, %eax            # imm = 0xEFF
ja 0x2cc0
addl $0xd, %ebx
jmp 0x2cd0
leaq 0x3714(%rip), %rdi      # 0x63db
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x1040
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-main.c
// Function: main
int main( int argc, char* argv[] )
{
    int error=0;
    ULONG parse_result;
    init_globals();
    // printf short info
    printf("mhmt - MeHruMsT - MEgalz, HRUM and hruST (c) 2009 lvd^nedopc\n\n");
    // parse arguments
    parse_result = parse_args(argc, argv);

    if( parse_result&ARG_PARSER_SHOWHELP ) {
        if( parse_result&ARG_PARSER_ERROR )
            printf("\n");

        show_help();
    }

    if( parse_result&ARG_PARSER_ERROR ) {
        printf("There were errors in arguments.\n");
        error++;

    } else if( parse_result&ARG_PARSER_GO ) {
        if( do_files() ) {
            dump_config();

            if( wrk.mode ) {
                error += depack() ? 0 : 1;

            } else {
                error += pack() ? 0 : 1;
            }

        } else {
            error++;
        }
    }

    free_globals();
    return error;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
callq 0x2750
leaq 0x3965(%rip), %rdi      # 0x6785
callq 0x1120
movl %ebp, %edi
movq %rbx, %rsi
callq 0x3790
movl %eax, %ebx
testb $0x1, %bl
je 0x2e4b
btl $0x8, %ebx
jae 0x2e46
movl $0xa, %edi
callq 0x10f0
callq 0x2ea7
btl $0x8, %ebx
jb 0x2e5a
testb $0x2, %bl
jne 0x2e6a
xorl %eax, %eax
jmp 0x2e96
leaq 0x3962(%rip), %rdi      # 0x67c3
callq 0x1120
movb $0x1, %al
jmp 0x2e96
callq 0x2fdf
testl %eax, %eax
je 0x2e66
callq 0x321e
leaq 0x84a1(%rip), %rax      # 0xb320
cmpl $0x0, 0x8(%rax)
je 0x2e8c
callq 0x4080
jmp 0x2e91
callq 0x35ec
testl %eax, %eax
sete %al
movzbl %al, %ebx
callq 0x278f
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq