	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rtl8411_cd_deglitch
_rtl8411_cd_deglitch:                   ## @rtl8411_cd_deglitch
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	_RTSX_BIPR@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	callq	_rtsx_pci_readl
	movl	%eax, %ebx
	movq	_CARD_EXIST@GOTPCREL(%rip), %rax
	andl	(%rax), %ebx
	je	LBB0_1
## %bb.2:
	movl	%ebx, %edi
	callq	_hweight32
	cmpl	$2, %eax
	jl	LBB0_4
## %bb.3:
	movq	_CARD_PWR_CTL@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	_BPP_POWER_MASK@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	movq	_BPP_POWER_5_PERCENT_ON@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdi
	callq	_rtsx_pci_write_register
	movl	$100, %edi
	callq	_msleep
	movl	(%r15), %esi
	movq	%r14, %rdi
	callq	_rtsx_pci_readl
	movq	_MS_EXIST@GOTPCREL(%rip), %rcx
	movq	_SD_EXIST@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	movl	%edx, %ebx
	andl	%eax, %ebx
	cmovnel	%edx, %ebx
	movl	(%rcx), %ecx
	testl	%eax, %ecx
	cmovnel	%ecx, %ebx
	movl	(%r12), %esi
	movl	(%r13), %edx
	movq	_BPP_POWER_OFF@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdi
	callq	_rtsx_pci_write_register
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_pcr_dbg
LBB0_4:
	movq	_MS_EXIST@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_6
## %bb.5:
	movq	_EFUSE_CONTENT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$224, %edx
	movl	$64, %ecx
	callq	_rtsx_pci_write_register
	movq	_CD_PAD_CTL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CD_DISABLE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_MS_CD_EN_ONLY@GOTPCREL(%rip), %rax
	jmp	LBB0_8
LBB0_1:
	movq	_CD_PAD_CTL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CD_DISABLE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_CD_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdi
	callq	_rtsx_pci_write_register
	movq	_EFUSE_CONTENT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	movl	$224, %edx
	xorl	%ecx, %ecx
	jmp	LBB0_9
LBB0_6:
	movq	_SD_EXIST@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_10
## %bb.7:
	movq	_EFUSE_CONTENT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$224, %edx
	movl	$128, %ecx
	callq	_rtsx_pci_write_register
	movq	_CD_PAD_CTL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CD_DISABLE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_SD_CD_EN_ONLY@GOTPCREL(%rip), %rax
LBB0_8:
	movl	(%rax), %ecx
	movq	%r14, %rdi
LBB0_9:
	callq	_rtsx_pci_write_register
LBB0_10:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RTSX_BIPR,4,2                  ## @RTSX_BIPR
	.comm	_CARD_EXIST,4,2                 ## @CARD_EXIST
	.comm	_CD_PAD_CTL,4,2                 ## @CD_PAD_CTL
	.comm	_CD_DISABLE_MASK,4,2            ## @CD_DISABLE_MASK
	.comm	_CD_ENABLE,4,2                  ## @CD_ENABLE
	.comm	_EFUSE_CONTENT,4,2              ## @EFUSE_CONTENT
	.comm	_CARD_PWR_CTL,4,2               ## @CARD_PWR_CTL
	.comm	_BPP_POWER_MASK,4,2             ## @BPP_POWER_MASK
	.comm	_BPP_POWER_5_PERCENT_ON,4,2     ## @BPP_POWER_5_PERCENT_ON
	.comm	_MS_EXIST,4,2                   ## @MS_EXIST
	.comm	_SD_EXIST,4,2                   ## @SD_EXIST
	.comm	_BPP_POWER_OFF,4,2              ## @BPP_POWER_OFF
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"After CD deglitch, card_exist = 0x%x\n"

	.comm	_MS_CD_EN_ONLY,4,2              ## @MS_CD_EN_ONLY
	.comm	_SD_CD_EN_ONLY,4,2              ## @SD_CD_EN_ONLY
	.no_dead_strip	_rtl8411_cd_deglitch
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rtl8411_cd_deglitch
_rtl8411_cd_deglitch:                   ; @rtl8411_cd_deglitch
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x0
Lloh0:
	adrp	x22, _RTSX_BIPR@GOTPAGE
