	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_remove_volume              ## -- Begin function ubi_remove_volume
	.p2align	4, 0x90
_ubi_remove_volume:                     ## @ubi_remove_volume
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, -48(%rbp)                 ## 4-byte Spill
	movq	%rdi, %rbx
	movq	8(%rdi), %r14
	movq	16(%r14), %r15
	movl	(%r14), %r13d
	movl	4(%r14), %r12d
	movl	40(%r15), %esi
	leaq	L_.str(%rip), %rdi
	movl	%r13d, %edx
	callq	_dbg_gen
	movq	(%rbx), %rax
	movq	_UBI_EXCLUSIVE@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	sete	%dil
	callq	_ubi_assert
	movq	24(%r15), %rax
	movslq	%r13d, %rbx
	xorl	%edi, %edi
	cmpq	(%rax,%rbx,8), %r14
	sete	%dil
	callq	_ubi_assert
	cmpq	$0, 32(%r15)
	je	LBB0_2
## %bb.1:
	movq	_EROFS@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_19
LBB0_2:
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movl	%r12d, -52(%rbp)                ## 4-byte Spill
	leaq	20(%r15), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock
	cmpl	$2, 8(%r14)
	jl	LBB0_4
## %bb.3:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_12
LBB0_4:
	movq	24(%r15), %rax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	$0, (%rax,%rcx,8)
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	callq	_spin_unlock
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_5
LBB0_6:
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	cmpl	$0, 4(%r14)
	jle	LBB0_13
## %bb.7:
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	%r13d, %edx
	callq	_ubi_eba_unmap_leb
	testl	%eax, %eax
	jne	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_9 Depth=1
	incl	%r13d
	cmpl	4(%r14), %r13d
	jl	LBB0_9
LBB0_13:
	leaq	12(%r14), %rdi
	callq	_cdev_del
	movq	%r14, %rdi
	callq	_volume_sysfs_close
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_spin_lock
	movl	(%r15), %eax
	movl	8(%r15), %esi
	movl	-52(%rbp), %edx                 ## 4-byte Reload
	subl	%edx, %eax
	movl	%eax, (%r15)
	addl	4(%r15), %edx
	movl	%edx, 4(%r15)
	movl	12(%r15), %ecx
	subl	%ecx, %esi
	jle	LBB0_16
## %bb.14:
	cmpl	%esi, %edx
	cmovll	%edx, %esi
	subl	%esi, %edx
	movl	%edx, 4(%r15)
	addl	%esi, %eax
	movl	%eax, (%r15)
	addl	%esi, %ecx
	movl	%ecx, 12(%r15)
	testl	%esi, %esi
	jle	LBB0_16
## %bb.15:
	leaq	L_.str.1(%rip), %rdi
	callq	_ubi_msg
LBB0_16:
	decl	16(%r15)
	movq	%rbx, %rdi
	callq	_spin_unlock
	movq	_UBI_VOLUME_REMOVED@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_ubi_volume_notify
	xorl	%r12d, %r12d
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	jne	LBB0_19
## %bb.17:
	movq	%r15, %rdi
	callq	_paranoid_check_volumes
	testq	%rax, %rax
	je	LBB0_19
## %bb.18:
	leaq	L_.str.2(%rip), %rdi
	movl	%ebx, %esi
	callq	_dbg_err
	jmp	LBB0_19
LBB0_5:
	movq	%r15, %rdi
	movl	%r13d, %esi
	xorl	%edx, %edx
	callq	_ubi_change_vtbl_record
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_11
	jmp	LBB0_6
LBB0_10:
	movl	%eax, %r12d
	movl	-44(%rbp), %r13d                ## 4-byte Reload
LBB0_11:
	leaq	L_.str.3(%rip), %rdi
	movl	%r13d, %esi
	movl	%r12d, %edx
	callq	_ubi_err
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_spin_lock
	movq	24(%r15), %rax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	%r14, (%rax,%rcx,8)
LBB0_12:
	movq	%rbx, %rdi
	callq	_spin_unlock
LBB0_19:
	movl	%r12d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"remove device %d, volume %d"

	.comm	_UBI_EXCLUSIVE,8,3              ## @UBI_EXCLUSIVE
	.comm	_EROFS,4,2                      ## @EROFS
	.comm	_EBUSY,4,2                      ## @EBUSY
L_.str.1:                               ## @.str.1
	.asciz	"reserve more %d PEBs"

	.comm	_UBI_VOLUME_REMOVED,4,2         ## @UBI_VOLUME_REMOVED
L_.str.2:                               ## @.str.2
	.asciz	"check failed while removing volume %d"

L_.str.3:                               ## @.str.3
	.asciz	"cannot remove volume %d, error %d"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_remove_volume              ; -- Begin function ubi_remove_volume
	.p2align	2
