LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/tasks.c
// Function: vTaskPriorityInherit
void vTaskPriorityInherit( xTaskHandle * const pxMutexHolder )
	{
	tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;

		if( pxTCB->uxPriority < pxCurrentTCB->uxPriority )
		{
			/* Adjust the mutex holder state to account for its new priority. */
			listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) pxCurrentTCB->uxPriority );

			/* If the task being modified is in the ready state it will need to
			be moved in to a new list. */
			if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ) )
			{
				vListRemove( &( pxTCB->xGenericListItem ) );

				/* Inherit the priority before being moved into the new list. */
				pxTCB->uxPriority = pxCurrentTCB->uxPriority;
				prvAddTaskToReadyQueue( pxTCB );
			}
			else
			{
				/* Just inherit the priority. */
				pxTCB->uxPriority = pxCurrentTCB->uxPriority;
			}
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x58(%rdi), %rax
movq 0x4442(%rip), %r15      # 0xafb0
movq (%r15), %rcx
cmpq 0x58(%rcx), %rax
jae 0x6ba2
movq %rdi, %rbx
movq (%r15), %rcx
pushq $0xa
popq %rdx
subl 0x58(%rcx), %edx
movl %edx, 0x30(%rdi)
imulq $0x28, %rax, %rax
addq 0x437f(%rip), %rax      # 0xaf10
cmpq %rax, 0x28(%rdi)
je 0x6bad
movq (%r15), %rax
movq 0x58(%rax), %rax
movq %rax, 0x58(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rbx), %r14
movq %r14, %rdi
callq 0x4040
movq (%r15), %rax
movq 0x58(%rax), %rax
movq %rax, 0x58(%rbx)
movq 0x42fd(%rip), %rcx      # 0xaec8
cmpq (%rcx), %rax
jbe 0x6bd3
movq %rax, (%rcx)
imulq $0x28, %rax, %rdi
addq 0x4332(%rip), %rdi      # 0xaf10
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4760
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/tasks.c
// Function: vTaskPriorityDisinherit
void vTaskPriorityDisinherit( xTaskHandle * const pxMutexHolder )
	{
	tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;

		if( pxMutexHolder != NULL )
		{
			if( pxTCB->uxPriority != pxTCB->uxBasePriority )
			{
				/* We must be the running task to be able to give the mutex back.
				Remove ourselves from the ready list we currently appear in. */
				vListRemove( &( pxTCB->xGenericListItem ) );

				/* Disinherit the priority before adding ourselves into the new
				ready list. */
				pxTCB->uxPriority = pxTCB->uxBasePriority;
				listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) pxTCB->uxPriority );
				prvAddTaskToReadyQueue( pxTCB );
			}
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x6c0c
movq %rdi, %r14
movq 0x58(%rdi), %rax
cmpq 0x80(%rdi), %rax
jne 0x6c11
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x8(%r14), %rbx
movq %rbx, %rdi
callq 0x4040
movq 0x80(%r14), %rax
movq %rax, 0x58(%r14)
pushq $0xa
popq %rcx
subl %eax, %ecx
movl %ecx, 0x30(%r14)
movq 0x4290(%rip), %rcx      # 0xaec8
cmpq (%rcx), %rax
jbe 0x6c40
movq %rax, (%rcx)
imulq $0x28, %rax, %rdi
addq 0x42c5(%rip), %rdi      # 0xaf10
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x4760
nop
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/MemMang/heap_3.c
// Function: vPortFree
void vPortFree( void *pv )
{
	if( pv )
	{
		vTaskSuspendAll();
		{
			free( pv );
		}
		xTaskResumeAll();
	}
}

