	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tegra_bpmp_write_threaded
_tegra_bpmp_write_threaded:             ## @tegra_bpmp_write_threaded
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r15
	movq	%rdx, %rbx
	movl	%esi, %r13d
	movq	%rdi, %r14
	movq	24(%rdi), %rax
	movq	(%rax), %rdi
	movl	8(%rax), %r12d
	callq	_usecs_to_jiffies
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_down_timeout
	testl	%eax, %eax
	js	LBB0_1
## %bb.3:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	leaq	12(%r14), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock_irqsave
	movl	4(%r14), %edi
	movl	%r12d, %esi
	callq	_find_first_zero_bit
	cmpl	%r12d, %eax
	je	LBB0_4
## %bb.5:
	movl	%eax, %r15d
	movl	%eax, %r12d
	shlq	$2, %r12
	addq	16(%r14), %r12
	movq	%r12, %rdi
	callq	_tegra_bpmp_is_request_channel_free
	testl	%eax, %eax
	je	LBB0_4
## %bb.6:
	movl	4(%r14), %esi
	movl	%r15d, %edi
	callq	_set_bit
	movq	_MSG_ACK@GOTPCREL(%rip), %rax
	movq	_MSG_RING@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	%r12, %rdi
	movl	%r13d, %esi
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	-56(%rbp), %r8                  ## 8-byte Reload
	callq	___tegra_bpmp_channel_write
	testl	%eax, %eax
	js	LBB0_7
## %bb.9:
	movl	8(%r14), %esi
	movl	%r15d, %edi
	callq	_set_bit
	movq	%rbx, %rdi
	callq	_spin_unlock_irqrestore
	movq	%r12, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_8:
	movq	%rbx, %rdi
	callq	_spin_unlock_irqrestore
	movq	%r14, %rdi
	callq	_up
	movl	%r13d, %edi
	jmp	LBB0_2
LBB0_1:
	movl	%eax, %edi
LBB0_2:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
LBB0_7:
	movl	%eax, %r13d
	movl	4(%r14), %esi
	movl	%r15d, %edi
	callq	_clear_bit
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_MSG_ACK,4,2                    ## @MSG_ACK
	.comm	_MSG_RING,4,2                   ## @MSG_RING
	.no_dead_strip	_tegra_bpmp_write_threaded
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tegra_bpmp_write_threaded
_tegra_bpmp_write_threaded:             ; @tegra_bpmp_write_threaded
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x21, x3
	mov	x22, x2
	mov	x23, x1
	mov	x19, x0
	ldr	x8, [x0, #24]
	ldr	x0, [x8]
	ldr	w25, [x8, #8]
	bl	_usecs_to_jiffies
	mov	x1, x0
	mov	x0, x19
	bl	_down_timeout
	tbnz	w0, #31, LBB0_7
; %bb.1:
	add	x20, x19, #12
	mov	x0, x20
	bl	_spin_lock_irqsave
	ldr	w0, [x19, #4]
	mov	x1, x25
	bl	_find_first_zero_bit
	cmp	w0, w25
	b.eq	LBB0_5
; %bb.2:
	mov	x24, x0
	ldr	x8, [x19, #16]
	add	x25, x8, w0, uxtw #2
	mov	x0, x25
	bl	_tegra_bpmp_is_request_channel_free
	cbz	w0, LBB0_5
; %bb.3:
	ldr	w1, [x19, #4]
	mov	x0, x24
	bl	_set_bit
Lloh0:
	adrp	x8, _MSG_ACK@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MSG_ACK@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _MSG_RING@GOTPAGE
Lloh4:
	ldr	x9, [x9, _MSG_RING@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x0, x25
	mov	x1, x23
	mov	x3, x22
	mov	x4, x21
	bl	___tegra_bpmp_channel_write
	tbnz	w0, #31, LBB0_8
; %bb.4:
	ldr	w1, [x19, #8]
	mov	x0, x24
	bl	_set_bit
	mov	x0, x20
	bl	_spin_unlock_irqrestore
	mov	x0, x25
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_5:
Lloh6:
	adrp	x8, _EBUSY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_6:
	mov	x0, x20
	bl	_spin_unlock_irqrestore
	mov	x0, x19
	bl	_up
	mov	x0, x21
LBB0_7:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_ERR_PTR
LBB0_8:
	mov	x21, x0
	ldr	w1, [x19, #4]
	mov	x0, x24
	bl	_clear_bit
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_MSG_ACK,4,2                    ; @MSG_ACK
	.comm	_MSG_RING,4,2                   ; @MSG_RING
	.no_dead_strip	_tegra_bpmp_write_threaded
.subsections_via_symbols
