	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pd_identify
_pd_identify:                           ## @pd_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_PD_ID_LEN@GOTPCREL(%rip), %r12
	movl	(%r12), %eax
	incl	%eax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r15
	cmpq	$0, (%r14)
	jne	LBB0_2
## %bb.1:
	movq	%r14, %rdi
	callq	_pd_reset
LBB0_2:
	movq	%r14, %rdi
	callq	_DRIVE
	movq	%r14, %rdi
	movl	$6, %esi
	movl	%eax, %edx
	callq	_write_reg
	leaq	L_.str(%rip), %rdi
	callq	_DBMSG
	movq	%r14, %rdi
	xorl	%esi, %esi
	movl	%eax, %edx
	callq	_pd_wait_for
	movq	_IDE_IDENTIFY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	subq	$8, %rsp
	movq	%r14, %rdi
	movl	$1, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	pushq	%rax
	callq	_pd_send_command
	addq	$16, %rsp
	movq	_STAT_DRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	leaq	L_.str.1(%rip), %rdi
	callq	_DBMSG
	movq	%r14, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_pd_wait_for
	movq	_STAT_ERR@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_4
## %bb.3:
	movq	_Fail@GOTPCREL(%rip), %rbx
	jmp	LBB0_20
LBB0_4:
	movl	40(%r14), %edi
	movq	_pd_scratch@GOTPCREL(%rip), %r13
	movq	(%r13), %rsi
	movl	$512, %edx                      ## imm = 0x200
	callq	_pi_read_block
	movq	(%r13), %rax
	movl	396(%rax), %ecx
	andl	$2, %ecx
	movl	%ecx, 8(%r14)
	movl	48(%rax), %edi
	callq	_le16_to_cpu
	movl	%eax, 12(%r14)
	movq	(%r13), %rax
	movl	24(%rax), %edi
	callq	_le16_to_cpu
	movl	%eax, 16(%r14)
	movq	(%r13), %rax
	movl	8(%rax), %edi
	callq	_le16_to_cpu
	movl	%eax, 20(%r14)
	cmpl	$0, 8(%r14)
	je	LBB0_6
## %bb.5:
	movq	(%r13), %rax
	movl	480(%rax), %edi
	callq	_le32_to_cpu
                                        ## kill: def $eax killed $eax def $rax
	jmp	LBB0_7
LBB0_6:
	imull	12(%r14), %eax
	imull	16(%r14), %eax
LBB0_7:
	movl	%eax, 24(%r14)
	movl	(%r12), %ecx
	testl	%ecx, %ecx
	jle	LBB0_12
## %bb.8:
	movq	(%r13), %r8
	movq	_PD_ID_OFF@GOTPCREL(%rip), %rdx
	movslq	(%rdx), %r9
	cmpl	$1, %ecx
	jne	LBB0_22
## %bb.9:
	xorl	%esi, %esi
	jmp	LBB0_10
LBB0_22:
	movl	%ecx, %r10d
	andl	$-2, %r10d
	leaq	(%r8,%r9,4), %rbx
	addq	$4, %rbx
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_23:                                ## =>This Inner Loop Header: Depth=1
	movzbl	-4(%rbx,%rsi,4), %edx
	movl	%esi, %edi
	andl	$-2, %edi
	movb	%dl, 1(%r15,%rdi)
	movzbl	(%rbx,%rsi,4), %edx
	movb	%dl, (%r15,%rdi)
	addq	$2, %rsi
	cmpq	%rsi, %r10
	jne	LBB0_23
LBB0_10:
	testb	$1, %cl
	je	LBB0_12
## %bb.11:
	addq	%rsi, %r9
	movb	(%r8,%r9,4), %dl
	movl	%esi, %esi
	xorq	$1, %rsi
	movb	%dl, (%r15,%rsi)
LBB0_12:
	movl	%ecx, %edx
	sarl	$31, %edx
	andl	%ecx, %edx
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	testl	%ecx, %ecx
	jle	LBB0_16
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	leaq	-1(%rcx), %rsi
	cmpb	$33, -1(%r15,%rcx)
	movq	%rsi, %rcx
	jl	LBB0_13
## %bb.15:
	incl	%esi
	movl	%esi, %edx
LBB0_16:
	movslq	%edx, %rcx
	movb	$0, (%r15,%rcx)
	movq	(%r13), %rdx
	cmpq	$0, (%r14)
	leaq	L_.str.4(%rip), %rsi
	leaq	L_.str.3(%rip), %rcx
	cmoveq	%rsi, %rcx
	leal	2047(%rax), %r9d
	testl	%eax, %eax
	cmovnsl	%eax, %r9d
	sarl	$11, %r9d
	movl	$128, %esi
	andl	(%rdx), %esi
	movl	%esi, 28(%r14)
	movl	36(%r14), %esi
	movl	20(%r14), %r10d
	movl	12(%r14), %r12d
	movl	16(%r14), %r11d
	leaq	L_.str.6(%rip), %rdx
	leaq	L_.str.5(%rip), %rbx
	cmoveq	%rdx, %rbx
	leaq	L_.str.2(%rip), %rdi
	movq	%r15, %rdx
	movl	%eax, %r8d
	pushq	%rbx
	pushq	%r12
	pushq	%r11
	pushq	%r10
	callq	_printk
	addq	$32, %rsp
	cmpl	$0, 24(%r14)
	je	LBB0_18
