	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ata_do_identify                ## -- Begin function ata_do_identify
	.p2align	4, 0x90
_ata_do_identify:                       ## @ata_do_identify
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r15
	movq	%rcx, %r12
	movl	%edx, %r14d
	movl	%esi, %r13d
	movq	%rdi, %rbx
	leaq	-88(%rbp), %rsi
	callq	_get_cpi
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	leaq	L_.str(%rip), %rdi
LBB0_2:
	callq	_warnx
	movl	$-1, %r14d
LBB0_19:
	movl	%r14d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movl	%r14d, -48(%rbp)                ## 4-byte Spill
	movq	-88(%rbp), %rax
	movq	_PROTO_ATA@GOTPCREL(%rip), %r14
	cmpq	(%r14), %rax
	jne	LBB0_10
## %bb.4:
	leaq	-80(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_get_cgd
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_2
LBB0_10:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	_ATA_ATA_IDENTIFY@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
	movq	_ATA_ATAPI_IDENTIFY@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	jmp	LBB0_11
LBB0_6:
	movq	-80(%rbp), %rax
	cmpq	(%r14), %rax
	jne	LBB0_7
## %bb.8:
	movq	_ATA_ATA_IDENTIFY@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_7:
	movq	_ATA_ATAPI_IDENTIFY@GOTPCREL(%rip), %rax
LBB0_9:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	(%rax), %r12
	xorl	%r15d, %r15d
LBB0_11:
	movl	$1, %r14d
	movl	$1, %edi
	movl	$4, %esi
	callq	_calloc
	testq	%rax, %rax
	je	LBB0_20
## %bb.12:
	movq	%rax, %r13
	movl	-48(%rbp), %eax                 ## 4-byte Reload
	testl	%eax, %eax
	movl	$30000, %ebx                    ## imm = 0x7530
	cmovnel	%eax, %ebx
	movq	_MSG_SIMPLE_Q_TAG@GOTPCREL(%rip), %r14
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movq	_CAM_DIR_IN@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_AP_PROTO_PIO_IN@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	_AP_FLAG_TLEN_SECT_CNT@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	movq	_AP_FLAG_BYT_BLOK_BLOCKS@GOTPCREL(%rip), %rax
	orl	(%rax), %r9d
	movl	(%r14), %eax
	subq	$8, %rsp
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	pushq	$0
	pushq	%rbx
	pushq	$4
	pushq	%r13
	pushq	$0
	pushq	$0
	pushq	$0
	pushq	%r12
	pushq	%rax
	callq	_ata_do_cmd
	addq	$80, %rsp
	testl	%eax, %eax
	je	LBB0_16
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	%r15, %r12
	testq	%r15, %r15
	movl	$0, %r15d
	jne	LBB0_13
	jmp	LBB0_15
LBB0_20:
	leaq	L_.str.2(%rip), %rdi
	callq	_warnx
	jmp	LBB0_19
LBB0_16:
	movq	%r13, %rdi
	callq	_ata_param_fixup
	movq	8(%r13), %rax
	orq	(%r13), %rax
	je	LBB0_17
## %bb.18:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%r13, (%rax)
	xorl	%r14d, %r14d
	jmp	LBB0_19
LBB0_17:
	leaq	L_.str.3(%rip), %rdi
	callq	_warnx
LBB0_15:
	movq	%r13, %rdi
	callq	_free
	movl	$1, %r14d
	jmp	LBB0_19
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"couldn't get CPI"

	.comm	_PROTO_ATA,8,3                  ## @PROTO_ATA
L_.str.1:                               ## @.str.1
	.asciz	"couldn't get CGD"

	.comm	_ATA_ATA_IDENTIFY,8,3           ## @ATA_ATA_IDENTIFY
	.comm	_ATA_ATAPI_IDENTIFY,8,3         ## @ATA_ATAPI_IDENTIFY
L_.str.2:                               ## @.str.2
	.asciz	"can't calloc memory for identify\n"

	.comm	_CAM_DIR_IN,4,2                 ## @CAM_DIR_IN
	.comm	_AP_PROTO_PIO_IN,4,2            ## @AP_PROTO_PIO_IN
	.comm	_AP_FLAG_BYT_BLOK_BLOCKS,4,2    ## @AP_FLAG_BYT_BLOK_BLOCKS
	.comm	_AP_FLAG_TLEN_SECT_CNT,4,2      ## @AP_FLAG_TLEN_SECT_CNT
	.comm	_MSG_SIMPLE_Q_TAG,4,2           ## @MSG_SIMPLE_Q_TAG
L_.str.3:                               ## @.str.3
	.asciz	"Invalid identify response detected"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ata_do_identify                ; -- Begin function ata_do_identify
	.p2align	2
_ata_do_identify:                       ; @ata_do_identify
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x27, x4
	mov	x20, x3
	mov	x25, x2
	mov	x21, x1
	mov	x22, x0
	add	x1, sp, #56
	bl	_get_cpi
	cbz	x0, LBB0_4
; %bb.1:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
LBB0_2:
	bl	_warnx
	mov	w0, #-1
LBB0_3:
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_4:
	ldr	x8, [sp, #56]
Lloh2:
	adrp	x19, _PROTO_ATA@GOTPAGE
Lloh3:
	ldr	x19, [x19, _PROTO_ATA@GOTPAGEOFF]
	ldr	x9, [x19]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.5:
	add	x1, sp, #48
	mov	x0, x22
	bl	_get_cgd
	cbz	x0, LBB0_8
; %bb.6:
Lloh4:
	adrp	x0, l_.str.1@PAGE
Lloh5:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_2
LBB0_7:
Lloh6:
	adrp	x8, _ATA_ATA_IDENTIFY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ATA_ATA_IDENTIFY@GOTPAGEOFF]
Lloh8:
	ldr	x24, [x8]
Lloh9:
	adrp	x8, _ATA_ATAPI_IDENTIFY@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ATA_ATAPI_IDENTIFY@GOTPAGEOFF]
