	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function maple_vmu_write_block
_maple_vmu_write_block:                 ## @maple_vmu_write_block
	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	movq	(%rdx), %rax
	movq	8(%rax), %r12
	movl	(%rax), %r13d
	movq	%r12, %rdi
	callq	_maple_get_drvdata
	movq	%rax, %r14
	movl	(%rax), %eax
	cltd
	idivl	4(%r14)
                                        ## kill: def $eax killed $eax def $rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	leal	4(%rax), %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_19
## %bb.1:
	movq	%rax, %r15
	cmpl	$0, 4(%r14)
	jle	LBB0_11
## %bb.2:
	shll	$24, %r13d
	orl	-44(%rbp), %r13d                ## 4-byte Folded Reload
	movl	%r13d, -64(%rbp)                ## 4-byte Spill
	movq	%r15, %rax
	addq	$4, %rax
	movq	%rax, -120(%rbp)                ## 8-byte Spill
	leaq	24(%r12), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	leal	3(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$2, %ecx
	addl	$2, %ecx
	movl	%ecx, -60(%rbp)                 ## 4-byte Spill
	cltq
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	xorl	%r13d, %r13d
	xorl	%r9d, %r9d
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	%r14, -112(%rbp)                ## 8-byte Spill
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_atomic_set
	movq	-96(%rbp), %rbx                 ## 8-byte Reload
	movq	-88(%rbp), %r9                  ## 8-byte Reload
LBB0_10:                                ##   in Loop: Header=BB0_3 Depth=1
	incq	%r9
	movslq	4(%r14), %rax
	addq	-104(%rbp), %rbx                ## 8-byte Folded Reload
	addl	$65536, %r13d                   ## imm = 0x10000
	cmpq	%rax, %r9
	movq	%r15, %r12
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	jge	LBB0_11
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r9, -88(%rbp)                  ## 8-byte Spill
	movl	-64(%rbp), %edi                 ## 4-byte Reload
	orl	%r13d, %edi
	callq	_cpu_to_be32
	movl	%eax, (%r15)
	movq	-120(%rbp), %rdi                ## 8-byte Reload
	movq	%rbx, -96(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rsi
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_memcpy
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_atomic_read
	cmpl	$1, %eax
	jne	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	28(%r12), %r14d
	movq	%rbx, %rdi
	callq	_atomic_read
	xorl	%esi, %esi
	testl	%eax, %eax
	sete	%sil
	movq	_HZ@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r14d, %edi
	callq	_wait_event_interruptible_timeout
	movq	%rbx, %rdi
	callq	_atomic_read
	cmpl	$1, %eax
	je	LBB0_5
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_atomic_set
	movq	_MAPLE_FUNC_MEMCARD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_MAPLE_COMMAND_BWRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	movl	-60(%rbp), %ecx                 ## 4-byte Reload
	movq	%r15, %r8
	callq	_maple_add_packet
	movl	%eax, %r14d
	movq	%r12, %r15
	movl	28(%r12), %r12d
	movq	%rbx, %rdi
	callq	_atomic_read
	xorl	%esi, %esi
	testl	%eax, %eax
	sete	%sil
	movq	_HZ@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	imulq	$1717986919, %rax, %rdx         ## imm = 0x66666667
	movq	%rdx, %rax
	shrq	$63, %rax
	sarq	$34, %rdx
	addl	%eax, %edx
	movl	%r12d, %edi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_wait_event_interruptible_timeout
	testl	%r14d, %r14d
	jne	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	%eax, %r12d
	movq	%rbx, %rdi
	callq	_atomic_read
	cmpl	$2, %eax
	movq	-112(%rbp), %r14                ## 8-byte Reload
	je	LBB0_9
## %bb.12:                              ##   in Loop: Header=BB0_3 Depth=1
	testl	%r12d, %r12d
	movq	-96(%rbp), %rbx                 ## 8-byte Reload
	movq	-88(%rbp), %r9                  ## 8-byte Reload
	je	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_ERESTARTSYS@GOTPCREL(%rip), %rax
	addl	(%rax), %r12d
	jne	LBB0_10
LBB0_14:
	movq	_EIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	%r15, %r12
	leaq	8(%r15), %rdi
	movl	(%r15), %ecx
	movl	4(%r15), %edx
	leaq	L_.str.1(%rip), %rsi
	movl	-44(%rbp), %r8d                 ## 4-byte Reload
                                        ## kill: def $r9d killed $r9d killed $r9
	callq	_dev_warn
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	xorl	%esi, %esi
	callq	_atomic_set
	movq	16(%r15), %rax
	movq	8(%rax), %rdi
	callq	_kfree
	movq	16(%r15), %rdi
	movq	$0, 8(%rdi)
	callq	_list_del_init
	jmp	LBB0_15
LBB0_19:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	jmp	LBB0_17
LBB0_11:
	movq	%r15, %rdi
	callq	_kfree
	movl	(%r14), %r14d
	jmp	LBB0_18
LBB0_7:
	movq	_EIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_atomic_set
	movq	%r15, %r12
LBB0_15:
	movq	-56(%rbp), %r15                 ## 8-byte Reload
LBB0_16:
	movq	%r15, %rdi
	callq	_kfree
LBB0_17:
	negl	%r14d
	leaq	8(%r12), %rdi
	movl	(%r12), %ecx
	movl	4(%r12), %edx
	leaq	L_.str.2(%rip), %rsi
	callq	_dev_err
LBB0_18:
	movl	%r14d, %eax
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	leaq	8(%r12), %rdi
	movl	(%r12), %ecx
	movl	4(%r12), %edx
	leaq	L_.str(%rip), %rsi
	callq	_dev_notice
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_HZ,4,2                         ## @HZ
	.comm	_EBUSY,4,2                      ## @EBUSY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"VMU write at (%d, %d)failed - device is busy\n"

	.comm	_MAPLE_FUNC_MEMCARD,4,2         ## @MAPLE_FUNC_MEMCARD
	.comm	_MAPLE_COMMAND_BWRITE,4,2       ## @MAPLE_COMMAND_BWRITE
	.comm	_EIO,4,2                        ## @EIO
	.comm	_ERESTARTSYS,4,2                ## @ERESTARTSYS
L_.str.1:                               ## @.str.1
	.asciz	"Write at (%d, %d) of block 0x%X at phase %d failed: could not communicate with VMU"

L_.str.2:                               ## @.str.2
	.asciz	"VMU (%d, %d): write failed\n"

	.no_dead_strip	_maple_vmu_write_block
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function maple_vmu_write_block
_maple_vmu_write_block:                 ; @maple_vmu_write_block
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x22, x1
	str	w0, [sp, #4]                    ; 4-byte Folded Spill
	ldr	x8, [x2]
	ldr	x19, [x8, #8]
	ldr	w21, [x8]
	mov	x0, x19
	bl	_maple_get_drvdata
	mov	x23, x0
	ldp	w8, w9, [x0]
	sdiv	w25, w8, w9
	add	w0, w25, #4
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_kmalloc
	cbz	x0, LBB0_12
; %bb.1:
	mov	x20, x0
	ldr	w8, [x23, #4]
	cmp	w8, #1
	b.lt	LBB0_13
; %bb.2:
	mov	w28, #0
	mov	x26, #0
	add	x8, x20, #4
	str	x8, [sp, #24]                   ; 8-byte Folded Spill
	add	x24, x19, #24
	add	w8, w25, #3
	cmp	w25, #0
	csel	w8, w8, w25, lt
	asr	w8, w8, #2
	add	w9, w8, #2
	sxtw	x8, w25
	str	x8, [sp, #8]                    ; 8-byte Folded Spill
	ldr	w8, [sp, #4]                    ; 4-byte Folded Reload
	orr	w8, w8, w21, lsl #24
	stp	w9, w8, [sp, #16]               ; 8-byte Folded Spill
	b	LBB0_5
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x24
	mov	w1, #0
	bl	_atomic_set
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x26, x26, #1
	ldrsw	x8, [x23, #4]
	ldr	x9, [sp, #8]                    ; 8-byte Folded Reload
	add	x22, x22, x9
	add	w28, w28, #16, lsl #12          ; =65536
	cmp	x26, x8
	b.ge	LBB0_13
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [sp, #20]                   ; 4-byte Folded Reload
	orr	w0, w8, w28
	bl	_cpu_to_be32
	str	w0, [x20]
	ldr	x0, [sp, #24]                   ; 8-byte Folded Reload
	mov	x1, x22
	mov	x2, x25
	bl	_memcpy
	mov	x0, x24
	bl	_atomic_read
	cmp	w0, #1
	b.ne	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w21, [x19, #28]
	mov	x0, x24
	bl	_atomic_read
	cmp	w0, #0
	cset	w1, eq
Lloh3:
	adrp	x8, _HZ@GOTPAGE
Lloh4:
	ldr	x8, [x8, _HZ@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	mov	x0, x21
	bl	_wait_event_interruptible_timeout
	mov	x0, x24
	bl	_atomic_read
	cmp	w0, #1
	b.eq	LBB0_15
LBB0_7:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x24
	mov	w1, #1
	bl	_atomic_set
Lloh6:
	adrp	x8, _MAPLE_FUNC_MEMCARD@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MAPLE_FUNC_MEMCARD@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
Lloh9:
	adrp	x8, _MAPLE_COMMAND_BWRITE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _MAPLE_COMMAND_BWRITE@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	x0, x19
	ldr	w3, [sp, #16]                   ; 4-byte Folded Reload
	mov	x4, x20
	bl	_maple_add_packet
	mov	x27, x0
	ldr	w21, [x19, #28]
	mov	x0, x24
	bl	_atomic_read
	cmp	w0, #0
	cset	w1, eq
Lloh12:
	adrp	x8, _HZ@GOTPAGE
Lloh13:
	ldr	x8, [x8, _HZ@GOTPAGEOFF]
Lloh14:
	ldrsw	x8, [x8]
	mov	w9, #26215
	movk	w9, #26214, lsl #16
	mul	x8, x8, x9
	lsr	x9, x8, #63
	asr	x8, x8, #34
	add	w2, w8, w9
	mov	x0, x21
	bl	_wait_event_interruptible_timeout
	cbnz	w27, LBB0_14
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x21, x0
	mov	x0, x24
	bl	_atomic_read
	cmp	w0, #2
	b.eq	LBB0_3
; %bb.9:                                ;   in Loop: Header=BB0_5 Depth=1
	cbz	w21, LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_5 Depth=1
Lloh15:
	adrp	x8, _ERESTARTSYS@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ERESTARTSYS@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	cmn	w21, w8
	b.ne	LBB0_4
LBB0_11:
Lloh18:
	adrp	x8, _EIO@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh20:
	ldr	w21, [x8]
	add	x0, x19, #8
	ldp	w3, w2, [x19]
Lloh21:
	adrp	x1, l_.str.1@PAGE
Lloh22:
	add	x1, x1, l_.str.1@PAGEOFF
	ldr	w4, [sp, #4]                    ; 4-byte Folded Reload
	mov	x5, x26
	bl	_dev_warn
	mov	x0, x24
	mov	w1, #0
	bl	_atomic_set
	ldr	x8, [x19, #16]
	ldr	x0, [x8, #8]
	bl	_kfree
	ldr	x0, [x19, #16]
	str	xzr, [x0, #8]
	bl	_list_del_init
	b	LBB0_16
LBB0_12:
Lloh23:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh24:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh25:
	ldr	w21, [x8]
	b	LBB0_17
LBB0_13:
	mov	x0, x20
	bl	_kfree
	ldr	w20, [x23]
	b	LBB0_18
LBB0_14:
Lloh26:
	adrp	x8, _EIO@GOTPAGE
Lloh27:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh28:
	ldr	w21, [x8]
	mov	x0, x24
	mov	w1, #0
	bl	_atomic_set
	b	LBB0_16
LBB0_15:
Lloh29:
	adrp	x8, _EBUSY@GOTPAGE
Lloh30:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh31:
	ldr	w21, [x8]
	add	x0, x19, #8
	ldp	w3, w2, [x19]
Lloh32:
	adrp	x1, l_.str@PAGE
Lloh33:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_notice
LBB0_16:
	mov	x0, x20
	bl	_kfree
LBB0_17:
	neg	w20, w21
	add	x0, x19, #8
	ldp	w3, w2, [x19]
Lloh34:
	adrp	x1, l_.str.2@PAGE
Lloh35:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
LBB0_18:
	mov	x0, x20
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_HZ,4,2                         ; @HZ
	.comm	_EBUSY,4,2                      ; @EBUSY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"VMU write at (%d, %d)failed - device is busy\n"

	.comm	_MAPLE_FUNC_MEMCARD,4,2         ; @MAPLE_FUNC_MEMCARD
	.comm	_MAPLE_COMMAND_BWRITE,4,2       ; @MAPLE_COMMAND_BWRITE
	.comm	_EIO,4,2                        ; @EIO
	.comm	_ERESTARTSYS,4,2                ; @ERESTARTSYS
l_.str.1:                               ; @.str.1
	.asciz	"Write at (%d, %d) of block 0x%X at phase %d failed: could not communicate with VMU"

l_.str.2:                               ; @.str.2
	.asciz	"VMU (%d, %d): write failed\n"

	.no_dead_strip	_maple_vmu_write_block
.subsections_via_symbols
