	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ata_hpa_resize
_ata_hpa_resize:                        ## @ata_hpa_resize
	.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
	movq	%rdi, %r13
	movq	24(%rdi), %rax
	movq	_ATA_EHI_PRINTINFO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	andl	(%rax), %ebx
	movl	12(%rdi), %edi
	callq	_ata_id_n_sectors
	movq	%rax, %r15
	movq	(%r13), %rax
	movq	_ATA_DEV_ATA@GOTPCREL(%rip), %rcx
	xorl	%r14d, %r14d
	cmpq	(%rcx), %rax
	jne	LBB0_25
## %bb.1:
	movl	12(%r13), %edi
	callq	_ata_id_has_lba
	testl	%eax, %eax
	je	LBB0_25
## %bb.2:
	movl	12(%r13), %edi
	callq	_ata_id_hpa_enabled
	testl	%eax, %eax
	je	LBB0_25
## %bb.3:
	movq	_ATA_HORKAGE_BROKEN_HPA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%r13)
	je	LBB0_4
LBB0_25:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	leaq	-48(%rbp), %rsi
	movq	%r13, %rdi
	callq	_ata_read_native_max_address
	testl	%eax, %eax
	je	LBB0_9
## %bb.5:
	movl	%eax, %r12d
	movq	_EACCES@GOTPCREL(%rip), %rbx
	movl	(%rbx), %eax
	addl	%r12d, %eax
	je	LBB0_8
## %bb.6:
	movq	_ata_ignore_hpa@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_8
## %bb.7:
	movl	%r12d, %r14d
	jmp	LBB0_25
LBB0_9:
	movq	-48(%rbp), %r8
	movq	%r8, 16(%r13)
	cmpq	%r15, %r8
	jle	LBB0_11
## %bb.10:
	movq	_ata_ignore_hpa@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_11
## %bb.18:
	movq	%r13, %rdi
	movq	%r8, %rsi
	callq	_ata_set_max_sectors
	movl	%eax, %r14d
	movq	_EACCES@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r14d, %eax
	jne	LBB0_20
## %bb.19:
	movq	_KERN_WARNING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-48(%rbp), %r8
	leaq	L_.str.3(%rip), %rdx
	xorl	%r14d, %r14d
	movq	%r13, %rdi
	movq	%r15, %rcx
	xorl	%eax, %eax
	callq	_ata_dev_printk
	movq	_ATA_HORKAGE_BROKEN_HPA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 8(%r13)
	jmp	LBB0_25
LBB0_8:
	movq	_KERN_WARNING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	xorl	%r14d, %r14d
	movq	%r13, %rdi
	xorl	%eax, %eax
	callq	_ata_dev_printk
	movq	_ATA_HORKAGE_BROKEN_HPA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 8(%r13)
	movl	(%rbx), %eax
	addl	%r12d, %eax
	cmovel	%r14d, %r12d
	movl	%r12d, %r14d
	jmp	LBB0_25
LBB0_11:
	testl	%ebx, %ebx
	je	LBB0_25
## %bb.12:
	cmpq	%r15, %r8
	je	LBB0_25
## %bb.13:
	jle	LBB0_16
## %bb.14:
	movq	_KERN_INFO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdx
	xorl	%r14d, %r14d
	movq	%r13, %rdi
	movq	%r15, %rcx
	jmp	LBB0_15
LBB0_20:
	testl	%r14d, %r14d
	jne	LBB0_25
## %bb.21:
	xorl	%r14d, %r14d
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_ata_dev_reread_id
	testl	%eax, %eax
	je	LBB0_23
## %bb.22:
	movl	%eax, %r12d
	movq	_KERN_ERR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.4(%rip), %rdx
	movq	%r13, %rdi
	xorl	%eax, %eax
	callq	_ata_dev_printk
	movl	%r12d, %r14d
	jmp	LBB0_25
LBB0_16:
	jge	LBB0_25
## %bb.17:
	movq	_KERN_WARNING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.2(%rip), %rdx
	xorl	%r14d, %r14d
	movq	%r13, %rdi
	movq	%r8, %rcx
	movq	%r15, %r8
LBB0_15:
	xorl	%eax, %eax
	callq	_ata_dev_printk
	jmp	LBB0_25
LBB0_23:
	testl	%ebx, %ebx
	je	LBB0_25
