// File: /workspace/github_c_makefile_star2_O0/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 0x42f0
movq %rax, 0x62ec(%rip)      # 0xe908
movl $0x0, -0x1cc(%rbp)
cmpl $0x40, -0x1cc(%rbp)
jge 0x8696
movq 0x62d2(%rip), %rax      # 0xe908
movslq -0x1cc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movq 0x62b6(%rip), %rax      # 0xe908
movslq -0x1cc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movq 0x6299(%rip), %rax      # 0xe908
movslq -0x1cc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq $0x0, 0x10(%rax)
movl -0x1cc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1cc(%rbp)
jmp 0x8626
movl $0x0, -0x10(%rbp)
leaq 0xccc(%rip), %rax       # 0x9370
movq %rax, -0x98(%rbp)
leaq -0x98(%rbp), %rdi
addq $0x8, %rdi
callq 0x4350
movl $0x0, -0xa8(%rbp)
leaq 0xd54(%rip), %rax       # 0x9420
movq %rax, -0x130(%rbp)
leaq -0x130(%rbp), %rdi
addq $0x8, %rdi
callq 0x4350
movl $0x0, -0x140(%rbp)
movq 0x57fc(%rip), %rax      # 0xdef0
movq %rax, -0x1c8(%rbp)
leaq -0x1c8(%rbp), %rdi
addq $0x8, %rdi
callq 0x4350
movl $0xa, %edi
leaq -0x98(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x40e0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x8736
leaq 0x29b0(%rip), %rdi      # 0xb0df
movb $0x0, %al
callq 0x4180
movl $0xc, %edi
leaq -0x130(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x40e0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x8761
leaq 0x29aa(%rip), %rdi      # 0xb104
movb $0x0, %al
callq 0x4180
movl $0xe, %edi
leaq -0x1c8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x40e0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x878c
leaq 0x299e(%rip), %rdi      # 0xb123
movb $0x0, %al
callq 0x4180
callq 0x4120
movl %eax, %esi
leaq 0x29a6(%rip), %rdi      # 0xb140
movb $0x0, %al
callq 0x4180
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopw (%rax,%rax)