	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ata_macio_attach
_ata_macio_attach:                      ## @ata_macio_attach
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, %r15
	movl	$0, -44(%rbp)
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	_RF_ACTIVE@GOTPCREL(%rip), %r13
	movl	(%r13), %ecx
	leaq	-44(%rbp), %rdx
	movl	%r14d, %edi
	callq	_bus_alloc_resource_any
	movq	%rax, 72(%r15)
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	_ATA_DATA@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	_ATA_COMMAND@GOTPCREL(%rip), %r9
	movq	56(%r15), %r8
	cmpl	(%r9), %edx
	jg	LBB0_5
## %bb.3:
	movslq	%edx, %rcx
	leaq	-1(%rcx), %rdi
	shlq	$4, %rcx
	leaq	(%r8,%rcx), %rbx
	addq	$8, %rbx
	movq	_ATA_MACIO_REGGAP@GOTPCREL(%rip), %rcx
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rax, (%rbx)
	movl	(%rcx), %esi
	imull	%edx, %esi
	movl	%esi, -8(%rbx)
	movslq	(%r9), %rsi
	incq	%rdi
	incl	%edx
	addq	$16, %rbx
	cmpq	%rsi, %rdi
	jl	LBB0_4
LBB0_5:
	movq	_ATA_CONTROL@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	shlq	$4, %rcx
	movq	%rax, 8(%r8,%rcx)
	movq	_ATA_MACIO_ALTOFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r8,%rcx)
	movl	%r14d, %edi
	callq	_ata_default_registers
	movq	%r15, %rbx
	movq	$0, 48(%r15)
	movq	_ATA_USE_16BIT@GOTPCREL(%rip), %rax
	movq	_ATA_NO_ATAPI_DMA@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	addq	$32, %rbx
	orl	%ecx, 40(%r15)
	movl	%r14d, %edi
	callq	_ata_generic_hw
	movl	$1, 32(%r15)
	movl	(%r12), %esi
	movl	(%r13), %ecx
	movl	%r14d, %edi
	movq	%rbx, %rdx
	callq	_bus_alloc_resource_any
	movq	%rax, 64(%r15)
	movl	%r14d, %edi
	callq	_ata_dbdma_dmainit
	movq	72(%r15), %rdi
	movq	_ATA_MACIO_TIMINGREG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_bus_read_4
	cmpl	$4, (%r15)
	jne	LBB0_7
## %bb.6:
	movl	%eax, %ecx
	andl	$535822336, %ecx                ## imm = 0x1FF00000
	movq	8(%r15), %rdx
	movl	%ecx, 4(%rdx)
	movl	%ecx, (%rdx)
	movl	%eax, %ecx
	andl	$2096128, %ecx                  ## imm = 0x1FFC00
	movq	16(%r15), %rdx
	movl	%ecx, 4(%rdx)
	movl	%ecx, (%rdx)
	andl	$1023, %eax                     ## imm = 0x3FF
	jmp	LBB0_8
LBB0_1:
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edi
	callq	_device_printf
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_9
LBB0_7:
	movq	8(%r15), %rcx
	movq	$0, (%rcx)
	movl	%eax, %ecx
	andl	$-2048, %ecx                    ## imm = 0xF800
	movq	16(%r15), %rdx
	movl	%ecx, 4(%rdx)
	movl	%ecx, (%rdx)
	andl	$2047, %eax                     ## imm = 0x7FF
