	.file	"extr_ipc_mqueue.c_ipc_mqueue_send.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"ipc_mqueue_send"
	.text
	.p2align 4
	.globl	ipc_mqueue_send
	.type	ipc_mqueue_send, @function
ipc_mqueue_send:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	mov	r14, rcx
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13, rsi
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12d, edx
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	call	imq_full@PLT
	test	eax, eax
	je	.L5
	mov	rdi, rbp
	call	imq_full_kernel@PLT
	test	rax, rax
	jne	.L4
	test	DWORD PTR MACH_SEND_ALWAYS[rip], r12d
	je	.L39
.L5:
	mov	rax, QWORD PTR 0[rbp]
	xor	edi, edi
	add	rax, 1
	mov	QWORD PTR 0[rbp], rax
	test	rax, rax
	setg	dil
	call	assert@PLT
	mov	rdi, rbp
	call	imq_unlock@PLT
.L3:
	mov	edx, r12d
	mov	rsi, r13
	mov	rdi, rbp
	call	ipc_mqueue_post@PLT
	mov	eax, DWORD PTR MACH_MSG_SUCCESS[rip]
.L1:
	mov	rbx, QWORD PTR 8[rsp]
	xor	rbx, QWORD PTR fs:40
	jne	.L40
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L39:
	.cfi_restore_state
	mov	rax, QWORD PTR 0[r13]
	mov	edi, DWORD PTR [rax]
	call	MACH_MSGH_BITS_REMOTE@PLT
	cmp	rax, QWORD PTR MACH_MSG_TYPE_PORT_SEND_ONCE[rip]
	je	.L5
.L4:
	xor	eax, eax
	call	current_thread@PLT
	mov	rdi, rbp
	mov	ebx, eax
	call	ip_from_mq@PLT
	mov	rdi, rbp
	mov	r15, rax
	test	DWORD PTR MACH_SEND_TIMEOUT[rip], r12d
	je	.L6
	test	r14, r14
	je	.L41
.L6:
	call	imq_full_kernel@PLT
	test	rax, rax
	jne	.L42
	mov	eax, DWORD PTR TRUE[rip]
	mov	DWORD PTR 8[rbp], eax
	test	DWORD PTR MACH_SEND_TIMEOUT[rip], r12d
	jne	.L43
	mov	QWORD PTR [rsp], 0
.L10:
	mov	esi, DWORD PTR kThreadWaitPortSend[rip]
	mov	edi, ebx
	call	thread_set_pending_block_hint@PLT
	mov	ebx, DWORD PTR TURNSTILE_SYNC_IPC[rip]
	mov	r14, QWORD PTR TURNSTILE_NULL[rip]
	mov	rdi, r15
	call	port_send_turnstile_address@PLT
	mov	rdi, r15
	mov	ecx, ebx
	mov	esi, eax
	mov	rdx, r14
	call	turnstile_prepare@PLT
	mov	rdi, r15
	mov	rbx, rax
	call	ip_active@PLT
	test	rax, rax
	je	.L11
	mov	rax, QWORD PTR MACH_PORT_NULL[rip]
	cmp	QWORD PTR [r15], rax
	je	.L44
.L11:
	mov	rdi, r15
	call	ipc_port_get_inheritor@PLT
	mov	esi, eax
.L12:
	mov	edx, DWORD PTR TURNSTILE_DELAYED_UPDATE[rip]
	mov	rdi, rbx
	or	edx, DWORD PTR TURNSTILE_INHERITOR_TURNSTILE[rip]
	call	turnstile_update_inheritor@PLT
	mov	r9d, DWORD PTR TIMEOUT_NO_LEEWAY[rip]
	mov	r8, QWORD PTR [rsp]
	mov	rdi, rbx
	mov	ecx, DWORD PTR TIMEOUT_URGENCY_USER_NORMAL[rip]
	mov	edx, DWORD PTR THREAD_ABORTSAFE[rip]
	mov	esi, DWORD PTR IPC_MQUEUE_FULL[rip]
	call	waitq_assert_wait64_leeway@PLT
	mov	rdi, rbp
	mov	r14d, eax
	call	imq_unlock@PLT
	mov	esi, DWORD PTR TURNSTILE_INTERLOCK_NOT_HELD[rip]
	mov	rdi, rbx
	call	turnstile_update_inheritor_complete@PLT
	cmp	DWORD PTR THREAD_WAITING[rip], r14d
	je	.L45
