	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bcm_mbox_read
_bcm_mbox_read:                         ## @bcm_mbox_read
	.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	%rdx, -48(%rbp)                 ## 8-byte Spill
	movl	%esi, %r15d
	movl	%edi, %r13d
	callq	_device_get_softc
	movq	%rax, %rbx
	leaq	L_.str(%rip), %rdi
	xorl	%r12d, %r12d
	movl	%r15d, %esi
	xorl	%eax, %eax
	callq	_dprintf
	movq	%rbx, %rdi
	callq	_MBOX_LOCK
	movq	_cold@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_5
## %bb.1:
	movq	_REG_STATUS@GOTPCREL(%rip), %r14
	movq	_STATUS_EMPTY@GOTPCREL(%rip), %r13
	leaq	-52(%rbp), %r12
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_mbox_read_4
	testl	%eax, (%r13)
	jne	LBB0_2
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_bcm_mbox_read_msg
	testq	%rax, %rax
	jne	LBB0_4
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpl	%r15d, -52(%rbp)
	jne	LBB0_2
## %bb.9:
	movslq	%r15d, %r14
	xorl	%r12d, %r12d
	jmp	LBB0_10
LBB0_5:
	movq	(%rbx), %rax
	movslq	%r15d, %r14
	cmpq	$0, (%rax,%r14,8)
	jne	LBB0_10
## %bb.6:
	leaq	(%rax,%r14,8), %rdi
	movq	%rbx, %rsi
	addq	$16, %rsi
	movq	_hz@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%eax, %eax
	leal	(%rax,%rax,4), %r8d
	leaq	L_.str.1(%rip), %rcx
	xorl	%r12d, %r12d
	xorl	%edx, %edx
	callq	_mtx_sleep
	testq	%rax, %rax
	je	LBB0_10
## %bb.7:
	leaq	L_.str.2(%rip), %rsi
	movl	%r13d, %edi
	movl	%r15d, %edx
	callq	_device_printf
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
LBB0_10:
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	movq	8(%rbx), %rax
	movq	(%rax,%r14,8), %rdi
	callq	_MBOX_DATA
	movl	%eax, (%r13)
	movq	8(%rbx), %rax
	movq	$0, (%rax,%r14,8)
	movq	(%rbx), %rax
	movq	$0, (%rax,%r14,8)
	jmp	LBB0_11
LBB0_4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	-48(%rbp), %r13                 ## 8-byte Reload
LBB0_11:
	movq	%rbx, %rdi
	callq	_MBOX_UNLOCK
	movl	(%r13), %edx
	leaq	L_.str.3(%rip), %rdi
	movl	%r15d, %esi
	xorl	%eax, %eax
	callq	_dprintf
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"bcm_mbox_read: chan %d\n"

	.comm	_cold,4,2                       ## @cold
L_.str.1:                               ## @.str.1
	.asciz	"mbox"

	.comm	_hz,4,2                         ## @hz
L_.str.2:                               ## @.str.2
	.asciz	"timeout waiting for message on chan %d\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.comm	_REG_STATUS,4,2                 ## @REG_STATUS
	.comm	_STATUS_EMPTY,4,2               ## @STATUS_EMPTY
	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.3:                               ## @.str.3
	.asciz	"bcm_mbox_read: chan %d, data %08x\n"

	.no_dead_strip	_bcm_mbox_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bcm_mbox_read
_bcm_mbox_read:                         ; @bcm_mbox_read
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x20, x2
	mov	x19, x1
	mov	x22, x0
	bl	_device_get_softc
	mov	x21, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_dprintf
	mov	x0, x21
	bl	_MBOX_LOCK
Lloh2:
	adrp	x8, _cold@GOTPAGE
Lloh3:
	ldr	x8, [x8, _cold@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	cbz	w8, LBB0_6
; %bb.1:
Lloh5:
	adrp	x22, _REG_STATUS@GOTPAGE
Lloh6:
	ldr	x22, [x22, _REG_STATUS@GOTPAGEOFF]
Lloh7:
	adrp	x23, _STATUS_EMPTY@GOTPAGE
Lloh8:
	ldr	x23, [x23, _STATUS_EMPTY@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x22]
	mov	x0, x21
	bl	_mbox_read_4
	ldr	w8, [x23]
	tst	w8, w0
	b.ne	LBB0_2
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x1, sp, #12
	mov	x0, x21
	bl	_bcm_mbox_read_msg
	cbnz	x0, LBB0_8
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w8, [sp, #12]
	cmp	w8, w19
	b.ne	LBB0_2
; %bb.5:
	mov	w22, #0
	mov	x8, x19
	sxtw	x23, w8
	b	LBB0_11
LBB0_6:
	ldr	x8, [x21]
	sxtw	x23, w19
	add	x0, x8, w19, sxtw #3
	ldr	x8, [x0]
	cbz	x8, LBB0_9
LBB0_7:
	mov	w22, #0
	b	LBB0_11
LBB0_8:
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w22, [x8]
	b	LBB0_12
LBB0_9:
	add	x1, x21, #16
Lloh12:
	adrp	x8, _hz@GOTPAGE
Lloh13:
	ldr	x8, [x8, _hz@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	add	w8, w8, w8, lsl #2
	lsl	w4, w8, #1
Lloh15:
	adrp	x3, l_.str.1@PAGE
Lloh16:
	add	x3, x3, l_.str.1@PAGEOFF
	mov	w2, #0
	bl	_mtx_sleep
	cbz	x0, LBB0_7
; %bb.10:
Lloh17:
	adrp	x1, l_.str.2@PAGE
Lloh18:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x22
	mov	x2, x19
	bl	_device_printf
Lloh19:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
Lloh21:
	ldr	w22, [x8]
LBB0_11:
	ldr	x8, [x21, #8]
	lsl	x23, x23, #3
	ldr	x0, [x8, x23]
	bl	_MBOX_DATA
	str	w0, [x20]
	ldp	x9, x8, [x21]
	str	xzr, [x8, x23]
	str	xzr, [x9, x23]
LBB0_12:
	mov	x0, x21
	bl	_MBOX_UNLOCK
	ldr	w8, [x20]
	str	x8, [sp]
Lloh22:
	adrp	x0, l_.str.3@PAGE
Lloh23:
	add	x0, x0, l_.str.3@PAGEOFF
	mov	x1, x19
	bl	_dprintf
	mov	x0, x22
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"bcm_mbox_read: chan %d\n"

	.comm	_cold,4,2                       ; @cold
l_.str.1:                               ; @.str.1
	.asciz	"mbox"

	.comm	_hz,4,2                         ; @hz
l_.str.2:                               ; @.str.2
	.asciz	"timeout waiting for message on chan %d\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.comm	_REG_STATUS,4,2                 ; @REG_STATUS
	.comm	_STATUS_EMPTY,4,2               ; @STATUS_EMPTY
	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.3:                               ; @.str.3
	.asciz	"bcm_mbox_read: chan %d, data %08x\n"

	.no_dead_strip	_bcm_mbox_read
.subsections_via_symbols