## %bb.17:
	movq	%r14, %rdi
	callq	_pd_init_dev_parms
LBB0_18:
	movq	_Ok@GOTPCREL(%rip), %rbx
	cmpl	$0, 32(%r14)
	jne	LBB0_20
## %bb.19:
	movq	%r14, %rdi
	callq	_pd_standby_off
LBB0_20:
	movl	(%rbx), %eax
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_21
## %bb.24:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_21:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_PD_ID_LEN,4,2                  ## @PD_ID_LEN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"before IDENT"

	.comm	_IDE_IDENTIFY,4,2               ## @IDE_IDENTIFY
	.comm	_STAT_DRQ,4,2                   ## @STAT_DRQ
L_.str.1:                               ## @.str.1
	.asciz	"IDENT DRQ"

	.comm	_STAT_ERR,4,2                   ## @STAT_ERR
	.comm	_Fail,4,2                       ## @Fail
	.comm	_pd_scratch,8,3                 ## @pd_scratch
	.comm	_PD_ID_OFF,4,2                  ## @PD_ID_OFF
L_.str.2:                               ## @.str.2
	.asciz	"%s: %s, %s, %d blocks [%dM], (%d/%d/%d), %s media\n"

L_.str.3:                               ## @.str.3
	.asciz	"slave"

L_.str.4:                               ## @.str.4
	.asciz	"master"

L_.str.5:                               ## @.str.5
	.asciz	"removable"

L_.str.6:                               ## @.str.6
	.asciz	"fixed"

	.comm	_Ok,4,2                         ## @Ok
	.no_dead_strip	_pd_identify
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pd_identify
_pd_identify:                           ; @pd_identify
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	sub	sp, sp, #16
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-40]
Lloh3:
	adrp	x22, _PD_ID_LEN@GOTPAGE
Lloh4:
	ldr	x22, [x22, _PD_ID_LEN@GOTPAGEOFF]
	ldr	w8, [x22]
	add	w8, w8, #1
	mov	x9, x8
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x1fffffff0
	sub	x20, x9, x8
	mov	sp, x20
	ldr	x8, [x0]
	cbnz	x8, LBB0_2
; %bb.1:
	mov	x0, x19
	bl	_pd_reset
LBB0_2:
	mov	x0, x19
	bl	_DRIVE
	mov	x2, x0
	mov	x0, x19
	mov	w1, #6
	bl	_write_reg
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DBMSG
	mov	x2, x0
	mov	x0, x19
	mov	w1, #0
	bl	_pd_wait_for
Lloh9:
	adrp	x8, _IDE_IDENTIFY@GOTPAGE
Lloh10:
	ldr	x8, [x8, _IDE_IDENTIFY@GOTPAGEOFF]
Lloh11:
	ldr	w6, [x8]
	mov	x0, x19
	mov	w1, #1
	mov	w2, #0
	mov	w3, #0
	mov	w4, #0
	mov	w5, #0
	bl	_pd_send_command
Lloh12:
	adrp	x8, _STAT_DRQ@GOTPAGE
Lloh13:
	ldr	x8, [x8, _STAT_DRQ@GOTPAGEOFF]
Lloh14:
	ldr	w21, [x8]
Lloh15:
	adrp	x0, l_.str.1@PAGE
Lloh16:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DBMSG
	mov	x2, x0
	mov	x0, x19
	mov	x1, x21
	bl	_pd_wait_for
Lloh17:
	adrp	x8, _STAT_ERR@GOTPAGE
