	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pccard_set_socket
_pccard_set_socket:                     ## @pccard_set_socket
	.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
	testq	%rdi, %rdi
	je	LBB0_6
## %bb.1:
	movl	(%rdi), %r15d
	movq	_CARD_MAX_SLOTS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	jae	LBB0_6
## %bb.2:
	movq	%rsi, %rbx
	movl	(%rsi), %ecx
	movl	4(%rsi), %eax
	testl	%ecx, %ecx
	je	LBB0_4
## %bb.3:
	cmpl	%eax, %ecx
	je	LBB0_4
LBB0_6:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_30:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	cmpl	$50, %eax
	ja	LBB0_6
## %bb.5:
	movl	%eax, %eax
	movabsq	$1125908496777217, %rcx         ## imm = 0x4000200000001
	btq	%rax, %rcx
	jae	LBB0_6
## %bb.7:
	movq	_vrc4171_sockets@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
	leaq	(%r15,%r15,2), %r13
	leaq	(%r12,%r13,4), %rdi
	addq	$8, %rdi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_spin_lock_irq
	movl	4(%rbx), %edi
	callq	_set_Vcc_value
	movq	_CARD_VOLTAGE_SELECT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%r15d, %edi
	movl	%eax, %edx
	callq	_exca_write_byte
	movq	_POWER_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rbx), %ecx
	xorl	%r14d, %r14d
	movl	$0, %edx
	cmpl	4(%rbx), %ecx
	jne	LBB0_9
## %bb.8:
	movq	_VPP_GET_VCC@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
LBB0_9:
	orl	(%rax), %edx
	movq	_SS_OUTPUT_ENA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	8(%rbx), %eax
	je	LBB0_11
## %bb.10:
	movq	_I365_PWR_OUT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_11:
	orl	%eax, %edx
	movq	_I365_POWER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, %edi
	callq	_exca_write_byte
	cmpq	$0, 16(%rbx)
	je	LBB0_13
## %bb.12:
	movl	(%r12,%r13,4), %r14d
LBB0_13:
	movl	8(%rbx), %eax
	movq	_SS_IOCARD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	andl	%eax, %edx
	je	LBB0_15
## %bb.14:
	movq	_I365_PC_IOCARD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
LBB0_15:
	orl	%r14d, %edx
	movq	_SS_RESET@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	movq	_I365_PC_RESET@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, %esi
	notl	%esi
	andl	%edx, %esi
	orl	%ecx, %edx
	testl	%eax, %eax
	cmovnel	%esi, %edx
	movq	_I365_INTCTL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, %edi
	callq	_exca_write_byte
	movq	_I365_CSCINT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%r14d, %r14d
	movl	%r15d, %edi
	xorl	%edx, %edx
	callq	_exca_write_byte
	movq	_I365_CSC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, %edi
	callq	_exca_read_byte
	movl	24(%rbx), %eax
	testl	%eax, %eax
	je	LBB0_17
## %bb.16:
	movl	4(%r12,%r13,4), %r14d
	shll	$8, %r14d
LBB0_17:
	movq	_SS_IOCARD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, 8(%rbx)
	je	LBB0_20
## %bb.18:
	movq	_SS_STSCHG@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_25
## %bb.19:
	movq	_I365_CSC_STSCHG@GOTPCREL(%rip), %rcx
	jmp	LBB0_24
LBB0_20:
	movq	_SS_BATDEAD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	%eax, %ecx
	je	LBB0_22
## %bb.21:
	movq	_I365_CSC_BVD1@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
LBB0_22:
	orl	%ecx, %r14d
	movq	_SS_BATWARN@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_25
## %bb.23:
	movq	_I365_CSC_BVD2@GOTPCREL(%rip), %rcx
LBB0_24:
	orl	(%rcx), %r14d
LBB0_25:
	movq	_SS_READY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	andl	%eax, %edx
	je	LBB0_27
## %bb.26:
	movq	_I365_CSC_READY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
LBB0_27:
	orl	%r14d, %edx
	movq	_SS_DETECT@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	je	LBB0_29
