	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ubiblock_open
_ubiblock_open:                         ## @ubiblock_open
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ebx
	movq	(%rdi), %rax
	movq	(%rax), %r15
	leaq	8(%r15), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	(%r15), %rax
	testq	%rax, %rax
	jle	LBB0_1
LBB0_5:
	incq	%rax
	movq	%rax, (%r15)
	xorl	%ebx, %ebx
	jmp	LBB0_6
LBB0_1:
	movq	_FMODE_WRITE@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_3
## %bb.2:
	movq	_EROFS@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_6
LBB0_3:
	movl	24(%r15), %esi
	movl	28(%r15), %edi
	movq	_UBI_READONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_ubi_open_volume
	movq	%rax, 16(%r15)
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_4
## %bb.7:
	movl	32(%r15), %edi
	callq	_disk_to_dev
	movl	24(%r15), %ecx
	movl	28(%r15), %edx
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	callq	_dev_err
	movq	16(%r15), %rdi
	callq	_PTR_ERR
	movl	%eax, %ebx
	movq	$0, 16(%r15)
LBB0_6:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	(%r15), %rax
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_FMODE_WRITE,4,2                ## @FMODE_WRITE
	.comm	_EROFS,4,2                      ## @EROFS
	.comm	_UBI_READONLY,4,2               ## @UBI_READONLY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to open ubi volume %d_%d"

	.no_dead_strip	_ubiblock_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ubiblock_open
_ubiblock_open:                         ; @ubiblock_open
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x1
	ldr	x8, [x0]
	ldr	x21, [x8]
	add	x19, x21, #8
	mov	x0, x19
	bl	_mutex_lock
	ldr	x8, [x21]
	cmp	x8, #0
	b.le	LBB0_2
LBB0_1:
	mov	w20, #0
	add	x8, x8, #1
	str	x8, [x21]
	b	LBB0_6
LBB0_2:
Lloh0:
	adrp	x8, _FMODE_WRITE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FMODE_WRITE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_4
; %bb.3:
Lloh3:
	adrp	x8, _EROFS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EROFS@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_6
LBB0_4:
	ldp	w1, w0, [x21, #24]
Lloh6:
	adrp	x8, _UBI_READONLY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _UBI_READONLY@GOTPAGEOFF]
Lloh8:
	ldr	w2, [x8]
	bl	_ubi_open_volume
	str	x0, [x21, #16]
	bl	_IS_ERR
	cbz	x0, LBB0_7
; %bb.5:
	ldr	w0, [x21, #32]
	bl	_disk_to_dev
	ldp	w3, w2, [x21, #24]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	ldr	x0, [x21, #16]
	bl	_PTR_ERR
	mov	x20, x0
	str	xzr, [x21, #16]
LBB0_6:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_7:
	ldr	x8, [x21]
	b	LBB0_1
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_FMODE_WRITE,4,2                ; @FMODE_WRITE
	.comm	_EROFS,4,2                      ; @EROFS
	.comm	_UBI_READONLY,4,2               ; @UBI_READONLY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to open ubi volume %d_%d"

	.no_dead_strip	_ubiblock_open
.subsections_via_symbols