LBB0_8:
	movq	24(%r15), %rcx
	movl	%eax, 4(%rcx)
	movl	%eax, (%rcx)
	movq	_ata_macio_begin_transaction@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 44(%r15)
	movl	%r14d, %edi
	callq	_ata_attach
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SYS_RES_MEMORY,4,2             ## @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ## @RF_ACTIVE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not allocate memory\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_ATA_DATA,4,2                   ## @ATA_DATA
	.comm	_ATA_COMMAND,4,2                ## @ATA_COMMAND
	.comm	_ATA_MACIO_REGGAP,4,2           ## @ATA_MACIO_REGGAP
	.comm	_ATA_CONTROL,8,3                ## @ATA_CONTROL
	.comm	_ATA_MACIO_ALTOFFSET,4,2        ## @ATA_MACIO_ALTOFFSET
	.comm	_ATA_USE_16BIT,4,2              ## @ATA_USE_16BIT
	.comm	_ATA_NO_ATAPI_DMA,4,2           ## @ATA_NO_ATAPI_DMA
	.comm	_ATA_MACIO_TIMINGREG,4,2        ## @ATA_MACIO_TIMINGREG
	.comm	_ata_macio_begin_transaction,4,2 ## @ata_macio_begin_transaction
	.comm	_ATA_INTR_FLAGS,4,2             ## @ATA_INTR_FLAGS
	.comm	_RF_SHAREABLE,4,2               ## @RF_SHAREABLE
	.comm	_SYS_RES_IRQ,4,2                ## @SYS_RES_IRQ
	.comm	_ata_interrupt,8,3              ## @ata_interrupt
	.no_dead_strip	_ata_macio_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ata_macio_attach
