// File: /workspace/github_c_makefile_star2_O1/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/tasks.c
// Function: xTaskResumeAll
signed portBASE_TYPE xTaskResumeAll( void )
{
register tskTCB *pxTCB;
signed portBASE_TYPE xAlreadyYielded = pdFALSE;

	/* It is possible that an ISR caused a task to be removed from an event
	list while the scheduler was suspended.  If this was the case then the
	removed task will have been added to the xPendingReadyList.  Once the
	scheduler has been resumed it is safe to move all the pending ready
	tasks from this list into their appropriate ready list. */
	portENTER_CRITICAL();
	{
		--uxSchedulerSuspended;

		if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )
		{
			if( uxCurrentNumberOfTasks > ( unsigned portBASE_TYPE ) 0 )
			{
				portBASE_TYPE xYieldRequired = pdFALSE;

				/* Move any readied tasks from the pending list into the
				appropriate ready list. */
				while( ( pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY(  ( ( xList * ) &xPendingReadyList ) ) ) != NULL )
				{
					vListRemove( &( pxTCB->xEventListItem ) );
					vListRemove( &( pxTCB->xGenericListItem ) );
					prvAddTaskToReadyQueue( pxTCB );

					/* If we have moved a task that has a priority higher than
					the current task then we should yield. */
					if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )
					{
						xYieldRequired = pdTRUE;
					}
				}

				/* If any ticks occurred while the scheduler was suspended then
				they should be processed now.  This ensures the tick count does not
				slip, and that any delayed tasks are resumed at the correct time. */
				if( uxMissedTicks > ( unsigned portBASE_TYPE ) 0 )
				{
					while( uxMissedTicks > ( unsigned portBASE_TYPE ) 0 )
					{
						vTaskIncrementTick();
						--uxMissedTicks;
					}

					/* As we have processed some ticks it is appropriate to yield
					to ensure the highest priority task that is ready to run is
					the task actually running. */
					#if configUSE_PREEMPTION == 1
					{
						xYieldRequired = pdTRUE;
					}
					#endif
				}

				if( ( xYieldRequired == pdTRUE ) || ( xMissedYield == pdTRUE ) )
				{
					xAlreadyYielded = pdTRUE;
					xMissedYield = pdFALSE;
					portYIELD_WITHIN_API();
				}
			}
		}
	}
	portEXIT_CRITICAL();

	return xAlreadyYielded;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x4320
movq 0x634a(%rip), %rax      # 0xbf68
decq (%rax)
cmpq $0x0, (%rax)
je 0x5c40
xorl %ebx, %ebx
callq 0x4480
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x62f9(%rip), %rax      # 0xbf40
cmpq $0x0, (%rax)
je 0x5c27
xorl %r14d, %r14d
movq 0x6341(%rip), %r15      # 0xbf98
movq 0x626a(%rip), %r12      # 0xbec8
cmpq $0x0, (%r15)
je 0x5c6e
movq 0x18(%r15), %rax
movq 0x18(%rax), %r13
jmp 0x5c71
xorl %r13d, %r13d
testq %r13, %r13
je 0x5cd1
leaq 0x30(%r13), %rdi
callq 0x4040
leaq 0x8(%r13), %rbx
movq %rbx, %rdi
callq 0x4040
movq 0x58(%r13), %rax
cmpq (%r12), %rax
jbe 0x5c99
movq %rax, (%r12)
movq 0x58(%r13), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq 0x6264(%rip), %rdi      # 0xbf10
movq %rbx, %rsi
callq 0x4730
movq 0x58(%r13), %rax
movq 0x62f1(%rip), %rcx      # 0xbfb0
movq (%rcx), %rcx
cmpq 0x58(%rcx), %rax
movl $0x1, %eax
cmovaeq %rax, %r14
jmp 0x5c5e
movq 0x62a8(%rip), %rbx      # 0xbf80
cmpq $0x0, (%rbx)
je 0x5cf4
movl $0x1, %r14d
cmpq $0x0, (%rbx)
je 0x5cf4
callq 0x43d0
decq (%rbx)
jmp 0x5ce4
cmpq $0x1, %r14
je 0x5d0e
movq 0x61d7(%rip), %rax      # 0xbed8
movq (%rax), %rax
cmpq $0x1, %rax
jne 0x5c27
movq 0x61c3(%rip), %rax      # 0xbed8
movq $0x0, (%rax)
callq 0x4540
movl $0x1, %ebx
jmp 0x5c29