	.file	"extr_vrc4171_card.c_pccard_set_socket.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	pccard_set_socket, @function
pccard_set_socket:
.LFB0:
	.cfi_startproc
	endbr64
	test	rdi, rdi
	je	.L49
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	mov	ebp, DWORD PTR [rdi]
	cmp	ebp, DWORD PTR CARD_MAX_SLOTS[rip]
	jnb	.L2
	mov	edx, DWORD PTR [rsi]
	mov	eax, DWORD PTR 4[rsi]
	mov	rbx, rsi
	cmp	edx, eax
	je	.L20
	test	edx, edx
	jne	.L2
.L20:
	cmp	eax, 50
	ja	.L2
	movabs	rdx, 1125908496777217
	bt	rdx, rax
	jnc	.L2
	mov	eax, ebp
	lea	rdx, [rax+rax*2]
	mov	rax, QWORD PTR vrc4171_sockets[rip]
	lea	r13, [rax+rdx*4]
	lea	r12, 8[r13]
	mov	rdi, r12
	call	spin_lock_irq@PLT
	mov	edi, DWORD PTR 4[rbx]
	call	set_Vcc_value@PLT
	mov	esi, DWORD PTR CARD_VOLTAGE_SELECT[rip]
	mov	edi, ebp
	mov	edx, eax
	call	exca_write_byte@PLT
	mov	edx, DWORD PTR POWER_ENABLE[rip]
	mov	eax, DWORD PTR 4[rbx]
	cmp	DWORD PTR [rbx], eax
	jne	.L6
	or	edx, DWORD PTR VPP_GET_VCC[rip]
.L6:
	mov	eax, DWORD PTR 8[rbx]
	test	DWORD PTR SS_OUTPUT_ENA[rip], eax
	je	.L7
	or	edx, DWORD PTR I365_PWR_OUT[rip]
.L7:
	mov	esi, DWORD PTR I365_POWER[rip]
	mov	edi, ebp
	call	exca_write_byte@PLT
	xor	edx, edx
	cmp	QWORD PTR 16[rbx], 0
	je	.L8
	mov	edx, DWORD PTR 0[r13]
.L8:
	mov	ecx, DWORD PTR 8[rbx]
	test	DWORD PTR SS_IOCARD[rip], ecx
	je	.L9
	or	edx, DWORD PTR I365_PC_IOCARD[rip]
.L9:
	mov	esi, DWORD PTR I365_PC_RESET[rip]
	mov	edi, ebp
	mov	eax, esi
	not	eax
	and	eax, edx
	or	edx, esi
	test	DWORD PTR SS_RESET[rip], ecx
	mov	esi, DWORD PTR I365_INTCTL[rip]
	cmovne	edx, eax
	call	exca_write_byte@PLT
	mov	esi, DWORD PTR I365_CSCINT[rip]
	xor	edx, edx
	mov	edi, ebp
	call	exca_write_byte@PLT
	mov	esi, DWORD PTR I365_CSC[rip]
	mov	edi, ebp
	call	exca_read_byte@PLT
	mov	eax, DWORD PTR 24[rbx]
	test	eax, eax
	je	.L12
	mov	edx, DWORD PTR 4[r13]
	mov	ecx, DWORD PTR 8[rbx]
	sal	edx, 8
	test	DWORD PTR SS_IOCARD[rip], ecx
	je	.L13
	test	DWORD PTR SS_STSCHG[rip], eax
	je	.L14
	or	edx, DWORD PTR I365_CSC_STSCHG[rip]
.L14:
	test	DWORD PTR SS_READY[rip], eax
	je	.L16
	or	edx, DWORD PTR I365_CSC_READY[rip]
.L16:
	test	DWORD PTR SS_DETECT[rip], eax
	je	.L17
	or	edx, DWORD PTR I365_CSC_DETECT[rip]
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L2:
	mov	eax, DWORD PTR EINVAL[rip]
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	neg	eax
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L12:
	.cfi_restore_state
	mov	edx, DWORD PTR 8[rbx]
	and	edx, DWORD PTR SS_IOCARD[rip]
	je	.L16
	xor	edx, edx
