	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_eba_write_leb_st           ## -- Begin function ubi_eba_write_leb_st
	.p2align	4, 0x90
_ubi_eba_write_leb_st:                  ## @ubi_eba_write_leb_st
	.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
LBB0_24:
	movl	%r13d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movl	%r9d, %r13d
	movl	%r8d, %r15d
	movl	%edx, %r12d
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movl	16(%rbp), %eax
	movl	(%rsi), %edx
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	decl	%eax
	movl	4(%rdi), %esi
	cmpl	%r12d, %eax
	movq	%rcx, -88(%rbp)                 ## 8-byte Spill
	jne	LBB0_5
## %bb.4:
	movl	%r15d, %edi
	callq	_ALIGN
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	jmp	LBB0_6
LBB0_5:
	decl	%esi
	xorl	%edi, %edi
	testl	%r15d, %esi
	sete	%dil
	callq	_ubi_assert
	movl	%r15d, -52(%rbp)                ## 4-byte Spill
LBB0_6:
	movq	_GFP_NOFS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_ubi_zalloc_vid_hdr
	testq	%rax, %rax
	je	LBB0_7
## %bb.8:
	movl	%r13d, -68(%rbp)                ## 4-byte Spill
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	%r14, %rdi
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %esi
	movl	%r12d, %edx
	callq	_leb_write_lock
	testl	%eax, %eax
	je	LBB0_11
## %bb.9:
	movl	%eax, %r13d
	jmp	LBB0_10
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_11:
	movq	%r14, %rdi
	callq	_next_sqnum
	movl	%eax, %edi
	callq	_cpu_to_be64
	movq	-64(%rbp), %r13                 ## 8-byte Reload
	movq	%rax, (%r13)
	movl	%ebx, %edi
	callq	_cpu_to_be32
	movq	%rax, 64(%r13)
	movl	%r12d, -48(%rbp)                ## 4-byte Spill
	movl	%r12d, %edi
	callq	_cpu_to_be32
	movq	%rax, 56(%r13)
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_ubi_get_compat
	movl	%eax, 48(%r13)
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movl	4(%rax), %edi
	callq	_cpu_to_be32
	movq	%rax, 40(%r13)
	movq	_UBI_CRC32_INIT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	-88(%rbp), %rsi                 ## 8-byte Reload
	movl	%r15d, %edx
	callq	_crc32
	movl	%eax, %ebx
	movq	_UBI_VID_STATIC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%r13)
	movl	%r15d, %edi
	callq	_cpu_to_be32
	movq	%rax, 24(%r13)
	movl	16(%rbp), %edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_cpu_to_be32
	movq	%rax, 16(%r13)
	movl	%ebx, %edi
	callq	_cpu_to_be32
	movq	%rax, 8(%r13)
	movq	%r14, %rdi
	movl	-68(%rbp), %esi                 ## 4-byte Reload
	callq	_ubi_wl_get_peb
	movl	%eax, %r15d
	testl	%eax, %eax
	js	LBB0_23
## %bb.12:
	movl	$0, -72(%rbp)                   ## 4-byte Folded Spill
	movl	-52(%rbp), %ebx                 ## 4-byte Reload
	movl	-44(%rbp), %r12d                ## 4-byte Reload
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	leaq	L_.str(%rip), %rdi
	movl	%ebx, %esi
	movl	%r12d, %edx
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %ecx
	movl	%r15d, %r8d
	movl	16(%rbp), %r9d
                                        ## kill: def $r9d killed $r9d killed $r9
	callq	_dbg_eba
	movq	%r14, %rdi
	movl	%r15d, %esi
	movq	%r13, %rdx
	callq	_ubi_io_write_vid_hdr
	testl	%eax, %eax
	je	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	movl	%eax, %r13d
	leaq	L_.str.1(%rip), %rdi
	movl	%r12d, %esi
	movl	%ebx, %edx
	movl	%r15d, %ecx
	xorl	%eax, %eax
	callq	_ubi_warn
	movl	-52(%rbp), %ebx                 ## 4-byte Reload
	jmp	LBB0_17
