	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mtd_check_open                 ## -- Begin function mtd_check_open
	.p2align	4, 0x90
_mtd_check_open:                        ## @mtd_check_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	%r14
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	xorl	%esi, %esi
	callq	_mtd_open
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movl	%eax, %ebx
	movq	_MEMGETINFO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-32(%rbp), %rdx
	movl	%ebx, %edi
	callq	_ioctl
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdx
	callq	_fprintf
	movl	%ebx, %edi
	callq	_close
	movl	$-1, %ebx
	jmp	LBB0_5
LBB0_1:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdx
	callq	_fprintf
	movl	$-1, %ebx
	jmp	LBB0_5
LBB0_4:
	movl	-24(%rbp), %eax
	movq	_mtdsize@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movl	-32(%rbp), %eax
	movl	-28(%rbp), %ecx
	movq	_erasesize@GOTPCREL(%rip), %rdx
	movl	%ecx, (%rdx)
	movq	_mtdtype@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
LBB0_5:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_stderr,4,2                     ## @stderr
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Could not open mtd device: %s\n"

	.comm	_MEMGETINFO,4,2                 ## @MEMGETINFO
L_.str.1:                               ## @.str.1
	.asciz	"Could not get MTD device info from %s\n"

	.comm	_mtdsize,4,2                    ## @mtdsize
	.comm	_erasesize,4,2                  ## @erasesize
	.comm	_mtdtype,4,2                    ## @mtdtype
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mtd_check_open                 ; -- Begin function mtd_check_open
	.p2align	2
_mtd_check_open:                        ; @mtd_check_open
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x20, x0
	mov	w1, #0
	bl	_mtd_open
	tbnz	w0, #31, LBB0_3
; %bb.1:
	mov	x19, x0
Lloh0:
	adrp	x8, _MEMGETINFO@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MEMGETINFO@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x2, sp
	bl	_ioctl
	cbz	x0, LBB0_4
; %bb.2:
Lloh3:
	adrp	x8, _stderr@GOTPAGE
Lloh4:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
Lloh6:
	adrp	x1, l_.str.1@PAGE
Lloh7:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	bl	_fprintf
	mov	x0, x19
	bl	_close
	mov	w19, #-1
	b	LBB0_5
LBB0_3:
Lloh8:
	adrp	x8, _stderr@GOTPAGE
Lloh9:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_fprintf
	mov	w19, #-1
	b	LBB0_5
LBB0_4:
	ldr	w8, [sp, #8]
Lloh13:
	adrp	x9, _mtdsize@GOTPAGE
Lloh14:
	ldr	x9, [x9, _mtdsize@GOTPAGEOFF]
Lloh15:
	str	w8, [x9]
Lloh16:
	adrp	x8, _erasesize@GOTPAGE
Lloh17:
	ldr	x8, [x8, _erasesize@GOTPAGEOFF]
	ldp	w10, w9, [sp]
Lloh18:
	str	w9, [x8]
Lloh19:
	adrp	x8, _mtdtype@GOTPAGE
Lloh20:
	ldr	x8, [x8, _mtdtype@GOTPAGEOFF]
Lloh21:
	str	w10, [x8]
LBB0_5:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotStr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotStr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotStr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_stderr,4,2                     ; @stderr
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Could not open mtd device: %s\n"

	.comm	_MEMGETINFO,4,2                 ; @MEMGETINFO
l_.str.1:                               ; @.str.1
	.asciz	"Could not get MTD device info from %s\n"

	.comm	_mtdsize,4,2                    ; @mtdsize
	.comm	_erasesize,4,2                  ; @erasesize
	.comm	_mtdtype,4,2                    ; @mtdtype
.subsections_via_symbols
