// File: /workspace/github_c_makefile_star2_O0/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/tasks.c
// Function: vTaskSwitchContext
void vTaskSwitchContext( void )
{
	if( uxSchedulerSuspended != ( unsigned portBASE_TYPE ) pdFALSE )
	{
		/* The scheduler is currently suspended - do not allow a context
		switch. */
		xMissedYield = pdTRUE;
		return;
	}

	traceTASK_SWITCHED_OUT();

	#if ( configGENERATE_RUN_TIME_STATS == 1 )
	{
		unsigned long ulTempCounter = portGET_RUN_TIME_COUNTER_VALUE();

			/* Add the amount of time the task has been running to the accumulated
			time so far.  The time the task started running was stored in
			ulTaskSwitchedInTime.  Note that there is no overflow protection here
			so count values are only valid until the timer overflows.  Generally
			this will be about 1 hour assuming a 1uS timer increment. */
			pxCurrentTCB->ulRunTimeCounter += ( ulTempCounter - ulTaskSwitchedInTime );
			ulTaskSwitchedInTime = ulTempCounter;
	}
	#endif

	taskFIRST_CHECK_FOR_STACK_OVERFLOW();
	taskSECOND_CHECK_FOR_STACK_OVERFLOW();

	/* Find the highest priority queue that contains ready tasks. */
	while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) )
	{
		--uxTopReadyPriority;
	}

	/* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the tasks of the
	same priority get an equal share of the processor time. */
	listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopReadyPriority ] ) );

	traceTASK_SWITCHED_IN();
	vWriteTraceToBuffer();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq 0x6319(%rip), %rax      # 0xdf68
movq (%rax), %rax
cmpq $0x0, %rax
je 0x7c6b
movq 0x6279(%rip), %rax      # 0xded8
movq $0x1, (%rax)
jmp 0x7e28
callq 0x4490
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rcx
movq 0x62b9(%rip), %rax      # 0xdf38
subq (%rax), %rcx
movq 0x6327(%rip), %rax      # 0xdfb0
movq (%rax), %rax
addq 0x90(%rax), %rcx
movq %rcx, 0x90(%rax)
movq -0x8(%rbp), %rcx
movq 0x6293(%rip), %rax      # 0xdf38
movq %rcx, (%rax)
movq 0x6219(%rip), %rax      # 0xdec8
movq (%rax), %rcx
movq 0x6257(%rip), %rax      # 0xdf10
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
cmpq $0x0, %rax
jne 0x7ce3
movq 0x61f8(%rip), %rax      # 0xdec8
movq (%rax), %rcx
addq $-0x1, %rcx
movq 0x61ea(%rip), %rax      # 0xdec8
movq %rcx, (%rax)
jmp 0x7ca8
movq 0x61de(%rip), %rax      # 0xdec8
movq (%rax), %rcx
movq 0x621c(%rip), %rax      # 0xdf10
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0x7d3c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rcx
movq 0x6261(%rip), %rax      # 0xdfb0
movq %rcx, (%rax)
movq 0x61ff(%rip), %rax      # 0xdf58
cmpq $0x0, (%rax)
je 0x7e28
movq 0x61be(%rip), %rax      # 0xdf28
movq (%rax), %rax
movq 0x623c(%rip), %rcx      # 0xdfb0
movq (%rcx), %rcx
cmpq 0x78(%rcx), %rax
je 0x7e26
movq 0x6178(%rip), %rax      # 0xdf00
movq (%rax), %rax
addq $0x10, %rax
movq 0x6162(%rip), %rcx      # 0xdef8
cmpq (%rcx), %rax
jae 0x7e16
movq 0x620e(%rip), %rax      # 0xdfb0
movq (%rax), %rax
movq 0x78(%rax), %rcx
movq 0x6178(%rip), %rax      # 0xdf28
movq %rcx, (%rax)
movq 0x6126(%rip), %rax      # 0xdee0
movl (%rax), %eax
movl %eax, %eax
movl %eax, %ecx
movq 0x6139(%rip), %rax      # 0xdf00
movq (%rax), %rax
movq %rcx, (%rax)
movq 0x612c(%rip), %rax      # 0xdf00
movq (%rax), %rcx
addq $0x8, %rcx
movq 0x611e(%rip), %rax      # 0xdf00
movq %rcx, (%rax)
movq 0x613c(%rip), %rax      # 0xdf28
movq (%rax), %rcx
movq 0x610a(%rip), %rax      # 0xdf00
movq (%rax), %rax
movq %rcx, (%rax)
movq 0x60fd(%rip), %rax      # 0xdf00
movq (%rax), %rcx
addq $0x8, %rcx
movq 0x60ef(%rip), %rax      # 0xdf00
movq %rcx, (%rax)
jmp 0x7e24
movq 0x613b(%rip), %rax      # 0xdf58
movq $0x0, (%rax)
jmp 0x7e26
jmp 0x7e28
addq $0x10, %rsp
popq %rbp
retq
nop