_ata_macio_attach:                      ; @ata_macio_attach
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x0
	bl	_device_get_softc
	mov	x20, x0
	str	wzr, [sp, #12]
Lloh0:
	adrp	x21, _SYS_RES_MEMORY@GOTPAGE
Lloh1:
	ldr	x21, [x21, _SYS_RES_MEMORY@GOTPAGEOFF]
	ldr	w1, [x21]
Lloh2:
	adrp	x22, _RF_ACTIVE@GOTPAGE
Lloh3:
	ldr	x22, [x22, _RF_ACTIVE@GOTPAGEOFF]
	ldr	w3, [x22]
	add	x2, sp, #12
	mov	x0, x19
	bl	_bus_alloc_resource_any
	str	x0, [x20, #72]
	cbz	x0, LBB0_6
; %bb.1:
Lloh4:
	adrp	x8, _ATA_DATA@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ATA_DATA@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x8]
Lloh7:
	adrp	x10, _ATA_COMMAND@GOTPAGE
Lloh8:
	ldr	x10, [x10, _ATA_COMMAND@GOTPAGEOFF]
	ldr	w11, [x10]
	ldr	x8, [x20, #56]
	cmp	w9, w11
	b.gt	LBB0_4
; %bb.2:
	sxtw	x12, w9
	sub	x11, x12, #1
	add	x12, x8, x12, lsl #4
	add	x12, x12, #8
Lloh9:
	adrp	x13, _ATA_MACIO_REGGAP@GOTPAGE
Lloh10:
	ldr	x13, [x13, _ATA_MACIO_REGGAP@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	str	x0, [x12]
	ldr	w14, [x13]
	mul	w14, w14, w9
	stur	w14, [x12, #-8]
	ldrsw	x14, [x10]
	add	x11, x11, #1
	add	w9, w9, #1
	add	x12, x12, #16
	cmp	x11, x14
	b.lt	LBB0_3
LBB0_4:
Lloh11:
	adrp	x9, _ATA_CONTROL@GOTPAGE
Lloh12:
	ldr	x9, [x9, _ATA_CONTROL@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	add	x8, x8, x9, lsl #4
	str	x0, [x8, #8]
Lloh14:
	adrp	x9, _ATA_MACIO_ALTOFFSET@GOTPAGE
Lloh15:
	ldr	x9, [x9, _ATA_MACIO_ALTOFFSET@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	str	w9, [x8]
	mov	x0, x19
	bl	_ata_default_registers
	str	xzr, [x20, #48]
Lloh17:
	adrp	x8, _ATA_USE_16BIT@GOTPAGE
Lloh18:
	ldr	x8, [x8, _ATA_USE_16BIT@GOTPAGEOFF]
Lloh19:
	adrp	x9, _ATA_NO_ATAPI_DMA@GOTPAGE
Lloh20:
	ldr	x9, [x9, _ATA_NO_ATAPI_DMA@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
Lloh22:
	ldr	w9, [x9]
	orr	w8, w9, w8
	ldr	w9, [x20, #40]
	orr	w8, w8, w9
	str	w8, [x20, #40]
	mov	x0, x19
	bl	_ata_generic_hw
	mov	w8, #1
	mov	x2, x20
	str	w8, [x2, #32]!
	ldr	w1, [x21]
	ldr	w3, [x22]
	mov	x0, x19
	bl	_bus_alloc_resource_any
	str	x0, [x20, #64]
	mov	x0, x19
	bl	_ata_dbdma_dmainit
	ldr	x0, [x20, #72]
Lloh23:
	adrp	x8, _ATA_MACIO_TIMINGREG@GOTPAGE
Lloh24:
	ldr	x8, [x8, _ATA_MACIO_TIMINGREG@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	bl	_bus_read_4
	ldr	w8, [x20]
	cmp	w8, #4
	b.ne	LBB0_7
; %bb.5:
	and	w8, w0, #0x1ff00000
	ldp	x9, x10, [x20, #8]
	stp	w8, w8, [x9]
	and	w8, w0, #0x1ffc00
	stp	w8, w8, [x10]
	and	w8, w0, #0x3ff
	ldr	x9, [x20, #24]
	stp	w8, w8, [x9]
	b	LBB0_8
LBB0_6:
Lloh26:
	adrp	x1, l_.str@PAGE
Lloh27:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_device_printf
Lloh28:
	adrp	x8, _ENXIO@GOTPAGE
Lloh29:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh30:
	ldr	w0, [x8]
	b	LBB0_9
LBB0_7:
	ldr	x8, [x20, #8]
	str	xzr, [x8]
	and	w8, w0, #0xfffff800
	ldp	x9, x10, [x20, #16]
	stp	w8, w8, [x9]
	and	w8, w0, #0x7ff
	stp	w8, w8, [x10]
LBB0_8:
Lloh31:
	adrp	x8, _ata_macio_begin_transaction@GOTPAGE
Lloh32:
	ldr	x8, [x8, _ata_macio_begin_transaction@GOTPAGEOFF]
Lloh33:
	ldr	w8, [x8]
	str	w8, [x20, #44]
	mov	x0, x19
	bl	_ata_attach
LBB0_9:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh21
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.cfi_endproc
                                        ; -- End function
	.comm	_SYS_RES_MEMORY,4,2             ; @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ; @RF_ACTIVE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not allocate memory\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_ATA_DATA,4,2                   ; @ATA_DATA
	.comm	_ATA_COMMAND,4,2                ; @ATA_COMMAND
	.comm	_ATA_MACIO_REGGAP,4,2           ; @ATA_MACIO_REGGAP
	.comm	_ATA_CONTROL,8,3                ; @ATA_CONTROL
	.comm	_ATA_MACIO_ALTOFFSET,4,2        ; @ATA_MACIO_ALTOFFSET
	.comm	_ATA_USE_16BIT,4,2              ; @ATA_USE_16BIT
	.comm	_ATA_NO_ATAPI_DMA,4,2           ; @ATA_NO_ATAPI_DMA
	.comm	_ATA_MACIO_TIMINGREG,4,2        ; @ATA_MACIO_TIMINGREG
	.comm	_ata_macio_begin_transaction,4,2 ; @ata_macio_begin_transaction
	.comm	_ATA_INTR_FLAGS,4,2             ; @ATA_INTR_FLAGS
	.comm	_RF_SHAREABLE,4,2               ; @RF_SHAREABLE
	.comm	_SYS_RES_IRQ,4,2                ; @SYS_RES_IRQ
	.comm	_ata_interrupt,8,3              ; @ata_interrupt
	.no_dead_strip	_ata_macio_attach
.subsections_via_symbols