.L17:
	mov	esi, DWORD PTR I365_CSCINT[rip]
	mov	edi, ebp
	call	exca_write_byte@PLT
	mov	rdi, r12
	call	spin_unlock_irq@PLT
	add	rsp, 8
	.cfi_def_cfa_offset 40
	xor	eax, eax
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L49:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	mov	eax, DWORD PTR EINVAL[rip]
	neg	eax
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -40
	.cfi_offset 6, -32
	.cfi_offset 12, -24
	.cfi_offset 13, -16
	test	DWORD PTR SS_BATDEAD[rip], eax
	je	.L15
	or	edx, DWORD PTR I365_CSC_BVD1[rip]
.L15:
	test	DWORD PTR SS_BATWARN[rip], eax
	je	.L14
	or	edx, DWORD PTR I365_CSC_BVD2[rip]
	jmp	.L14
	.cfi_endproc
.LFE0:
	.size	pccard_set_socket, .-pccard_set_socket
	.comm	vrc4171_sockets,8,8
	.comm	VPP_GET_VCC,4,4
	.comm	SS_STSCHG,4,4
	.comm	SS_RESET,4,4
	.comm	SS_READY,4,4
	.comm	SS_OUTPUT_ENA,4,4
	.comm	SS_IOCARD,4,4
	.comm	SS_DETECT,4,4
	.comm	SS_BATWARN,4,4
	.comm	SS_BATDEAD,4,4
	.comm	POWER_ENABLE,4,4
	.comm	I365_PWR_OUT,4,4
	.comm	I365_POWER,4,4
	.comm	I365_PC_RESET,4,4
	.comm	I365_PC_IOCARD,4,4
	.comm	I365_INTCTL,4,4
	.comm	I365_CSC_STSCHG,4,4
	.comm	I365_CSC_READY,4,4
	.comm	I365_CSC_DETECT,4,4
	.comm	I365_CSC_BVD2,4,4
	.comm	I365_CSC_BVD1,4,4
	.comm	I365_CSCINT,4,4
	.comm	I365_CSC,4,4
	.comm	EINVAL,4,4
	.comm	CARD_VOLTAGE_SELECT,4,4
	.comm	CARD_MAX_SLOTS,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_vrc4171_card.c_pccard_set_socket.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	pccard_set_socket, %function
