	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function remove_spare
_remove_spare:                          ## @remove_spare
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpl	$2, %edi
	jne	LBB0_6
## %bb.1:
	movq	%rsi, %r15
	movq	_mpt_unit@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_mpt_open
	testl	%eax, %eax
	js	LBB0_8
## %bb.2:
	movl	%eax, %r14d
	movl	%eax, %edi
	callq	_mpt_pd_list
	testq	%rax, %rax
	je	LBB0_9
## %bb.3:
	movq	%rax, %r12
	movq	8(%r15), %rsi
	leaq	-36(%rbp), %rdx
	movq	%rax, %rdi
	callq	_mpt_lookup_drive
	testl	%eax, %eax
	je	LBB0_12
## %bb.4:
	movl	%eax, %ebx
	movq	8(%r15), %rsi
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_warn
LBB0_5:
	movl	%r14d, %edi
	callq	_close
	jmp	LBB0_11
LBB0_6:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_warnx
LBB0_7:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_10:
	movl	(%rax), %ebx
	jmp	LBB0_11
LBB0_8:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_warn
LBB0_11:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movl	%r14d, %edi
	callq	_close
	movq	_errno@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_12:
	movq	%r12, %rdi
	callq	_mpt_free_pd_list
	movl	-36(%rbp), %esi
	movl	%r14d, %edi
	xorl	%edx, %edx
	callq	_mpt_pd_info
	testq	%rax, %rax
	je	LBB0_16
## %bb.13:
	movq	%rax, %r15
	cmpq	$0, 8(%rax)
	movl	-36(%rbp), %esi
	je	LBB0_17
## %bb.14:
	movl	%r14d, %edi
	callq	_mpt_delete_physdisk
	testq	%rax, %rax
	js	LBB0_18
## %bb.15:
	movl	(%r15), %esi
	movl	4(%r15), %edi
	callq	_mpt_rescan_bus
	movq	%r15, %rdi
	callq	_free
	movl	%r14d, %edi
	callq	_close
	xorl	%ebx, %ebx
	jmp	LBB0_11
LBB0_16:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_warn
	jmp	LBB0_5
LBB0_17:
	leaq	L_.str.4(%rip), %rdi
	xorl	%eax, %eax
	callq	_warnx
	movq	%r15, %rdi
	callq	_free
	movl	%r14d, %edi
	callq	_close
	jmp	LBB0_7
LBB0_18:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	leaq	L_.str.5(%rip), %rdi
	xorl	%eax, %eax
	callq	_warn
	movq	%r15, %rdi
	callq	_free
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"remove spare: drive required"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_mpt_unit,4,2                   ## @mpt_unit
	.comm	_errno,4,2                      ## @errno
L_.str.1:                               ## @.str.1
	.asciz	"mpt_open"

L_.str.2:                               ## @.str.2
	.asciz	"Failed to find drive %s"

L_.str.3:                               ## @.str.3
	.asciz	"Failed to fetch drive info"

L_.str.4:                               ## @.str.4
	.asciz	"Drive %u is not a hot spare"

L_.str.5:                               ## @.str.5
	.asciz	"Failed to delete physical disk page"

	.no_dead_strip	_remove_spare
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function remove_spare
_remove_spare:                          ; @remove_spare
	.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
	cmp	w0, #2
	b.ne	LBB0_7
; %bb.1:
	mov	x21, x1
Lloh0:
	adrp	x8, _mpt_unit@GOTPAGE
Lloh1:
	ldr	x8, [x8, _mpt_unit@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_mpt_open
	tbnz	w0, #31, LBB0_10
; %bb.2:
	mov	x19, x0
	bl	_mpt_pd_list
	cbz	x0, LBB0_12
; %bb.3:
	mov	x22, x0
	ldr	x1, [x21, #8]
	add	x2, sp, #12
	bl	_mpt_lookup_drive
	cbz	w0, LBB0_13
; %bb.4:
	mov	x20, x0
	ldr	x8, [x21, #8]
	str	x8, [sp]
Lloh3:
	adrp	x0, l_.str.2@PAGE
Lloh4:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_5:
	bl	_warn
LBB0_6:
	mov	x0, x19
	bl	_close
	b	LBB0_11
LBB0_7:
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_warnx
LBB0_8:
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_9:
	ldr	w20, [x8]
	b	LBB0_11
LBB0_10:
Lloh9:
	adrp	x8, _errno@GOTPAGE
Lloh10:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh11:
	ldr	w20, [x8]
Lloh12:
	adrp	x0, l_.str.1@PAGE
Lloh13:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_warn
LBB0_11:
	mov	x0, x20
	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
LBB0_12:
	mov	x0, x19
	bl	_close
Lloh14:
	adrp	x8, _errno@GOTPAGE
Lloh15:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
	b	LBB0_9
LBB0_13:
	mov	x0, x22
	bl	_mpt_free_pd_list
	ldr	w1, [sp, #12]
	mov	x0, x19
	mov	x2, #0
	bl	_mpt_pd_info
	cbz	x0, LBB0_17
; %bb.14:
	mov	x21, x0
	ldr	x8, [x0, #8]
	ldr	w1, [sp, #12]
	cbz	x8, LBB0_18
; %bb.15:
	mov	x0, x19
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_mpt_delete_physdisk
	tbnz	x0, #63, LBB0_19
; %bb.16:
	ldp	w1, w0, [x21]
	bl	_mpt_rescan_bus
	mov	x0, x21
	bl	_free
	mov	x0, x19
	bl	_close
	mov	w20, #0
	b	LBB0_11
LBB0_17:
Lloh16:
	adrp	x8, _errno@GOTPAGE
Lloh17:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh18:
	ldr	w20, [x8]
Lloh19:
	adrp	x0, l_.str.3@PAGE
Lloh20:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_5
LBB0_18:
	str	x1, [sp]
Lloh21:
	adrp	x0, l_.str.4@PAGE
Lloh22:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_warnx
	mov	x0, x21
	bl	_free
	mov	x0, x19
	bl	_close
	b	LBB0_8
LBB0_19:
Lloh23:
	adrp	x8, _errno@GOTPAGE
Lloh24:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh25:
	ldr	w20, [x8]
Lloh26:
	adrp	x0, l_.str.5@PAGE
Lloh27:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_warn
	mov	x0, x21
	bl	_free
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"remove spare: drive required"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_mpt_unit,4,2                   ; @mpt_unit
	.comm	_errno,4,2                      ; @errno
l_.str.1:                               ; @.str.1
	.asciz	"mpt_open"

l_.str.2:                               ; @.str.2
	.asciz	"Failed to find drive %s"

l_.str.3:                               ; @.str.3
	.asciz	"Failed to fetch drive info"

l_.str.4:                               ; @.str.4
	.asciz	"Drive %u is not a hot spare"

l_.str.5:                               ; @.str.5
	.asciz	"Failed to delete physical disk page"

	.no_dead_strip	_remove_spare
.subsections_via_symbols
