	.file	"extr_pata_legacy.c_ht6560b_set_piomode.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	ht6560b_set_piomode, @function
ht6560b_set_piomode:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	mov	r13, rsi
	mov	r8d, 1000
	mov	ecx, 20000
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rdi
	mov	rdi, r13
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 24
	.cfi_def_cfa_offset 64
	mov	esi, DWORD PTR 8[rsi]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	mov	rdx, rsp
	call	ata_timing_compute@PLT
	mov	edi, DWORD PTR 4[rsp]
	mov	edx, 15
	mov	esi, 2
	call	clamp_val@PLT
	mov	edi, DWORD PTR [rsp]
	mov	edx, 16
	mov	esi, 2
	mov	r12d, eax
	call	clamp_val@PLT
	mov	edi, 998
	mov	ebx, eax
	call	inb@PLT
	mov	edi, 998
	sal	ebx, 4
	call	inb@PLT
	mov	edi, 998
	call	inb@PLT
	mov	edi, 998
	call	inb@PLT
	mov	edi, ebx
	mov	esi, DWORD PTR 4[rbp]
	and	edi, 336
	or	edi, r12d
	call	iowrite8@PLT
	mov	rax, QWORD PTR ATA_DEV_ATA[rip]
	cmp	QWORD PTR 0[r13], rax
	jne	.L11
.L3:
	mov	edi, DWORD PTR 0[rbp]
	call	ioread8@PLT
	mov	rax, QWORD PTR 8[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L12
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	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
.L11:
	.cfi_restore_state
	mov	edi, 998
	call	inb@PLT
	test	al, 36
	je	.L3
	and	eax, -37
	mov	esi, 998
	mov	edi, eax
	call	outb@PLT
	jmp	.L3
.L12:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	ht6560b_set_piomode, .-ht6560b_set_piomode
	.comm	ATA_DEV_ATA,8,8
	.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_legacy.c_ht6560b_set_piomode.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	ht6560b_set_piomode, %function
ht6560b_set_piomode:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, lr}
	mov	r3, #1000
	mov	r5, r1
	sub	sp, sp, #28
	ldr	ip, .L13
	ldr	r1, [r1, #4]
	mov	r6, r0
	str	r3, [sp]
	add	r2, sp, #12
	ldr	r3, .L13+4
	mov	r0, r5
	ldr	ip, [ip]
	str	ip, [sp, #20]
	mov	ip,#0
	bl	ata_timing_compute
	mov	r2, #15
	mov	r1, #2
	ldr	r0, [sp, #16]
	bl	clamp_val
	mov	r2, #16
	mov	r1, #2
	mov	r7, r0
	ldr	r0, [sp, #12]
	bl	clamp_val
	mov	r4, r0
	ldr	r0, .L13+8
	bl	inb
	ldr	r0, .L13+8
	bl	inb
	lsl	r4, r4, #4
	ldr	r0, .L13+8
	bl	inb
	and	r4, r4, #336
	ldr	r0, .L13+8
	bl	inb
	ldr	r1, [r6, #4]
	orr	r0, r4, r7
	bl	iowrite8
	ldr	r3, .L13+12
	ldr	r2, [r5]
	ldr	r3, [r3]
	cmp	r2, r3
	bne	.L11
.L3:
	ldr	r0, [r6]
	bl	ioread8
	ldr	r3, .L13
	ldr	r2, [r3]
	ldr	r3, [sp, #20]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L12
	add	sp, sp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, pc}
.L11:
	ldr	r0, .L13+8
	bl	inb
	tst	r0, #36
	beq	.L3
	ldr	r1, .L13+8
	bic	r0, r0, #36
	bl	outb
	b	.L3
.L12:
	bl	__stack_chk_fail
.L14:
	.align	2
.L13:
	.word	.LC0
	.word	20000
	.word	998
	.word	ATA_DEV_ATA
	.size	ht6560b_set_piomode, .-ht6560b_set_piomode
	.comm	ATA_DEV_ATA,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