## %bb.24:
	movl	12(%r13), %edi
	callq	_ata_id_n_sectors
	movq	_KERN_INFO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	-48(%rbp), %r9
	leaq	L_.str.5(%rip), %rdx
	xorl	%r14d, %r14d
	movq	%r13, %rdi
	movq	%r15, %rcx
	movq	%rax, %r8
	xorl	%eax, %eax
	callq	_ata_dev_printk
	jmp	LBB0_25
	.cfi_endproc
                                        ## -- End function
	.comm	_ATA_EHI_PRINTINFO,4,2          ## @ATA_EHI_PRINTINFO
	.comm	_ATA_DEV_ATA,8,3                ## @ATA_DEV_ATA
	.comm	_ATA_HORKAGE_BROKEN_HPA,4,2     ## @ATA_HORKAGE_BROKEN_HPA
	.comm	_EACCES,4,2                     ## @EACCES
	.comm	_ata_ignore_hpa,4,2             ## @ata_ignore_hpa
	.comm	_KERN_WARNING,4,2               ## @KERN_WARNING
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"HPA support seems broken, skipping HPA handling\n"

	.comm	_KERN_INFO,4,2                  ## @KERN_INFO
L_.str.1:                               ## @.str.1
	.asciz	"HPA detected: current %llu, native %llu\n"

L_.str.2:                               ## @.str.2
	.asciz	"native sectors (%llu) is smaller than sectors (%llu)\n"

L_.str.3:                               ## @.str.3
	.asciz	"device aborted resize (%llu -> %llu), skipping HPA handling\n"

	.comm	_KERN_ERR,4,2                   ## @KERN_ERR
L_.str.4:                               ## @.str.4
	.asciz	"failed to re-read IDENTIFY data after HPA resizing\n"

L_.str.5:                               ## @.str.5
	.asciz	"HPA unlocked: %llu -> %llu, native %llu\n"

	.no_dead_strip	_ata_hpa_resize
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ata_hpa_resize
_ata_hpa_resize:                        ; @ata_hpa_resize
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x19, x0
	ldr	x8, [x0, #24]
	ldr	w23, [x8]
Lloh0:
	adrp	x8, _ATA_EHI_PRINTINFO@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ATA_EHI_PRINTINFO@GOTPAGEOFF]