LBB0_15:                                ##   in Loop: Header=BB0_13 Depth=1
	movq	%r14, %rdi
	movq	-88(%rbp), %rsi                 ## 8-byte Reload
	movl	%r15d, %edx
	xorl	%ecx, %ecx
	movl	-52(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %r8d
	callq	_ubi_io_write_data
	testl	%eax, %eax
	je	LBB0_25
## %bb.16:                              ##   in Loop: Header=BB0_13 Depth=1
	movl	%eax, %r13d
	leaq	L_.str.2(%rip), %rdi
	movl	%ebx, %esi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_ubi_warn
LBB0_17:                                ##   in Loop: Header=BB0_13 Depth=1
	movq	_EIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r13d, %eax
	jne	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_13 Depth=1
	cmpl	$0, (%r14)
	je	LBB0_19
## %bb.20:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	$1, %edx
	callq	_ubi_wl_put_peb
	movl	%eax, %r13d
	testl	%eax, %eax
	movl	-72(%rbp), %ecx                 ## 4-byte Reload
	jne	LBB0_19
## %bb.21:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	_UBI_IO_RETRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ecx
	jge	LBB0_19
## %bb.22:                              ##   in Loop: Header=BB0_13 Depth=1
	incl	%ecx
	movl	%ecx, -72(%rbp)                 ## 4-byte Spill
	movq	%r14, %rdi
	callq	_next_sqnum
	movl	%eax, %edi
	callq	_cpu_to_be64
	movq	-64(%rbp), %r13                 ## 8-byte Reload
	movq	%rax, (%r13)
	leaq	L_.str.3(%rip), %rdi
	callq	_ubi_msg
	movq	%r14, %rdi
	movl	-68(%rbp), %esi                 ## 4-byte Reload
	callq	_ubi_wl_get_peb
	movl	%eax, %r15d
	testl	%eax, %eax
	jns	LBB0_13
LBB0_23:
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_ubi_free_vid_hdr
	movq	%r14, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	callq	_leb_write_unlock
	movl	%r15d, %r13d
	jmp	LBB0_24
LBB0_19:
	movq	%r14, %rdi
	callq	_ubi_ro_mode
	movq	%r14, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	callq	_leb_write_unlock
LBB0_10:
	movq	%r14, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_ubi_free_vid_hdr
	jmp	LBB0_24
LBB0_25:
	movq	-80(%rbp), %r13                 ## 8-byte Reload
	movq	8(%r13), %rax
	movl	-48(%rbp), %r12d                ## 4-byte Reload
	movslq	%r12d, %rbx
	movl	(%rax,%rbx,4), %edi
	shrl	$31, %edi
	callq	_ubi_assert
	movq	8(%r13), %rax
	movl	%r15d, (%rax,%rbx,4)
	movq	%r14, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	%r12d, %edx
	callq	_leb_write_unlock
	movq	%r14, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_ubi_free_vid_hdr
	xorl	%r13d, %r13d
	jmp	LBB0_24
	.cfi_endproc
                                        ## -- End function
	.comm	_EROFS,4,2                      ## @EROFS
	.comm	_GFP_NOFS,4,2                   ## @GFP_NOFS
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_UBI_CRC32_INIT,4,2             ## @UBI_CRC32_INIT
	.comm	_UBI_VID_STATIC,4,2             ## @UBI_VID_STATIC
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"write VID hdr and %d bytes at LEB %d:%d, PEB %d, used_ebs %d"

L_.str.1:                               ## @.str.1
	.asciz	"failed to write VID header to LEB %d:%d, PEB %d"

L_.str.2:                               ## @.str.2
	.asciz	"failed to write %d bytes of data to PEB %d"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_UBI_IO_RETRIES,4,2             ## @UBI_IO_RETRIES
L_.str.3:                               ## @.str.3
	.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_st           ; -- Begin function ubi_eba_write_leb_st
	.p2align	2
_ubi_eba_write_leb_st:                  ; @ubi_eba_write_leb_st
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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_4
; %bb.1:
Lloh0:
	adrp	x8, _EROFS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EROFS@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w27, w8
LBB0_3:
	mov	x0, x27
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_4:
	mov	x24, x6
	mov	x25, x5
	mov	x28, x4
	mov	x26, x3
	mov	x20, x2
	mov	x9, x1
	mov	x19, x0
	ldr	w27, [x1]
	sub	w8, w6, #1
	ldr	w1, [x0, #4]
	mov	x23, x9
	cmp	w8, w2
	b.ne	LBB0_6
; %bb.5:
	mov	x0, x28
	bl	_ALIGN
	mov	x21, x0
	b	LBB0_7
LBB0_6:
	sub	w8, w1, #1
	tst	w8, w28
	cset	w0, eq
	bl	_ubi_assert
	mov	x21, x28
LBB0_7:
Lloh2:
	adrp	x8, _GFP_NOFS@GOTPAGE
Lloh3:
	ldr	x8, [x8, _GFP_NOFS@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ubi_zalloc_vid_hdr
	cbz	x0, LBB0_10
; %bb.8:
	mov	x22, x0
	str	w21, [sp, #28]                  ; 4-byte Folded Spill
	mov	x0, x19
	mov	x1, x27
	mov	x2, x20
	bl	_leb_write_lock
	cbz	w0, LBB0_11
; %bb.9:
	mov	x27, x0
	b	LBB0_25
LBB0_10:
Lloh5:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_2
LBB0_11:
	mov	x21, x27
	mov	x0, x19
	bl	_next_sqnum
	bl	_cpu_to_be64
	str	x0, [x22]
	mov	x0, x27
	bl	_cpu_to_be32
	str	x0, [x22, #64]
	mov	x0, x20
	bl	_cpu_to_be32
	str	x0, [x22, #56]
	mov	x0, x19
	str	w27, [sp, #24]                  ; 4-byte Folded Spill
	mov	x1, x27
	bl	_ubi_get_compat
	str	w0, [x22, #48]
	ldr	w0, [x23, #4]
	bl	_cpu_to_be32
	str	x0, [x22, #40]
Lloh7:
	adrp	x8, _UBI_CRC32_INIT@GOTPAGE
Lloh8:
	ldr	x8, [x8, _UBI_CRC32_INIT@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
	mov	x1, x26
	mov	x2, x28
	bl	_crc32
	mov	x27, x0
Lloh10:
	adrp	x8, _UBI_VID_STATIC@GOTPAGE
Lloh11:
	ldr	x8, [x8, _UBI_VID_STATIC@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	str	w8, [x22, #32]
	mov	x0, x28
	bl	_cpu_to_be32
	str	x0, [x22, #24]
	mov	x0, x24
	bl	_cpu_to_be32
	str	x0, [x22, #16]
	mov	x0, x27
	bl	_cpu_to_be32
	str	x0, [x22, #8]
	mov	x0, x19
	mov	x1, x25
	bl	_ubi_wl_get_peb
	mov	x28, x0
	tbnz	w0, #31, LBB0_22
; %bb.12:
	stp	x23, x26, [sp, #8]              ; 16-byte Folded Spill
	mov	w26, #0
	ldp	w23, w21, [sp, #24]             ; 8-byte Folded Reload
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
Lloh13:
	adrp	x0, l_.str@PAGE
Lloh14:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x21
	mov	x2, x23
	mov	x3, x20
	mov	x4, x28
	mov	x5, x24
	bl	_dbg_eba
	mov	x0, x19
	mov	x1, x28
	mov	x2, x22
	bl	_ubi_io_write_vid_hdr
	cbz	w0, LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	mov	x27, x0
	str	x28, [sp]
Lloh15:
	adrp	x0, l_.str.1@PAGE
Lloh16:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x23
	mov	x2, x20
	b	LBB0_17
LBB0_15:                                ;   in Loop: Header=BB0_13 Depth=1
	mov	x0, x19
	ldr	x1, [sp, #16]                   ; 8-byte Folded Reload
	mov	x2, x28
	mov	w3, #0
	mov	x4, x21
	bl	_ubi_io_write_data
	mov	x27, x0
	cbz	w0, LBB0_26
; %bb.16:                               ;   in Loop: Header=BB0_13 Depth=1
Lloh17:
	adrp	x0, l_.str.2@PAGE
Lloh18:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x21
	mov	x2, x28
LBB0_17:                                ;   in Loop: Header=BB0_13 Depth=1
	bl	_ubi_warn
Lloh19:
	adrp	x8, _EIO@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	cmn	w27, w8
	b.ne	LBB0_23
; %bb.18:                               ;   in Loop: Header=BB0_13 Depth=1
	ldr	w8, [x19]
	cbz	w8, LBB0_23
; %bb.19:                               ;   in Loop: Header=BB0_13 Depth=1
	mov	x0, x19
	mov	x1, x28
	mov	w2, #1
	bl	_ubi_wl_put_peb
	mov	x27, x0
	cbnz	w0, LBB0_23
; %bb.20:                               ;   in Loop: Header=BB0_13 Depth=1
Lloh22:
	adrp	x8, _UBI_IO_RETRIES@GOTPAGE
Lloh23:
	ldr	x8, [x8, _UBI_IO_RETRIES@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	cmp	w26, w8
	b.ge	LBB0_23
; %bb.21:                               ;   in Loop: Header=BB0_13 Depth=1
	add	w26, w26, #1
	mov	x0, x19
	bl	_next_sqnum
	bl	_cpu_to_be64
	str	x0, [x22]
Lloh25:
	adrp	x0, l_.str.3@PAGE
Lloh26:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_ubi_msg
	mov	x0, x19
	mov	x1, x25
	bl	_ubi_wl_get_peb
	mov	x28, x0
	tbz	w0, #31, LBB0_13
LBB0_22:
	mov	x0, x19
	mov	x1, x22
	bl	_ubi_free_vid_hdr
	mov	x0, x19
	ldr	w1, [sp, #24]                   ; 4-byte Folded Reload
	mov	x2, x20
	bl	_leb_write_unlock
	mov	x27, x28
	b	LBB0_3
LBB0_23:
	mov	x0, x19
	bl	_ubi_ro_mode
LBB0_24:
	mov	x0, x19
	ldr	w1, [sp, #24]                   ; 4-byte Folded Reload
	mov	x2, x20
	bl	_leb_write_unlock
LBB0_25:
	mov	x0, x19
	mov	x1, x22
	bl	_ubi_free_vid_hdr
	b	LBB0_3
LBB0_26:
	ldr	x21, [sp, #8]                   ; 8-byte Folded Reload
	ldr	x8, [x21, #8]
	sbfiz	x24, x20, #2, #32
	ldr	w8, [x8, x24]
	lsr	w0, w8, #31
	bl	_ubi_assert
	ldr	x8, [x21, #8]
	str	w28, [x8, x24]
	b	LBB0_24
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_EROFS,4,2                      ; @EROFS
	.comm	_GFP_NOFS,4,2                   ; @GFP_NOFS
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_UBI_CRC32_INIT,4,2             ; @UBI_CRC32_INIT
	.comm	_UBI_VID_STATIC,4,2             ; @UBI_VID_STATIC
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"write VID hdr and %d bytes at LEB %d:%d, PEB %d, used_ebs %d"

l_.str.1:                               ; @.str.1
	.asciz	"failed to write VID header to LEB %d:%d, PEB %d"

l_.str.2:                               ; @.str.2
	.asciz	"failed to write %d bytes of data to PEB %d"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_UBI_IO_RETRIES,4,2             ; @UBI_IO_RETRIES
l_.str.3:                               ; @.str.3
	.asciz	"try another PEB"

.subsections_via_symbols
