	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_eba_write_leb              ## -- Begin function ubi_eba_write_leb
	.p2align	4, 0x90
_ubi_eba_write_leb:                     ## @ubi_eba_write_leb
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpq	$0, 8(%rdi)
	je	LBB0_3
## %bb.1:
	movq	_EROFS@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_26
LBB0_3:
	movl	%edx, %r14d
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movl	%r9d, -52(%rbp)                 ## 4-byte Spill
	movq	%rcx, -72(%rbp)                 ## 8-byte Spill
	movl	%r8d, -56(%rbp)                 ## 4-byte Spill
	movl	(%rsi), %r15d
	movl	%r15d, %esi
	callq	_leb_write_lock
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_26
## %bb.4:
	movq	8(%r12), %rax
	movq	(%rax), %rax
	movslq	%r14d, %rcx
	movl	(%rax,%rcx,4), %eax
	movl	%eax, -44(%rbp)
	testl	%eax, %eax
	js	LBB0_11
## %bb.5:
	leaq	-44(%rbp), %rcx
	movq	%rbx, %rdi
	movq	%r12, %rsi
	movl	%r14d, %edx
	callq	_check_mapping
	movl	%eax, %r13d
	testl	%eax, %eax
	js	LBB0_24
## %bb.6:
	movl	-44(%rbp), %r9d
	testl	%r9d, %r9d
	js	LBB0_12
## %bb.7:
	leaq	L_.str(%rip), %rdi
	movl	-52(%rbp), %r13d                ## 4-byte Reload
	movl	%r13d, %esi
	movl	-56(%rbp), %r12d                ## 4-byte Reload
	movl	%r12d, %edx
	movl	%r15d, %ecx
	movl	%r14d, %r8d
	callq	_dbg_eba
	movl	-44(%rbp), %edx
	movq	%rbx, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	movl	%r12d, %ecx
	movl	%r13d, %r8d
	callq	_ubi_io_write_data
	testl	%eax, %eax
	je	LBB0_19
## %bb.8:
	movl	%eax, %r13d
	movl	-44(%rbp), %edx
	leaq	L_.str.1(%rip), %rsi
	movq	%rbx, %rdi
	callq	_ubi_warn
	movq	_EIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r13d, %eax
	jne	LBB0_24
## %bb.9:
	cmpq	$0, (%rbx)
	je	LBB0_24
## %bb.10:
	movl	-44(%rbp), %esi
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, (%rsp)
	movq	%rbx, %rdi
	movl	%r15d, %edx
	movl	%r14d, %ecx
	movq	-72(%rbp), %r8                  ## 8-byte Reload
	movl	-56(%rbp), %r9d                 ## 4-byte Reload
	callq	_recover_peb
	movl	%eax, %r13d
	jmp	LBB0_23
LBB0_11:
	xorl	%r13d, %r13d
LBB0_12:
	movq	_GFP_NOFS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_ubi_alloc_vid_buf
	testq	%rax, %rax
	je	LBB0_18
## %bb.13:
	movq	%rax, %rdi
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	callq	_ubi_get_vid_hdr
	movl	%r15d, -48(%rbp)                ## 4-byte Spill
	movq	%rax, %r15
	movq	_UBI_VID_DYNAMIC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 40(%r15)
	movq	%rbx, %rdi
	callq	_ubi_next_sqnum
	movl	%eax, %edi
	callq	_cpu_to_be64
	movq	%rax, (%r15)
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	callq	_cpu_to_be32
	movq	%rax, 32(%r15)
	movl	%r14d, %edi
	callq	_cpu_to_be32
	movq	%rax, 24(%r15)
	movq	%rbx, %rdi
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	callq	_ubi_get_compat
	movl	%eax, 16(%r15)
	movl	4(%r12), %edi
	callq	_cpu_to_be32
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	movq	%rax, 8(%r15)
	movq	_UBI_IO_RETRIES@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	js	LBB0_22