Lloh1:
	ldr	x22, [x22, _RTSX_BIPR@GOTPAGEOFF]
	ldr	w1, [x22]
	bl	_rtsx_pci_readl
Lloh2:
	adrp	x8, _CARD_EXIST@GOTPAGE
Lloh3:
	ldr	x8, [x8, _CARD_EXIST@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	ands	w20, w8, w0
	b.eq	LBB0_5
; %bb.1:
	mov	x0, x20
	bl	_hweight32
Lloh5:
	adrp	x21, _MS_EXIST@GOTPAGE
Lloh6:
	ldr	x21, [x21, _MS_EXIST@GOTPAGEOFF]
	cmp	w0, #2
	b.lt	LBB0_3
; %bb.2:
Lloh7:
	adrp	x23, _CARD_PWR_CTL@GOTPAGE
Lloh8:
	ldr	x23, [x23, _CARD_PWR_CTL@GOTPAGEOFF]
	ldr	w1, [x23]
Lloh9:
	adrp	x24, _BPP_POWER_MASK@GOTPAGE
Lloh10:
	ldr	x24, [x24, _BPP_POWER_MASK@GOTPAGEOFF]
	ldr	w2, [x24]
Lloh11:
	adrp	x8, _BPP_POWER_5_PERCENT_ON@GOTPAGE
Lloh12:
	ldr	x8, [x8, _BPP_POWER_5_PERCENT_ON@GOTPAGEOFF]
Lloh13:
	ldr	w3, [x8]
	mov	x0, x19
	bl	_rtsx_pci_write_register
	mov	w0, #100
	bl	_msleep
	ldr	w1, [x22]
	mov	x0, x19
	bl	_rtsx_pci_readl
	ldr	w8, [x21]
Lloh14:
	adrp	x9, _SD_EXIST@GOTPAGE
Lloh15:
	ldr	x9, [x9, _SD_EXIST@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	tst	w9, w0
	csel	w9, wzr, w9, eq
	tst	w8, w0
	csel	w20, w9, w8, eq
	ldr	w1, [x23]
	ldr	w2, [x24]
Lloh17:
	adrp	x8, _BPP_POWER_OFF@GOTPAGE
Lloh18:
	ldr	x8, [x8, _BPP_POWER_OFF@GOTPAGEOFF]
Lloh19:
	ldr	w3, [x8]
	mov	x0, x19
	bl	_rtsx_pci_write_register
Lloh20:
	adrp	x1, l_.str@PAGE
Lloh21:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x2, x20
	bl	_pcr_dbg
LBB0_3:
	ldr	w8, [x21]
	tst	w8, w20
	b.eq	LBB0_6
; %bb.4:
Lloh22:
	adrp	x8, _EFUSE_CONTENT@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EFUSE_CONTENT@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #224
	mov	w3, #64
	bl	_rtsx_pci_write_register
Lloh25:
	adrp	x8, _CD_PAD_CTL@GOTPAGE
Lloh26:
	ldr	x8, [x8, _CD_PAD_CTL@GOTPAGEOFF]
Lloh27:
	ldr	w1, [x8]
Lloh28:
	adrp	x8, _CD_DISABLE_MASK@GOTPAGE
Lloh29:
	ldr	x8, [x8, _CD_DISABLE_MASK@GOTPAGEOFF]
Lloh30:
	ldr	w2, [x8]
Lloh31:
	adrp	x8, _MS_CD_EN_ONLY@GOTPAGE
Lloh32:
	ldr	x8, [x8, _MS_CD_EN_ONLY@GOTPAGEOFF]
	b	LBB0_8
LBB0_5:
Lloh33:
	adrp	x8, _CD_PAD_CTL@GOTPAGE
Lloh34:
	ldr	x8, [x8, _CD_PAD_CTL@GOTPAGEOFF]
Lloh35:
	ldr	w1, [x8]
Lloh36:
	adrp	x8, _CD_DISABLE_MASK@GOTPAGE
Lloh37:
	ldr	x8, [x8, _CD_DISABLE_MASK@GOTPAGEOFF]
Lloh38:
	ldr	w2, [x8]
Lloh39:
	adrp	x8, _CD_ENABLE@GOTPAGE
Lloh40:
	ldr	x8, [x8, _CD_ENABLE@GOTPAGEOFF]
Lloh41:
	ldr	w3, [x8]
	mov	x0, x19
	bl	_rtsx_pci_write_register
Lloh42:
	adrp	x8, _EFUSE_CONTENT@GOTPAGE
Lloh43:
	ldr	x8, [x8, _EFUSE_CONTENT@GOTPAGEOFF]
Lloh44:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #224
	mov	w3, #0
	b	LBB0_9
LBB0_6:
Lloh45:
	adrp	x8, _SD_EXIST@GOTPAGE
Lloh46:
	ldr	x8, [x8, _SD_EXIST@GOTPAGEOFF]
Lloh47:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_10
; %bb.7:
Lloh48:
	adrp	x8, _EFUSE_CONTENT@GOTPAGE
Lloh49:
	ldr	x8, [x8, _EFUSE_CONTENT@GOTPAGEOFF]
Lloh50:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #224
	mov	w3, #128
	bl	_rtsx_pci_write_register
Lloh51:
	adrp	x8, _CD_PAD_CTL@GOTPAGE
Lloh52:
	ldr	x8, [x8, _CD_PAD_CTL@GOTPAGEOFF]
Lloh53:
	ldr	w1, [x8]
Lloh54:
	adrp	x8, _CD_DISABLE_MASK@GOTPAGE
Lloh55:
	ldr	x8, [x8, _CD_DISABLE_MASK@GOTPAGEOFF]
Lloh56:
	ldr	w2, [x8]
Lloh57:
	adrp	x8, _SD_CD_EN_ONLY@GOTPAGE
Lloh58:
	ldr	x8, [x8, _SD_CD_EN_ONLY@GOTPAGEOFF]
LBB0_8:
	ldr	w3, [x8]
	mov	x0, x19
LBB0_9:
	bl	_rtsx_pci_write_register
LBB0_10:
	mov	x0, x20
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpLdrGot	Lloh57, Lloh58
	.loh AdrpLdrGotLdr	Lloh54, Lloh55, Lloh56
	.loh AdrpLdrGotLdr	Lloh51, Lloh52, Lloh53
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.cfi_endproc
                                        ; -- End function
	.comm	_RTSX_BIPR,4,2                  ; @RTSX_BIPR
	.comm	_CARD_EXIST,4,2                 ; @CARD_EXIST
	.comm	_CD_PAD_CTL,4,2                 ; @CD_PAD_CTL
	.comm	_CD_DISABLE_MASK,4,2            ; @CD_DISABLE_MASK
	.comm	_CD_ENABLE,4,2                  ; @CD_ENABLE
	.comm	_EFUSE_CONTENT,4,2              ; @EFUSE_CONTENT
	.comm	_CARD_PWR_CTL,4,2               ; @CARD_PWR_CTL
	.comm	_BPP_POWER_MASK,4,2             ; @BPP_POWER_MASK
	.comm	_BPP_POWER_5_PERCENT_ON,4,2     ; @BPP_POWER_5_PERCENT_ON
	.comm	_MS_EXIST,4,2                   ; @MS_EXIST
	.comm	_SD_EXIST,4,2                   ; @SD_EXIST
	.comm	_BPP_POWER_OFF,4,2              ; @BPP_POWER_OFF
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"After CD deglitch, card_exist = 0x%x\n"

	.comm	_MS_CD_EN_ONLY,4,2              ; @MS_CD_EN_ONLY
	.comm	_SD_CD_EN_ONLY,4,2              ; @SD_CD_EN_ONLY
	.no_dead_strip	_rtl8411_cd_deglitch
.subsections_via_symbols
