	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sm_add_mtd
_sm_add_mtd:                            ## @sm_add_mtd
	.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, %r14
	movq	%rdi, %r12
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movl	$120, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_18
## %bb.1:
	movq	%rax, %rbx
	leaq	112(%rax), %rdi
	callq	_mutex_init
	leaq	108(%rbx), %rdi
	movq	_sm_cache_flush_timer@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_timer_setup
	movq	%rbx, %rdi
	addq	$104, %rdi
	movq	_sm_cache_flush_work@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_INIT_WORK
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_sm_get_media_info
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_dbg
	jmp	LBB0_17
LBB0_3:
	movq	_SM_SECTOR_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%r15), %esi
	callq	_kzalloc
	movq	%rax, 24(%rbx)
	testq	%rax, %rax
	je	LBB0_17
## %bb.4:
	movl	(%rbx), %edi
	movl	(%r15), %edx
	movl	$4, %esi
	callq	_kcalloc
	movq	%rax, 32(%rbx)
	testq	%rax, %rax
	je	LBB0_16
## %bb.5:
	movl	4(%rbx), %edi
	movl	(%r15), %esi
	callq	_kzalloc
	movq	%rax, 40(%rbx)
	testq	%rax, %rax
	je	LBB0_15
## %bb.6:
	movq	%rbx, %rdi
	callq	_sm_cache_init
	movl	(%r15), %esi
	movl	$120, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_14
## %bb.7:
	movq	%rax, %r15
	movq	%rax, 96(%rbx)
	movq	%rbx, 88(%rax)
	movq	%r12, 80(%rax)
	movq	%r14, 72(%rax)
	movl	$-1, 8(%rax)
	movl	16(%rbx), %eax
	imull	4(%rbx), %eax
	imull	(%rbx), %eax
	sarl	$9, %eax
	movl	%eax, 12(%r15)
	movl	64(%rbx), %eax
	movl	%eax, 64(%r15)
	movq	%rbx, %rdi
	callq	_sm_find_cis
	testq	%rax, %rax
	je	LBB0_9
## %bb.8:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_12
LBB0_9:
	movq	%rbx, %rdi
	callq	_sm_create_sysfs_attributes
	movq	%rax, 56(%rbx)
	testq	%rax, %rax
	je	LBB0_13
## %bb.10:
	movq	%rax, 56(%r15)
	movl	(%r14), %eax
	movl	4(%r14), %edx
	leal	1048575(%rax), %esi
	testl	%eax, %eax
	cmovnsl	%eax, %esi
	sarl	$20, %esi
	leaq	L_.str.2(%rip), %rdi
	callq	_sm_printk
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_dbg
	movl	(%rbx), %esi
	movslq	16(%rbx), %rdx
	movq	48(%rbx), %rcx
	subq	%rdx, %rcx
	leaq	L_.str.4(%rip), %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	xorl	%eax, %eax
	callq	_dbg
	movl	4(%rbx), %esi
	leaq	L_.str.5(%rip), %rdi
	xorl	%eax, %eax
	callq	_dbg
	movq	%r15, %rdi
	callq	_add_mtd_blktrans_dev
	testq	%rax, %rax
	je	LBB0_18
## %bb.11:
	leaq	L_.str.6(%rip), %rdi
LBB0_12:
	xorl	%eax, %eax
	callq	_dbg
LBB0_13:
	movq	%r15, %rdi
	callq	_kfree
LBB0_14:
	movq	40(%rbx), %rdi
	callq	_kfree
LBB0_15:
	movq	32(%rbx), %rdi
	callq	_kfree
LBB0_16:
	movq	24(%rbx), %rdi
	callq	_kfree
LBB0_17:
	movq	%rbx, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_kfree                          ## TAILCALL
LBB0_18:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_sm_cache_flush_timer,4,2       ## @sm_cache_flush_timer
	.comm	_sm_cache_flush_work,4,2        ## @sm_cache_flush_work
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"found unsupported mtd device, aborting"

	.comm	_SM_SECTOR_SIZE,4,2             ## @SM_SECTOR_SIZE
L_.str.1:                               ## @.str.1
	.asciz	"CIS not found on mtd device, aborting"

L_.str.2:                               ## @.str.2
	.asciz	"Found %d MiB xD/SmartMedia FTL on mtd%d"

L_.str.3:                               ## @.str.3
	.asciz	"FTL layout:"

L_.str.4:                               ## @.str.4
	.asciz	"%d zone(s), each consists of %d blocks (+%d spares)"

L_.str.5:                               ## @.str.5
	.asciz	"each block consists of %d bytes"

L_.str.6:                               ## @.str.6
	.asciz	"error in mtdblktrans layer"

	.no_dead_strip	_sm_add_mtd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sm_add_mtd