pccard_set_socket:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	cmp	r0, #0
	beq	.L46
	ldr	r3, .L50
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	ldr	r3, [r3]
	ldr	r5, [r0]
	cmp	r5, r3
	bcs	.L2
	ldm	r1, {r2, r3}
	cmp	r2, r3
	cmpne	r2, #0
	mov	r4, r1
	bne	.L2
	cmp	r3, #50
	cmpne	r3, #33
	movne	r2, #1
	moveq	r2, #0
	cmp	r3, #0
	movne	r3, r2
	moveq	r3, #0
	cmp	r3, #0
	bne	.L2
	ldr	r2, .L50+4
	add	r3, r5, r5, lsl #1
	ldr	r8, [r2]
	lsl	r9, r3, #2
	add	r6, r8, r3, lsl #2
	add	r7, r6, #8
	mov	r0, r7
	bl	spin_lock_irq
	ldr	r0, [r4, #4]
	bl	set_Vcc_value
	ldr	r3, .L50+8
	mov	r2, r0
	ldr	r1, [r3]
	mov	r0, r5
	bl	exca_write_byte
	ldm	r4, {r1, r2}
	ldr	r3, .L50+12
	cmp	r1, r2
	ldr	r2, [r3]
	ldreq	r3, .L50+16
	ldr	r1, [r4, #8]
	ldreq	r3, [r3]
	mov	r0, r5
	orreq	r2, r2, r3
	ldr	r3, .L50+20
	ldr	r3, [r3]
	tst	r1, r3
	ldrne	r3, .L50+24
	ldrne	r3, [r3]
	orrne	r2, r2, r3
	ldr	r3, .L50+28
	ldr	r1, [r3]
	bl	exca_write_byte
	ldr	ip, [r4, #12]
	ldr	r3, [r4, #8]
	cmp	ip, #0
	ldrne	ip, [r8, r9]
	ldr	r9, .L50+32
	ldr	r0, .L50+36
	ldr	r1, [r9]
	ldr	r8, .L50+40
	tst	r3, r1
	ldrne	r2, .L50+44
	ldr	r1, .L50+48
	ldrne	r2, [r2]
	ldr	r1, [r1]
	orrne	ip, ip, r2
	tst	r3, r1
	ldr	r2, [r0]
	ldr	r3, .L50+52
	bicne	r2, ip, r2
	orreq	r2, ip, r2
	ldr	r1, [r3]
	mov	r0, r5
	bl	exca_write_byte
	mov	r2, #0
	ldr	r1, [r8]
	mov	r0, r5
	bl	exca_write_byte
	ldr	r3, .L50+56
	mov	r0, r5
	ldr	r1, [r3]
	bl	exca_read_byte
	ldr	r1, [r4, #16]
	cmp	r1, #0
	beq	.L11
	ldr	r0, [r4, #8]
	ldr	r3, [r9]
	ldr	r2, [r6, #4]
	tst	r0, r3
	lsl	r2, r2, #8
	beq	.L12
	ldr	r3, .L50+60
	ldr	r3, [r3]
	tst	r1, r3
	ldrne	r3, .L50+64
	ldrne	r3, [r3]
	orrne	r2, r2, r3
.L13:
	ldr	r3, .L50+68
	ldr	r3, [r3]
	tst	r1, r3
	ldrne	r3, .L50+72
	ldrne	r3, [r3]
	orrne	r2, r2, r3
	b	.L15
.L2:
	ldr	r3, .L50+76
	ldr	r0, [r3]
	rsb	r0, r0, #0
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L11:
	ldr	r3, [r4, #8]
	ldr	r2, [r9]
	ands	r2, r3, r2
	movne	r2, r1
	bne	.L16
.L15:
	ldr	r3, .L50+80
	ldr	r3, [r3]
	tst	r1, r3
	ldrne	r3, .L50+84
	ldrne	r3, [r3]
	orrne	r2, r2, r3
.L16:
	ldr	r1, [r8]
	mov	r0, r5
	bl	exca_write_byte
	mov	r0, r7
	bl	spin_unlock_irq
	mov	r0, #0
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L46:
	ldr	r3, .L50+76
	ldr	r0, [r3]
	rsb	r0, r0, #0
	bx	lr
.L12:
	ldr	r3, .L50+88
	ldr	r3, [r3]
	tst	r1, r3
	ldrne	r3, .L50+92
	ldrne	r3, [r3]
	orrne	r2, r2, r3
	ldr	r3, .L50+96
	ldr	r3, [r3]
	tst	r1, r3
	ldrne	r3, .L50+100
	ldrne	r3, [r3]
	orrne	r2, r2, r3
	b	.L13
.L51:
	.align	2
.L50:
	.word	CARD_MAX_SLOTS
	.word	vrc4171_sockets
	.word	CARD_VOLTAGE_SELECT
	.word	POWER_ENABLE
	.word	VPP_GET_VCC
	.word	SS_OUTPUT_ENA
	.word	I365_PWR_OUT
	.word	I365_POWER
	.word	SS_IOCARD
	.word	I365_PC_RESET
	.word	I365_CSCINT
	.word	I365_PC_IOCARD
	.word	SS_RESET
	.word	I365_INTCTL
	.word	I365_CSC
	.word	SS_STSCHG
	.word	I365_CSC_STSCHG
	.word	SS_READY
	.word	I365_CSC_READY
	.word	EINVAL
	.word	SS_DETECT
	.word	I365_CSC_DETECT
	.word	SS_BATDEAD
	.word	I365_CSC_BVD1
	.word	SS_BATWARN
	.word	I365_CSC_BVD2
	.size	pccard_set_socket, .-pccard_set_socket
	.comm	vrc4171_sockets,4,4
	.comm	VPP_GET_VCC,4,4
	.comm	SS_STSCHG,4,4
	.comm	SS_RESET,4,4
	.comm	SS_READY,4,4
	.comm	SS_OUTPUT_ENA,4,4
	.comm	SS_IOCARD,4,4
	.comm	SS_DETECT,4,4
	.comm	SS_BATWARN,4,4
	.comm	SS_BATDEAD,4,4
	.comm	POWER_ENABLE,4,4
	.comm	I365_PWR_OUT,4,4
	.comm	I365_POWER,4,4
	.comm	I365_PC_RESET,4,4
	.comm	I365_PC_IOCARD,4,4
	.comm	I365_INTCTL,4,4
	.comm	I365_CSC_STSCHG,4,4
	.comm	I365_CSC_READY,4,4
	.comm	I365_CSC_DETECT,4,4
	.comm	I365_CSC_BVD2,4,4
	.comm	I365_CSC_BVD1,4,4
	.comm	I365_CSCINT,4,4
	.comm	I365_CSC,4,4
	.comm	EINVAL,4,4
	.comm	CARD_VOLTAGE_SELECT,4,4
	.comm	CARD_MAX_SLOTS,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
