	.file	"extr_pata_via.c_via_cable_detect.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	via_cable_detect, @function
via_cable_detect:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	sub	rsp, 16
	.cfi_def_cfa_offset 48
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	mov	rax, QWORD PTR 8[rdi]
	mov	edi, DWORD PTR [rax]
	mov	rbx, QWORD PTR 8[rax]
	call	to_pci_dev@PLT
	mov	rdi, rax
	mov	r12, rax
	call	via_cable_override@PLT
	test	rax, rax
	jne	.L22
	mov	eax, DWORD PTR [rbx]
	test	DWORD PTR VIA_SATA_PATA[rip], eax
	je	.L4
	mov	edx, DWORD PTR 0[rbp]
	test	edx, edx
	je	.L23
.L4:
	and	eax, DWORD PTR VIA_UDMA[rip]
	cmp	eax, DWORD PTR VIA_UDMA_66[rip]
	jl	.L8
	cmp	eax, DWORD PTR VIA_UDMA_100[rip]
	jge	.L6
	mov	eax, DWORD PTR ATA_CBL_PATA_UNK[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L6:
	lea	rdx, 4[rsp]
	mov	esi, 80
	mov	rdi, r12
	call	pci_read_config_dword@PLT
	mov	ecx, DWORD PTR 0[rbp]
	mov	eax, 269484032
	sal	ecx, 4
	sar	eax, cl
	test	DWORD PTR 4[rsp], eax
	jne	.L20
	mov	rdi, rbp
	call	ata_acpi_init_gtm@PLT
	test	rax, rax
	jne	.L24
.L8:
	mov	eax, DWORD PTR ATA_CBL_PATA40[rip]
.L1:
	mov	rsi, QWORD PTR 8[rsp]
	xor	rsi, QWORD PTR fs:40
	jne	.L25
	add	rsp, 16
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	pop	rbx
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L22:
	.cfi_restore_state
	mov	eax, DWORD PTR ATA_CBL_PATA40_SHORT[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L23:
	mov	eax, DWORD PTR ATA_CBL_SATA[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L24:
	mov	rdi, rbp
	call	ata_acpi_init_gtm@PLT
	mov	rdi, rbp
	mov	rsi, rax
	call	ata_acpi_cbl_80wire@PLT
	test	rax, rax
	je	.L8
	.p2align 4,,10
	.p2align 3
.L20:
	mov	eax, DWORD PTR ATA_CBL_PATA80[rip]
	jmp	.L1
.L25:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	via_cable_detect, .-via_cable_detect
	.comm	VIA_UDMA_66,4,4
	.comm	VIA_UDMA_100,4,4
	.comm	VIA_UDMA,4,4
	.comm	VIA_SATA_PATA,4,4
	.comm	ATA_CBL_SATA,4,4
	.comm	ATA_CBL_PATA_UNK,4,4
	.comm	ATA_CBL_PATA80,4,4
	.comm	ATA_CBL_PATA40_SHORT,4,4
	.comm	ATA_CBL_PATA40,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_pata_via.c_via_cable_detect.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	via_cable_detect, %function
via_cable_detect:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	ldr	r3, [r0, #4]
	ldr	r2, .L26
	sub	sp, sp, #8
	mov	r4, r0
	ldm	r3, {r0, r6}
	ldr	r2, [r2]
	str	r2, [sp, #4]
	mov	r2,#0
	bl	to_pci_dev
	mov	r5, r0
	bl	via_cable_override
	cmp	r0, #0
	bne	.L22
	ldr	r2, .L26+4
	ldr	r3, [r6]
	ldr	r2, [r2]
	tst	r3, r2
	beq	.L4
	ldr	r2, [r4]
	cmp	r2, #0
	beq	.L23
.L4:
	ldr	r1, .L26+8
	ldr	r2, .L26+12
	ldr	r1, [r1]
	ldr	r2, [r2]
	and	r3, r3, r1
	cmp	r3, r2
	blt	.L8
	ldr	r2, .L26+16
	ldr	r2, [r2]
	cmp	r3, r2
	ldrlt	r3, .L26+20
	ldrlt	r0, [r3]
	blt	.L1
.L6:
	mov	r2, sp
	mov	r1, #80
	mov	r0, r5
	bl	pci_read_config_dword
	ldr	r3, [r4]
	ldr	r1, .L26+24
	ldr	r2, [sp]
	lsl	r3, r3, #4
	ands	r3, r2, r1, asr r3
	bne	.L20
	mov	r0, r4
	bl	ata_acpi_init_gtm
	cmp	r0, #0
	bne	.L24
.L8:
	ldr	r3, .L26+28
	ldr	r0, [r3]
.L1:
	ldr	r3, .L26
	ldr	r2, [r3]
	ldr	r3, [sp, #4]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L25
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, pc}
.L22:
	ldr	r3, .L26+32
	ldr	r0, [r3]
	b	.L1
.L23:
	ldr	r3, .L26+36
	ldr	r0, [r3]
	b	.L1
.L24:
	mov	r0, r4
	bl	ata_acpi_init_gtm
	mov	r1, r0
	mov	r0, r4
	bl	ata_acpi_cbl_80wire
	cmp	r0, #0
	beq	.L8
.L20:
	ldr	r3, .L26+40
	ldr	r0, [r3]
	b	.L1
.L25:
	bl	__stack_chk_fail
.L27:
	.align	2
.L26:
	.word	.LC0
	.word	VIA_SATA_PATA
	.word	VIA_UDMA
	.word	VIA_UDMA_66
	.word	VIA_UDMA_100
	.word	ATA_CBL_PATA_UNK
	.word	269484032
	.word	ATA_CBL_PATA40
	.word	ATA_CBL_PATA40_SHORT
	.word	ATA_CBL_SATA
	.word	ATA_CBL_PATA80
	.size	via_cable_detect, .-via_cable_detect
	.comm	VIA_UDMA_66,4,4
	.comm	VIA_UDMA_100,4,4
	.comm	VIA_UDMA,4,4
	.comm	VIA_SATA_PATA,4,4
	.comm	ATA_CBL_SATA,4,4
	.comm	ATA_CBL_PATA_UNK,4,4
	.comm	ATA_CBL_PATA80,4,4
	.comm	ATA_CBL_PATA40_SHORT,4,4
	.comm	ATA_CBL_PATA40,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
