	.file	"extr_cs5536.c_cs5536_set_pio_mode.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	cs5536_set_pio_mode, @function
cs5536_set_pio_mode:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movsx	r13, esi
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12, rdi
	movsx	r14, r13d
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	mov	rax, QWORD PTR 8[rdi]
	mov	edi, DWORD PTR [rax]
	call	to_pci_dev@PLT
	mov	rdi, r12
	mov	rbp, rax
	call	ide_get_pair_dev@PLT
	mov	rdi, r12
	mov	ebx, DWORD PTR IDE_CAST_D1_SHIFT[rip]
	test	BYTE PTR [r12], 1
	mov	r15, rax
	cmove	ebx, DWORD PTR IDE_CAST_D0_SHIFT[rip]
	call	ide_get_drivedata@PLT
	mov	rcx, rax
	test	r15, r15
	je	.L4
	mov	edx, 4
	mov	esi, 255
	mov	rdi, r15
	mov	QWORD PTR 8[rsp], rax
	call	ide_get_best_pio_mode@PLT
	mov	edi, r13d
	mov	esi, eax
	call	min@PLT
	mov	rcx, QWORD PTR 8[rsp]
	movsx	r14, eax
.L4:
	mov	esi, DWORD PTR IDE_DRV_MASK[rip]
	lea	rax, drv_timings.1965[rip]
	mov	rdi, r12
	movsx	rax, DWORD PTR [rax+r13*4]
	sal	esi, 8
	movsx	rsi, esi
	mov	r15, rax
	and	rsi, rcx
	or	rsi, rax
	call	ide_set_drivedata@PLT
	mov	esi, r15d
	mov	rdi, r12
	call	cs5536_program_dtc@PLT
	mov	esi, DWORD PTR CAST[rip]
	lea	rdx, 20[rsp]
	mov	rdi, rbp
	call	cs5536_read@PLT
	mov	edx, DWORD PTR IDE_CAST_DRV_MASK[rip]
	mov	ecx, ebx
	mov	rdi, rbp
	lea	rax, addr_timings.1966[rip]
	mov	esi, DWORD PTR IDE_CAST_CMD_SHIFT[rip]
	mov	eax, DWORD PTR [rax+r13*4]
	sal	edx, cl
	not	edx
	and	edx, DWORD PTR 20[rsp]
	sal	eax, cl
	mov	ecx, esi
	mov	esi, DWORD PTR CAST[rip]
	or	edx, eax
	mov	eax, DWORD PTR IDE_CAST_CMD_MASK[rip]
	sal	eax, cl
	not	eax
	and	edx, eax
	lea	rax, cmd_timings.1967[rip]
	mov	eax, DWORD PTR [rax+r14*4]
	sal	eax, cl
	or	edx, eax
	mov	DWORD PTR 20[rsp], edx
	call	cs5536_write@PLT
	mov	rax, QWORD PTR 24[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L11
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
.L11:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	cs5536_set_pio_mode, .-cs5536_set_pio_mode
	.section	.rodata
	.align 16
	.type	cmd_timings.1967, @object
	.size	cmd_timings.1967, 20
cmd_timings.1967:
	.long	153
	.long	146
	.long	144
	.long	34
	.long	32
	.align 16
	.type	addr_timings.1966, @object
	.size	addr_timings.1966, 20
addr_timings.1966:
	.long	2
	.long	1
	.long	0
	.long	0
	.long	0
	.align 16
	.type	drv_timings.1965, @object
	.size	drv_timings.1965, 20
drv_timings.1965:
	.long	152
	.long	85
	.long	50
	.long	33
	.long	32
	.comm	IDE_DRV_MASK,4,4
	.comm	IDE_CAST_DRV_MASK,4,4
	.comm	IDE_CAST_D1_SHIFT,4,4
	.comm	IDE_CAST_D0_SHIFT,4,4
	.comm	IDE_CAST_CMD_SHIFT,4,4
	.comm	IDE_CAST_CMD_MASK,4,4
	.comm	CAST,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_cs5536.c_cs5536_set_pio_mode.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	cs5536_set_pio_mode, %function
cs5536_set_pio_mode:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r3, [r0, #4]
	mov	r4, r0
	ldr	r0, [r3]
	ldr	r3, .L10
	sub	sp, sp, #12
	mov	r7, r1
	ldr	r3, [r3]
	str	r3, [sp, #4]
	mov	r3,#0
	bl	to_pci_dev
	mov	r5, r0
	mov	r0, r4
	bl	ide_get_pair_dev
	ldr	r3, [r4]
	mov	r8, r0
	tst	r3, #1
	ldrne	r3, .L10+4
	ldreq	r3, .L10+8
	mov	r0, r4
	ldr	r9, [r3]
	bl	ide_get_drivedata
	cmp	r8, #0
	mov	r6, r0
	moveq	r10, r7
	beq	.L4
	mov	r2, #4
	mov	r1, #255
	mov	r0, r8
	bl	ide_get_best_pio_mode
	mov	r1, r0
	mov	r0, r7
	bl	min
	mov	r10, r0
.L4:
	ldr	r3, .L10+12
	ldr	r8, .L10+16
	ldr	r1, [r3]
	ldr	fp, [r8, r7, lsl #2]
	and	r1, r6, r1, lsl #8
	orr	r1, fp, r1
	ldr	r6, .L10+20
	mov	r0, r4
	bl	ide_set_drivedata
	mov	r1, fp
	mov	r0, r4
	bl	cs5536_program_dtc
	mov	r2, sp
	ldr	r1, [r6]
	mov	r0, r5
	bl	cs5536_read
	ldr	r3, .L10+24
	ldr	r2, [sp]
	ldr	r0, [r3]
	ldr	r1, .L10+28
	add	r7, r8, r7, lsl #2
	ldr	r3, .L10+32
	ldr	ip, [r7, #20]
	ldr	r3, [r3]
	bic	r2, r2, r0, lsl r9
	add	r8, r8, r10, lsl #2
	ldr	r0, [r1]
	orr	r2, r2, ip, lsl r9
	ldr	r1, [r8, #40]
	bic	r2, r2, r0, lsl r3
	orr	r2, r2, r1, lsl r3
	mov	r0, r5
	ldr	r1, [r6]
	str	r2, [sp]
	bl	cs5536_write
	ldr	r3, .L10
	ldr	r2, [r3]
	ldr	r3, [sp, #4]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L9
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L9:
	bl	__stack_chk_fail
.L11:
	.align	2
.L10:
	.word	.LC0
	.word	IDE_CAST_D1_SHIFT
	.word	IDE_CAST_D0_SHIFT
	.word	IDE_DRV_MASK
	.word	.LANCHOR0
	.word	CAST
	.word	IDE_CAST_DRV_MASK
	.word	IDE_CAST_CMD_MASK
	.word	IDE_CAST_CMD_SHIFT
	.size	cs5536_set_pio_mode, .-cs5536_set_pio_mode
	.comm	IDE_DRV_MASK,4,4
	.comm	IDE_CAST_DRV_MASK,4,4
	.comm	IDE_CAST_D1_SHIFT,4,4
	.comm	IDE_CAST_D0_SHIFT,4,4
	.comm	IDE_CAST_CMD_SHIFT,4,4
	.comm	IDE_CAST_CMD_MASK,4,4
	.comm	CAST,4,4
	.section	.rodata
	.align	2
	.set	.LANCHOR0,. + 0
	.type	drv_timings.4249, %object
	.size	drv_timings.4249, 20
drv_timings.4249:
	.word	152
	.word	85
	.word	50
	.word	33
	.word	32
	.type	addr_timings.4250, %object
	.size	addr_timings.4250, 20
addr_timings.4250:
	.word	2
	.word	1
	.word	0
	.word	0
	.word	0
	.type	cmd_timings.4251, %object
	.size	cmd_timings.4251, 20
cmd_timings.4251:
	.word	153
	.word	146
	.word	144
	.word	34
	.word	32
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