// Assembly:
testq %rdi, %rdi
je 0x6ca6
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x4650
movq %rbx, %rdi
callq 0x4060
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4080
retq
nop
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: pxPortInitialiseStack
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
{
/* Should actually keep this struct on the stack. */
xParams *pxThisThreadParams = pvPortMalloc( sizeof( xParams ) );

	(void)pthread_once( &hSigSetupThread, prvSetupSignalsAndSchedulerPolicy );

	if ( (pthread_t)NULL == hMainThread )
	{
		hMainThread = pthread_self();
	}

	/* No need to join the threads. */
	pthread_attr_init( &xThreadAttributes );
	pthread_attr_setdetachstate( &xThreadAttributes, PTHREAD_CREATE_DETACHED );

	/* Add the task parameters. */
	pxThisThreadParams->pxCode = pxCode;
	pxThisThreadParams->pvParams = pvParameters;

	vPortEnterCritical();

	lIndexOfLastAddedTask = prvGetFreeThreadState();

	/* Create the new pThread. */
	if ( 0 == pthread_mutex_lock( &xSingleThreadMutex ) )
	{
		xSentinel = 0;
		if ( 0 != pthread_create( &( pxThreads[ lIndexOfLastAddedTask ].hThread ), &xThreadAttributes, prvWaitForStart, (void *)pxThisThreadParams ) )
		{
			/* Thread create failed, signal the failure */
			pxTopOfStack = 0;
		}

		/* Wait until the task suspends. */
		(void)pthread_mutex_unlock( &xSingleThreadMutex );
		while ( xSentinel == 0 );
		vPortExitCritical();
	}

	return pxTopOfStack;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
pushq $0x10
popq %rdi
callq 0x4300
movq %rax, %r14
leaq 0x4bb7(%rip), %rdi      # 0xb888
leaq 0x101(%rip), %rsi       # 0x6dd9
callq 0x4780
cmpq $0x0, 0x4bab(%rip)      # 0xb890
jne 0x6cf3
callq 0x4580
movq %rax, 0x4b9d(%rip)      # 0xb890
leaq 0x4b9e(%rip), %r13      # 0xb898
movq %r13, %rdi
callq 0x42d0
pushq $0x1
popq %rsi
movq %r13, %rdi
callq 0x43e0
movq %r12, (%r14)
movq %r15, 0x8(%r14)
movq $0x0, 0x46e1(%rip) # 0xb400
incq 0x4bea(%rip)            # 0xb910
xorl %eax, %eax
movq 0x4bd9(%rip), %rcx      # 0xb908
cmpq $0x40, %rax
je 0x6d44
cmpq $0x0, (%rcx)
je 0x6d57
incq %rax
addq $0x18, %rcx
jmp 0x6d2f
leaq 0x13d3(%rip), %rdi      # 0x811e
callq 0x40c0
callq 0x44d0
xorl %eax, %eax
movl %eax, 0x4b73(%rip)      # 0xb8d0
leaq 0x4b74(%rip), %rdi      # 0xb8d8
callq 0x47b0
testl %eax, %eax
jne 0x6dc7
movq $0x0, 0x4b88(%rip) # 0xb900
movslq 0x4b51(%rip), %rax      # 0xb8d0
imulq $0x18, %rax, %rdi
addq 0x4b7e(%rip), %rdi      # 0xb908
leaq 0x4b07(%rip), %rsi      # 0xb898
leaq 0x16e(%rip), %rdx       # 0x6f06
movq %r14, %rcx
callq 0x4560
movl %eax, %r14d
leaq 0x4b2e(%rip), %rdi      # 0xb8d8
callq 0x4410
cmpq $0x0, 0x4b49(%rip)      # 0xb900
je 0x6daf
xorl %eax, %eax
testl %r14d, %r14d
cmovneq %rax, %rbx
callq 0x44b0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: prvSetupSignalsAndSchedulerPolicy
void prvSetupSignalsAndSchedulerPolicy( void )
{
/* The following code would allow for configuring the scheduling of this task as a Real-time task.
 * The process would then need to be run with higher privileges for it to take affect.
int iPolicy;
int iResult;
int iSchedulerPriority;
	iResult = pthread_getschedparam( pthread_self(), &iPolicy, &iSchedulerPriority );
	iResult = pthread_attr_setschedpolicy( &xThreadAttributes, SCHED_FIFO );
	iPolicy = SCHED_FIFO;
	iResult = pthread_setschedparam( pthread_self(), iPolicy, &iSchedulerPriority );		*/

struct sigaction sigsuspendself, sigresume, sigtick;
portLONG lIndex;

	pxThreads = ( xThreadState *)pvPortMalloc( sizeof( xThreadState ) * MAX_NUMBER_OF_TASKS );
	for ( lIndex = 0; lIndex < MAX_NUMBER_OF_TASKS; lIndex++ )
	{
		pxThreads[ lIndex ].hThread = ( pthread_t )NULL;
		pxThreads[ lIndex ].hTask = ( xTaskHandle )NULL;
		pxThreads[ lIndex ].uxCriticalNesting = 0;
	}

	sigsuspendself.sa_flags = 0;
	sigsuspendself.sa_handler = prvSuspendSignalHandler;
	sigfillset( &sigsuspendself.sa_mask );

	sigresume.sa_flags = 0;
	sigresume.sa_handler = prvResumeSignalHandler;
	sigfillset( &sigresume.sa_mask );

	sigtick.sa_flags = 0;
	sigtick.sa_handler = vPortSystemTickHandler;
	sigfillset( &sigtick.sa_mask );

	if ( 0 != sigaction( SIG_SUSPEND, &sigsuspendself, NULL ) )
	{
		printf( "Problem installing SIG_SUSPEND_SELF\n" );
	}
	if ( 0 != sigaction( SIG_RESUME, &sigresume, NULL ) )
	{
		printf( "Problem installing SIG_RESUME\n" );
	}
	if ( 0 != sigaction( SIG_TICK, &sigtick, NULL ) )
	{
		printf( "Problem installing SIG_TICK\n" );
	}
	printf( "Running as PID: %d\n", getpid() );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movl $0x600, %edi            # imm = 0x600
callq 0x4300
movq %rax, 0x4b13(%rip)      # 0xb908
xorl %ecx, %ecx
xorps %xmm0, %xmm0
cmpq $0x600, %rcx            # imm = 0x600
je 0x6e13
movups %xmm0, (%rax,%rcx)
andq $0x0, 0x10(%rax,%rcx)
addq $0x18, %rcx
jmp 0x6dfa
leaq -0x1c0(%rbp), %rdi
andl $0x0, 0x80(%rdi)
leaq 0x7ea(%rip), %rax       # 0x7612
movq %rax, -0x8(%rdi)
callq 0x4360
leaq -0x128(%rbp), %rdi
andl $0x0, 0x80(%rdi)
leaq 0x85f(%rip), %rax       # 0x76a5
movq %rax, -0x8(%rdi)
callq 0x4360
leaq -0x90(%rbp), %rdi
andl $0x0, 0x80(%rdi)
movq 0x408c(%rip), %rax      # 0xaef0
movq %rax, -0x8(%rdi)
callq 0x4360
pushq $0xa
popq %rdi
leaq -0x1c8(%rbp), %rsi
xorl %edx, %edx
callq 0x40f0
testl %eax, %eax
je 0x6e8e
leaq 0x1237(%rip), %rdi      # 0x80c0
callq 0x40c0
pushq $0xc
popq %rdi
leaq -0x130(%rbp), %rsi
xorl %edx, %edx
callq 0x40f0
testl %eax, %eax
je 0x6eaf
leaq 0x123a(%rip), %rdi      # 0x80e4
callq 0x40c0
pushq $0xe
popq %rdi
leaq -0x98(%rbp), %rsi
xorl %edx, %edx
callq 0x40f0
testl %eax, %eax
je 0x6ed0
leaq 0x1237(%rip), %rdi      # 0x8102
callq 0x40c0
callq 0x4130
leaq 0x11c4(%rip), %rdi      # 0x80a0
movl %eax, %esi
xorl %eax, %eax
callq 0x4190
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: prvWaitForStart
void *prvWaitForStart( void * pvParams )
{
xParams * pxParams = ( xParams * )pvParams;
pdTASK_CODE pvCode = pxParams->pxCode;
void * pParams = pxParams->pvParams;
	vPortFree( pvParams );

	pthread_cleanup_push( prvDeleteThread, (void *)pthread_self() );

	if ( 0 == pthread_mutex_lock( &xSingleThreadMutex ) )
	{
		prvSuspendThread( pthread_self() );
	}

	pvCode( pParams );

	pthread_cleanup_pop( 1 );
	return (void *)NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq (%rdi), %r15
movq 0x8(%rdi), %r14
callq 0x41b0
callq 0x4580
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
callq 0x4740
testl %eax, %eax
jne 0x6f7b
leaq -0x80(%rbp), %rdi
callq 0x46d0
leaq 0x4992(%rip), %rdi      # 0xb8d8
callq 0x47b0
testl %eax, %eax
jne 0x6f57
movq %rbx, %rdi
callq 0x730e
movq %r14, %rdi
callq *%r15
leaq -0x80(%rbp), %rdi
callq 0x41e0
movq %rbx, %rdi
callq 0x75be
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x75be
leaq -0x80(%rbp), %rdi
callq 0x44f0
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: prvResumeThread
void prvResumeThread( pthread_t xThreadId )
{
portBASE_TYPE xResult;
	if ( 0 == pthread_mutex_lock( &xSuspendResumeThreadMutex ) )
	{
		if ( pthread_self() != xThreadId )
		{
			xResult = pthread_kill( xThreadId, SIG_RESUME );
		}
		xResult = pthread_mutex_unlock( &xSuspendResumeThreadMutex );
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x48fc(%rip), %rdi      # 0xb920
callq 0x47b0
testl %eax, %eax
je 0x7034
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
callq 0x4580
cmpq %rbx, %rax
je 0x7049
pushq $0xc
popq %rsi
movq %rbx, %rdi
callq 0x42f0
leaq 0x48d0(%rip), %rdi      # 0xb920
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4410
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: prvGetThreadHandle
pthread_t prvGetThreadHandle( xTaskHandle hTask )
{
pthread_t hThread = ( pthread_t )NULL;
portLONG lIndex;
	for ( lIndex = 0; lIndex < MAX_NUMBER_OF_TASKS; lIndex++ )
	{
		if ( pxThreads[ lIndex ].hTask == hTask )
		{
			hThread = pxThreads[ lIndex ].hThread;
			break;
		}
	}
	return hThread;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movabsq $0x8, %rdx
movq 0x4898(%rip), %rcx      # 0xb908
xorl %eax, %eax
leaq 0x18(%rdx), %rsi
cmpq $0x620, %rsi            # imm = 0x620
je 0x708d
cmpq %rdi, (%rcx,%rdx)
movq %rsi, %rdx
jne 0x7072
movq -0x20(%rcx,%rsi), %rax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: xPortStartScheduler
portBASE_TYPE xPortStartScheduler( void )
{
portBASE_TYPE xResult;
int iSignal;
sigset_t xSignals;
sigset_t xSignalToBlock;
sigset_t xSignalsBlocked;
portLONG lIndex;

	/* Establish the signals to block before they are needed. */
	sigfillset( &xSignalToBlock );

	/* Block until the end */
	(void)pthread_sigmask( SIG_SETMASK, &xSignalToBlock, &xSignalsBlocked );

	for ( lIndex = 0; lIndex < MAX_NUMBER_OF_TASKS; lIndex++ )
	{
		pxThreads[ lIndex ].uxCriticalNesting = 0;
	}

	/* Start the timer that generates the tick ISR.  Interrupts are disabled
	here already. */
	prvSetupTimerInterrupt();

	/* Start the first task. Will not return unless all threads are killed. */
	vPortStartFirstTask();

	/* This is the end signal we are looking for. */
	sigemptyset( &xSignals );
	sigaddset( &xSignals, SIG_RESUME );

	while ( pdTRUE != xSchedulerEnd )
	{
		if ( 0 != sigwait( &xSignals, &iSignal ) )
		{
			printf( "Main thread spurious signal: %d\n", iSignal );
		}
	}

	printf( "Cleaning Up, Exiting.\n" );
	/* Cleanup the mutexes */
	xResult = pthread_mutex_destroy( &xSuspendResumeThreadMutex );
	xResult = pthread_mutex_destroy( &xSingleThreadMutex );
	vPortFree( (void *)pxThreads );

	/* Should not get here! */
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
leaq -0x1b8(%rbp), %rbx
movq %rbx, %rdi
callq 0x4360
pushq $0x2
popq %rdi
leaq -0x138(%rbp), %rdx
movq %rbx, %rsi
callq 0x44e0
pushq $0x10
popq %rax
movq 0x483e(%rip), %rcx      # 0xb908
cmpq $0x610, %rax            # imm = 0x610
je 0x70dd
andq $0x0, (%rcx,%rax)
addq $0x18, %rax
jmp 0x70ca
leaq -0xb8(%rbp), %rsi
xorl %edi, %edi
callq 0x4630
testl %eax, %eax
je 0x70f8
leaq 0x1071(%rip), %rdi      # 0x8167
jmp 0x712b
leaq -0xb8(%rbp), %rsi
andq $0x0, (%rsi)
movl $0x3e8, %eax            # imm = 0x3E8
movq %rax, 0x8(%rsi)
andq $0x0, 0x10(%rsi)
movq %rax, 0x18(%rsi)
leaq -0x38(%rbp), %rdx
xorl %edi, %edi
callq 0x4510
testl %eax, %eax
je 0x7130
leaq 0x104f(%rip), %rdi      # 0x817a
callq 0x40c0
callq 0x4490
leaq -0xb8(%rbp), %rbx
movq %rbx, %rdi
callq 0x4310
pushq $0xc
popq %rsi
movq %rbx, %rdi
callq 0x4790
leaq -0x38(%rbp), %r14
leaq 0xee8(%rip), %r15       # 0x8042
movq 0x47b7(%rip), %rax      # 0xb918
cmpq $0x1, %rax
je 0x7185
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4660
testl %eax, %eax
je 0x715a
movl -0x38(%rbp), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x4190
jmp 0x715a
leaq 0xfc5(%rip), %rdi       # 0x8151
callq 0x40c0
leaq 0x4788(%rip), %rdi      # 0xb920
callq 0x41c0
leaq 0x4734(%rip), %rdi      # 0xb8d8
callq 0x41c0
movq 0x4758(%rip), %rdi      # 0xb908
callq 0x41b0
xorl %eax, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: vPortEndScheduler
void vPortEndScheduler( void )
{
portBASE_TYPE xNumberOfThreads;
portBASE_TYPE xResult;
	for ( xNumberOfThreads = 0; xNumberOfThreads < MAX_NUMBER_OF_TASKS; xNumberOfThreads++ )
	{
		if ( ( pthread_t )NULL != pxThreads[ xNumberOfThreads ].hThread )
		{
			/* Kill all of the threads, they are in the detached state. */
			xResult = pthread_cancel( pxThreads[ xNumberOfThreads ].hThread );
		}
	}

	/* Signal the scheduler to exit its loop. */
	xSchedulerEnd = pdTRUE;
	(void)pthread_kill( hMainThread, SIG_RESUME );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
xorl %ebx, %ebx
cmpq $0x600, %rbx            # imm = 0x600
je 0x71f1
movq 0x472b(%rip), %rax      # 0xb908
movq (%rax,%rbx), %rdi
testq %rdi, %rdi
je 0x71eb
callq 0x4750
addq $0x18, %rbx
jmp 0x71cd
movq $0x1, 0x471c(%rip) # 0xb918
movq 0x468d(%rip), %rdi      # 0xb890
pushq $0xc
popq %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x42f0
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: vPortYield
void vPortYield( void )
{
pthread_t xTaskToSuspend;
pthread_t xTaskToResume;

	if ( 0 == pthread_mutex_lock( &xSingleThreadMutex ) )
	{
		xTaskToSuspend = prvGetThreadHandle( xTaskGetCurrentTaskHandle() );

		vTaskSwitchContext();

		xTaskToResume = prvGetThreadHandle( xTaskGetCurrentTaskHandle() );
		if ( xTaskToSuspend != xTaskToResume )
		{
			/* Remember and switch the critical nesting. */
			prvSetTaskCriticalNesting( xTaskToSuspend, uxCriticalNesting );
			uxCriticalNesting = prvGetTaskCriticalNesting( xTaskToResume );
			/* Switch tasks. */
			prvResumeThread( xTaskToResume );
			prvSuspendThread( xTaskToSuspend );
		}
		else
		{
			/* Yielding to self */
			(void)pthread_mutex_unlock( &xSingleThreadMutex );
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x4697(%rip), %rdi      # 0xb8d8
callq 0x47b0
testl %eax, %eax
je 0x724f
popq %rbx
popq %r14
popq %rbp
retq
callq 0x40d0
movq %rax, %rdi
callq 0x705b
movq %rax, %rbx
callq 0x4710
callq 0x40d0
movq %rax, %rdi
callq 0x705b
cmpq %rax, %rbx
jne 0x7286
leaq 0x465b(%rip), %rdi      # 0xb8d8
popq %rbx
popq %r14
popq %rbp
jmp 0x4410
movq %rax, %r14
movq 0x4680(%rip), %rsi      # 0xb910
movq %rbx, %rdi
callq 0x72b8
movq %r14, %rdi
callq 0x72e2
movq %rax, 0x4669(%rip)      # 0xb910
movq %r14, %rdi
callq 0x7014
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x730e
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: prvSetTaskCriticalNesting
void prvSetTaskCriticalNesting( pthread_t xThreadId, unsigned portBASE_TYPE uxNesting )
{
portLONG lIndex;
	for ( lIndex = 0; lIndex < MAX_NUMBER_OF_TASKS; lIndex++ )
	{
		if ( pxThreads[ lIndex ].hThread == xThreadId )
		{
			pxThreads[ lIndex ].uxCriticalNesting = uxNesting;
			break;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x4645(%rip), %rax      # 0xb908
xorl %ecx, %ecx
leaq 0x18(%rcx), %rdx
cmpq $0x618, %rdx            # imm = 0x618
je 0x72e0
cmpq %rdi, (%rax,%rcx)
movq %rdx, %rcx
jne 0x72c5
movq %rsi, -0x8(%rax,%rdx)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: prvGetTaskCriticalNesting
unsigned portBASE_TYPE prvGetTaskCriticalNesting( pthread_t xThreadId )
{
unsigned portBASE_TYPE uxNesting = 0;
portLONG lIndex;
	for ( lIndex = 0; lIndex < MAX_NUMBER_OF_TASKS; lIndex++ )
	{
		if ( pxThreads[ lIndex ].hThread == xThreadId )
		{
			uxNesting = pxThreads[ lIndex ].uxCriticalNesting;
			break;
		}
	}
	return uxNesting;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x461b(%rip), %rcx      # 0xb908
xorl %eax, %eax
xorl %edx, %edx
leaq 0x18(%rdx), %rsi
cmpq $0x618, %rsi            # imm = 0x618
je 0x730c
cmpq %rdi, (%rcx,%rdx)
movq %rsi, %rdx
jne 0x72f1
movq -0x8(%rcx,%rsi), %rax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: prvSuspendThread
void prvSuspendThread( pthread_t xThreadId )
{
portBASE_TYPE xResult = pthread_mutex_lock( &xSuspendResumeThreadMutex );
	if ( 0 == xResult )
	{
		/* Set-up for the Suspend Signal handler? */
		xSentinel = 0;
		xResult = pthread_mutex_unlock( &xSuspendResumeThreadMutex );
		xResult = pthread_kill( xThreadId, SIG_SUSPEND );
		while ( ( xSentinel == 0 ) && ( pdTRUE != xServicingTick ) )
		{
			sched_yield();
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x4602(%rip), %rdi      # 0xb920
callq 0x47b0
testl %eax, %eax
je 0x732e
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq $0x0, 0x45c7(%rip) # 0xb900
leaq 0x45e0(%rip), %rdi      # 0xb920
callq 0x4410
pushq $0xa
popq %rsi
movq %rbx, %rdi
callq 0x42f0
cmpq $0x0, 0x45a8(%rip)      # 0xb900
jne 0x7327
movq 0x45ef(%rip), %rax      # 0xb950
cmpq $0x1, %rax
je 0x7327
callq 0x42a0
jmp 0x7350
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: vPortSystemTickHandler
void vPortSystemTickHandler( int sig )
{
pthread_t xTaskToSuspend;
pthread_t xTaskToResume;

	if ( ( pdTRUE == xInterruptsEnabled ) && ( pdTRUE != xServicingTick ) )
	{
		if ( 0 == pthread_mutex_trylock( &xSingleThreadMutex ) )
		{
			xServicingTick = pdTRUE;

			xTaskToSuspend = prvGetThreadHandle( xTaskGetCurrentTaskHandle() );
			/* Tick Increment. */
			vTaskIncrementTick();

			/* Select Next Task. */
#if ( configUSE_PREEMPTION == 1 )
			vTaskSwitchContext();
#endif
			xTaskToResume = prvGetThreadHandle( xTaskGetCurrentTaskHandle() );

			/* The only thread that can process this tick is the running thread. */
			if ( xTaskToSuspend != xTaskToResume )
			{
				/* Remember and switch the critical nesting. */
				prvSetTaskCriticalNesting( xTaskToSuspend, uxCriticalNesting );
				uxCriticalNesting = prvGetTaskCriticalNesting( xTaskToResume );
				/* Resume next task. */
				prvResumeThread( xTaskToResume );
				/* Suspend the current task. */
				prvSuspendThread( xTaskToSuspend );
			}
			else
			{
				/* Release the lock as we are Resuming. */
				(void)pthread_mutex_unlock( &xSingleThreadMutex );
			}
			xServicingTick = pdFALSE;
		}
		else
		{
			xPendYield = pdTRUE;
		}
	}
	else
	{
		xPendYield = pdTRUE;
	}
}

// Assembly:
movq 0x4066(%rip), %rax      # 0xb400
cmpq $0x1, %rax
jne 0x73ad
movq 0x45a9(%rip), %rax      # 0xb950
cmpq $0x1, %rax
jne 0x73b9
movq $0x1, 0x4590(%rip) # 0xb948
retq
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x4511(%rip), %rdi      # 0xb8d8
callq 0x4280
testl %eax, %eax
je 0x73e0
movq $0x1, 0x456d(%rip) # 0xb948
jmp 0x7461
movq $0x1, 0x4565(%rip) # 0xb950
callq 0x40d0
movq %rax, %rdi
callq 0x705b
movq %rax, %rbx
callq 0x4400
callq 0x4710
callq 0x40d0
movq %rax, %rdi
callq 0x705b
cmpq %rax, %rbx
jne 0x7425
leaq 0x44ba(%rip), %rdi      # 0xb8d8
callq 0x4410
jmp 0x7456
movq %rax, %r14
movq 0x44e1(%rip), %rsi      # 0xb910
movq %rbx, %rdi
callq 0x72b8
movq %r14, %rdi
callq 0x72e2
movq %rax, 0x44ca(%rip)      # 0xb910
movq %r14, %rdi
callq 0x7014
movq %rbx, %rdi
callq 0x730e
movq $0x0, 0x44ef(%rip) # 0xb950
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: vPortForciblyEndThread
void vPortForciblyEndThread( void *pxTaskToDelete )
{
xTaskHandle hTaskToDelete = ( xTaskHandle )pxTaskToDelete;
pthread_t xTaskToDelete;
pthread_t xTaskToResume;
portBASE_TYPE xResult;

	if ( 0 == pthread_mutex_lock( &xSingleThreadMutex ) )
	{
		xTaskToDelete = prvGetThreadHandle( hTaskToDelete );
		xTaskToResume = prvGetThreadHandle( xTaskGetCurrentTaskHandle() );

		if ( xTaskToResume == xTaskToDelete )
		{
			/* This is a suicidal thread, need to select a different task to run. */
			vTaskSwitchContext();
			xTaskToResume = prvGetThreadHandle( xTaskGetCurrentTaskHandle() );
		}

		if ( pthread_self() != xTaskToDelete )
		{
			/* Cancelling a thread that is not me. */
			if ( xTaskToDelete != ( pthread_t )NULL )
			{
				/* Send a signal to wake the task so that it definitely cancels. */
				pthread_testcancel();
				xResult = pthread_cancel( xTaskToDelete );
				/* Pthread Clean-up function will note the cancellation. */
			}
			(void)pthread_mutex_unlock( &xSingleThreadMutex );
		}
		else
		{
			/* Resume the other thread. */
			prvResumeThread( xTaskToResume );
			/* Pthread Clean-up function will note the cancellation. */
			/* Release the execution. */
			uxCriticalNesting = 0;
			vPortEnableInterrupts();
			(void)pthread_mutex_unlock( &xSingleThreadMutex );
			/* Commit suicide */
			pthread_exit( (void *)1 );
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x4461(%rip), %rdi      # 0xb8d8
callq 0x47b0
testl %eax, %eax
je 0x7485
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
callq 0x705b
movq %rax, %rbx
callq 0x40d0
movq %rax, %rdi
callq 0x705b
movq %rax, %r14
cmpq %rbx, %rax
jne 0x74ba
callq 0x4710
callq 0x40d0
movq %rax, %rdi
callq 0x705b
movq %rax, %r14
callq 0x4580
cmpq %rbx, %rax
je 0x74e6
testq %rbx, %rbx
je 0x74d6
callq 0x4350
movq %rbx, %rdi
callq 0x4750
leaq 0x43fb(%rip), %rdi      # 0xb8d8
popq %rbx
popq %r14
popq %rbp
jmp 0x4410
movq %r14, %rdi
callq 0x7014
movq $0x0, 0x4417(%rip) # 0xb910
movq $0x1, 0x3efc(%rip) # 0xb400
leaq 0x43cd(%rip), %rdi      # 0xb8d8
callq 0x4410
pushq $0x1
popq %rdi
callq 0x4420
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: vPortAddTaskHandle
void vPortAddTaskHandle( void *pxTaskHandle )
{
portLONG lIndex;

	pxThreads[ lIndexOfLastAddedTask ].hTask = ( xTaskHandle )pxTaskHandle;
	for ( lIndex = 0; lIndex < MAX_NUMBER_OF_TASKS; lIndex++ )
	{
		if ( pxThreads[ lIndex ].hThread == pxThreads[ lIndexOfLastAddedTask ].hThread )
		{
			if ( pxThreads[ lIndex ].hTask != pxThreads[ lIndexOfLastAddedTask ].hTask )
			{
				pxThreads[ lIndex ].hThread = ( pthread_t )NULL;
				pxThreads[ lIndex ].hTask = NULL;
				pxThreads[ lIndex ].uxCriticalNesting = 0;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x43e5(%rip), %rax      # 0xb908
movslq 0x43a6(%rip), %rcx      # 0xb8d0
imulq $0x18, %rcx, %rcx
movq %rdi, 0x8(%rax,%rcx)
xorl %ecx, %ecx
xorps %xmm0, %xmm0
cmpq $0x600, %rcx            # imm = 0x600
je 0x757f
movq (%rax,%rcx), %rdx
movslq 0x4384(%rip), %rsi      # 0xb8d0
imulq $0x18, %rsi, %rsi
cmpq (%rax,%rsi), %rdx
jne 0x7579
movq 0x8(%rax,%rcx), %rdx
movslq 0x436e(%rip), %rsi      # 0xb8d0
imulq $0x18, %rsi, %rsi
cmpq 0x8(%rax,%rsi), %rdx
je 0x7579
leaq (%rax,%rcx), %rdx
movups %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
addq $0x18, %rcx
jmp 0x7538
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: prvDeleteThread
void prvDeleteThread( void *xThreadId )
{
portLONG lIndex;
	for ( lIndex = 0; lIndex < MAX_NUMBER_OF_TASKS; lIndex++ )
	{
		if ( pxThreads[ lIndex ].hThread == ( pthread_t )xThreadId )
		{
			pxThreads[ lIndex ].hThread = (pthread_t)NULL;
			pxThreads[ lIndex ].hTask = (xTaskHandle)NULL;
			if ( pxThreads[ lIndex ].uxCriticalNesting > 0 )
			{
				uxCriticalNesting = 0;
				vPortEnableInterrupts();
			}
			pxThreads[ lIndex ].uxCriticalNesting = 0;
			break;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x433f(%rip), %rax      # 0xb908
xorl %edx, %edx
leaq 0x18(%rdx), %rcx
cmpq $0x618, %rcx            # imm = 0x618
je 0x7610
cmpq %rdi, (%rax,%rdx)
movq %rcx, %rdx
jne 0x75cb
leaq (%rax,%rcx), %rdx
xorps %xmm0, %xmm0
movups %xmm0, -0x18(%rax,%rcx)
cmpq $0x0, -0x8(%rax,%rcx)
je 0x760b
movq $0x0, 0x4310(%rip) # 0xb910
movq $0x1, 0x3df5(%rip) # 0xb400
andq $0x0, -0x8(%rdx)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/portable/GCC/Posix/port.c
// Function: prvSuspendSignalHandler
void prvSuspendSignalHandler(int sig)
{
sigset_t xSignals;

	/* Only interested in the resume signal. */
	sigemptyset( &xSignals );
	sigaddset( &xSignals, SIG_RESUME );
	xSentinel = 1;

	/* Unlock the Single thread mutex to allow the resumed task to continue. */
	if ( 0 != pthread_mutex_unlock( &xSingleThreadMutex ) )
	{
		printf( "Releasing someone else's lock.\n" );
	}

	/* Wait on the resume signal. */
	if ( 0 != sigwait( &xSignals, &sig ) )
	{
		printf( "SSH: Sw %d\n", sig );
	}

	/* Will resume here when the SIG_RESUME signal is received. */
	/* Need to set the interrupts based on the task's critical nesting. */
	if ( uxCriticalNesting == 0 )
	{
		vPortEnableInterrupts();
	}
	else
	{
		vPortDisableInterrupts();
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x88, %rsp
movl %edi, -0xc(%rbp)
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
callq 0x4310
pushq $0xc
popq %rsi
movq %rbx, %rdi
callq 0x4790
movq $0x1, 0x42ba(%rip) # 0xb900
leaq 0x428b(%rip), %rdi      # 0xb8d8
callq 0x4410
testl %eax, %eax
je 0x7662
leaq 0xb30(%rip), %rdi       # 0x818d
callq 0x40c0
leaq -0x90(%rbp), %rdi
leaq -0xc(%rbp), %rsi
callq 0x4660
testl %eax, %eax
je 0x7687
movl -0xc(%rbp), %esi
leaq 0xa34(%rip), %rdi       # 0x80b4
xorl %eax, %eax
callq 0x4190
xorl %eax, %eax
cmpq $0x0, 0x427f(%rip)      # 0xb910
sete %al
movq %rax, 0x3d65(%rip)      # 0xb400
addq $0x88, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FileIO/fileIO.c
// Function: vDisplayMessage
void vDisplayMessage( const char * const pcMessageToPrint )
{
	vTaskSuspendAll();
	{
		printf( "%s", pcMessageToPrint );
		fflush( stdout );
	}
	xTaskResumeAll();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x4650
leaq 0xacf(%rip), %rdi       # 0x81ac
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4190
movq 0x37d2(%rip), %rax      # 0xaec0
movq (%rax), %rdi
callq 0x4440
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4080
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FileIO/fileIO.c
// Function: vWriteMessageToDisk
void vWriteMessageToDisk( const char * const pcMessage )
{
const portCHAR * const pcFileName = "RTOSlog.txt";
const portCHAR * const pcSeparator = "\r\n-----------------------\r\n";
FILE *pf;

	vTaskSuspendAll();
	{
		pf = fopen( pcFileName, "a" );
		if( pf != NULL )
		{
			fwrite( pcMessage, strlen( pcMessage ), ( unsigned portSHORT ) 1, pf );
			fwrite( pcSeparator, strlen( pcSeparator ), ( unsigned portSHORT ) 1, pf );
			fclose( pf );
		}
	}
	xTaskResumeAll();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x4650
leaq 0xa95(%rip), %rdi       # 0x81af
leaq 0xab6(%rip), %rsi       # 0x81d7
callq 0x4600
testq %rax, %rax
je 0x7768
movq %rax, %rbx
movq %r14, %rdi
callq 0x4170
pushq $0x1
popq %r15
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x46c0
leaq 0xa69(%rip), %rdi       # 0x81bb
pushq $0x1b
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x46c0
movq %rbx, %rdi
callq 0x4150
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4080
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/FileIO/fileIO.c
// Function: vWriteBufferToDisk
void vWriteBufferToDisk( const char * const pcBuffer, unsigned long ulBufferLength )
{
const portCHAR * const pcFileName = "trace.bin";
FILE *pf;

	vTaskSuspendAll();
	{
		pf = fopen( pcFileName, "wb" );
		if( pf )
		{
			fwrite( pcBuffer, ( size_t ) ulBufferLength, ( unsigned portSHORT ) 1, pf );
			fclose( pf );
		}
	}
	xTaskResumeAll();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x4650
leaq 0xa46(%rip), %rdi       # 0x81d9
leaq 0xa49(%rip), %rsi       # 0x81e3
callq 0x4600
testq %rax, %rax
je 0x77c0
movq %rax, %r15
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rcx
callq 0x46c0
movq %r15, %rdi
callq 0x4150
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4080
nop
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIO.c
// Function: lAsyncIORegisterCallback
long lAsyncIORegisterCallback( int iFileDescriptor, void (*pvFunction)(int,void*), void *pvContext )
{
xAsyncIOCallback *pxIterator;
	if ( NULL != pvFunction )
	{
		/* Record the socket against its call back. */
		for ( pxIterator = &xHead; pxIterator->pxNext != NULL; pxIterator = pxIterator->pxNext );
		pxIterator->pxNext = ( xAsyncIOCallback * )malloc( sizeof( xAsyncIOCallback ) );
		pxIterator->pxNext->iFileHandle = iFileDescriptor;
		pxIterator->pxNext->pvFunction = pvFunction;
		pxIterator->pxNext->pvContext = pvContext;

		/* Set the socket as requiring a signal when messages are received. */
		prvRegisterSignalHandler( iFileDescriptor );
	}
	return ( NULL != pvFunction );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
testq %rsi, %rsi
je 0x781c
movq %rdx, %r15
movl %edi, %r14d
leaq 0x4168(%rip), %rax      # 0xb958
movq %rax, %r12
movq 0x18(%rax), %rax
testq %rax, %rax
jne 0x77f0
pushq $0x20
popq %rdi
callq 0x4430
movq %rax, 0x18(%r12)
movl %r14d, (%rax)
movq %rbx, 0x8(%rax)
movq %r15, 0x10(%rax)
movl %r14d, %edi
callq 0x47c0
xorl %eax, %eax
testq %rbx, %rbx
setne %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIO.c
// Function: prvRegisterSignalHandler
void prvRegisterSignalHandler( int iSocket )
{
struct sigaction xAction;

	if ( 1 != iAlreadyRegisteredHandler )
	{
		/* Initialise the sigaction struct for the signal handler. */
		xAction.sa_sigaction = prvSignalHandler;
		xAction.sa_flags = SA_SIGINFO;	/* Using this option, the signal handler knows which socket caused the signal. */
		sigfillset( &xAction.sa_mask );
		sigdelset( &xAction.sa_mask, SIG_MSG_RX );
		sigdelset( &xAction.sa_mask, SIG_TICK );

		/* Register the signal handler. */
		if ( 0 != sigaction( SIG_MSG_RX, &xAction, NULL ) )	/* Register the Signal Handler. */
		{
			printf( "Problem installing SIG_MSG_RX\n" );
		}
		else
		{
			iAlreadyRegisteredHandler = 1;
		}
	}

	/* Request that the socket generates a signal. */
	if ( SIG_MSG_RX == SIGIO )
	{
		if ( 0 != fcntl( iSocket, F_SETOWN, getpid() ) )
		{
			printf( "fnctl: Failed: %d\n", errno );
		}
	}
	else
	{
		/* Use real-time signals instead of SIGIO */
		if ( 0 != fcntl( iSocket, F_SETSIG, SIG_MSG_RX ) )
		{
			printf( "fnctl: Failed: %d\n", errno );
		}
	}

	/* Indicate that the socket is Asynchronous. */
	if ( 0 != fcntl( iSocket, F_SETFL, O_ASYNC ) )
	{
		printf( "fcntl: Failed: %d\n", errno );
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movl %edi, %ebx
movl 0x4133(%rip), %eax      # 0xb978
cmpl $0x1, %eax
je 0x78b6
movq 0x3757(%rip), %rax      # 0xafa8
leaq -0xa8(%rbp), %r14
movq %rax, -0x8(%r14)
movl $0x4, 0x80(%r14)
movq %r14, %rdi
callq 0x4360
pushq $0x1d
popq %r15
movq %r14, %rdi
movl %r15d, %esi
callq 0x4610
pushq $0xe
popq %rsi
movq %r14, %rdi
callq 0x4610
leaq -0xb0(%rbp), %rsi
movl %r15d, %edi
xorl %edx, %edx
callq 0x40f0
testl %eax, %eax
je 0x78ac
leaq 0x967(%rip), %rdi       # 0x820c
callq 0x40c0
jmp 0x78b6
movl $0x1, 0x40c2(%rip)      # 0xb978
callq 0x4130
pushq $0x8
popq %rsi
movl %ebx, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x4120
testl %eax, %eax
je 0x78e2
callq 0x40a0
movl (%rax), %esi
leaq 0x90b(%rip), %rdi       # 0x81e6
xorl %eax, %eax
callq 0x4190
pushq $0x4
popq %rsi
movl %ebx, %edi
movl $0x2000, %edx           # imm = 0x2000
xorl %eax, %eax
callq 0x4120
testl %eax, %eax
je 0x790c
callq 0x40a0
movl (%rax), %esi
leaq 0x8f4(%rip), %rdi       # 0x81f9
xorl %eax, %eax
callq 0x4190
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIO.c
// Function: prvSignalHandler
void prvSignalHandler( int signal, siginfo_t * data, void * pvParam )
{
int iSocket = 0, iReturn;
xAsyncIOCallback *pxIterator;
struct pollfd xFileDescriptorPollEvents;
	if ( SIG_MSG_RX == signal )	/* Are we in the correct signal handler. */
	{
		if ( data->si_code == SI_SIGIO )	/* Do we know which socket caused the signal? */
		{
			iSocket = data->si_fd;	/* Yes we do. Find the owner. */

			for ( pxIterator = &xHead; ( pxIterator->pxNext != NULL ) && ( pxIterator->iFileHandle != iSocket ); pxIterator = pxIterator->pxNext );

			if ( pxIterator->iFileHandle == iSocket )
			{
				( pxIterator->pvFunction )( iSocket, pxIterator->pvContext );
			}
			else
			{
				printf( "No socket owner.\n" );
			}
		}
		else
		{
			/* We don't know which socket cause the signal. Use poll to find the socket. */
			for ( pxIterator = &xHead; pxIterator != NULL; pxIterator = pxIterator->pxNext )
			{
				xFileDescriptorPollEvents.fd = pxIterator->iFileHandle;
				xFileDescriptorPollEvents.events = POLLIN;
				xFileDescriptorPollEvents.revents = 0;
				if ( xFileDescriptorPollEvents.fd != 0 )
				{
					iReturn = poll( &xFileDescriptorPollEvents, 1, 0 );	/* Need to kick off the signal handling. */

					if ( ( 1 == iReturn ) && ( POLLIN == xFileDescriptorPollEvents.revents ) )
					{
						if ( pxIterator->pvFunction != NULL )
						{
							( pxIterator->pvFunction )( xFileDescriptorPollEvents.fd, pxIterator->pvContext );
						}
					}
				}
			}
			/* Note that poll should really be passed all of the sockets in one go and then iterate over the results. */
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x1d, %edi
jne 0x79ea
cmpl $-0x5, 0x8(%rsi)
jne 0x7994
movl 0x18(%rsi), %edi
leaq 0x3fee(%rip), %rcx      # 0xb958
movq %rcx, %rax
movq 0x18(%rcx), %rcx
movl (%rax), %edx
testq %rcx, %rcx
je 0x797c
cmpl %edi, %edx
jne 0x796a
cmpl %edi, %edx
jne 0x79f5
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
leaq 0x3fbd(%rip), %r15      # 0xb958
leaq -0x20(%rbp), %rbx
pushq $0x1
popq %r14
testq %r15, %r15
je 0x79ea
movl (%r15), %eax
movl %eax, -0x20(%rbp)
movl $0x1, -0x1c(%rbp)
testl %eax, %eax
je 0x79e4
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x4540
cmpl $0x1, %eax
jne 0x79e4
cmpw $0x1, -0x1a(%rbp)
jne 0x79e4
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x79e4
movl -0x20(%rbp), %edi
movq 0x10(%r15), %rsi
callq *%rax
movq 0x18(%r15), %r15
jmp 0x79a3
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x82e(%rip), %rdi       # 0x822a
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x40c0
nop
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSerial.c
// Function: lAsyncIOSerialOpen
long lAsyncIOSerialOpen( const char *pcDevice, int *piDeviceDescriptor )
{
int iSerialDevice = 0;
struct termios xTerminalSettings;
long lReturn = pdFALSE;

	/* Open the port that was passed in. */
	iSerialDevice = open( pcDevice, O_RDWR | O_NOCTTY | O_NONBLOCK );
	if ( iSerialDevice < 0 )
	{
		lReturn = pdFALSE;
	}
	else
	{
		/* Grab a copy of the current terminal settings. */
		if ( 0 == tcgetattr( iSerialDevice, &xTerminalSettings ) )
		{
			/* Configure the port to the Hard-coded values. */
			cfmakeraw( &xTerminalSettings );
			cfsetspeed( &xTerminalSettings, B38400 );
			/* Set the terminal settings. */
			lReturn = ( 0 == tcsetattr(iSerialDevice, TCSANOW, &xTerminalSettings) );

			/* Pass out the device descriptor for subsequent calls to AsyncIORegisterCallback() */
			*piDeviceDescriptor = iSerialDevice;
		}
	}

	return lReturn;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
xorl %r15d, %r15d
movl $0x902, %esi            # imm = 0x902
xorl %eax, %eax
callq 0x45e0
testl %eax, %eax
js 0x7a76
movl %eax, %r14d
leaq -0x54(%rbp), %rsi
movl %eax, %edi
callq 0x45a0
testl %eax, %eax
je 0x7a46
xorl %r15d, %r15d
jmp 0x7a76
leaq -0x54(%rbp), %r15
movq %r15, %rdi
callq 0x4520
pushq $0xf
popq %rsi
movq %r15, %rdi
callq 0x4210
movl %r14d, %edi
xorl %esi, %esi
movq %r15, %rdx
callq 0x45b0
xorl %r15d, %r15d
testl %eax, %eax
sete %r15b
movl %r14d, (%rbx)
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSerial.c
// Function: vAsyncSerialIODataAvailableISR
void vAsyncSerialIODataAvailableISR( int iFileDescriptor, void *pContext )
{
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
ssize_t iReadResult = -1;
unsigned char ucRx;

	/* This handler only processes a single byte/character at a time. */
	iReadResult = read( iFileDescriptor, &ucRx, 1 );
	if ( 1 == iReadResult )
	{
		if ( NULL != pContext )
		{
			/* Send the received byte to the queue. */
			if ( pdTRUE != xQueueSendFromISR( (xQueueHandle)pContext, &ucRx, &xHigherPriorityTaskWoken ) )
			{
				/* the queue is full. */
			}
		}
	}
	portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
andq $0x0, -0x20(%rbp)
leaq -0x11(%rbp), %rsi
pushq $0x1
popq %rdx
callq 0x42b0
testq %rbx, %rbx
je 0x7ace
cmpq $0x1, %rax
jne 0x7ace
leaq -0x11(%rbp), %rsi
leaq -0x20(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x4100
cmpq $0x0, (%r14)
je 0x7ace
callq 0x4470
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSocket.c
// Function: iSocketOpenUDP
int iSocketOpenUDP( void (*vSocketCallback)( int, void * ), void *pvContext, struct sockaddr_in *pxBindAddress )
{
int iSocket = 0;

	taskENTER_CRITICAL();
	{
		/* Open a new socket. */
		iSocket = socket( PF_INET, SOCK_DGRAM, IPPROTO_UDP );
		if ( 0 != iSocket )
		{
			/* Have we been passed a call back function that will deal with received messages? */
			if ( pdTRUE == lAsyncIORegisterCallback( iSocket, vSocketCallback, pvContext ) )
			{
				/* This is UDP so bind it passed listen address. */
				if ( NULL != pxBindAddress )
				{
					if ( 0 != bind( iSocket, ( struct sockaddr *)pxBindAddress, sizeof( struct sockaddr_in ) ) )
					{
						printf("Bind error: %d\n", errno );
					}
				}
			}
			else
			{
				/* Socket is being used as polled IO or for sending data. */
			}
		}
		else
		{
			printf( "Failed to open socket: %d.\n", errno );
		}
	}
	taskEXIT_CRITICAL();
	return iSocket;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
callq 0x4340
pushq $0x2
popq %rdi
pushq $0x11
popq %rdx
movl %edi, %esi
callq 0x47d0
movl %eax, %ebx
testl %eax, %eax
je 0x7b36
movl %ebx, %edi
movq %r12, %rsi
movq %r15, %rdx
callq 0x4450
testq %r14, %r14
je 0x7b4e
cmpq $0x1, %rax
jne 0x7b4e
pushq $0x10
popq %rdx
movl %ebx, %edi
movq %r14, %rsi
callq 0x4550
testl %eax, %eax
je 0x7b4e
leaq 0x707(%rip), %r14       # 0x823b
jmp 0x7b3d
leaq 0x70e(%rip), %r14       # 0x824b
callq 0x40a0
movl (%rax), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x4190
callq 0x44b0
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSocket.c
// Function: iSocketUDPSendTo
int iSocketUDPSendTo( int iSocket, xUDPPacket *pxPacket, struct sockaddr_in *pxSendAddress )
{
int iBytesSent = 0;
	if ( ( 0 != iSocket ) && ( NULL != pxPacket ) )
	{
		taskENTER_CRITICAL();
			iBytesSent = sendto( iSocket, pxPacket, sizeof( xUDPPacket ), 0, ( struct sockaddr *)pxSendAddress, sizeof( struct sockaddr_in ) );
		taskEXIT_CRITICAL();
	}
	return iBytesSent;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testl %edi, %edi
sete %al
testq %rsi, %rsi
sete %cl
xorl %r12d, %r12d
orb %al, %cl
jne 0x7bc4
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %r15d
callq 0x4340
pushq $0x10
popq %r9
movl $0x400, %edx            # imm = 0x400
movl %r15d, %edi
movq %r14, %rsi
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x4220
movq %rax, %r12
callq 0x44b0
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSocket.c
// Function: iSocketUDPReceiveISR
int iSocketUDPReceiveISR( int iSocket, xUDPPacket *pxPacket, struct sockaddr_in *pxReceiveAddress )
{
int iBytesReceived = 0;
socklen_t xSocketLength = sizeof( struct sockaddr_in );

	if ( 0 != iSocket )
	{
		iBytesReceived = recvfrom( iSocket, pxPacket, sizeof( xUDPPacket ), 0, ( struct sockaddr *)pxReceiveAddress, &xSocketLength );
		pxPacket->ucNull = 0;
	}
	return iBytesReceived;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl $0x10, -0xc(%rbp)
testl %edi, %edi
je 0x7c00
movq %rdx, %r8
movq %rsi, %rbx
leaq -0xc(%rbp), %r9
movl $0x400, %edx            # imm = 0x400
xorl %ecx, %ecx
callq 0x4480
movb $0x0, 0x3ff(%rbx)
jmp 0x7c02
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSocket.c
// Function: iSocketUDPReceiveFrom
int iSocketUDPReceiveFrom( int iSocket, xUDPPacket *pxPacket, struct sockaddr_in *pxReceiveAddress )
{
int iBytesReceived = 0;
socklen_t xSocketLength = sizeof( struct sockaddr_in );

	if ( 0 != iSocket )
	{
		taskENTER_CRITICAL();
			iBytesReceived = recvfrom( iSocket, pxPacket, sizeof( xUDPPacket ), 0, ( struct sockaddr *)pxReceiveAddress, &xSocketLength );
			pxPacket->ucNull = 0;
		taskEXIT_CRITICAL();
	}
	return iBytesReceived;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl $0x10, -0x1c(%rbp)
testl %edi, %edi
je 0x7c56
movq %rdx, %r14
movq %rsi, %rbx
movl %edi, %r15d
callq 0x4340
leaq -0x1c(%rbp), %r9
movl $0x400, %edx            # imm = 0x400
movl %r15d, %edi
movq %rbx, %rsi
xorl %ecx, %ecx
movq %r14, %r8
callq 0x4480
movq %rax, %r14
movb $0x0, 0x3ff(%rbx)
callq 0x44b0
jmp 0x7c59
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSocket.c
// Function: vUDPReceiveAndDeliverCallback
void vUDPReceiveAndDeliverCallback( int iSocket, void *pvContext )
{
portBASE_TYPE xHigherTaskWoken = pdFALSE;
static xUDPPacket xPacket;
struct sockaddr_in xReceiveAddress;

	if ( sizeof( xUDPPacket ) == iSocketUDPReceiveISR( iSocket, &xPacket, &xReceiveAddress ) )
	{
		if ( pdPASS != xQueueSendFromISR( (xQueueHandle)pvContext, &xPacket, &xHigherTaskWoken ) )
		{
			printf( "UDP Rx failed\n" );
		}
	}
	else
	{
		printf( "UDP Rx failed: %d\n", errno );
	}
	portEND_SWITCHING_ISR( xHigherTaskWoken );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
andq $0x0, -0x10(%rbp)
leaq 0x3cfd(%rip), %rsi      # 0xb97c
leaq -0x20(%rbp), %rdx
callq 0x4180
cmpl $0x400, %eax            # imm = 0x400
jne 0x7cb8
leaq 0x3ce6(%rip), %rsi      # 0xb97c
leaq -0x10(%rbp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x4100
cmpq $0x1, %rax
je 0x7ccd
leaq 0x5c9(%rip), %rdi       # 0x827a
callq 0x40c0
jmp 0x7ccd
callq 0x40a0
movl (%rax), %esi
leaq 0x5a1(%rip), %rdi       # 0x8267
xorl %eax, %eax
callq 0x4190
cmpq $0x0, -0x10(%rbp)
je 0x7cd9
callq 0x4470
addq $0x18, %rsp
popq %rbx
popq %rbp
retq