_sm_add_mtd:                            ; @sm_add_mtd
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x21, x0
Lloh0:
	adrp	x22, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x22, [x22, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	w0, #120
	bl	_kzalloc
	cbz	x0, LBB0_18
; %bb.1:
	mov	x19, x0
	add	x0, x0, #112
	bl	_mutex_init
	add	x0, x19, #108
Lloh2:
	adrp	x8, _sm_cache_flush_timer@GOTPAGE
Lloh3:
	ldr	x8, [x8, _sm_cache_flush_timer@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_timer_setup
	add	x0, x19, #104
Lloh5:
	adrp	x8, _sm_cache_flush_work@GOTPAGE
Lloh6:
	ldr	x8, [x8, _sm_cache_flush_work@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	bl	_INIT_WORK
	mov	x0, x19
	mov	x1, x20
	bl	_sm_get_media_info
	cbz	x0, LBB0_3
; %bb.2:
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
	bl	_dbg
	b	LBB0_17
LBB0_3:
Lloh10:
	adrp	x8, _SM_SECTOR_SIZE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _SM_SECTOR_SIZE@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	ldr	w1, [x22]
	bl	_kzalloc
	str	x0, [x19, #24]
	cbz	x0, LBB0_17
; %bb.4:
	ldr	w0, [x19]
	ldr	w2, [x22]
	mov	w1, #4
	bl	_kcalloc
	str	x0, [x19, #32]
	cbz	x0, LBB0_16
; %bb.5:
	ldr	w0, [x19, #4]
	ldr	w1, [x22]
	bl	_kzalloc
	str	x0, [x19, #40]
	cbz	x0, LBB0_15
; %bb.6:
	mov	x0, x19
	bl	_sm_cache_init
	ldr	w1, [x22]
	mov	w0, #120
	bl	_kzalloc
	cbz	x0, LBB0_14
; %bb.7:
	mov	x22, x0
	ldr	w8, [x19, #16]
	ldp	w10, w9, [x19]
	mul	w8, w8, w9
	str	x0, [x19, #96]
	stp	x21, x19, [x0, #80]
	str	x20, [x0, #72]
	mul	w8, w8, w10
	mov	w9, #-1
	asr	w8, w8, #9
	stp	w9, w8, [x0, #8]
	ldr	w8, [x19, #64]
	str	w8, [x0, #64]
	mov	x0, x19
	bl	_sm_find_cis
	cbz	x0, LBB0_9
; %bb.8:
Lloh13:
	adrp	x0, l_.str.1@PAGE
Lloh14:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_12
LBB0_9:
	mov	x0, x19
	bl	_sm_create_sysfs_attributes
	str	x0, [x19, #56]
	cbz	x0, LBB0_13
; %bb.10:
	str	x0, [x22, #56]
	mov	w8, #1048575
	ldp	w9, w2, [x20]
	add	w8, w9, w8
	cmp	w9, #0
	csel	w8, w8, w9, lt
	asr	w1, w8, #20
Lloh15:
	adrp	x0, l_.str.2@PAGE
Lloh16:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_sm_printk
Lloh17:
	adrp	x0, l_.str.3@PAGE
Lloh18:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_dbg
	ldr	x8, [x19, #48]
	ldrsw	x9, [x19, #16]
	sub	x8, x8, x9
	ldr	w10, [x19]
	stp	x9, x8, [sp, #8]
	str	x10, [sp]
Lloh19:
	adrp	x0, l_.str.4@PAGE
Lloh20:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_dbg
	ldr	w8, [x19, #4]
	str	x8, [sp]
Lloh21:
	adrp	x0, l_.str.5@PAGE
Lloh22:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_dbg
	mov	x0, x22
	bl	_add_mtd_blktrans_dev
	cbz	x0, LBB0_18
; %bb.11:
Lloh23:
	adrp	x0, l_.str.6@PAGE
Lloh24:
	add	x0, x0, l_.str.6@PAGEOFF
LBB0_12:
	bl	_dbg
LBB0_13:
	mov	x0, x22
	bl	_kfree
LBB0_14:
	ldr	x0, [x19, #40]
	bl	_kfree
LBB0_15:
	ldr	x0, [x19, #32]
	bl	_kfree
LBB0_16:
	ldr	x0, [x19, #24]
	bl	_kfree
LBB0_17:
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	b	_kfree
LBB0_18:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_sm_cache_flush_timer,4,2       ; @sm_cache_flush_timer
	.comm	_sm_cache_flush_work,4,2        ; @sm_cache_flush_work
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"found unsupported mtd device, aborting"

	.comm	_SM_SECTOR_SIZE,4,2             ; @SM_SECTOR_SIZE
l_.str.1:                               ; @.str.1
	.asciz	"CIS not found on mtd device, aborting"

l_.str.2:                               ; @.str.2
	.asciz	"Found %d MiB xD/SmartMedia FTL on mtd%d"

l_.str.3:                               ; @.str.3
	.asciz	"FTL layout:"

l_.str.4:                               ; @.str.4
	.asciz	"%d zone(s), each consists of %d blocks (+%d spares)"

l_.str.5:                               ; @.str.5
	.asciz	"each block consists of %d bytes"

l_.str.6:                               ; @.str.6
	.asciz	"error in mtdblktrans layer"

	.no_dead_strip	_sm_add_mtd
.subsections_via_symbols
