	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtdsplit_parse_brnimage
_mtdsplit_parse_brnimage:               ## @mtdsplit_parse_brnimage
	.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
	cmpq	$0, (%rdi)
	je	LBB0_5
## %bb.1:
	movq	%rsi, %r14
	movq	%rdi, %r15
	xorl	%ebx, %ebx
	movq	_BRNIMAGE_ALIGN_BYTES@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movq	%rbx, %rsi
	xorl	%edx, %edx
	callq	_mtd_check_rootfs_magic
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	addq	(%r12), %rbx
	cmpq	(%r15), %rbx
	jb	LBB0_2
	jmp	LBB0_15
LBB0_4:
	cmpq	(%r15), %rbx
	jae	LBB0_5
## %bb.7:
	movq	_BRNIMAGE_FOOTER_SIZE@GOTPCREL(%rip), %r13
	movq	%rbx, %rsi
	subq	(%r13), %rsi
	leaq	-56(%rbp), %rcx
	leaq	-44(%rbp), %r8
	movq	%r15, %rdi
	movl	$4, %edx
	callq	_mtd_read
	testl	%eax, %eax
	jne	LBB0_15
## %bb.8:
	cmpq	$4, -56(%rbp)
	jne	LBB0_9
## %bb.10:
	movl	-44(%rbp), %edi
	callq	_le32_to_cpu
	movq	%rax, %r12
	movq	_BRNIMAGE_MIN_OVERHEAD@GOTPCREL(%rip), %rax
	movq	%rbx, %rcx
	subq	(%rax), %rcx
	cmpq	%rcx, %r12
	ja	LBB0_5
## %bb.11:
	movq	_BRNIMAGE_MAX_OVERHEAD@GOTPCREL(%rip), %rax
	movq	%rbx, %rcx
	subq	(%rax), %rcx
	cmpq	%rcx, %r12
	jae	LBB0_12
LBB0_5:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_6:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_15:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	_EIO@GOTPCREL(%rip), %rcx
	jmp	LBB0_6
LBB0_12:
	movq	(%r15), %r15
	movq	(%r13), %r13
	movq	_BRNIMAGE_NR_PARTS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shll	$3, %eax
	leal	(%rax,%rax,2), %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_13
## %bb.14:
	addq	%rbx, %r13
	subq	%r13, %r15
	movq	_KERNEL_PART_NAME@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 16(%rax)
	movq	$0, (%rax)
	movq	%r12, 8(%rax)
	movq	_ROOTFS_PART_NAME@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 40(%rax)
	movq	%rbx, 24(%rax)
	movq	%r15, 32(%rax)
	movq	%rax, (%r14)
	movq	_BRNIMAGE_NR_PARTS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_15
LBB0_13:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	jmp	LBB0_6
	.cfi_endproc
                                        ## -- End function
	.comm	_BRNIMAGE_ALIGN_BYTES,8,3       ## @BRNIMAGE_ALIGN_BYTES
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_BRNIMAGE_FOOTER_SIZE,8,3       ## @BRNIMAGE_FOOTER_SIZE
	.comm	_EIO,4,2                        ## @EIO
	.comm	_BRNIMAGE_MIN_OVERHEAD,8,3      ## @BRNIMAGE_MIN_OVERHEAD
	.comm	_BRNIMAGE_MAX_OVERHEAD,8,3      ## @BRNIMAGE_MAX_OVERHEAD
	.comm	_BRNIMAGE_NR_PARTS,4,2          ## @BRNIMAGE_NR_PARTS
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_KERNEL_PART_NAME,4,2           ## @KERNEL_PART_NAME
	.comm	_ROOTFS_PART_NAME,4,2           ## @ROOTFS_PART_NAME
	.no_dead_strip	_mtdsplit_parse_brnimage
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtdsplit_parse_brnimage
_mtdsplit_parse_brnimage:               ; @mtdsplit_parse_brnimage
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	ldr	x8, [x0]
	cbz	x8, LBB0_9
; %bb.1:
	mov	x19, x1
	mov	x21, x0
	mov	x20, #0
Lloh0:
	adrp	x22, _BRNIMAGE_ALIGN_BYTES@GOTPAGE
