	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mtd_add_partition              ## -- Begin function mtd_add_partition
	.p2align	4, 0x90
_mtd_add_partition:                     ## @mtd_add_partition
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_MTDPART_OFS_APPEND@GOTPCREL(%rip), %rax
	cmpq	%rdx, (%rax)
	je	LBB0_2
## %bb.1:
	movq	%rdx, %rbx
	movq	_MTDPART_OFS_NXTBLK@GOTPCREL(%rip), %rax
	cmpq	%rdx, (%rax)
	je	LBB0_2
## %bb.3:
	movq	%rcx, %r15
	movq	%rsi, %r12
	movq	%rdi, %r14
	movq	_MTDPART_SIZ_FULL@GOTPCREL(%rip), %rax
	cmpq	%rcx, (%rax)
	jne	LBB0_5
## %bb.4:
	movq	(%r14), %r15
	subq	%rbx, %r15
LBB0_5:
	testq	%r15, %r15
	jle	LBB0_2
## %bb.6:
	leaq	-64(%rbp), %r13
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	$24, %edx
	callq	_memset
	movq	%r12, -64(%rbp)
	movq	%r15, -56(%rbp)
	movq	%rbx, -48(%rbp)
	movq	%r14, %rdi
	movq	%r13, %rsi
	movl	$-1, %edx
	movq	%rbx, %rcx
	callq	_allocate_partition
	movq	%rax, %r14
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	movq	%r14, %rdi
	callq	_PTR_ERR
	movl	%eax, %ebx
	jmp	LBB0_11
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_11:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	_mtd_partitions_mutex@GOTPCREL(%rip), %rbx
	movq	%rbx, %rdi
	callq	_mutex_lock
	movq	_mtd_partitions@GOTPCREL(%rip), %rsi
	movq	%r14, %rdi
	callq	_list_add
	movq	%rbx, %rdi
	callq	_mutex_unlock
	movq	%r14, %rdi
	addq	$4, %rdi
	callq	_add_mtd_device
	testl	%eax, %eax
	je	LBB0_9
## %bb.10:
	movl	%eax, %ebx
	movq	_mtd_partitions_mutex@GOTPCREL(%rip), %r15
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	%r14, %rdi
	callq	_list_del
	movq	%r15, %rdi
	callq	_mutex_unlock
	movq	%r14, %rdi
	callq	_free_partition
	jmp	LBB0_11
LBB0_9:
	movq	%r14, %rdi
	callq	_mtd_add_partition_attrs
	xorl	%ebx, %ebx
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_MTDPART_OFS_APPEND,8,3         ## @MTDPART_OFS_APPEND
	.comm	_MTDPART_OFS_NXTBLK,8,3         ## @MTDPART_OFS_NXTBLK
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MTDPART_SIZ_FULL,8,3           ## @MTDPART_SIZ_FULL
	.comm	_mtd_partitions_mutex,4,2       ## @mtd_partitions_mutex
	.comm	_mtd_partitions,4,2             ## @mtd_partitions
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mtd_add_partition              ; -- Begin function mtd_add_partition
	.p2align	2
_mtd_add_partition:                     ; @mtd_add_partition
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
Lloh0:
	adrp	x8, _MTDPART_OFS_APPEND@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MTDPART_OFS_APPEND@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x9, _MTDPART_OFS_NXTBLK@GOTPAGE
Lloh4:
	ldr	x9, [x9, _MTDPART_OFS_NXTBLK@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x2
	ccmp	x9, x2, #4, ne
	b.eq	LBB0_6
; %bb.1:
	mov	x21, x3
	mov	x19, x2
	mov	x22, x1
	mov	x20, x0
Lloh6:
	adrp	x8, _MTDPART_SIZ_FULL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MTDPART_SIZ_FULL@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	cmp	x8, x3
	b.ne	LBB0_3
; %bb.2:
	ldr	x8, [x20]
	sub	x21, x8, x19
LBB0_3:
	cmp	x21, #0
	b.le	LBB0_6
; %bb.4:
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #24
	bl	_memset
	stp	x22, x21, [sp, #8]
	str	x19, [sp, #24]
	add	x1, sp, #8
	mov	x0, x20
	mov	w2, #-1
	mov	x3, x19
	bl	_allocate_partition
	mov	x19, x0
	bl	_IS_ERR
	cbz	x0, LBB0_8
; %bb.5:
	mov	x0, x19
	bl	_PTR_ERR
	mov	x20, x0
	b	LBB0_7
LBB0_6:
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_7:
	mov	x0, x20
	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
	add	sp, sp, #80
	ret
LBB0_8:
Lloh12:
	adrp	x20, _mtd_partitions_mutex@GOTPAGE
Lloh13:
	ldr	x20, [x20, _mtd_partitions_mutex@GOTPAGEOFF]
	mov	x0, x20
	bl	_mutex_lock
Lloh14:
	adrp	x1, _mtd_partitions@GOTPAGE
Lloh15:
	ldr	x1, [x1, _mtd_partitions@GOTPAGEOFF]
	mov	x0, x19
	bl	_list_add
	mov	x0, x20
	bl	_mutex_unlock
	add	x0, x19, #4
	bl	_add_mtd_device
	mov	x20, x0
	cbz	w0, LBB0_10
; %bb.9:
Lloh16:
	adrp	x21, _mtd_partitions_mutex@GOTPAGE
Lloh17:
	ldr	x21, [x21, _mtd_partitions_mutex@GOTPAGEOFF]
	mov	x0, x21
	bl	_mutex_lock
	mov	x0, x19
	bl	_list_del
	mov	x0, x21
	bl	_mutex_unlock
	mov	x0, x19
	bl	_free_partition
	b	LBB0_7
LBB0_10:
	mov	x0, x19
	bl	_mtd_add_partition_attrs
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_MTDPART_OFS_APPEND,8,3         ; @MTDPART_OFS_APPEND
	.comm	_MTDPART_OFS_NXTBLK,8,3         ; @MTDPART_OFS_NXTBLK
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MTDPART_SIZ_FULL,8,3           ; @MTDPART_SIZ_FULL
	.comm	_mtd_partitions_mutex,4,2       ; @mtd_partitions_mutex
	.comm	_mtd_partitions,4,2             ; @mtd_partitions
.subsections_via_symbols
