	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtd_open
_mtd_open:                              ## @mtd_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	callq	_iminor
	movl	%eax, %r14d
	movl	%eax, %ebx
	sarl	%ebx
	movq	_MTD_DEBUG_LEVEL0@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_DEBUG
	movq	_MAX_MTD_DEVICES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jge	LBB0_1
## %bb.3:
	movq	_FMODE_WRITE@GOTPCREL(%rip), %r12
	movl	(%r12), %eax
	testl	%eax, (%r15)
	je	LBB0_6
## %bb.4:
	andl	$1, %r14d
	je	LBB0_6
## %bb.5:
	movq	_EACCES@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_20
LBB0_6:
	xorl	%eax, %eax
	callq	_lock_kernel
	xorl	%edi, %edi
	movl	%ebx, %esi
	callq	_get_mtd_device
	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_19
LBB0_8:
	movq	(%r14), %rax
	movq	_MTD_ABSENT@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_11
## %bb.9:
	movq	%r14, %rdi
	callq	_put_mtd_device
	movq	_ENODEV@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_11:
	movq	16(%r14), %rax
	testq	%rax, %rax
	je	LBB0_13
## %bb.12:
	movq	16(%r15), %rcx
	movq	%rax, (%rcx)
LBB0_13:
	movl	(%r12), %eax
	testl	%eax, (%r15)
	je	LBB0_16
## %bb.14:
	movq	_MTD_WRITEABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%r14)
	je	LBB0_15
LBB0_16:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$8, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_17
## %bb.18:
	movq	%r14, (%rax)
	movq	%rax, 8(%r15)
	xorl	%ebx, %ebx
	jmp	LBB0_19
LBB0_17:
	movq	%r14, %rdi
	callq	_put_mtd_device
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_15:
	movq	%r14, %rdi
	callq	_put_mtd_device
	movq	_EACCES@GOTPCREL(%rip), %rax
LBB0_10:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_19:
	xorl	%eax, %eax
	callq	_unlock_kernel
LBB0_20:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MTD_DEBUG_LEVEL0,4,2           ## @MTD_DEBUG_LEVEL0
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"MTD_open\n"

	.comm	_MAX_MTD_DEVICES,4,2            ## @MAX_MTD_DEVICES
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_FMODE_WRITE,4,2                ## @FMODE_WRITE
	.comm	_EACCES,4,2                     ## @EACCES
	.comm	_MTD_ABSENT,8,3                 ## @MTD_ABSENT
	.comm	_MTD_WRITEABLE,4,2              ## @MTD_WRITEABLE
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_mtd_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtd_open
_mtd_open:                              ; @mtd_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	x19, x1
	bl	_iminor
	mov	x21, x0
	asr	w20, w0, #1
Lloh0:
	adrp	x8, _MTD_DEBUG_LEVEL0@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MTD_DEBUG_LEVEL0@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_DEBUG
Lloh5:
	adrp	x8, _MAX_MTD_DEVICES@GOTPAGE
Lloh6:
	ldr	x8, [x8, _MAX_MTD_DEVICES@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	cmp	w20, w8
	b.ge	LBB0_4
; %bb.1:
Lloh8:
	adrp	x22, _FMODE_WRITE@GOTPAGE
Lloh9:
	ldr	x22, [x22, _FMODE_WRITE@GOTPAGEOFF]
	ldr	w8, [x19]
	ldr	w9, [x22]
	and	w8, w9, w8
	and	w9, w21, #0x1
	cmp	w8, #0
	ccmp	w9, #0, #4, ne
	b.ne	LBB0_5
; %bb.2:
	bl	_lock_kernel
	mov	x0, #0
	mov	x1, x20
	bl	_get_mtd_device
	mov	x20, x0
	bl	_IS_ERR
	cbz	x0, LBB0_7
; %bb.3:
	mov	x0, x20
	bl	_PTR_ERR
	mov	x21, x0
	b	LBB0_18
LBB0_4:
Lloh10:
	adrp	x8, _ENODEV@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
	b	LBB0_6
LBB0_5:
Lloh12:
	adrp	x8, _EACCES@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EACCES@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_19
LBB0_7:
	ldr	x8, [x20]
Lloh14:
	adrp	x9, _MTD_ABSENT@GOTPAGE
Lloh15:
	ldr	x9, [x9, _MTD_ABSENT@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_9
; %bb.8:
	mov	x0, x20
	bl	_put_mtd_device
Lloh17:
	adrp	x8, _ENODEV@GOTPAGE
Lloh18:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
	b	LBB0_17
LBB0_9:
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_11
; %bb.10:
	ldr	x9, [x19, #16]
	str	x8, [x9]
LBB0_11:
	ldr	w8, [x19]
	ldr	w9, [x22]
	tst	w9, w8
	b.eq	LBB0_13
; %bb.12:
	ldr	w8, [x20, #8]
Lloh19:
	adrp	x9, _MTD_WRITEABLE@GOTPAGE
Lloh20:
	ldr	x9, [x9, _MTD_WRITEABLE@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_16
LBB0_13:
Lloh22:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh23:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
	mov	w0, #8
	bl	_kzalloc
	cbz	x0, LBB0_15
; %bb.14:
	mov	w21, #0
	str	x20, [x0]
	str	x0, [x19, #8]
	b	LBB0_18
LBB0_15:
	mov	x0, x20
	bl	_put_mtd_device
Lloh25:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_17
LBB0_16:
	mov	x0, x20
	bl	_put_mtd_device
Lloh27:
	adrp	x8, _EACCES@GOTPAGE
Lloh28:
	ldr	x8, [x8, _EACCES@GOTPAGEOFF]
LBB0_17:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_18:
	bl	_unlock_kernel
LBB0_19:
	mov	x0, x21
	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
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_MTD_DEBUG_LEVEL0,4,2           ; @MTD_DEBUG_LEVEL0
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"MTD_open\n"

	.comm	_MAX_MTD_DEVICES,4,2            ; @MAX_MTD_DEVICES
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_FMODE_WRITE,4,2                ; @FMODE_WRITE
	.comm	_EACCES,4,2                     ; @EACCES
	.comm	_MTD_ABSENT,8,3                 ; @MTD_ABSENT
	.comm	_MTD_WRITEABLE,4,2              ; @MTD_WRITEABLE
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_mtd_open
.subsections_via_symbols