## %bb.14:
	movl	$-1, %r15d
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	movl	%r14d, %esi
	movq	%rcx, %rdx
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movl	-56(%rbp), %r8d                 ## 4-byte Reload
	movl	-52(%rbp), %r9d                 ## 4-byte Reload
	callq	_try_write_vid_and_data
	movl	%eax, %r13d
	movq	_EIO@GOTPCREL(%rip), %rcx
	addl	(%rcx), %eax
	jne	LBB0_21
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	cmpq	$0, (%rbx)
	je	LBB0_21
## %bb.17:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	%rbx, %rdi
	callq	_ubi_next_sqnum
	movl	%eax, %edi
	callq	_cpu_to_be64
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx)
	movq	%rbx, %rdi
	leaq	L_.str.2(%rip), %rsi
	callq	_ubi_msg
	incl	%r15d
	movq	_UBI_IO_RETRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	jl	LBB0_15
	jmp	LBB0_22
LBB0_18:
	movq	%rbx, %rdi
	movl	%r15d, %esi
	movl	%r14d, %edx
	callq	_leb_write_unlock
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_21:
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
LBB0_22:
	movq	%rcx, %rdi
	callq	_ubi_free_vid_buf
	movl	-48(%rbp), %r15d                ## 4-byte Reload
LBB0_23:
	testl	%r13d, %r13d
	je	LBB0_19
LBB0_24:
	movq	%rbx, %rdi
	callq	_ubi_ro_mode
	jmp	LBB0_25
LBB0_19:
	xorl	%r13d, %r13d
LBB0_25:
	movq	%rbx, %rdi
	movl	%r15d, %esi
	movl	%r14d, %edx
	callq	_leb_write_unlock
LBB0_26:
	movl	%r13d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EROFS,4,2                      ## @EROFS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"write %d bytes at offset %d of LEB %d:%d, PEB %d"

L_.str.1:                               ## @.str.1
	.asciz	"failed to write data to PEB %d"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_GFP_NOFS,4,2                   ## @GFP_NOFS
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_UBI_VID_DYNAMIC,4,2            ## @UBI_VID_DYNAMIC
	.comm	_UBI_IO_RETRIES,4,2             ## @UBI_IO_RETRIES
L_.str.2:                               ## @.str.2
	.asciz	"try another PEB"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_eba_write_leb              ; -- Begin function ubi_eba_write_leb
	.p2align	2
_ubi_eba_write_leb:                     ; @ubi_eba_write_leb
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_3
; %bb.1:
Lloh0:
	adrp	x8, _EROFS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EROFS@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w25, w8
	b	LBB0_22
LBB0_3:
	mov	x22, x5
	mov	x23, x4
	mov	x24, x3
	mov	x19, x2
	mov	x26, x1
	mov	x20, x0
	ldr	w21, [x1]
	mov	x1, x21
	bl	_leb_write_lock
	mov	x25, x0
	cbnz	w0, LBB0_22