## %bb.28:
	movq	_I365_CSC_DETECT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_29:
	orl	%eax, %edx
	movq	_I365_CSCINT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, %edi
	callq	_exca_write_byte
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_spin_unlock_irq
	xorl	%eax, %eax
	jmp	LBB0_30
	.cfi_endproc
                                        ## -- End function
	.comm	_CARD_MAX_SLOTS,4,2             ## @CARD_MAX_SLOTS
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_vrc4171_sockets,8,3            ## @vrc4171_sockets
	.comm	_CARD_VOLTAGE_SELECT,4,2        ## @CARD_VOLTAGE_SELECT
	.comm	_POWER_ENABLE,4,2               ## @POWER_ENABLE
	.comm	_VPP_GET_VCC,4,2                ## @VPP_GET_VCC
	.comm	_SS_OUTPUT_ENA,4,2              ## @SS_OUTPUT_ENA
	.comm	_I365_PWR_OUT,4,2               ## @I365_PWR_OUT
	.comm	_I365_POWER,4,2                 ## @I365_POWER
	.comm	_SS_IOCARD,4,2                  ## @SS_IOCARD
	.comm	_I365_PC_IOCARD,4,2             ## @I365_PC_IOCARD
	.comm	_SS_RESET,4,2                   ## @SS_RESET
	.comm	_I365_PC_RESET,4,2              ## @I365_PC_RESET
	.comm	_I365_INTCTL,4,2                ## @I365_INTCTL
	.comm	_I365_CSCINT,4,2                ## @I365_CSCINT
	.comm	_I365_CSC,4,2                   ## @I365_CSC
	.comm	_SS_STSCHG,4,2                  ## @SS_STSCHG
	.comm	_I365_CSC_STSCHG,4,2            ## @I365_CSC_STSCHG
	.comm	_SS_BATDEAD,4,2                 ## @SS_BATDEAD
	.comm	_I365_CSC_BVD1,4,2              ## @I365_CSC_BVD1
	.comm	_SS_BATWARN,4,2                 ## @SS_BATWARN
	.comm	_I365_CSC_BVD2,4,2              ## @I365_CSC_BVD2
	.comm	_SS_READY,4,2                   ## @SS_READY
	.comm	_I365_CSC_READY,4,2             ## @I365_CSC_READY
	.comm	_SS_DETECT,4,2                  ## @SS_DETECT
	.comm	_I365_CSC_DETECT,4,2            ## @I365_CSC_DETECT
	.no_dead_strip	_pccard_set_socket
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pccard_set_socket
_pccard_set_socket:                     ; @pccard_set_socket
	.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
	cbz	x0, LBB0_8
; %bb.1:
	ldr	w19, [x0]
Lloh0:
	adrp	x8, _CARD_MAX_SLOTS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CARD_MAX_SLOTS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w19, w8
	b.hs	LBB0_8
; %bb.2:
	mov	x21, x1
	ldp	w9, w8, [x1]
	cmp	w9, #0
	ccmp	w9, w8, #4, ne
	b.ne	LBB0_8
; %bb.3:
	cmp	w8, #50
	mov	w9, #1
	lsl	x8, x9, x8
	mov	x9, #1
	movk	x9, #2, lsl #32
	movk	x9, #4, lsl #48
	and	x8, x8, x9
	ccmp	x8, #0, #4, ls
	b.eq	LBB0_8
; %bb.4:
Lloh3:
	adrp	x8, _vrc4171_sockets@GOTPAGE
Lloh4:
	ldr	x8, [x8, _vrc4171_sockets@GOTPAGEOFF]