Lloh1:
	ldr	x22, [x22, _BRNIMAGE_ALIGN_BYTES@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	mov	x1, x20
	mov	x2, #0
	bl	_mtd_check_rootfs_magic
	cbz	w0, LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [x22]
	ldr	x9, [x21]
	add	x20, x8, x20
	cmp	x20, x9
	b.lo	LBB0_2
	b	LBB0_11
LBB0_4:
	ldr	x8, [x21]
	cmp	x20, x8
	b.hs	LBB0_9
; %bb.5:
Lloh2:
	adrp	x23, _BRNIMAGE_FOOTER_SIZE@GOTPAGE
Lloh3:
	ldr	x23, [x23, _BRNIMAGE_FOOTER_SIZE@GOTPAGEOFF]
	ldr	x8, [x23]
	sub	x1, x20, x8
	mov	x3, sp
	add	x4, sp, #12
	mov	x0, x21
	mov	w2, #4
	bl	_mtd_read
	cbnz	w0, LBB0_11
; %bb.6:
	ldr	x8, [sp]
	cmp	x8, #4
	b.ne	LBB0_12
; %bb.7:
	ldr	w0, [sp, #12]
	bl	_le32_to_cpu
Lloh4:
	adrp	x8, _BRNIMAGE_MIN_OVERHEAD@GOTPAGE
Lloh5:
	ldr	x8, [x8, _BRNIMAGE_MIN_OVERHEAD@GOTPAGEOFF]
Lloh6:
	ldr	x8, [x8]
	sub	x8, x20, x8
	cmp	x0, x8
	b.hi	LBB0_9
; %bb.8:
	mov	x22, x0
Lloh7:
	adrp	x8, _BRNIMAGE_MAX_OVERHEAD@GOTPAGE
Lloh8:
	ldr	x8, [x8, _BRNIMAGE_MAX_OVERHEAD@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
	sub	x8, x20, x8
	cmp	x0, x8
	b.hs	LBB0_13
LBB0_9:
Lloh10:
	adrp	x8, _EINVAL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_10:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_11:
	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
	add	sp, sp, #80
	ret
LBB0_12:
Lloh12:
	adrp	x8, _EIO@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_10
LBB0_13:
	ldr	x24, [x21]
	ldr	x23, [x23]
Lloh14:
	adrp	x21, _BRNIMAGE_NR_PARTS@GOTPAGE
Lloh15:
	ldr	x21, [x21, _BRNIMAGE_NR_PARTS@GOTPAGEOFF]
	ldr	w8, [x21]
	add	w8, w8, w8, lsl #1
	lsl	w0, w8, #3
Lloh16:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh17:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	bl	_kzalloc
	cbz	x0, LBB0_15
; %bb.14:
	add	x8, x20, x23
	sub	x8, x24, x8
Lloh19:
	adrp	x9, _KERNEL_PART_NAME@GOTPAGE
Lloh20:
	ldr	x9, [x9, _KERNEL_PART_NAME@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	str	w9, [x0, #16]
	stp	xzr, x22, [x0]
Lloh22:
	adrp	x9, _ROOTFS_PART_NAME@GOTPAGE
Lloh23:
	ldr	x9, [x9, _ROOTFS_PART_NAME@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	str	w9, [x0, #40]
	stp	x20, x8, [x0, #24]
	str	x0, [x19]
	ldr	w0, [x21]
	b	LBB0_11
LBB0_15:
Lloh25:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_10
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_BRNIMAGE_ALIGN_BYTES,8,3       ; @BRNIMAGE_ALIGN_BYTES
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_BRNIMAGE_FOOTER_SIZE,8,3       ; @BRNIMAGE_FOOTER_SIZE
	.comm	_EIO,4,2                        ; @EIO
	.comm	_BRNIMAGE_MIN_OVERHEAD,8,3      ; @BRNIMAGE_MIN_OVERHEAD
	.comm	_BRNIMAGE_MAX_OVERHEAD,8,3      ; @BRNIMAGE_MAX_OVERHEAD
	.comm	_BRNIMAGE_NR_PARTS,4,2          ; @BRNIMAGE_NR_PARTS
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_KERNEL_PART_NAME,4,2           ; @KERNEL_PART_NAME
	.comm	_ROOTFS_PART_NAME,4,2           ; @ROOTFS_PART_NAME
	.no_dead_strip	_mtdsplit_parse_brnimage
.subsections_via_symbols
