	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function reset_controller
_reset_controller:                      ## @reset_controller
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	_HD_CMD@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movl	$4, %edi
	callq	_outb_p
	movl	$1000, %ebx                     ## imm = 0x3E8
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_barrier
	decl	%ebx
	jne	LBB0_1
## %bb.2:
	movq	_hd_info@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %edi
	andl	$15, %edi
	movl	(%r14), %esi
	callq	_outb_p
	movl	$1000, %ebx                     ## imm = 0x3E8
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_barrier
	decl	%ebx
	jne	LBB0_3
## %bb.4:
	xorl	%eax, %eax
	callq	_drive_busy
	testq	%rax, %rax
	je	LBB0_5
## %bb.7:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_printk                         ## TAILCALL
LBB0_5:
	movq	_HD_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_inb
	movq	_hd_error@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	cmpl	$1, %eax
	jne	LBB0_8
## %bb.6:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_8:
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_printk                         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_HD_CMD,4,2                     ## @HD_CMD
	.comm	_hd_info,8,3                    ## @hd_info
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"hd: controller still busy\n"

	.comm	_HD_ERROR,4,2                   ## @HD_ERROR
	.comm	_hd_error,4,2                   ## @hd_error
L_.str.1:                               ## @.str.1
	.asciz	"hd: controller reset failed: %02x\n"

	.no_dead_strip	_reset_controller
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function reset_controller
_reset_controller:                      ; @reset_controller
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
Lloh0:
	adrp	x19, _HD_CMD@GOTPAGE
Lloh1:
	ldr	x19, [x19, _HD_CMD@GOTPAGEOFF]
	ldr	w1, [x19]
	mov	w0, #4
	bl	_outb_p
	mov	w20, #1000
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	bl	_barrier
	subs	w20, w20, #1
	b.ne	LBB0_1
; %bb.2:
Lloh2:
	adrp	x8, _hd_info@GOTPAGE
Lloh3:
	ldr	x8, [x8, _hd_info@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	ldr	w8, [x8]
	and	w0, w8, #0xf
	ldr	w1, [x19]
	bl	_outb_p
	mov	w19, #1000
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	bl	_barrier
	subs	w19, w19, #1
	b.ne	LBB0_3
; %bb.4:
	bl	_drive_busy
	cbz	x0, LBB0_6
; %bb.5:
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	b	_printk
LBB0_6:
Lloh7:
	adrp	x8, _HD_ERROR@GOTPAGE
Lloh8:
	ldr	x8, [x8, _HD_ERROR@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
	bl	_inb
                                        ; kill: def $w0 killed $w0 def $x0
Lloh10:
	adrp	x8, _hd_error@GOTPAGE
Lloh11:
	ldr	x8, [x8, _hd_error@GOTPAGEOFF]
Lloh12:
	str	w0, [x8]
	cmp	w0, #1
	b.eq	LBB0_8
; %bb.7:
	str	x0, [sp]
Lloh13:
	adrp	x0, l_.str.1@PAGE
Lloh14:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_printk
LBB0_8:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotStr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_HD_CMD,4,2                     ; @HD_CMD
	.comm	_hd_info,8,3                    ; @hd_info
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"hd: controller still busy\n"

	.comm	_HD_ERROR,4,2                   ; @HD_ERROR
	.comm	_hd_error,4,2                   ; @hd_error
l_.str.1:                               ; @.str.1
	.asciz	"hd: controller reset failed: %02x\n"

	.no_dead_strip	_reset_controller
.subsections_via_symbols