.L13:
	mov	rdi, rbp
	call	imq_lock@PLT
	mov	rdi, r15
	call	port_send_turnstile_address@PLT
	xor	edx, edx
	mov	rdi, r15
	mov	esi, eax
	call	turnstile_complete@PLT
	mov	rdi, rbp
	call	imq_unlock@PLT
	xor	eax, eax
	call	turnstile_cleanup@PLT
	cmp	r14d, 130
	je	.L14
	jg	.L15
	cmp	r14d, 128
	je	.L16
	cmp	r14d, 129
	jne	.L18
	mov	eax, DWORD PTR MACH_SEND_INVALID_DEST[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L15:
	cmp	r14d, 131
	je	.L3
.L18:
	lea	rdi, .LC0[rip]
	call	panic@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L43:
	imul	esi, DWORD PTR NSEC_PER_USEC[rip], 1000
	mov	rdx, rsp
	mov	rdi, r14
	call	clock_interval_to_deadline@PLT
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L42:
	mov	rdi, rbp
	call	imq_unlock@PLT
	mov	eax, DWORD PTR MACH_SEND_NO_BUFFER[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L41:
	call	imq_unlock@PLT
	mov	eax, DWORD PTR MACH_SEND_TIMED_OUT[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L44:
	mov	rdi, QWORD PTR 8[r15]
	test	rdi, rdi
	je	.L11
	call	port_send_turnstile@PLT
	mov	esi, eax
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L45:
	mov	edi, DWORD PTR THREAD_CONTINUE_NULL[rip]
	call	thread_block@PLT
	mov	edi, DWORD PTR c_ipc_mqueue_send_block[rip]
	mov	r14d, eax
	lea	eax, 1[rdi]
	mov	DWORD PTR c_ipc_mqueue_send_block[rip], eax
	call	counter@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L14:
	mov	eax, DWORD PTR MACH_SEND_INTERRUPTED[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L16:
	mov	edi, DWORD PTR MACH_SEND_TIMEOUT[rip]
	and	edi, r12d
	call	assert@PLT
	mov	eax, DWORD PTR MACH_SEND_TIMED_OUT[rip]
	jmp	.L1
.L40:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	ipc_mqueue_send, .-ipc_mqueue_send
	.comm	kThreadWaitPortSend,4,4
	.comm	c_ipc_mqueue_send_block,4,4
	.comm	TURNSTILE_SYNC_IPC,4,4
	.comm	TURNSTILE_NULL,8,8
	.comm	TURNSTILE_INTERLOCK_NOT_HELD,4,4
	.comm	TURNSTILE_INHERITOR_TURNSTILE,4,4
	.comm	TURNSTILE_INHERITOR_NULL,4,4
	.comm	TURNSTILE_DELAYED_UPDATE,4,4
	.comm	TRUE,4,4
	.comm	TIMEOUT_URGENCY_USER_NORMAL,4,4
	.comm	TIMEOUT_NO_LEEWAY,4,4
	.comm	THREAD_WAITING,4,4
	.comm	THREAD_CONTINUE_NULL,4,4
	.comm	THREAD_ABORTSAFE,4,4
	.comm	NSEC_PER_USEC,4,4
	.comm	MACH_SEND_TIMEOUT,4,4
	.comm	MACH_SEND_TIMED_OUT,4,4
	.comm	MACH_SEND_NO_BUFFER,4,4
	.comm	MACH_SEND_INVALID_DEST,4,4
	.comm	MACH_SEND_INTERRUPTED,4,4
	.comm	MACH_SEND_ALWAYS,4,4
	.comm	MACH_PORT_NULL,8,8
	.comm	MACH_MSG_TYPE_PORT_SEND_ONCE,8,8
	.comm	MACH_MSG_SUCCESS,4,4
	.comm	IPC_MQUEUE_FULL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_ipc_mqueue.c_ipc_mqueue_send.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"ipc_mqueue_send\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	ipc_mqueue_send
	.syntax unified
	.arm
	.fpu softvfp
	.type	ipc_mqueue_send, %function
ipc_mqueue_send:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r7, r3
	ldr	r3, .L37
	sub	sp, sp, #16
	mov	r6, r1
	mov	r5, r2
	ldr	r3, [r3]
	str	r3, [sp, #12]
	mov	r3,#0
	mov	r4, r0
	bl	imq_full
	cmp	r0, #0
	beq	.L5
	mov	r0, r4
	bl	imq_full_kernel
	cmp	r0, #0
	bne	.L4
	ldr	r3, .L37+4
	ldr	r3, [r3]
	tst	r5, r3
	beq	.L30
.L5:
	ldr	r0, [r4]
	add	r0, r0, #1
	cmp	r0, #0
	str	r0, [r4]
	movle	r0, #0
	movgt	r0, #1
	bl	assert
	mov	r0, r4
	bl	imq_unlock
.L3:
	mov	r2, r5
	mov	r1, r6
	mov	r0, r4
	bl	ipc_mqueue_post
	ldr	r3, .L37+8
	ldr	r0, [r3]
.L1:
	ldr	r3, .L37
	ldr	r2, [r3]
	ldr	r3, [sp, #12]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L31
	add	sp, sp, #16
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L30:
	ldr	r3, [r6]
	ldr	r0, [r3]
	bl	MACH_MSGH_BITS_REMOTE
	ldr	r3, .L37+12
	ldr	r3, [r3]
	cmp	r0, r3
	beq	.L5
.L4:
	bl	current_thread
	ldr	r9, .L37+16
	mov	r10, r0
	mov	r0, r4
	bl	ip_from_mq
	ldr	r3, [r9]
	mov	r8, r0
	tst	r5, r3
	movne	r3, #1
	moveq	r3, #0
	cmp	r7, #0
	movne	r3, #0
	cmp	r3, #0
	mov	r0, r4
	bne	.L32
	bl	imq_full_kernel
	cmp	r0, #0
	bne	.L33
	ldr	r2, .L37+20
	ldr	r3, [r9]
	ldr	r2, [r2]
	ands	r3, r5, r3
	str	r2, [r4, #4]
	streq	r3, [sp, #8]
	bne	.L34
.L10:
	ldr	r3, .L37+24
	mov	r0, r10
	ldr	r1, [r3]
	bl	thread_set_pending_block_hint
	mov	r0, r8
	bl	port_send_turnstile_address
	ldr	r3, .L37+28
	ldr	r2, .L37+32
	mov	r1, r0
	ldr	r3, [r3]
	ldr	r2, [r2]
	mov	r0, r8
	bl	turnstile_prepare
	mov	r10, r0
	mov	r0, r8
	bl	ip_active
	cmp	r0, #0
	beq	.L11
	ldr	r3, .L37+36
	ldr	r2, [r8]
	ldr	r3, [r3]
	cmp	r2, r3
	beq	.L35
.L11:
	mov	r0, r8
	bl	ipc_port_get_inheritor
	mov	r1, r0
.L12:
	ldr	r2, .L37+40
	ldr	r3, .L37+44
	ldr	r2, [r2]
	ldr	r3, [r3]
	mov	r0, r10
	orr	r2, r2, r3
	bl	turnstile_update_inheritor
	ldr	r2, .L37+48
	ldr	r0, [sp, #8]
	ldr	ip, [r2]
	ldr	r3, .L37+52
	ldr	r2, .L37+56
	ldr	r1, .L37+60
	str	ip, [sp, #4]
	ldr	r3, [r3]
	ldr	r2, [r2]
	ldr	r1, [r1]
	str	r0, [sp]
	mov	r0, r10
	bl	waitq_assert_wait64_leeway
	mov	r7, r0
	mov	r0, r4
	bl	imq_unlock
	ldr	r3, .L37+64
	mov	r0, r10
	ldr	r1, [r3]
	bl	turnstile_update_inheritor_complete
	ldr	r3, .L37+68
	ldr	r3, [r3]
	cmp	r3, r7
	beq	.L36
.L13:
	mov	r0, r4
	bl	imq_lock
	mov	r0, r8
	bl	port_send_turnstile_address
	mov	r2, #0
	mov	r1, r0
	mov	r0, r8
	bl	turnstile_complete
	sub	r7, r7, #128
	mov	r0, r4
	bl	imq_unlock
	bl	turnstile_cleanup
	cmp	r7, #3
	ldrls	pc, [pc, r7, asl #2]
	b	.L14
.L16:
	.word	.L19
	.word	.L18
	.word	.L17
	.word	.L3
.L34:
	ldr	r3, .L37+72
	mov	r0, r7
	ldr	r1, [r3]
	add	r2, sp, #8
	rsb	r3, r1, r1, lsl #5
	add	r1, r1, r3, lsl #2
	lsl	r1, r1, #3
	bl	clock_interval_to_deadline
	b	.L10
.L33:
	mov	r0, r4
	bl	imq_unlock
	ldr	r3, .L37+76
	ldr	r0, [r3]
	b	.L1
.L17:
	ldr	r3, .L37+80
	ldr	r0, [r3]
	b	.L1
.L18:
	ldr	r3, .L37+84
	ldr	r0, [r3]
	b	.L1
.L19:
	ldr	r0, [r9]
	and	r0, r0, r5
	bl	assert
	ldr	r3, .L37+88
	ldr	r0, [r3]
	b	.L1
.L35:
	ldr	r0, [r8, #4]
	cmp	r0, #0
	beq	.L11
	bl	port_send_turnstile
	mov	r1, r0
	b	.L12
.L36:
	ldr	r3, .L37+92
	ldr	r0, [r3]
	bl	thread_block
	ldr	r3, .L37+96
	mov	r7, r0
	ldr	r0, [r3]
	add	r2, r0, #1
	str	r2, [r3]
	bl	counter
	b	.L13
.L32:
	bl	imq_unlock
	ldr	r3, .L37+88
	ldr	r0, [r3]
	b	.L1
.L31:
	bl	__stack_chk_fail
.L14:
	ldr	r0, .L37+100
	bl	panic
	b	.L3
.L38:
	.align	2
.L37:
	.word	.LC1
	.word	MACH_SEND_ALWAYS
	.word	MACH_MSG_SUCCESS
	.word	MACH_MSG_TYPE_PORT_SEND_ONCE
	.word	MACH_SEND_TIMEOUT
	.word	TRUE
	.word	kThreadWaitPortSend
	.word	TURNSTILE_SYNC_IPC
	.word	TURNSTILE_NULL
	.word	MACH_PORT_NULL
	.word	TURNSTILE_DELAYED_UPDATE
	.word	TURNSTILE_INHERITOR_TURNSTILE
	.word	TIMEOUT_NO_LEEWAY
	.word	TIMEOUT_URGENCY_USER_NORMAL
	.word	THREAD_ABORTSAFE
	.word	IPC_MQUEUE_FULL
	.word	TURNSTILE_INTERLOCK_NOT_HELD
	.word	THREAD_WAITING
	.word	NSEC_PER_USEC
	.word	MACH_SEND_NO_BUFFER
	.word	MACH_SEND_INTERRUPTED
	.word	MACH_SEND_INVALID_DEST
	.word	MACH_SEND_TIMED_OUT
	.word	THREAD_CONTINUE_NULL
	.word	c_ipc_mqueue_send_block
	.word	.LC0
	.size	ipc_mqueue_send, .-ipc_mqueue_send
	.comm	kThreadWaitPortSend,4,4
	.comm	c_ipc_mqueue_send_block,4,4
	.comm	TURNSTILE_SYNC_IPC,4,4
	.comm	TURNSTILE_NULL,4,4
	.comm	TURNSTILE_INTERLOCK_NOT_HELD,4,4
	.comm	TURNSTILE_INHERITOR_TURNSTILE,4,4
	.comm	TURNSTILE_INHERITOR_NULL,4,4
	.comm	TURNSTILE_DELAYED_UPDATE,4,4
	.comm	TRUE,4,4
	.comm	TIMEOUT_URGENCY_USER_NORMAL,4,4
	.comm	TIMEOUT_NO_LEEWAY,4,4
	.comm	THREAD_WAITING,4,4
	.comm	THREAD_CONTINUE_NULL,4,4
	.comm	THREAD_ABORTSAFE,4,4
	.comm	NSEC_PER_USEC,4,4
	.comm	MACH_SEND_TIMEOUT,4,4
	.comm	MACH_SEND_TIMED_OUT,4,4
	.comm	MACH_SEND_NO_BUFFER,4,4
	.comm	MACH_SEND_INVALID_DEST,4,4
	.comm	MACH_SEND_INTERRUPTED,4,4
	.comm	MACH_SEND_ALWAYS,4,4
	.comm	MACH_PORT_NULL,4,4
	.comm	MACH_MSG_TYPE_PORT_SEND_ONCE,4,4
	.comm	MACH_MSG_SUCCESS,4,4
	.comm	IPC_MQUEUE_FULL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
