	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function amd_set_drive
_amd_set_drive:                         ## @amd_set_drive
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r13
	movq	16(%rdi), %rbx
	movl	8(%rbx), %edi
	callq	_to_pci_dev
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	%r13, %rdi
	callq	_ide_get_pair_dev
	movq	%rax, %r12
	movq	(%rbx), %rbx
	movq	_amd_clock@GOTPCREL(%rip), %rcx
	movl	$1000000000, %eax               ## imm = 0x3B9ACA00
	xorl	%edx, %edx
	idivl	(%rcx)
	movl	%eax, %r15d
	movq	_ATA_UDMA2@GOTPCREL(%rip), %rax
	movl	%r15d, %r14d
	cmpq	(%rax), %rbx
	je	LBB0_2
## %bb.1:
	movl	%r15d, %r14d
	shrl	$31, %r14d
	addl	%r15d, %r14d
	sarl	%r14d
LBB0_2:
	leaq	-48(%rbp), %rdx
	movq	%r13, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	%r15d, %ecx
	movl	%r14d, %r8d
	callq	_ide_timing_compute
	testq	%r12, %r12
	je	LBB0_4
## %bb.3:
	movq	(%r12), %rsi
	leaq	-72(%rbp), %rdx
	movq	%r12, %rdi
	movq	%rdx, %r12
	movl	%r15d, %ecx
	movl	%r14d, %r8d
	callq	_ide_timing_compute
	movq	_IDE_TIMING_8BIT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-48(%rbp), %rdx
	movq	%r12, %rdi
	movq	%rdx, %rsi
	callq	_ide_timing_merge
LBB0_4:
	movq	_XFER_UDMA_5@GOTPCREL(%rip), %rcx
	movq	_amd_clock@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	cmpq	%rdx, (%rcx)
	jne	LBB0_7
## %bb.5:
	cmpl	$33333, %eax                    ## imm = 0x8235
	jg	LBB0_7
## %bb.6:
	movl	$1, -48(%rbp)
LBB0_7:
	movq	_XFER_UDMA_6@GOTPCREL(%rip), %rcx
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	cmpq	%rdx, (%rcx)
	jne	LBB0_10
## %bb.8:
	cmpl	$33333, %eax                    ## imm = 0x8235
	jg	LBB0_10
## %bb.9:
	movl	$15, -48(%rbp)
LBB0_10:
	movl	8(%r13), %esi
	leaq	-48(%rbp), %rcx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%rbx, %rdx
	callq	_amd_set_speed
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_amd_clock,4,2                  ## @amd_clock
	.comm	_ATA_UDMA2,8,3                  ## @ATA_UDMA2
	.comm	_IDE_TIMING_8BIT,4,2            ## @IDE_TIMING_8BIT
	.comm	_XFER_UDMA_5,8,3                ## @XFER_UDMA_5
	.comm	_XFER_UDMA_6,8,3                ## @XFER_UDMA_6
	.no_dead_strip	_amd_set_drive
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function amd_set_drive
_amd_set_drive:                         ; @amd_set_drive
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x22, x1
	mov	x19, x0
	ldr	x21, [x0, #16]
	ldr	w0, [x21, #8]
	bl	_to_pci_dev
	mov	x20, x0
	mov	x0, x19
	bl	_ide_get_pair_dev
	mov	x23, x0
Lloh0:
	adrp	x26, _amd_clock@GOTPAGE
Lloh1:
	ldr	x26, [x26, _amd_clock@GOTPAGEOFF]
	ldr	x21, [x21]
	ldr	w8, [x26]
	mov	w9, #51712
	movk	w9, #15258, lsl #16
	sdiv	w24, w9, w8
Lloh2:
	adrp	x8, _ATA_UDMA2@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ATA_UDMA2@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	cmp	w24, #0
	cinc	w9, w24, lt
	asr	w9, w9, #1
	cmp	x21, x8
	csel	w25, w24, w9, eq
	add	x2, sp, #8
	mov	x0, x19
	mov	x1, x22
	mov	x3, x24
	mov	x4, x25
	bl	_ide_timing_compute
	cbz	x23, LBB0_2
; %bb.1:
	ldr	x1, [x23]
	mov	x2, sp
	mov	x0, x23
	mov	x3, x24
	mov	x4, x25
	bl	_ide_timing_compute
Lloh5:
	adrp	x8, _IDE_TIMING_8BIT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _IDE_TIMING_8BIT@GOTPAGEOFF]
Lloh7:
	ldr	w3, [x8]
	mov	x0, sp
	add	x1, sp, #8
	add	x2, sp, #8
	bl	_ide_timing_merge
LBB0_2:
Lloh8:
	adrp	x8, _XFER_UDMA_5@GOTPAGE
Lloh9:
	ldr	x8, [x8, _XFER_UDMA_5@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x8]
	ldr	w8, [x26]
	cmp	x9, x22
	mov	w9, #33333
	ccmp	w8, w9, #0, eq
	b.gt	LBB0_4
; %bb.3:
	mov	w10, #1
	str	w10, [sp, #8]
LBB0_4:
Lloh11:
	adrp	x10, _XFER_UDMA_6@GOTPAGE
Lloh12:
	ldr	x10, [x10, _XFER_UDMA_6@GOTPAGEOFF]
Lloh13:
	ldr	x10, [x10]
	cmp	x10, x22
	ccmp	w8, w9, #0, eq
	b.gt	LBB0_6
; %bb.5:
	mov	w8, #15
	str	w8, [sp, #8]
LBB0_6:
	ldr	w1, [x19, #8]
	add	x3, sp, #8
	mov	x0, x20
	mov	x2, x21
	bl	_amd_set_speed
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_amd_clock,4,2                  ; @amd_clock
	.comm	_ATA_UDMA2,8,3                  ; @ATA_UDMA2
	.comm	_IDE_TIMING_8BIT,4,2            ; @IDE_TIMING_8BIT
	.comm	_XFER_UDMA_5,8,3                ; @XFER_UDMA_5
	.comm	_XFER_UDMA_6,8,3                ; @XFER_UDMA_6
	.no_dead_strip	_amd_set_drive
.subsections_via_symbols