Lloh11:
	ldr	x26, [x8]
	b	LBB0_9
LBB0_8:
	mov	x26, #0
	ldr	x8, [sp, #48]
Lloh12:
	adrp	x9, _ATA_ATA_IDENTIFY@GOTPAGE
Lloh13:
	ldr	x9, [x9, _ATA_ATA_IDENTIFY@GOTPAGEOFF]
	ldr	x10, [x19]
Lloh14:
	adrp	x11, _ATA_ATAPI_IDENTIFY@GOTPAGE
Lloh15:
	ldr	x11, [x11, _ATA_ATAPI_IDENTIFY@GOTPAGEOFF]
	cmp	x8, x10
	csel	x8, x9, x11, eq
	ldr	x24, [x8]
LBB0_9:
	mov	w0, #1
	mov	w1, #4
	bl	_calloc
	cbz	x0, LBB0_13
; %bb.10:
	mov	x23, x0
	str	x27, [sp, #40]                  ; 8-byte Folded Spill
	mov	w8, #30000
	cmp	w25, #0
	csel	w25, w8, w25, eq
Lloh16:
	adrp	x28, _AP_FLAG_TLEN_SECT_CNT@GOTPAGE
Lloh17:
	ldr	x28, [x28, _AP_FLAG_TLEN_SECT_CNT@GOTPAGEOFF]
Lloh18:
	adrp	x19, _MSG_SIMPLE_Q_TAG@GOTPAGE
Lloh19:
	ldr	x19, [x19, _MSG_SIMPLE_Q_TAG@GOTPAGEOFF]
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	mov	x27, x26
Lloh20:
	adrp	x8, _CAM_DIR_IN@GOTPAGE
Lloh21:
	ldr	x8, [x8, _CAM_DIR_IN@GOTPAGEOFF]
Lloh22:
	ldr	w3, [x8]
Lloh23:
	adrp	x8, _AP_PROTO_PIO_IN@GOTPAGE
Lloh24:
	ldr	x8, [x8, _AP_PROTO_PIO_IN@GOTPAGEOFF]
Lloh25:
	ldr	w4, [x8]
Lloh26:
	adrp	x8, _AP_FLAG_BYT_BLOK_BLOCKS@GOTPAGE
Lloh27:
	ldr	x8, [x8, _AP_FLAG_BYT_BLOK_BLOCKS@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	ldr	w9, [x28]
	orr	w5, w9, w8
	ldr	w6, [x19]
	stp	w25, wzr, [sp, #28]
	mov	w8, #4
	str	w8, [sp, #24]
	str	x23, [sp, #16]
	str	wzr, [sp, #8]
	str	xzr, [sp]
	mov	x0, x22
	mov	x1, x20
	mov	x2, x21
	mov	x7, x24
	bl	_ata_do_cmd
	cbz	w0, LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	x26, #0
	mov	x24, x27
	cbnz	x27, LBB0_11
	b	LBB0_17
LBB0_13:
Lloh29:
	adrp	x0, l_.str.2@PAGE
Lloh30:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_warnx
	mov	w0, #1
	b	LBB0_3
LBB0_14:
	mov	x0, x23
	bl	_ata_param_fixup
	ldp	x8, x9, [x23]
	orr	x8, x9, x8
	cbz	x8, LBB0_16
; %bb.15:
	mov	w0, #0
	ldr	x8, [sp, #40]                   ; 8-byte Folded Reload
	str	x23, [x8]
	b	LBB0_3
LBB0_16:
Lloh31:
	adrp	x0, l_.str.3@PAGE
Lloh32:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_warnx
LBB0_17:
	mov	x0, x23
	bl	_free
	mov	w0, #1
	b	LBB0_3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"couldn't get CPI"

	.comm	_PROTO_ATA,8,3                  ; @PROTO_ATA
l_.str.1:                               ; @.str.1
	.asciz	"couldn't get CGD"

	.comm	_ATA_ATA_IDENTIFY,8,3           ; @ATA_ATA_IDENTIFY
	.comm	_ATA_ATAPI_IDENTIFY,8,3         ; @ATA_ATAPI_IDENTIFY
l_.str.2:                               ; @.str.2
	.asciz	"can't calloc memory for identify\n"

	.comm	_CAM_DIR_IN,4,2                 ; @CAM_DIR_IN
	.comm	_AP_PROTO_PIO_IN,4,2            ; @AP_PROTO_PIO_IN
	.comm	_AP_FLAG_BYT_BLOK_BLOCKS,4,2    ; @AP_FLAG_BYT_BLOK_BLOCKS
	.comm	_AP_FLAG_TLEN_SECT_CNT,4,2      ; @AP_FLAG_TLEN_SECT_CNT
	.comm	_MSG_SIMPLE_Q_TAG,4,2           ; @MSG_SIMPLE_Q_TAG
l_.str.3:                               ; @.str.3
	.asciz	"Invalid identify response detected"

.subsections_via_symbols
