	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function alloc_device
_alloc_device:                          ## @alloc_device
	.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
	movq	%rdi, %r15
	movq	_cache_file@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	testq	%rdi, %rdi
	je	LBB0_16
## %bb.1:
	movq	_O_CREAT@GOTPCREL(%rip), %rax
	movq	_O_RDWR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movq	_O_LARGEFILE@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movl	$384, %edx                      ## imm = 0x180
	callq	_filp_open
	movq	%rax, %r14
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_2
## %bb.24:
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PTR_ERR                        ## TAILCALL
LBB0_16:
	movl	12(%r15), %edi
	shll	$2, %edi
	callq	_vmalloc
	movq	%rax, 24(%r15)
	testq	%rax, %rax
	je	LBB0_21
## %bb.17:
	movl	12(%r15), %esi
	testl	%esi, %esi
	jle	LBB0_19
## %bb.18:
	shlq	$3, %rsi
	movq	%rax, %rdi
	callq	___bzero
LBB0_19:
	movl	16(%r15), %esi
	leaq	L_.str.5(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_kmem_cache_create
	movl	%eax, 8(%r15)
	testl	%eax, %eax
	jne	LBB0_23
## %bb.20:
	leaq	L_.str.6(%rip), %rdi
	jmp	LBB0_22
LBB0_2:
	movq	(%r14), %rax
	testq	%rax, %rax
	je	LBB0_5
## %bb.3:
	cmpl	$0, 12(%rax)
	jne	LBB0_7
## %bb.4:
	cmpl	$0, 8(%rax)
	je	LBB0_5
LBB0_7:
	cmpl	$0, 4(%rax)
	jne	LBB0_10
## %bb.8:
	cmpl	$0, (%rax)
	je	LBB0_9
LBB0_10:
	movl	12(%r15), %edi
	callq	_vmalloc
	movq	%rax, (%r15)
	testq	%rax, %rax
	je	LBB0_11
## %bb.12:
	movl	16(%r15), %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kmalloc
	movl	%eax, 40(%r15)
	testl	%eax, %eax
	je	LBB0_13
## %bb.15:
	movq	%r14, 32(%r15)
	movq	(%r15), %rdi
	movl	12(%r15), %edx
	xorl	%ebx, %ebx
	xorl	%esi, %esi
	callq	_memset
	jmp	LBB0_23
LBB0_21:
	leaq	L_.str.4(%rip), %rdi
LBB0_22:
	callq	_NS_ERR
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_23
LBB0_5:
	leaq	L_.str(%rip), %rdi
LBB0_6:
	callq	_NS_ERR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_14
LBB0_11:
	leaq	L_.str.2(%rip), %rdi
	callq	_NS_ERR
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_14
LBB0_13:
	leaq	L_.str.3(%rip), %rdi
	callq	_NS_ERR
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	(%r15), %rdi
	callq	_vfree
LBB0_14:
	negl	%ebx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_filp_close
LBB0_23:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_6
	.cfi_endproc
                                        ## -- End function
	.comm	_cache_file,8,3                 ## @cache_file
	.comm	_O_CREAT,4,2                    ## @O_CREAT
	.comm	_O_RDWR,4,2                     ## @O_RDWR
	.comm	_O_LARGEFILE,4,2                ## @O_LARGEFILE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"alloc_device: cache file not readable\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"alloc_device: cache file not writeable\n"

L_.str.2:                               ## @.str.2
	.asciz	"alloc_device: unable to allocate pages written array\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.3:                               ## @.str.3
	.asciz	"alloc_device: unable to allocate file buf\n"

L_.str.4:                               ## @.str.4
	.asciz	"alloc_device: unable to allocate page array\n"

L_.str.5:                               ## @.str.5
	.asciz	"nandsim"

L_.str.6:                               ## @.str.6
	.asciz	"cache_create: unable to create kmem_cache\n"

	.no_dead_strip	_alloc_device
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function alloc_device
_alloc_device:                          ; @alloc_device
	.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, x0
Lloh0:
	adrp	x8, _cache_file@GOTPAGE
Lloh1:
	ldr	x8, [x8, _cache_file@GOTPAGEOFF]
Lloh2:
	ldr	x0, [x8]
	cbz	x0, LBB0_3
; %bb.1:
Lloh3:
	adrp	x8, _O_CREAT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _O_CREAT@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _O_RDWR@GOTPAGE
Lloh7:
	ldr	x9, [x9, _O_RDWR@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh9:
	adrp	x9, _O_LARGEFILE@GOTPAGE
Lloh10:
	ldr	x9, [x9, _O_LARGEFILE@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w1, w8, w9
	mov	w2, #384
	bl	_filp_open
	mov	x20, x0
	bl	_IS_ERR
	cbz	x0, LBB0_8
; %bb.2:
	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
	b	_PTR_ERR
LBB0_3:
	ldr	w8, [x19, #12]
	lsl	w0, w8, #2
	bl	_vmalloc
	str	x0, [x19, #24]
	cbz	x0, LBB0_16
; %bb.4:
	ldr	w8, [x19, #12]
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.5:
	lsl	x1, x8, #3
	bl	_bzero
LBB0_6:
	ldr	w1, [x19, #16]
Lloh12:
	adrp	x0, l_.str.5@PAGE
Lloh13:
	add	x0, x0, l_.str.5@PAGEOFF
	mov	w2, #0
	mov	w3, #0
	mov	x4, #0
	bl	_kmem_cache_create
	mov	w21, #0
	str	w0, [x19, #8]
	cbnz	w0, LBB0_23
; %bb.7:
Lloh14:
	adrp	x0, l_.str.6@PAGE
Lloh15:
	add	x0, x0, l_.str.6@PAGEOFF
	b	LBB0_17
LBB0_8:
	ldr	x8, [x20]
	cbz	x8, LBB0_18
; %bb.9:
	ldr	w9, [x8, #12]
	cbnz	w9, LBB0_11
; %bb.10:
	ldr	w9, [x8, #8]
	cbz	w9, LBB0_18
LBB0_11:
	ldr	w9, [x8, #4]
	cbnz	w9, LBB0_13
; %bb.12:
	ldr	w8, [x8]
	cbz	w8, LBB0_24
LBB0_13:
	ldr	w0, [x19, #12]
	bl	_vmalloc
	str	x0, [x19]
	cbz	x0, LBB0_20
; %bb.14:
	ldr	w0, [x19, #16]
Lloh16:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh17:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	bl	_kmalloc
	str	w0, [x19, #40]
	cbz	w0, LBB0_21
; %bb.15:
	str	x20, [x19, #32]
	ldr	x0, [x19]
	ldr	w2, [x19, #12]
	mov	w1, #0
	bl	_memset
	mov	w21, #0
	b	LBB0_23
LBB0_16:
Lloh19:
	adrp	x0, l_.str.4@PAGE
Lloh20:
	add	x0, x0, l_.str.4@PAGEOFF
LBB0_17:
	bl	_NS_ERR
Lloh21:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_23
LBB0_18:
Lloh24:
	adrp	x0, l_.str@PAGE
Lloh25:
	add	x0, x0, l_.str@PAGEOFF
LBB0_19:
	bl	_NS_ERR
Lloh26:
	adrp	x8, _EINVAL@GOTPAGE
Lloh27:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh28:
	ldr	w21, [x8]
	b	LBB0_22
LBB0_20:
Lloh29:
	adrp	x0, l_.str.2@PAGE
Lloh30:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_NS_ERR
Lloh31:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh32:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh33:
	ldr	w21, [x8]
	b	LBB0_22
LBB0_21:
Lloh34:
	adrp	x0, l_.str.3@PAGE
Lloh35:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_NS_ERR
Lloh36:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh37:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh38:
	ldr	w21, [x8]
	ldr	x0, [x19]
	bl	_vfree
LBB0_22:
	neg	w21, w21
	mov	x0, x20
	mov	x1, #0
	bl	_filp_close
LBB0_23:
	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
LBB0_24:
Lloh39:
	adrp	x0, l_.str.1@PAGE
Lloh40:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_19
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpAdd	Lloh39, Lloh40
	.cfi_endproc
                                        ; -- End function
	.comm	_cache_file,8,3                 ; @cache_file
	.comm	_O_CREAT,4,2                    ; @O_CREAT
	.comm	_O_RDWR,4,2                     ; @O_RDWR
	.comm	_O_LARGEFILE,4,2                ; @O_LARGEFILE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"alloc_device: cache file not readable\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"alloc_device: cache file not writeable\n"

l_.str.2:                               ; @.str.2
	.asciz	"alloc_device: unable to allocate pages written array\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.3:                               ; @.str.3
	.asciz	"alloc_device: unable to allocate file buf\n"

l_.str.4:                               ; @.str.4
	.asciz	"alloc_device: unable to allocate page array\n"

l_.str.5:                               ; @.str.5
	.asciz	"nandsim"

l_.str.6:                               ; @.str.6
	.asciz	"cache_create: unable to create kmem_cache\n"

	.no_dead_strip	_alloc_device
.subsections_via_symbols