Lloh2:
	ldr	w24, [x8]
	ldr	w0, [x0, #12]
	bl	_ata_id_n_sectors
	ldr	x8, [x19]
Lloh3:
	adrp	x9, _ATA_DEV_ATA@GOTPAGE
Lloh4:
	ldr	x9, [x9, _ATA_DEV_ATA@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.1:
	mov	x20, x0
	ldr	w0, [x19, #12]
	bl	_ata_id_has_lba
	cbz	w0, LBB0_4
; %bb.2:
	ldr	w0, [x19, #12]
	bl	_ata_id_hpa_enabled
	cbz	w0, LBB0_4
; %bb.3:
	ldr	w8, [x19, #8]
Lloh6:
	adrp	x22, _ATA_HORKAGE_BROKEN_HPA@GOTPAGE
Lloh7:
	ldr	x22, [x22, _ATA_HORKAGE_BROKEN_HPA@GOTPAGEOFF]
	ldr	w9, [x22]
	tst	w9, w8
	b.eq	LBB0_6
LBB0_4:
	mov	w21, #0
LBB0_5:
	mov	x0, x21
	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
	add	sp, sp, #96
	ret
LBB0_6:
	add	x1, sp, #24
	mov	x0, x19
	bl	_ata_read_native_max_address
	cbz	w0, LBB0_9
; %bb.7:
	mov	x21, x0
Lloh8:
	adrp	x20, _EACCES@GOTPAGE
Lloh9:
	ldr	x20, [x20, _EACCES@GOTPAGEOFF]
	ldr	w8, [x20]
Lloh10:
	adrp	x9, _ata_ignore_hpa@GOTPAGE
Lloh11:
	ldr	x9, [x9, _ata_ignore_hpa@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	cmn	w0, w8
	ccmp	w9, #0, #4, ne
	b.ne	LBB0_5
; %bb.8:
Lloh13:
	adrp	x8, _KERN_WARNING@GOTPAGE
Lloh14:
	ldr	x8, [x8, _KERN_WARNING@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
Lloh16:
	adrp	x2, l_.str@PAGE
Lloh17:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	bl	_ata_dev_printk
	ldr	w8, [x22]
	ldr	w9, [x19, #8]
	orr	w8, w9, w8
	str	w8, [x19, #8]
	ldr	w8, [x20]
	cmn	w21, w8
	csel	w21, wzr, w21, eq
	b	LBB0_5
LBB0_9:
	and	w23, w24, w23
	ldr	x1, [sp, #24]
	str	x1, [x19, #16]
	cmp	x1, x20
	b.le	LBB0_13
; %bb.10:
Lloh18:
	adrp	x8, _ata_ignore_hpa@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ata_ignore_hpa@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	cbz	w8, LBB0_13
; %bb.11:
	mov	x0, x19
	bl	_ata_set_max_sectors
Lloh21:
	adrp	x8, _EACCES@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EACCES@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	cmn	w0, w8
	b.ne	LBB0_16
; %bb.12:
Lloh24:
	adrp	x8, _KERN_WARNING@GOTPAGE
Lloh25:
	ldr	x8, [x8, _KERN_WARNING@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
	ldr	x8, [sp, #24]
	stp	x20, x8, [sp]
Lloh27:
	adrp	x2, l_.str.3@PAGE
Lloh28:
	add	x2, x2, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_ata_dev_printk
	mov	w21, #0
	ldr	w8, [x22]
	ldr	w9, [x19, #8]
	orr	w8, w9, w8
	str	w8, [x19, #8]
	b	LBB0_5
LBB0_13:
	cmp	w23, #0
	ccmp	x1, x20, #4, ne
	b.eq	LBB0_4
; %bb.14:
	cmp	x1, x20
	b.le	LBB0_19
; %bb.15:
Lloh29:
	adrp	x8, _KERN_INFO@GOTPAGE
Lloh30:
	ldr	x8, [x8, _KERN_INFO@GOTPAGEOFF]
Lloh31:
	ldr	w8, [x8]
	stp	x20, x1, [sp]
Lloh32:
	adrp	x2, l_.str.1@PAGE
Lloh33:
	add	x2, x2, l_.str.1@PAGEOFF
	b	LBB0_21
LBB0_16:
	mov	x21, x0
	cbnz	w0, LBB0_5
; %bb.17:
	mov	x0, x19
	mov	w1, #0
	bl	_ata_dev_reread_id
	cbz	w0, LBB0_23
; %bb.18:
	mov	x21, x0
Lloh34:
	adrp	x8, _KERN_ERR@GOTPAGE
Lloh35:
	ldr	x8, [x8, _KERN_ERR@GOTPAGEOFF]
Lloh36:
	ldr	w1, [x8]
Lloh37:
	adrp	x2, l_.str.4@PAGE
Lloh38:
	add	x2, x2, l_.str.4@PAGEOFF
	mov	x0, x19
	bl	_ata_dev_printk
	b	LBB0_5
LBB0_19:
	b.ge	LBB0_4
; %bb.20:
Lloh39:
	adrp	x8, _KERN_WARNING@GOTPAGE
Lloh40:
	ldr	x8, [x8, _KERN_WARNING@GOTPAGEOFF]
Lloh41:
	ldr	w8, [x8]
	stp	x1, x20, [sp]
Lloh42:
	adrp	x2, l_.str.2@PAGE
Lloh43:
	add	x2, x2, l_.str.2@PAGEOFF
LBB0_21:
	mov	x0, x19
	mov	x1, x8
LBB0_22:
	bl	_ata_dev_printk
	b	LBB0_4
LBB0_23:
	cbz	w23, LBB0_4
; %bb.24:
	ldr	w0, [x19, #12]
	bl	_ata_id_n_sectors
Lloh44:
	adrp	x8, _KERN_INFO@GOTPAGE
Lloh45:
	ldr	x8, [x8, _KERN_INFO@GOTPAGEOFF]
Lloh46:
	ldr	w1, [x8]
	ldr	x8, [sp, #24]
	stp	x0, x8, [sp, #8]
	str	x20, [sp]
Lloh47:
	adrp	x2, l_.str.5@PAGE
Lloh48:
	add	x2, x2, l_.str.5@PAGEOFF
	mov	x0, x19
	b	LBB0_22
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpAdd	Lloh47, Lloh48
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.cfi_endproc
                                        ; -- End function
	.comm	_ATA_EHI_PRINTINFO,4,2          ; @ATA_EHI_PRINTINFO
	.comm	_ATA_DEV_ATA,8,3                ; @ATA_DEV_ATA
	.comm	_ATA_HORKAGE_BROKEN_HPA,4,2     ; @ATA_HORKAGE_BROKEN_HPA
	.comm	_EACCES,4,2                     ; @EACCES
	.comm	_ata_ignore_hpa,4,2             ; @ata_ignore_hpa
	.comm	_KERN_WARNING,4,2               ; @KERN_WARNING
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"HPA support seems broken, skipping HPA handling\n"

	.comm	_KERN_INFO,4,2                  ; @KERN_INFO
l_.str.1:                               ; @.str.1
	.asciz	"HPA detected: current %llu, native %llu\n"

l_.str.2:                               ; @.str.2
	.asciz	"native sectors (%llu) is smaller than sectors (%llu)\n"

l_.str.3:                               ; @.str.3
	.asciz	"device aborted resize (%llu -> %llu), skipping HPA handling\n"

	.comm	_KERN_ERR,4,2                   ; @KERN_ERR
l_.str.4:                               ; @.str.4
	.asciz	"failed to re-read IDENTIFY data after HPA resizing\n"

l_.str.5:                               ; @.str.5
	.asciz	"HPA unlocked: %llu -> %llu, native %llu\n"

	.no_dead_strip	_ata_hpa_resize
.subsections_via_symbols