Lloh18:
	ldr	x8, [x8, _STAT_ERR@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_4
; %bb.3:
Lloh20:
	adrp	x8, _Fail@GOTPAGE
Lloh21:
	ldr	x8, [x8, _Fail@GOTPAGEOFF]
	b	LBB0_19
LBB0_4:
	ldr	w0, [x19, #40]
Lloh22:
	adrp	x21, _pd_scratch@GOTPAGE
Lloh23:
	ldr	x21, [x21, _pd_scratch@GOTPAGEOFF]
	ldr	x1, [x21]
	mov	w2, #512
	bl	_pi_read_block
	ldr	x8, [x21]
	ldr	w9, [x8, #396]
	and	w9, w9, #0x2
	str	w9, [x19, #8]
	ldr	w0, [x8, #48]
	bl	_le16_to_cpu
	str	w0, [x19, #12]
	ldr	x8, [x21]
	ldr	w0, [x8, #24]
	bl	_le16_to_cpu
	str	w0, [x19, #16]
	ldr	x8, [x21]
	ldr	w0, [x8, #8]
	bl	_le16_to_cpu
	str	w0, [x19, #20]
	ldr	w8, [x19, #8]
	cbz	w8, LBB0_6
; %bb.5:
	ldr	x8, [x21]
	ldr	w0, [x8, #480]
	bl	_le32_to_cpu
	mov	x4, x0
	b	LBB0_7
LBB0_6:
	ldp	w8, w9, [x19, #12]
	mul	w8, w8, w0
	mul	w4, w8, w9
LBB0_7:
	str	w4, [x19, #24]
	ldr	w8, [x22]
	cmp	w8, #0
	b.le	LBB0_10
; %bb.8:
	mov	x9, #0
	ldr	x10, [x21]
Lloh24:
	adrp	x11, _PD_ID_OFF@GOTPAGE
Lloh25:
	ldr	x11, [x11, _PD_ID_OFF@GOTPAGEOFF]
Lloh26:
	ldrsw	x11, [x11]
	add	x10, x10, x11, lsl #2
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x10, x9, lsl #2]
	eor	x12, x9, #0x1
	strb	w11, [x20, x12]
	add	x9, x9, #1
	cmp	x8, x9
	b.ne	LBB0_9
LBB0_10:
	cmp	w8, #0
	csel	w9, w8, wzr, lt
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	cmp	w8, #1
	b.lt	LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	sub	x10, x8, #1
	add	x8, x20, x8
	ldursb	w11, [x8, #-1]
	mov	x8, x10
	cmp	w11, #33
	b.lt	LBB0_11
; %bb.13:
	add	w9, w10, #1
LBB0_14:
	strb	wzr, [x20, w9, sxtw]
	ldr	x8, [x21]
	ldr	w8, [x8]
Lloh27:
	adrp	x9, l_.str.3@PAGE
Lloh28:
	add	x9, x9, l_.str.3@PAGEOFF
Lloh29:
	adrp	x10, l_.str.4@PAGE
Lloh30:
	add	x10, x10, l_.str.4@PAGEOFF
	ldr	x11, [x19]
	cmp	x11, #0
	csel	x3, x10, x9, eq
	add	w9, w4, #2047
	cmp	w4, #0
	csel	w9, w9, w4, lt
	ands	w8, w8, #0x80
	str	w8, [x19, #28]
	ldr	w1, [x19, #36]
	asr	w5, w9, #11
	ldp	w7, w6, [x19, #16]
	ldr	w8, [x19, #12]
Lloh31:
	adrp	x9, l_.str.5@PAGE
Lloh32:
	add	x9, x9, l_.str.5@PAGEOFF
Lloh33:
	adrp	x10, l_.str.6@PAGE
Lloh34:
	add	x10, x10, l_.str.6@PAGEOFF
	csel	x9, x10, x9, eq
	sub	sp, sp, #16
	str	x9, [sp, #8]
	str	w8, [sp]
Lloh35:
	adrp	x0, l_.str.2@PAGE
Lloh36:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x2, x20
	bl	_printk
	add	sp, sp, #16
	ldr	w8, [x19, #24]
	cbz	w8, LBB0_16
; %bb.15:
	mov	x0, x19
	bl	_pd_init_dev_parms
LBB0_16:
	ldr	w8, [x19, #32]
	cbnz	w8, LBB0_18
; %bb.17:
	mov	x0, x19
	bl	_pd_standby_off
LBB0_18:
Lloh37:
	adrp	x8, _Ok@GOTPAGE
Lloh38:
	ldr	x8, [x8, _Ok@GOTPAGEOFF]
LBB0_19:
	ldr	w0, [x8]
	ldur	x8, [x29, #-40]
Lloh39:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh40:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh41:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_21
; %bb.20:
	sub	sp, x29, #32
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_21:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.cfi_endproc
                                        ; -- End function
	.comm	_PD_ID_LEN,4,2                  ; @PD_ID_LEN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"before IDENT"

	.comm	_IDE_IDENTIFY,4,2               ; @IDE_IDENTIFY
	.comm	_STAT_DRQ,4,2                   ; @STAT_DRQ
l_.str.1:                               ; @.str.1
	.asciz	"IDENT DRQ"

	.comm	_STAT_ERR,4,2                   ; @STAT_ERR
	.comm	_Fail,4,2                       ; @Fail
	.comm	_pd_scratch,8,3                 ; @pd_scratch
	.comm	_PD_ID_OFF,4,2                  ; @PD_ID_OFF
l_.str.2:                               ; @.str.2
	.asciz	"%s: %s, %s, %d blocks [%dM], (%d/%d/%d), %s media\n"

l_.str.3:                               ; @.str.3
	.asciz	"slave"

l_.str.4:                               ; @.str.4
	.asciz	"master"

l_.str.5:                               ; @.str.5
	.asciz	"removable"

l_.str.6:                               ; @.str.6
	.asciz	"fixed"

	.comm	_Ok,4,2                         ; @Ok
	.no_dead_strip	_pd_identify
.subsections_via_symbols