_ubi_remove_volume:                     ; @ubi_remove_volume
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x21, x1
	mov	x22, x0
	ldr	x20, [x0, #8]
	ldr	x19, [x20, #16]
	ldp	w23, w26, [x20]
	ldr	w1, [x19, #40]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x2, x23
	bl	_dbg_gen
	ldr	x8, [x22]
Lloh2:
	adrp	x9, _UBI_EXCLUSIVE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _UBI_EXCLUSIVE@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, eq
	bl	_ubi_assert
	ldr	x8, [x19, #24]
	ldr	x8, [x8, w23, sxtw #3]
	cmp	x20, x8
	cset	w0, eq
	bl	_ubi_assert
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_2
; %bb.1:
Lloh5:
	adrp	x8, _EROFS@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EROFS@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_20
LBB0_2:
	add	x22, x19, #20
	mov	x0, x22
	bl	_spin_lock
	ldr	w8, [x20, #8]
	cmp	w8, #2
	b.lt	LBB0_4
; %bb.3:
Lloh8:
	adrp	x8, _EBUSY@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_19
LBB0_4:
	sxtw	x23, w23
	ldr	x8, [x19, #24]
	str	xzr, [x8, x23, lsl #3]
	mov	x0, x22
	bl	_spin_unlock
	cbz	w21, LBB0_16
LBB0_5:
	ldr	w8, [x20, #4]
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.6:
	mov	w25, #0
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x20
	mov	x2, x25
	bl	_ubi_eba_unmap_leb
	cbnz	w0, LBB0_17
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	add	w25, w25, #1
	ldr	w8, [x20, #4]
	cmp	w25, w8
	b.lt	LBB0_7
LBB0_9:
	add	x0, x20, #12
	bl	_cdev_del
	mov	x0, x20
	bl	_volume_sysfs_close
	mov	x0, x22
	bl	_spin_lock
	ldp	w8, w9, [x19]
	sub	w8, w8, w26
	add	w10, w9, w26
	stp	w8, w10, [x19]
	ldp	w11, w9, [x19, #8]
	sub	w11, w11, w9
	cmp	w11, #1
	b.lt	LBB0_12
; %bb.10:
	cmp	w10, w11
	csel	w1, w10, w11, lt
	sub	w10, w10, w1
	add	w8, w1, w8
	stp	w8, w10, [x19]
	add	w8, w1, w9
	str	w8, [x19, #12]
	cmp	w1, #1
	b.lt	LBB0_12
; %bb.11:
Lloh11:
	adrp	x0, l_.str.1@PAGE
Lloh12:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_ubi_msg
LBB0_12:
	ldr	w8, [x19, #16]
	sub	w8, w8, #1
	str	w8, [x19, #16]
	mov	x0, x22
	bl	_spin_unlock
Lloh13:
	adrp	x8, _UBI_VOLUME_REMOVED@GOTPAGE
Lloh14:
	ldr	x8, [x8, _UBI_VOLUME_REMOVED@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x20
	bl	_ubi_volume_notify
	cbnz	w21, LBB0_15
; %bb.13:
	mov	x0, x19
	bl	_paranoid_check_volumes
	cbz	x0, LBB0_15
; %bb.14:
Lloh16:
	adrp	x0, l_.str.2@PAGE
Lloh17:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x23
	bl	_dbg_err
LBB0_15:
	mov	w24, #0
	b	LBB0_20
LBB0_16:
	mov	x0, x19
	mov	x1, x23
	mov	x2, #0
	bl	_ubi_change_vtbl_record
	mov	x24, x0
	cbnz	w0, LBB0_18
	b	LBB0_5
LBB0_17:
	mov	x24, x0
LBB0_18:
Lloh18:
	adrp	x0, l_.str.3@PAGE
Lloh19:
	add	x0, x0, l_.str.3@PAGEOFF
	mov	x1, x23
	mov	x2, x24
	bl	_ubi_err
	mov	x0, x22
	bl	_spin_lock
	ldr	x8, [x19, #24]
	str	x20, [x8, x23, lsl #3]
LBB0_19:
	mov	x0, x22
	bl	_spin_unlock
LBB0_20:
	mov	x0, x24
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"remove device %d, volume %d"

	.comm	_UBI_EXCLUSIVE,8,3              ; @UBI_EXCLUSIVE
	.comm	_EROFS,4,2                      ; @EROFS
	.comm	_EBUSY,4,2                      ; @EBUSY
l_.str.1:                               ; @.str.1
	.asciz	"reserve more %d PEBs"

	.comm	_UBI_VOLUME_REMOVED,4,2         ; @UBI_VOLUME_REMOVED
l_.str.2:                               ; @.str.2
	.asciz	"check failed while removing volume %d"

l_.str.3:                               ; @.str.3
	.asciz	"cannot remove volume %d, error %d"

.subsections_via_symbols
