// File: /workspace/github_c_makefile_star2_O0/weaslepalace[P]FreeRTOS_Posix_Sim/FreeRTOS_Kernel/tasks.c
// Function: vTaskPrioritySet
void vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority )
	{
	tskTCB *pxTCB;
	unsigned portBASE_TYPE uxCurrentPriority, xYieldRequired = pdFALSE;

		/* Ensure the new priority is valid. */
		if( uxNewPriority >= configMAX_PRIORITIES )
		{
			uxNewPriority = configMAX_PRIORITIES - 1;
		}

		portENTER_CRITICAL();
		{
			if( pxTask == pxCurrentTCB )
			{
				pxTask = NULL;
			}

			/* If null is passed in here then we are changing the
			priority of the calling function. */
			pxTCB = prvGetTCBFromHandle( pxTask );

			traceTASK_PRIORITY_SET( pxTask, uxNewPriority );

			#if ( configUSE_MUTEXES == 1 )
			{
				uxCurrentPriority = pxTCB->uxBasePriority;
			}
			#else
			{
				uxCurrentPriority = pxTCB->uxPriority;
			}
			#endif

			if( uxCurrentPriority != uxNewPriority )
			{
				/* The priority change may have readied a task of higher
				priority than the calling task. */
				if( uxNewPriority > uxCurrentPriority )
				{
					if( pxTask != NULL )
					{
						/* The priority of another task is being raised.  If we
						were raising the priority of the currently running task
						there would be no need to switch as it must have already
						been the highest priority task. */
						xYieldRequired = pdTRUE;
					}
				}
				else if( pxTask == NULL )
				{
					/* Setting our own priority down means there may now be another
					task of higher priority that is ready to execute. */
					xYieldRequired = pdTRUE;
				}



				#if ( configUSE_MUTEXES == 1 )
				{
					/* Only change the priority being used if the task is not
					currently using an inherited priority. */
					if( pxTCB->uxBasePriority == pxTCB->uxPriority )
					{
						pxTCB->uxPriority = uxNewPriority;
					}

					/* The base priority gets set whatever. */
					pxTCB->uxBasePriority = uxNewPriority;
				}
				#else
				{
					pxTCB->uxPriority = uxNewPriority;
				}
				#endif

				listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( configMAX_PRIORITIES - ( portTickType ) uxNewPriority ) );

				/* If the task is in the blocked or suspended list we need do
				nothing more than change it's priority variable. However, if
				the task is in a ready list it needs to be removed and placed
				in the queue appropriate to its new priority. */
				if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ uxCurrentPriority ] ), &( pxTCB->xGenericListItem ) ) )
				{
					/* The task is currently in its ready list - remove before adding
					it to it's new ready list.  As we are in a critical section we
					can do this even if the scheduler is suspended. */
					vListRemove( &( pxTCB->xGenericListItem ) );
					prvAddTaskToReadyQueue( pxTCB );
				}

				if( xYieldRequired == pdTRUE )
				{
					portYIELD_WITHIN_API();
				}
			}
		}
		portEXIT_CRITICAL();
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x28(%rbp)
cmpq $0xa, -0x10(%rbp)
jb 0x6b37
movq $0x9, -0x10(%rbp)
callq 0x4330
movq -0x8(%rbp), %rax
movq 0x7469(%rip), %rcx      # 0xdfb0
movq (%rcx), %rcx
cmpq %rcx, %rax
jne 0x6b57
movq $0x0, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x6b6e
movq 0x744b(%rip), %rax      # 0xdfb0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x6b76
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0x6c90
movq -0x10(%rbp), %rax
cmpq -0x20(%rbp), %rax
jbe 0x6bb6
cmpq $0x0, -0x8(%rbp)
je 0x6bb4
movq $0x1, -0x28(%rbp)
jmp 0x6bc7
cmpq $0x0, -0x8(%rbp)
jne 0x6bc5
movq $0x1, -0x28(%rbp)
jmp 0x6bc7
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jne 0x6be8
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x10(%rbp), %rax
movl %eax, %eax
movl %eax, %ecx
movl $0xa, %eax
subq %rcx, %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x72f1(%rip), %rcx      # 0xdf10
imulq $0x28, -0x20(%rbp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x6c82
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x4040
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq 0x7280(%rip), %rcx      # 0xdec8
movq (%rcx), %rcx
cmpq %rcx, %rax
jbe 0x6c62
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rcx
movq 0x7269(%rip), %rax      # 0xdec8
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq 0x72a3(%rip), %rdi      # 0xdf10
imulq $0x28, 0x58(%rax), %rax
addq %rax, %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
callq 0x4760
cmpq $0x1, -0x28(%rbp)
jne 0x6c8e
callq 0x4560
jmp 0x6c90
callq 0x44a0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)