; %bb.4:
	ldr	x8, [x26, #8]
	ldr	x8, [x8]
	ldr	w8, [x8, w19, sxtw #2]
	str	w8, [sp, #12]
	tbnz	w8, #31, LBB0_11
; %bb.5:
	add	x3, sp, #12
	mov	x0, x20
	mov	x1, x26
	mov	x2, x19
	bl	_check_mapping
	mov	x25, x0
	tbnz	w0, #31, LBB0_20
; %bb.6:
	ldr	w5, [sp, #12]
	tbnz	w5, #31, LBB0_12
; %bb.7:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x22
	mov	x2, x23
	mov	x3, x21
	mov	x4, x19
	bl	_dbg_eba
	ldr	w2, [sp, #12]
	mov	x0, x20
	mov	x1, x24
	mov	x3, x23
	mov	x4, x22
	bl	_ubi_io_write_data
	mov	x25, x0
	cbz	w0, LBB0_21
; %bb.8:
	ldr	w2, [sp, #12]
Lloh4:
	adrp	x1, l_.str.1@PAGE
Lloh5:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_ubi_warn
Lloh6:
	adrp	x8, _EIO@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cmn	w25, w8
	b.ne	LBB0_20
; %bb.9:
	ldr	x8, [x20]
	cbz	x8, LBB0_20
; %bb.10:
	ldr	w1, [sp, #12]
	mov	x0, x20
	mov	x2, x21
	mov	x3, x19
	mov	x4, x24
	mov	x5, x23
	mov	x6, x22
	bl	_recover_peb
	mov	x25, x0
	b	LBB0_19
LBB0_11:
	mov	w25, #0
LBB0_12:
Lloh9:
	adrp	x8, _GFP_NOFS@GOTPAGE
Lloh10:
	ldr	x8, [x8, _GFP_NOFS@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_ubi_alloc_vid_buf
	cbz	x0, LBB0_23
; %bb.13:
	mov	x27, x0
	bl	_ubi_get_vid_hdr
	mov	x28, x0
Lloh12:
	adrp	x8, _UBI_VID_DYNAMIC@GOTPAGE
Lloh13:
	ldr	x8, [x8, _UBI_VID_DYNAMIC@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	str	w8, [x0, #40]
	mov	x0, x20
	bl	_ubi_next_sqnum
	bl	_cpu_to_be64
	str	x0, [x28]
	mov	x0, x21
	bl	_cpu_to_be32
	str	x0, [x28, #32]
	mov	x0, x19
	bl	_cpu_to_be32
	str	x0, [x28, #24]
	mov	x0, x20
	str	w21, [sp, #8]                   ; 4-byte Folded Spill
	mov	x1, x21
	bl	_ubi_get_compat
	str	w0, [x28, #16]
	ldr	w0, [x26, #4]
	bl	_cpu_to_be32
	str	x0, [x28, #8]
Lloh15:
	adrp	x8, _UBI_IO_RETRIES@GOTPAGE
Lloh16:
	ldr	x8, [x8, _UBI_IO_RETRIES@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	tbnz	w8, #31, LBB0_18
; %bb.14:
	mov	w21, #-1
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x26
	mov	x1, x19
	mov	x2, x27
	mov	x3, x24
	mov	x4, x23
	mov	x5, x22
	bl	_try_write_vid_and_data
	mov	x25, x0
Lloh18:
	adrp	x8, _EIO@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	cmn	w0, w8
	b.ne	LBB0_18
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	ldr	x8, [x20]
	cbz	x8, LBB0_18
; %bb.17:                               ;   in Loop: Header=BB0_15 Depth=1
	mov	x0, x20
	bl	_ubi_next_sqnum
	bl	_cpu_to_be64
	str	x0, [x28]
	mov	x0, x20
Lloh21:
	adrp	x1, l_.str.2@PAGE
Lloh22:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_ubi_msg
Lloh23:
	adrp	x8, _UBI_IO_RETRIES@GOTPAGE
Lloh24:
	ldr	x8, [x8, _UBI_IO_RETRIES@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	add	w21, w21, #1
	cmp	w21, w8
	b.lt	LBB0_15
LBB0_18:
	mov	x0, x27
	bl	_ubi_free_vid_buf
	ldr	w21, [sp, #8]                   ; 4-byte Folded Reload
LBB0_19:
	cbz	w25, LBB0_21
LBB0_20:
	mov	x0, x20
	bl	_ubi_ro_mode
LBB0_21:
	mov	x0, x20
	mov	x1, x21
	mov	x2, x19
	bl	_leb_write_unlock
LBB0_22:
	mov	x0, x25
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_23:
	mov	x0, x20
	mov	x1, x21
	mov	x2, x19
	bl	_leb_write_unlock
Lloh26:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh27:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_2
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_EROFS,4,2                      ; @EROFS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"write %d bytes at offset %d of LEB %d:%d, PEB %d"

l_.str.1:                               ; @.str.1
	.asciz	"failed to write data to PEB %d"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_GFP_NOFS,4,2                   ; @GFP_NOFS
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_UBI_VID_DYNAMIC,4,2            ; @UBI_VID_DYNAMIC
	.comm	_UBI_IO_RETRIES,4,2             ; @UBI_IO_RETRIES
l_.str.2:                               ; @.str.2
	.asciz	"try another PEB"

.subsections_via_symbols
