LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/parserurl/parserurl.c
// Function: gethost
char *gethost( char *url)
{
	char *hosts,*hoste;
	char *rhttp ;
	if( url == NULL)
		return NULL;

	if ((hosts = strstr(url,"//")) == NULL)
	{
		return NULL;
	}
	hosts+=2;
	if ((hoste = strstr( hosts,":")) == NULL)
	{
		if((hoste = strstr(hosts,"/")) == NULL)
		{
			rhttp = (char*)malloc(strlen(hosts)+1);
			if ( rhttp == NULL)
				return NULL;
			memset(rhttp, 0 , strlen(hosts)+1);
			memcpy(rhttp, hosts,strlen(hosts));
			return rhttp;
		}
	}
	int len = hoste - hosts;
	rhttp = (char *)malloc(len + 1);
	memset( rhttp, 0 , len+1);
	memcpy( rhttp, hosts, len);
	return rhttp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xbf80
movq $0x0, -0x8(%rbp)
jmp 0xc0c1
movq -0x10(%rbp), %rdi
leaq 0x9617b(%rip), %rsi     # 0xa2106
callq 0x8090
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0xbfa7
movq $0x0, -0x8(%rbp)
jmp 0xc0c1
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x9e1fd(%rip), %rsi     # 0xaa1bb
callq 0x8090
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0xc074
movq -0x18(%rbp), %rdi
leaq 0x9612b(%rip), %rsi     # 0xa2107
callq 0x8090
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0xc072
movq -0x18(%rbp), %rdi
callq 0x8120
movq %rax, %rdi
addq $0x1, %rdi
callq 0x83b0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xc01c
movq $0x0, -0x8(%rbp)
jmp 0xc0c1
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0x8120
movq -0x48(%rbp), %rdi
movq %rax, %rdx
addq $0x1, %rdx
xorl %esi, %esi
callq 0x8160
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0x8120
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %rax, %rdx
callq 0x8220
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc0c1
jmp 0xc074
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x83b0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
xorl %esi, %esi
callq 0x8160
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
movslq -0x2c(%rbp), %rdx
callq 0x8220
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/parserurl/parserurl.c
// Function: getres
char *getres( char *url )
{
	char *u;
	char *find;
	char *ret;
	int len;

	if (url == NULL)
		return NULL;

	u = removehttp(url);
	if ( (find = strchr(u,'/')) == NULL)
	{
		free(u);
		ret = (char *)malloc(2);
		if (ret == NULL )
			return NULL;
		sprintf( ret , "/");
		return ret;
	}
	len = strlen(find);
	ret = (char *)malloc(len+1);
	if ( ret == NULL )
	{
		free(u);
		return NULL;
	}
	sprintf(ret , "%s", find);
	free(u);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xc320
movq $0x0, -0x8(%rbp)
jmp 0xc3e8
movq -0x10(%rbp), %rdi
callq 0xbe10
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl $0x2f, %esi
callq 0x8100
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0xc389
movq -0x18(%rbp), %rdi
callq 0x8320
movl $0x2, %edi
callq 0x83b0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xc36d
movq $0x0, -0x8(%rbp)
jmp 0xc3e8
movq -0x28(%rbp), %rdi
leaq 0x95d8f(%rip), %rsi     # 0xa2107
movb $0x0, %al
callq 0x8080
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc3e8
movq -0x20(%rbp), %rdi
callq 0x8120
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x83b0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xc3c1
movq -0x18(%rbp), %rdi
callq 0x8320
movq $0x0, -0x8(%rbp)
jmp 0xc3e8
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x9aa2c(%rip), %rsi     # 0xa6dfc
movb $0x0, %al
callq 0x8080
movq -0x18(%rbp), %rdi
callq 0x8320
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/parserurl/parserurl.c
// Function: parserURL
PURL *parserURL( PURL *u , char *url)
{
	PURL *ret;
	char *host;
	char *port;
	char *res;

	if (url == NULL)
		return NULL;
	host = gethost(url);
	port = getport(url);
	res =  getres(url);

	if (host == NULL )
	{
		if ( u == NULL || u->host == NULL)
			return NULL;
		host = (char *)malloc(strlen(u->host)+1);
		sprintf(host , "%s", u->host);
	}
	if (port == NULL )
	{
		if ( u == NULL || u->port == NULL)
			return NULL;
		port = (char *)malloc(strlen(u->port)+1);
		sprintf( port , "%s" , u->port);
	}
	ret = (PURL*)malloc(sizeof(PURL));
	if (ret == NULL )
	{
		if ( host == NULL)
			free(host);
		if ( port == NULL)
			free(port);
		if ( res == NULL )
			free(res);
		return NULL;
	}
	ret->host = host;
	ret->port = port;
	ret->res  = res;
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xc424
movq $0x0, -0x8(%rbp)
jmp 0xc57c
movq -0x18(%rbp), %rdi
callq 0xbf60
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0xc0d0
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
callq 0xc300
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xc4a5
cmpq $0x0, -0x10(%rbp)
je 0xc463
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0xc470
movq $0x0, -0x8(%rbp)
jmp 0xc57c
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x8120
movq %rax, %rdi
addq $0x1, %rdi
callq 0x83b0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x9a95e(%rip), %rsi     # 0xa6dfc
movb $0x0, %al
callq 0x8080
cmpq $0x0, -0x30(%rbp)
jne 0xc502
cmpq $0x0, -0x10(%rbp)
je 0xc4be
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xc4cb
movq $0x0, -0x8(%rbp)
jmp 0xc57c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x8120
movq %rax, %rdi
addq $0x1, %rdi
callq 0x83b0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x9a901(%rip), %rsi     # 0xa6dfc
movb $0x0, %al
callq 0x8080
movl $0x20, %edi
callq 0x83b0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xc551
cmpq $0x0, -0x28(%rbp)
jne 0xc527
movq -0x28(%rbp), %rdi
callq 0x8320
cmpq $0x0, -0x30(%rbp)
jne 0xc537
movq -0x30(%rbp), %rdi
callq 0x8320
cmpq $0x0, -0x38(%rbp)
jne 0xc547
movq -0x38(%rbp), %rdi
callq 0x8320
movq $0x0, -0x8(%rbp)
jmp 0xc57c
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/SockTool/sockutils.c
// Function: setnonblock
int setnonblock( int fd)
{
	int flags = fcntl( fd , F_GETFL); 
	if (flags < 0 )
		return -1;
	flags|=O_NONBLOCK;
	if ( fcntl( fd, F_SETFL , flags) < 0)
		return -1;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
movl -0x8(%rbp), %edi
movl $0x3, %esi
movb $0x0, %al
callq 0x8170
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0xc5fc
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc62e
movl -0xc(%rbp), %eax
orl $0x800, %eax            # imm = 0x800
movl %eax, -0xc(%rbp)
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %edx
movl $0x4, %esi
movb $0x0, %al
callq 0x8170
cmpl $0x0, %eax
jge 0xc627
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc62e
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/SockTool/sockutils.c
// Function: setblock
int setblock( int fd )
{
	int flags = fcntl( fd , F_GETFL); 
	if (flags < 0 )
		return -1;
	flags&=~O_NONBLOCK;
	if ( fcntl( fd, F_SETFL , flags) < 0)
		return -1;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
movl -0x8(%rbp), %edi
movl $0x3, %esi
movb $0x0, %al
callq 0x8170
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0xc66c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc69e
movl -0xc(%rbp), %eax
andl $0xfffff7ff, %eax       # imm = 0xFFFFF7FF
movl %eax, -0xc(%rbp)
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %edx
movl $0x4, %esi
movb $0x0, %al
callq 0x8170
cmpl $0x0, %eax
jge 0xc697
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc69e
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/SockTool/sockutils.c
// Function: read_timeout
int read_timeout( int fd , int sec)
{
	fd_set fds;
	struct timeval t;
	int ret;
	
	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;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jg 0xc6d3
movl $0x0, -0x4(%rbp)
jmp 0xc7f8
jmp 0xc6d5
leaq -0x90(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl $0x0, -0xa8(%rbp)
movl -0xa8(%rbp), %eax
cmpq $0x10, %rax
jae 0xc71f
movq -0xb0(%rbp), %rax
movl -0xa8(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0xc6ed
jmp 0xc721
movl -0x8(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x8(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x90(%rbp,%rax,8), %rcx
movq %rcx, -0x90(%rbp,%rax,8)
movslq -0xc(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq $0x0, -0x98(%rbp)
movl -0x8(%rbp), %edi
addl $0x1, %edi
leaq -0x90(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
leaq -0xa0(%rbp), %r8
movq %rcx, %rdx
callq 0x82b0
movl %eax, -0xa4(%rbp)
xorl %eax, %eax
cmpl $0x0, -0xa4(%rbp)
movb %al, -0xb1(%rbp)
jge 0xc7b6
callq 0x8050
cmpl $0x4, (%rax)
sete %al
movb %al, -0xb1(%rbp)
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0xc76e
cmpl $0x0, -0xa4(%rbp)
jge 0xc7d2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc7f8
cmpl $0x0, -0xa4(%rbp)
jne 0xc7ef
callq 0x8050
movl $0x6e, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc7f8
jmp 0xc7f1
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jg 0xc833
movl $0x0, -0x4(%rbp)
jmp 0xc958
jmp 0xc835
leaq -0x90(%rbp), %rax
movq %rax, -0xb8(%rbp)
movl $0x0, -0xac(%rbp)
movl -0xac(%rbp), %eax
cmpq $0x10, %rax
jae 0xc87f
movq -0xb8(%rbp), %rax
movl -0xac(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0xc84d
jmp 0xc881
movl -0x8(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x8(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x90(%rbp,%rax,8), %rcx
movq %rcx, -0x90(%rbp,%rax,8)
movslq -0xc(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq $0x0, -0xa0(%rbp)
movl -0x8(%rbp), %edi
addl $0x1, %edi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x90(%rbp), %rdx
leaq -0xa8(%rbp), %r8
movq %rcx, %rsi
callq 0x82b0
movl %eax, -0x94(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x94(%rbp)
movb %al, -0xb9(%rbp)
jge 0xc916
callq 0x8050
cmpl $0x4, (%rax)
sete %al
movb %al, -0xb9(%rbp)
movb -0xb9(%rbp), %al
testb $0x1, %al
jne 0xc8ce
cmpl $0x0, -0x94(%rbp)
jge 0xc932
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc958
cmpl $0x0, -0x94(%rbp)
jne 0xc94f
callq 0x8050
movl $0x6e, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc958
jmp 0xc951
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0xd0, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl $0x10, -0xb0(%rbp)
cmpl $0x0, -0x14(%rbp)
jg 0xc9a1
movl $0x0, -0x4(%rbp)
jmp 0xcaff
jmp 0xc9a3
leaq -0x98(%rbp), %rax
movq %rax, -0xc0(%rbp)
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpq $0x10, %rax
jae 0xc9ed
movq -0xc0(%rbp), %rax
movl -0xb4(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0xc9bb
jmp 0xc9ef
movl -0x8(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x8(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x98(%rbp,%rax,8), %rcx
movq %rcx, -0x98(%rbp,%rax,8)
movslq -0x14(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq $0x0, -0xa0(%rbp)
movl -0x8(%rbp), %edi
addl $0x1, %edi
leaq -0x98(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
leaq -0xa8(%rbp), %r8
movq %rcx, %rdx
callq 0x82b0
movl %eax, -0xac(%rbp)
xorl %eax, %eax
cmpl $0x0, -0xac(%rbp)
movb %al, -0xc1(%rbp)
jge 0xca84
callq 0x8050
cmpl $0x4, (%rax)
sete %al
movb %al, -0xc1(%rbp)
movb -0xc1(%rbp), %al
testb $0x1, %al
jne 0xca3c
cmpl $0x0, -0xac(%rbp)
jge 0xcaa0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xcaff
cmpl $0x0, -0xac(%rbp)
jne 0xcabd
callq 0x8050
movl $0x6e, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xcaff
jmp 0xcabf
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x8160
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x80c0
movl %eax, -0xac(%rbp)
cmpl $0x0, %eax
jge 0xcaf6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xcaff
movl -0xac(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0xd0, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jg 0xcb37
movl $0x0, -0x4(%rbp)
jmp 0xcce3
movl -0x8(%rbp), %edi
callq 0xc5d0
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
movl $0x10, %edx
callq 0x8230
movl %eax, -0x9c(%rbp)
cmpl $0x0, -0x9c(%rbp)
jge 0xccd2
callq 0x8050
cmpl $0x73, (%rax)
jne 0xccd2
jmp 0xcb73
leaq -0x98(%rbp), %rax
movq %rax, -0xc0(%rbp)
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpq $0x10, %rax
jae 0xcbbd
movq -0xc0(%rbp), %rax
movl -0xb4(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0xcb8b
jmp 0xcbbf
movl -0x8(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x8(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x98(%rbp,%rax,8), %rcx
movq %rcx, -0x98(%rbp,%rax,8)
movslq -0x14(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq $0x0, -0xa8(%rbp)
movl -0x8(%rbp), %edi
addl $0x1, %edi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x98(%rbp), %rdx
leaq -0xb0(%rbp), %r8
movq %rcx, %rsi
callq 0x82b0
movl %eax, -0x9c(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x9c(%rbp)
movb %al, -0xc9(%rbp)
jge 0xcc54
callq 0x8050
cmpl $0x4, (%rax)
sete %al
movb %al, -0xc9(%rbp)
movb -0xc9(%rbp), %al
testb $0x1, %al
jne 0xcc0c
cmpl $0x0, -0x9c(%rbp)
jle 0xcca4
movl -0x8(%rbp), %edi
movl $0x1, %esi
movl $0x4, %edx
leaq -0xc4(%rbp), %rcx
leaq -0xc8(%rbp), %r8
callq 0x81e0
cmpl $0x0, %eax
jne 0xcc98
movl $0x0, -0x9c(%rbp)
jmp 0xcca2
movl $0xffffffff, -0x9c(%rbp) # imm = 0xFFFFFFFF
jmp 0xccd0
cmpl $0x0, -0x9c(%rbp)
jne 0xccc4
callq 0x8050
movl $0x6e, (%rax)
movl $0xffffffff, -0x9c(%rbp) # imm = 0xFFFFFFFF
jmp 0xccce
movl $0xffffffff, -0x9c(%rbp) # imm = 0xFFFFFFFF
jmp 0xccd0
jmp 0xccd2
movl -0x8(%rbp), %edi
callq 0xc640
movl -0x9c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xcd28
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0xcd28
cmpl $0x0, -0x18(%rbp)
jge 0xcd31
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xcd9e
cmpl $0x0, -0x18(%rbp)
jne 0xcd40
movl $0x0, -0x4(%rbp)
jmp 0xcd9e
jmp 0xcd42
cmpl $0x0, -0x1c(%rbp)
jle 0xcd95
movl -0x8(%rbp), %edi
movq -0x28(%rbp), %rsi
movslq -0x1c(%rbp), %rdx
callq 0x83f0
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jge 0xcd6d
callq 0x8050
cmpl $0x4, (%rax)
jne 0xcd6d
jmp 0xcd42
cmpl $0x0, -0x2c(%rbp)
jne 0xcd75
jmp 0xcd95
movl -0x2c(%rbp), %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x2c(%rbp), %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0xcd93
jmp 0xcd42
movl -0x18(%rbp), %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xcddd
cmpl $0x0, -0x14(%rbp)
jge 0xcde6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xce47
cmpl $0x0, -0x14(%rbp)
jne 0xcdf5
movl $0x0, -0x4(%rbp)
jmp 0xce47
jmp 0xcdf7
cmpl $0x0, -0x18(%rbp)
jle 0xce40
movl -0x8(%rbp), %edi
movq -0x20(%rbp), %rsi
movslq -0x18(%rbp), %rdx
callq 0x80f0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jge 0xce22
callq 0x8050
cmpl $0x4, (%rax)
jne 0xce22
jmp 0xcdf7
movl -0x24(%rbp), %ecx
movl -0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0x24(%rbp), %ecx
movq -0x20(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
jmp 0xcdf7
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xce8b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xcf6d
jmp 0xce8d
cmpl $0x0, -0x18(%rbp)
jle 0xcf66
movl -0x8(%rbp), %edi
movq -0x20(%rbp), %rsi
movslq -0x18(%rbp), %rdx
movl $0x2, %ecx
callq 0x80d0
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jge 0xcec1
callq 0x8050
cmpl $0x4, (%rax)
jne 0xcec1
jmp 0xce8d
cmpl $0x0, -0x2c(%rbp)
jne 0xced3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xcf6d
jmp 0xced5
movq -0x20(%rbp), %rdi
movl $0xa, %esi
callq 0x8100
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xcf33
movl -0x8(%rbp), %edi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
subq %rcx, %rax
addq $0x1, %rax
movl %eax, %edx
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
subq %rcx, %rax
addq $0x1, %rax
movl %eax, %ecx
callq 0xccf0
movl %eax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x4(%rbp)
jmp 0xcf6d
movl -0x8(%rbp), %edi
movq -0x20(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl -0x2c(%rbp), %ecx
callq 0xccf0
movl -0x2c(%rbp), %ecx
movl -0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0x2c(%rbp), %ecx
movq -0x20(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
jmp 0xce8d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xa0d7c
cmpl $0x1, -0x14(%rbp)
jge 0xa0d88
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa0e71
movslq -0x14(%rbp), %rdi
shlq $0x3, %rdi
addq $0x88, %rdi
callq 0x83b0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xa0db3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa0e71
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8440
movq -0x20(%rbp), %rdi
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8330
movq -0x20(%rbp), %rcx
addq $0x88, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x60(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x78(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x80(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xa0e5f
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rdi
movslq -0x24(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x20(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq 0x46(%rip), %rdx        # 0xa0e80
callq 0x8500
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x81a0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xa0e10
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8410
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, 0x78(%rcx)
movb %al, -0x19(%rbp)
jne 0xa0ec0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x80(%rax)
setne %al
xorb $-0x1, %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
testb $0x1, %al
jne 0xa0ec9
jmp 0xa0edc
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
movq -0x10(%rbp), %rsi
callq 0x8450
jmp 0xa0e9d
movq -0x10(%rbp), %rax
movl 0x60(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x60(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x80(%rax)
je 0xa0f01
movq -0x10(%rbp), %rdi
callq 0x81f0
jmp 0xa0f6b
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rdi
callq 0x81f0
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rdi
callq *%rax
cmpq $0x0, -0x18(%rbp)
je 0xa0f47
movq -0x18(%rbp), %rdi
callq 0x8320
movq -0x10(%rbp), %rdi
callq 0x8410
movq -0x10(%rbp), %rax
movl 0x60(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x60(%rax)
movq -0x10(%rbp), %rdi
callq 0x81f0
jmp 0xa0e94
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xa0fa7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa100a
cmpq $0x0, -0x18(%rbp)
jne 0xa0fb7
movl $0x0, -0x4(%rbp)
jmp 0xa100a
movq -0x18(%rbp), %rax
movl $0x1, 0x80(%rax)
movq -0x18(%rbp), %rdi
addq $0x28, %rdi
callq 0x80e0
movq -0x18(%rbp), %rdi
callq 0x8300
movq -0x18(%rbp), %rdi
addq $0x28, %rdi
callq 0x8510
cmpq $0x0, -0x18(%rbp)
je 0xa1003
movq -0x18(%rbp), %rdi
callq 0x8320
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xa104a
cmpq $0x0, -0x18(%rbp)
jne 0xa1056
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa10ee
movl $0x18, %edi
callq 0x83b0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xa1074
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa10ee
movq -0x18(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
addq $0x68, %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x8410
movq -0x30(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0xa10b9
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0xa10a0
movq -0x38(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rdi
callq 0x81f0
movq -0x28(%rbp), %rdi
addq $0x28, %rdi
callq 0x8030
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/theandrew168[P]skylark/src/op_test.c
// Function: test_operation_UNDEFINED
bool
test_operation_UNDEFINED(void)
{
    struct chip8 chip8 = { 0 };
    chip8_init(&chip8);

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

    int rc = operation_UNDEFINED(&chip8, &inst);
    if (rc == CHIP8_OK) {
        fprintf(stderr, "operation_UNDEFINED failed to return an error\n");
        return false;
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1860, %rsp           # imm = 0x1860
leaq -0x184a(%rbp), %rdi
xorl %esi, %esi
movl $0x1848, %edx           # imm = 0x1848
callq 0x1050
leaq -0x184a(%rbp), %rdi
callq 0x2b20
movq 0x1d6f(%rip), %rax      # 0x32f0
movq %rax, -0x1858(%rbp)
movl 0x1d6a(%rip), %eax      # 0x32f8
movl %eax, -0x1850(%rbp)
leaq -0x184a(%rbp), %rdi
leaq -0x1858(%rbp), %rsi
callq 0x15f0
movl %eax, -0x185c(%rbp)
cmpl $0x0, -0x185c(%rbp)
jne 0x15d4
movq 0x4a3b(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x1e56(%rip), %rsi      # 0x341d
movb $0x0, %al
callq 0x1070
movb $0x0, -0x1(%rbp)
jmp 0x15d8
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1860, %rsp           # imm = 0x1860
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x1880, %rsp           # imm = 0x1880
leaq -0x184a(%rbp), %rdi
xorl %esi, %esi
movl $0x1848, %edx           # imm = 0x1848
callq 0x1050
leaq -0x184a(%rbp), %rdi
callq 0x2b20
movq 0x1cbb(%rip), %rax      # 0x32fc
movq %rax, -0x1858(%rbp)
movl 0x1cb6(%rip), %eax      # 0x3304
movl %eax, -0x1850(%rbp)
movq $0x0, -0x1860(%rbp)
cmpq $0x800, -0x1860(%rbp) # imm = 0x800
jge 0x168f
movq -0x1860(%rbp), %rax
movb $0x1, -0x804(%rbp,%rax)
movq -0x1860(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1860(%rbp)
jmp 0x165f
movw -0x838(%rbp), %ax
movw %ax, -0x1862(%rbp)
leaq -0x184a(%rbp), %rdi
leaq -0x1858(%rbp), %rsi
callq 0x17b0
movl %eax, -0x1868(%rbp)
cmpl $0x0, -0x1868(%rbp)
je 0x16fc
movq 0x4932(%rip), %rax      # 0x5ff8
movq (%rax), %rax
movq %rax, -0x1878(%rbp)
movl -0x1868(%rbp), %edi
callq 0x14d0
movq -0x1878(%rbp), %rdi
movq %rax, %rdx
leaq 0x1d60(%rip), %rsi      # 0x344c
movb $0x0, %al
callq 0x1070
movb $0x0, -0x1(%rbp)
jmp 0x1797
movq $0x0, -0x1870(%rbp)
cmpq $0x800, -0x1870(%rbp) # imm = 0x800
jge 0x1760
movq -0x1870(%rbp), %rax
movb -0x804(%rbp,%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x174a
movq 0x48c5(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x1d39(%rip), %rsi      # 0x3476
movb $0x0, %al
callq 0x1070
movb $0x0, -0x1(%rbp)
jmp 0x1797
jmp 0x174c
movq -0x1870(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1870(%rbp)
jmp 0x1707
movzwl -0x838(%rbp), %eax
movzwl -0x1862(%rbp), %ecx
addl $0x2, %ecx
cmpl %ecx, %eax
je 0x1793
movq 0x487c(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x1d1f(%rip), %rsi      # 0x34a5
movb $0x0, %al
callq 0x1070
movb $0x0, -0x1(%rbp)
jmp 0x1797
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1880, %rsp           # imm = 0x1880
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/theandrew168[P]skylark/src/op_test.c
// Function: test_operation_RET_00EE
bool
test_operation_RET_00EE(void)
{
    struct chip8 chip8 = { 0 };
    chip8_init(&chip8);

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

    // validate that calling RET_00EE with an empty stack returns an error
    chip8.sp = 0;
    int rc = operation_RET_00EE(&chip8, &inst);
    if (rc != OPERATION_ERROR_STACK_UNDERFLOW) {
        fprintf(stderr, "operation_RET_00EE did not underflow the stack\n");
        return false;
    }

    // execute a CALL_2nnn to setup a valid return
    operation_CALL_2nnn(&chip8, &(struct instruction){
        .opcode = OPCODE_CALL_2nnn,
        .nnn = 0x234,
    });

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

    // pc will be 0x0002 because the CALL_2nnn was made from pc == 0
    if (chip8.pc != 0x0002) {
        fprintf(stderr, "operation_RET_00EE returned to the wrong address\n");
        return false;
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1870, %rsp           # imm = 0x1870
leaq -0x184a(%rbp), %rdi
xorl %esi, %esi
movl $0x1848, %edx           # imm = 0x1848
callq 0x1050
leaq -0x184a(%rbp), %rdi
callq 0x2b20
movq 0x1ad7(%rip), %rax      # 0x3308
movq %rax, -0x1858(%rbp)
movl 0x1ad2(%rip), %eax      # 0x3310
movl %eax, -0x1850(%rbp)
movw $0x0, -0x816(%rbp)
leaq -0x184a(%rbp), %rdi
leaq -0x1858(%rbp), %rsi
callq 0x1970
movl %eax, -0x185c(%rbp)
cmpl $0x4, -0x185c(%rbp)
je 0x1890
movq 0x4782(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x1c5d(%rip), %rsi      # 0x34dd
movb $0x0, %al
callq 0x1070
movb $0x0, -0x1(%rbp)
jmp 0x195c
movl $0x5, -0x1868(%rbp)
movw $0x234, -0x1864(%rbp)   # imm = 0x234
movb $0x0, -0x1862(%rbp)
movb $0x0, -0x1861(%rbp)
movb $0x0, -0x1860(%rbp)
movb $0x0, -0x185f(%rbp)
leaq -0x184a(%rbp), %rdi
leaq -0x1868(%rbp), %rsi
callq 0x19f0
leaq -0x184a(%rbp), %rdi
leaq -0x1858(%rbp), %rsi
callq 0x1970
movl %eax, -0x185c(%rbp)
cmpl $0x0, -0x185c(%rbp)
je 0x192e
movq 0x46fd(%rip), %rax      # 0x5ff8
movq (%rax), %rax
movq %rax, -0x1870(%rbp)
movl -0x185c(%rbp), %edi
callq 0x14d0
movq -0x1870(%rbp), %rdi
movq %rax, %rdx
leaq 0x1bec(%rip), %rsi      # 0x350d
movb $0x0, %al
callq 0x1070
movb $0x0, -0x1(%rbp)
jmp 0x195c
movzwl -0x838(%rbp), %eax
cmpl $0x2, %eax
je 0x1958
movq 0x46b7(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x1bec(%rip), %rsi      # 0x3537
movb $0x0, %al
callq 0x1070
movb $0x0, -0x1(%rbp)
jmp 0x195c
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1870, %rsp           # imm = 0x1870
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/theandrew168[P]skylark/src/op_test.c
// Function: test_operation_SYS_0nnn
bool
test_operation_SYS_0nnn(void)
{
    struct chip8 chip8 = { 0 };
    chip8_init(&chip8);

    struct instruction inst = {
        .opcode = OPCODE_SYS_0nnn,
        .nnn = 0x234,
    };

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

    if (chip8.pc != 0x234) {
        fprintf(stderr, "operation_SYS_0nnn set the program counter to the wrong value\n");
        return false;
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1870, %rsp           # imm = 0x1870
leaq -0x184a(%rbp), %rdi
xorl %esi, %esi
movl $0x1848, %edx           # imm = 0x1848
callq 0x1050
leaq -0x184a(%rbp), %rdi
callq 0x2b20
movq 0x1873(%rip), %rax      # 0x3314
movq %rax, -0x1858(%rbp)
movl 0x186e(%rip), %eax      # 0x331c
movl %eax, -0x1850(%rbp)
leaq -0x184a(%rbp), %rdi
leaq -0x1858(%rbp), %rsi
callq 0x1b50
movl %eax, -0x185c(%rbp)
cmpl $0x0, -0x185c(%rbp)
je 0x1b10
movq 0x451b(%rip), %rax      # 0x5ff8
movq (%rax), %rax
movq %rax, -0x1868(%rbp)
movl -0x185c(%rbp), %edi
callq 0x14d0
movq -0x1868(%rbp), %rdi
movq %rax, %rdx
leaq 0x1a66(%rip), %rsi      # 0x3569
movb $0x0, %al
callq 0x1070
movb $0x0, -0x1(%rbp)
jmp 0x1b40
movzwl -0x838(%rbp), %eax
cmpl $0x234, %eax            # imm = 0x234
je 0x1b3c
movq 0x44d3(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x1a64(%rip), %rsi      # 0x3593
movb $0x0, %al
callq 0x1070
movb $0x0, -0x1(%rbp)
jmp 0x1b40
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1870, %rsp           # imm = 0x1870
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/theandrew168[P]skylark/src/op_test.c
// Function: test_operation_JP_1nnn
bool
test_operation_JP_1nnn(void)
{
    struct chip8 chip8 = { 0 };
    chip8_init(&chip8);

    struct instruction inst = {
        .opcode = OPCODE_JP_1nnn,
        .nnn = 0x234,
    };

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

    if (chip8.pc != 0x234) {
        fprintf(stderr, "operation_JP_1nnn set the program counter to the wrong value\n");
        return false;
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1870, %rsp           # imm = 0x1870
leaq -0x184a(%rbp), %rdi
xorl %esi, %esi
movl $0x1848, %edx           # imm = 0x1848
callq 0x1050
leaq -0x184a(%rbp), %rdi
callq 0x2b20
movq 0x176f(%rip), %rax      # 0x3320
movq %rax, -0x1858(%rbp)
movl 0x176a(%rip), %eax      # 0x3328
movl %eax, -0x1850(%rbp)
leaq -0x184a(%rbp), %rdi
leaq -0x1858(%rbp), %rsi
callq 0x1c60
movl %eax, -0x185c(%rbp)
cmpl $0x0, -0x185c(%rbp)
je 0x1c20
movq 0x440b(%rip), %rax      # 0x5ff8
movq (%rax), %rax
movq %rax, -0x1868(%rbp)
movl -0x185c(%rbp), %edi
callq 0x14d0
movq -0x1868(%rbp), %rdi
movq %rax, %rdx
leaq 0x19bf(%rip), %rsi      # 0x35d2
movb $0x0, %al
callq 0x1070
movb $0x0, -0x1(%rbp)
jmp 0x1c50
movzwl -0x838(%rbp), %eax
cmpl $0x234, %eax            # imm = 0x234
je 0x1c4c
movq 0x43c3(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x19bc(%rip), %rsi      # 0x35fb
movb $0x0, %al
callq 0x1070
movb $0x0, -0x1(%rbp)
jmp 0x1c50
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1870, %rsp           # imm = 0x1870
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x6, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x1d16
movq -0x30(%rbp), %rcx
leaq 0x40e5(%rip), %rax      # 0x5dc0
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
callq *-0x38(%rbp)
testb $0x1, %al
jne 0x1cec
jmp 0x1cfa
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1d06
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1d08
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1cc6
movq -0x20(%rbp), %rsi
movq -0x20(%rbp), %rcx
leaq 0x193b(%rip), %rdx      # 0x3660
leaq 0x192f(%rip), %rax      # 0x365b
cmpq $0x1, %rcx
cmoveq %rax, %rdx
movq -0x28(%rbp), %rcx
movq -0x28(%rbp), %rdi
leaq 0x191d(%rip), %r8       # 0x3660
leaq 0x1911(%rip), %rax      # 0x365b
cmpq $0x1, %rdi
cmoveq %rax, %r8
leaq 0x18e0(%rip), %rdi      # 0x3639
movb $0x0, %al
callq 0x1030
movq -0x28(%rbp), %rdx
movl $0x1, %eax
xorl %ecx, %ecx
cmpq $0x0, %rdx
cmovel %ecx, %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/dvb_print_si.c
// Function: handle_pat_section
static void handle_pat_section(uint16_t i_pid, uint8_t *p_section)
{
    if (i_pid != PAT_PID || !pat_validate(p_section)) {
        switch (i_print_type) {
        case PRINT_XML:
            printf("<ERROR type=\"invalid_pat_section\"/>\n");
            break;
        default:
            printf("invalid PAT section received on PID %hu\n", i_pid);
        }
        free(p_section);
        return;
    }

    if (!psi_table_section(pp_next_pat_sections, p_section))
        return;

    handle_pat();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movq %rsi, -0x10(%rbp)
movzwl -0x2(%rbp), %eax
cmpl $0x0, %eax
jne 0x35b9
movq -0x10(%rbp), %rdi
callq 0x4390
testb $0x1, %al
jne 0x35f3
movl 0x34d31(%rip), %eax     # 0x382f0
subl $0x1, %eax
jne 0x35d6
jmp 0x35c6
leaq 0x2088b(%rip), %rdi     # 0x23e58
movb $0x0, %al
callq 0x20b0
jmp 0x35e8
movzwl -0x2(%rbp), %esi
leaq 0x2089c(%rip), %rdi     # 0x23e7d
movb $0x0, %al
callq 0x20b0
movq -0x10(%rbp), %rdi
callq 0x2030
jmp 0x360e
movq -0x10(%rbp), %rsi
leaq 0x65502(%rip), %rdi     # 0x68b00
callq 0x4400
testb $0x1, %al
jne 0x3609
jmp 0x360e
callq 0x4530
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/dvb_print_si.c
// Function: handle_cat_section
static void handle_cat_section(uint16_t i_pid, uint8_t *p_section)
{
    if (i_pid != CAT_PID || !cat_validate(p_section)) {
        switch (i_print_type) {
        case PRINT_XML:
            printf("<ERROR type=\"invalid_cat_section\"/>\n");
            break;
        default:
            printf("invalid CAT section received on PID %hu\n", i_pid);
        }
        free(p_section);
        return;
    }

    if (!psi_table_section(pp_next_cat_sections, p_section))
        return;

    handle_cat();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movq %rsi, -0x10(%rbp)
movzwl -0x2(%rbp), %eax
cmpl $0x1, %eax
jne 0x3649
movq -0x10(%rbp), %rdi
callq 0x5870
testb $0x1, %al
jne 0x3683
movl 0x34ca1(%rip), %eax     # 0x382f0
subl $0x1, %eax
jne 0x3666
jmp 0x3656
leaq 0x2096b(%rip), %rdi     # 0x23fc8
movb $0x0, %al
callq 0x20b0
jmp 0x3678
movzwl -0x2(%rbp), %esi
leaq 0x2097c(%rip), %rdi     # 0x23fed
movb $0x0, %al
callq 0x20b0
movq -0x10(%rbp), %rdi
callq 0x2030
jmp 0x369e
movq -0x10(%rbp), %rsi
leaq 0x66472(%rip), %rdi     # 0x69b00
callq 0x4400
testb $0x1, %al
jne 0x3699
jmp 0x369e
callq 0x5950
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/dvb_print_si.c
// Function: handle_tsdt_section
static void handle_tsdt_section(uint16_t i_pid, uint8_t *p_section)
{
    if (i_pid != TSDT_PID || !tsdt_validate(p_section)) {
        switch (i_print_type) {
        case PRINT_XML:
            printf("<ERROR type=\"invalid_tsdt_section\"/>\n");
            break;
        default:
            printf("invalid TSDT section received on PID %hu\n", i_pid);
        }
        free(p_section);
        return;
    }

    if (!psi_table_section(pp_next_tsdt_sections, p_section))
        return;

    handle_tsdt();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movq %rsi, -0x10(%rbp)
movzwl -0x2(%rbp), %eax
cmpl $0x2, %eax
jne 0x36d9
movq -0x10(%rbp), %rdi
callq 0x1c5d0
testb $0x1, %al
jne 0x3713
movl 0x34c11(%rip), %eax     # 0x382f0
subl $0x1, %eax
jne 0x36f6
jmp 0x36e6
leaq 0x273ed(%rip), %rdi     # 0x2aada
movb $0x0, %al
callq 0x20b0
jmp 0x3708
movzwl -0x2(%rbp), %esi
leaq 0x273ff(%rip), %rdi     # 0x2ab00
movb $0x0, %al
callq 0x20b0
movq -0x10(%rbp), %rdi
callq 0x2030
jmp 0x372e
movq -0x10(%rbp), %rsi
leaq 0x673e2(%rip), %rdi     # 0x6ab00
callq 0x4400
testb $0x1, %al
jne 0x3729
jmp 0x372e
callq 0x1c6b0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/dvb_print_si.c
// Function: handle_nit_section
static void handle_nit_section(uint16_t i_pid, uint8_t *p_section)
{
    if (i_pid != NIT_PID || !nit_validate(p_section)) {
        switch (i_print_type) {
        case PRINT_XML:
            printf("<ERROR type=\"invalid_nit_section\" pid=\"%hu\"/>\n",
                   i_pid);
            break;
        default:
            printf("invalid NIT section received on PID %hu\n", i_pid);
        }
        free(p_section);
        return;
    }

    if (!psi_table_section(pp_next_nit_sections, p_section))
        return;

    handle_nit();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movq %rsi, -0x10(%rbp)
movzwl -0x2(%rbp), %eax
cmpl $0x10, %eax
jne 0x39f9
movq -0x10(%rbp), %rdi
callq 0x1d200
testb $0x1, %al
jne 0x3a37
movl 0x348f1(%rip), %eax     # 0x382f0
subl $0x1, %eax
jne 0x3a1a
jmp 0x3a06
movzwl -0x2(%rbp), %esi
leaq 0x276f6(%rip), %rdi     # 0x2b107
movb $0x0, %al
callq 0x20b0
jmp 0x3a2c
movzwl -0x2(%rbp), %esi
leaq 0x27711(%rip), %rdi     # 0x2b136
movb $0x0, %al
callq 0x20b0
movq -0x10(%rbp), %rdi
callq 0x2030
jmp 0x3a52
movq -0x10(%rbp), %rsi
leaq 0x680be(%rip), %rdi     # 0x6bb00
callq 0x4400
testb $0x1, %al
jne 0x3a4d
jmp 0x3a52
callq 0x1d3d0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)