Lloh5:
	ldr	x22, [x8]
	mov	w8, #12
	madd	x8, x19, x8, x22
	add	x20, x8, #8
	mov	x0, x20
	bl	_spin_lock_irq
	ldr	w0, [x21, #4]
	bl	_set_Vcc_value
	mov	x2, x0
Lloh6:
	adrp	x8, _CARD_VOLTAGE_SELECT@GOTPAGE
Lloh7:
	ldr	x8, [x8, _CARD_VOLTAGE_SELECT@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_exca_write_byte
Lloh9:
	adrp	x8, _POWER_ENABLE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _POWER_ENABLE@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
Lloh12:
	adrp	x9, _VPP_GET_VCC@GOTPAGE
Lloh13:
	ldr	x9, [x9, _VPP_GET_VCC@GOTPAGEOFF]
	ldp	w10, w11, [x21]
Lloh14:
	ldr	w9, [x9]
	cmp	w10, w11
	csel	w9, w9, wzr, eq
	orr	w8, w9, w8
	ldr	w9, [x21, #8]
Lloh15:
	adrp	x10, _SS_OUTPUT_ENA@GOTPAGE
Lloh16:
	ldr	x10, [x10, _SS_OUTPUT_ENA@GOTPAGEOFF]
Lloh17:
	ldr	w10, [x10]
Lloh18:
	adrp	x11, _I365_PWR_OUT@GOTPAGE
Lloh19:
	ldr	x11, [x11, _I365_PWR_OUT@GOTPAGEOFF]
Lloh20:
	ldr	w11, [x11]
	tst	w10, w9
	csel	w9, wzr, w11, eq
	orr	w2, w8, w9
Lloh21:
	adrp	x8, _I365_POWER@GOTPAGE
Lloh22:
	ldr	x8, [x8, _I365_POWER@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_exca_write_byte
	ldr	x8, [x21, #16]
	cbz	x8, LBB0_6
; %bb.5:
	mov	w8, #12
	mul	x8, x19, x8
	ldr	w8, [x22, x8]
LBB0_6:
	ldr	w9, [x21, #8]
Lloh24:
	adrp	x24, _SS_IOCARD@GOTPAGE
Lloh25:
	ldr	x24, [x24, _SS_IOCARD@GOTPAGEOFF]
Lloh26:
	adrp	x10, _I365_PC_IOCARD@GOTPAGE
Lloh27:
	ldr	x10, [x10, _I365_PC_IOCARD@GOTPAGEOFF]
	ldr	w11, [x24]
Lloh28:
	ldr	w10, [x10]
	tst	w11, w9
	csel	w10, wzr, w10, eq
Lloh29:
	adrp	x11, _SS_RESET@GOTPAGE
Lloh30:
	ldr	x11, [x11, _SS_RESET@GOTPAGEOFF]
	orr	w8, w10, w8
Lloh31:
	ldr	w10, [x11]
Lloh32:
	adrp	x11, _I365_PC_RESET@GOTPAGE
Lloh33:
	ldr	x11, [x11, _I365_PC_RESET@GOTPAGEOFF]
Lloh34:
	ldr	w11, [x11]
	bic	w12, w8, w11
	orr	w8, w11, w8
	tst	w10, w9
	csel	w2, w8, w12, eq
Lloh35:
	adrp	x8, _I365_INTCTL@GOTPAGE
Lloh36:
	ldr	x8, [x8, _I365_INTCTL@GOTPAGEOFF]
Lloh37:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_exca_write_byte
Lloh38:
	adrp	x23, _I365_CSCINT@GOTPAGE
Lloh39:
	ldr	x23, [x23, _I365_CSCINT@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x19
	mov	w2, #0
	bl	_exca_write_byte
Lloh40:
	adrp	x8, _I365_CSC@GOTPAGE
Lloh41:
	ldr	x8, [x8, _I365_CSC@GOTPAGEOFF]
Lloh42:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_exca_read_byte
	ldr	w8, [x21, #24]
	cbz	w8, LBB0_10
; %bb.7:
	mov	w9, #12
	madd	x9, x19, x9, x22
	ldr	w9, [x9, #4]
	lsl	w9, w9, #8
	b	LBB0_11
LBB0_8:
Lloh43:
	adrp	x8, _EINVAL@GOTPAGE
Lloh44:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh45:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_9:
	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
LBB0_10:
	mov	w9, #0
LBB0_11:
	ldr	w10, [x21, #8]
	ldr	w11, [x24]
	tst	w11, w10
	b.eq	LBB0_14
; %bb.12:
Lloh46:
	adrp	x10, _SS_STSCHG@GOTPAGE
Lloh47:
	ldr	x10, [x10, _SS_STSCHG@GOTPAGEOFF]
Lloh48:
	ldr	w10, [x10]
	tst	w10, w8
	b.eq	LBB0_17
; %bb.13:
Lloh49:
	adrp	x10, _I365_CSC_STSCHG@GOTPAGE
Lloh50:
	ldr	x10, [x10, _I365_CSC_STSCHG@GOTPAGEOFF]
	b	LBB0_16
LBB0_14:
Lloh51:
	adrp	x10, _SS_BATDEAD@GOTPAGE
Lloh52:
	ldr	x10, [x10, _SS_BATDEAD@GOTPAGEOFF]
Lloh53:
	ldr	w10, [x10]
Lloh54:
	adrp	x11, _I365_CSC_BVD1@GOTPAGE
Lloh55:
	ldr	x11, [x11, _I365_CSC_BVD1@GOTPAGEOFF]
Lloh56:
	ldr	w11, [x11]
	tst	w10, w8
	csel	w10, wzr, w11, eq
	orr	w9, w10, w9
Lloh57:
	adrp	x10, _SS_BATWARN@GOTPAGE
Lloh58:
	ldr	x10, [x10, _SS_BATWARN@GOTPAGEOFF]
Lloh59:
	ldr	w10, [x10]
	tst	w10, w8
	b.eq	LBB0_17
; %bb.15:
Lloh60:
	adrp	x10, _I365_CSC_BVD2@GOTPAGE
Lloh61:
	ldr	x10, [x10, _I365_CSC_BVD2@GOTPAGEOFF]
LBB0_16:
	ldr	w10, [x10]
	orr	w9, w10, w9
LBB0_17:
Lloh62:
	adrp	x10, _SS_READY@GOTPAGE
Lloh63:
	ldr	x10, [x10, _SS_READY@GOTPAGEOFF]
Lloh64:
	ldr	w10, [x10]
Lloh65:
	adrp	x11, _I365_CSC_READY@GOTPAGE
Lloh66:
	ldr	x11, [x11, _I365_CSC_READY@GOTPAGEOFF]
Lloh67:
	ldr	w11, [x11]
	tst	w10, w8
	csel	w10, wzr, w11, eq
	orr	w9, w10, w9
Lloh68:
	adrp	x10, _SS_DETECT@GOTPAGE
Lloh69:
	ldr	x10, [x10, _SS_DETECT@GOTPAGEOFF]
Lloh70:
	adrp	x11, _I365_CSC_DETECT@GOTPAGE
Lloh71:
	ldr	x11, [x11, _I365_CSC_DETECT@GOTPAGEOFF]
Lloh72:
	ldr	w10, [x10]
Lloh73:
	ldr	w11, [x11]
	tst	w10, w8
	csel	w8, wzr, w11, eq
	orr	w2, w9, w8
	ldr	w1, [x23]
	mov	x0, x19
	bl	_exca_write_byte
	mov	x0, x20
	bl	_spin_unlock_irq
	mov	w0, #0
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.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	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGot	Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.loh AdrpLdrGot	Lloh49, Lloh50
	.loh AdrpLdrGotLdr	Lloh57, Lloh58, Lloh59
	.loh AdrpLdrGotLdr	Lloh54, Lloh55, Lloh56
	.loh AdrpLdrGotLdr	Lloh51, Lloh52, Lloh53
	.loh AdrpLdrGot	Lloh60, Lloh61
	.loh AdrpLdrGotLdr	Lloh70, Lloh71, Lloh73
	.loh AdrpLdrGotLdr	Lloh68, Lloh69, Lloh72
	.loh AdrpLdrGotLdr	Lloh65, Lloh66, Lloh67
	.loh AdrpLdrGotLdr	Lloh62, Lloh63, Lloh64
	.cfi_endproc
                                        ; -- End function
	.comm	_CARD_MAX_SLOTS,4,2             ; @CARD_MAX_SLOTS
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_vrc4171_sockets,8,3            ; @vrc4171_sockets
	.comm	_CARD_VOLTAGE_SELECT,4,2        ; @CARD_VOLTAGE_SELECT
	.comm	_POWER_ENABLE,4,2               ; @POWER_ENABLE
	.comm	_VPP_GET_VCC,4,2                ; @VPP_GET_VCC
	.comm	_SS_OUTPUT_ENA,4,2              ; @SS_OUTPUT_ENA
	.comm	_I365_PWR_OUT,4,2               ; @I365_PWR_OUT
	.comm	_I365_POWER,4,2                 ; @I365_POWER
	.comm	_SS_IOCARD,4,2                  ; @SS_IOCARD
	.comm	_I365_PC_IOCARD,4,2             ; @I365_PC_IOCARD
	.comm	_SS_RESET,4,2                   ; @SS_RESET
	.comm	_I365_PC_RESET,4,2              ; @I365_PC_RESET
	.comm	_I365_INTCTL,4,2                ; @I365_INTCTL
	.comm	_I365_CSCINT,4,2                ; @I365_CSCINT
	.comm	_I365_CSC,4,2                   ; @I365_CSC
	.comm	_SS_STSCHG,4,2                  ; @SS_STSCHG
	.comm	_I365_CSC_STSCHG,4,2            ; @I365_CSC_STSCHG
	.comm	_SS_BATDEAD,4,2                 ; @SS_BATDEAD
	.comm	_I365_CSC_BVD1,4,2              ; @I365_CSC_BVD1
	.comm	_SS_BATWARN,4,2                 ; @SS_BATWARN
	.comm	_I365_CSC_BVD2,4,2              ; @I365_CSC_BVD2
	.comm	_SS_READY,4,2                   ; @SS_READY
	.comm	_I365_CSC_READY,4,2             ; @I365_CSC_READY
	.comm	_SS_DETECT,4,2                  ; @SS_DETECT
	.comm	_I365_CSC_DETECT,4,2            ; @I365_CSC_DETECT
	.no_dead_strip	_pccard_set_socket
.subsections_via_symbols
