	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function r852_update_media_status
_r852_update_media_status:              ## @r852_update_media_status
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	leaq	8(%rdi), %r14
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	cmpl	$0, 12(%rbx)
	je	LBB0_1
## %bb.2:
	movq	_R852_CARD_STA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_r852_read_reg
	movl	%eax, %r15d
	movq	_R852_CARD_STA_RO@GOTPCREL(%rip), %rax
	movq	_R852_DMA_CAP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	andl	(%rax), %r15d
	leaq	L_.str.5(%rip), %rax
	leaq	L_.str.4(%rip), %r12
	cmoveq	%rax, %r12
	movq	%rbx, %rdi
	callq	_r852_read_reg
	movq	_R852_DMA1@GOTPCREL(%rip), %rcx
	movq	_R852_DMA2@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	testl	%eax, %edx
	movq	_R852_SMBIT@GOTPCREL(%rip), %rcx
	setne	%dl
	andl	(%rcx), %eax
	setne	%al
	andb	%dl, %al
	movzbl	%al, %eax
	movl	%eax, (%rbx)
	leaq	L_.str.3(%rip), %rcx
	leaq	L_.str.2(%rip), %rsi
	testb	%al, %al
	cmoveq	%rcx, %rsi
	leaq	L_.str.1(%rip), %rdi
	movq	%r12, %rdx
	xorl	%eax, %eax
	callq	_message
	movl	%r15d, 4(%rbx)
	jmp	LBB0_3
LBB0_1:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_message
LBB0_3:
	movq	%r14, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_spin_unlock_irqrestore         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"card removed"

	.comm	_R852_CARD_STA,4,2              ## @R852_CARD_STA
	.comm	_R852_CARD_STA_RO,4,2           ## @R852_CARD_STA_RO
	.comm	_R852_DMA_CAP,4,2               ## @R852_DMA_CAP
	.comm	_R852_DMA1,4,2                  ## @R852_DMA1
	.comm	_R852_DMA2,4,2                  ## @R852_DMA2
	.comm	_R852_SMBIT,4,2                 ## @R852_SMBIT
L_.str.1:                               ## @.str.1
	.asciz	"detected %s %s card in slot"

L_.str.2:                               ## @.str.2
	.asciz	"SmartMedia"

L_.str.3:                               ## @.str.3
	.asciz	"xD"

L_.str.4:                               ## @.str.4
	.asciz	"readonly"

L_.str.5:                               ## @.str.5
	.asciz	"writeable"

	.no_dead_strip	_r852_update_media_status
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function r852_update_media_status
_r852_update_media_status:              ; @r852_update_media_status
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x20, x0
	add	x19, x0, #8
	mov	x0, x19
	bl	_spin_lock_irqsave
	ldr	w8, [x20, #12]
	cbz	w8, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _R852_CARD_STA@GOTPAGE
Lloh1:
	ldr	x8, [x8, _R852_CARD_STA@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_r852_read_reg
	mov	x21, x0
Lloh3:
	adrp	x8, _R852_CARD_STA_RO@GOTPAGE
Lloh4:
	ldr	x8, [x8, _R852_CARD_STA_RO@GOTPAGEOFF]
Lloh5:
	ldr	w22, [x8]
Lloh6:
	adrp	x8, _R852_DMA_CAP@GOTPAGE
Lloh7:
	ldr	x8, [x8, _R852_DMA_CAP@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_r852_read_reg
Lloh9:
	adrp	x8, _R852_DMA1@GOTPAGE
Lloh10:
	ldr	x8, [x8, _R852_DMA1@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
Lloh12:
	adrp	x9, _R852_DMA2@GOTPAGE
Lloh13:
	ldr	x9, [x9, _R852_DMA2@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	orr	w8, w9, w8
	tst	w8, w0
	cset	w8, ne
Lloh15:
	adrp	x9, _R852_SMBIT@GOTPAGE
Lloh16:
	ldr	x9, [x9, _R852_SMBIT@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	tst	w9, w0
	cset	w9, ne
	ands	w8, w8, w9
	str	w8, [x20]
Lloh18:
	adrp	x8, l_.str.3@PAGE
Lloh19:
	add	x8, x8, l_.str.3@PAGEOFF
Lloh20:
	adrp	x9, l_.str.2@PAGE
Lloh21:
	add	x9, x9, l_.str.2@PAGEOFF
	csel	x8, x9, x8, ne
Lloh22:
	adrp	x9, l_.str.4@PAGE
Lloh23:
	add	x9, x9, l_.str.4@PAGEOFF
Lloh24:
	adrp	x10, l_.str.5@PAGE
Lloh25:
	add	x10, x10, l_.str.5@PAGEOFF
	ands	w21, w22, w21
	csel	x9, x10, x9, eq
	stp	x8, x9, [sp]
Lloh26:
	adrp	x0, l_.str.1@PAGE
Lloh27:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_message
	str	w21, [x20, #4]
	b	LBB0_3
LBB0_2:
Lloh28:
	adrp	x0, l_.str@PAGE
Lloh29:
	add	x0, x0, l_.str@PAGEOFF
	bl	_message
LBB0_3:
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	b	_spin_unlock_irqrestore
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"card removed"

	.comm	_R852_CARD_STA,4,2              ; @R852_CARD_STA
	.comm	_R852_CARD_STA_RO,4,2           ; @R852_CARD_STA_RO
	.comm	_R852_DMA_CAP,4,2               ; @R852_DMA_CAP
	.comm	_R852_DMA1,4,2                  ; @R852_DMA1
	.comm	_R852_DMA2,4,2                  ; @R852_DMA2
	.comm	_R852_SMBIT,4,2                 ; @R852_SMBIT
l_.str.1:                               ; @.str.1
	.asciz	"detected %s %s card in slot"

l_.str.2:                               ; @.str.2
	.asciz	"SmartMedia"

l_.str.3:                               ; @.str.3
	.asciz	"xD"

l_.str.4:                               ; @.str.4
	.asciz	"readonly"

l_.str.5:                               ; @.str.5
	.asciz	"writeable"

	.no_dead_strip	_r852_update_media_status
.subsections_via_symbols
