	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function psp_v12_0_cmd_submit
_psp_v12_0_cmd_submit:                  ## @psp_v12_0_cmd_submit
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, -52(%rbp)                 ## 4-byte Spill
	movl	%edx, -48(%rbp)                 ## 4-byte Spill
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	movq	16(%rdi), %r13
	movslq	8(%rdi), %rcx
	movabsq	$-3689348814741910323, %rdx     ## imm = 0xCCCCCCCCCCCCCCCD
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rbx
	shrq	$5, %rbx
	leal	3(%rcx), %r12d
	testq	%rcx, %rcx
	cmovnsl	%ecx, %r12d
	sarl	$2, %r12d
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	callq	_psp_v12_0_support_vmr_ring
	movq	_MP0@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	testq	%rax, %rax
	jne	LBB0_1
## %bb.2:
	movq	_mmMP0_SMN_C2PMSG_67@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_mmMP0_SMN_C2PMSG_102@GOTPCREL(%rip), %rax
LBB0_3:
	leaq	(%rbx,%rbx,4), %rbx
	movl	(%rax), %edx
	xorl	%esi, %esi
	callq	_RREG32_SOC15
	movl	%eax, %r15d
	xorl	%edx, %edx
	divl	%r12d
	movq	%r13, %r14
	testl	%edx, %edx
	je	LBB0_5
## %bb.4:
	movl	%r15d, %eax
	movl	$3435973837, %ecx               ## imm = 0xCCCCCCCD
	imulq	%rax, %rcx
	shrq	$35, %rcx
	leaq	(%rcx,%rcx,4), %rax
	leaq	(,%rax,8), %r14
	addq	%r13, %r14
LBB0_5:
	leaq	-40(,%rbx,8), %rdx
	addq	%r13, %rdx
	cmpq	%r13, %r14
	jb	LBB0_7
## %bb.6:
	cmpq	%r14, %rdx
	jb	LBB0_7
## %bb.8:
	xorl	%r13d, %r13d
	movq	%r14, %rdi
	xorl	%esi, %esi
	movl	$40, %edx
	callq	_memset
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %edi
	callq	_upper_32_bits
	movq	%rax, 32(%r14)
	movl	%ebx, %edi
	callq	_lower_32_bits
	movq	%rax, 24(%r14)
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %edi
	callq	_upper_32_bits
	movq	%rax, 16(%r14)
	movl	%ebx, %edi
	callq	_lower_32_bits
	movq	%rax, 8(%r14)
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, (%r14)
	addl	$10, %r15d
	movl	%r15d, %eax
	xorl	%edx, %edx
	divl	%r12d
	movl	%edx, %r14d
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_psp_v12_0_support_vmr_ring
	movq	_MP0@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:
	movq	_mmMP0_SMN_C2PMSG_102@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%esi, %esi
	movl	%r14d, %ecx
	callq	_WREG32_SOC15
	movl	(%rbx), %edi
	movq	_mmMP0_SMN_C2PMSG_101@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_GFX_CTRL_CMD_ID_CONSUME_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	xorl	%esi, %esi
	jmp	LBB0_11
LBB0_7:
	leaq	L_.str(%rip), %rdi
	movq	%r13, %rsi
	xorl	%r13d, %r13d
	movq	%r14, %rcx
	xorl	%eax, %eax
	callq	_DRM_ERROR
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
	jmp	LBB0_12
LBB0_10:
	movq	_mmMP0_SMN_C2PMSG_67@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%r13d, %r13d
	xorl	%esi, %esi
	movl	%r14d, %ecx
LBB0_11:
	callq	_WREG32_SOC15
LBB0_12:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MP0,4,2                        ## @MP0
	.comm	_mmMP0_SMN_C2PMSG_102,4,2       ## @mmMP0_SMN_C2PMSG_102
	.comm	_mmMP0_SMN_C2PMSG_67,4,2        ## @mmMP0_SMN_C2PMSG_67
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ring_buffer_start = %p; ring_buffer_end = %p; write_frame = %p\n"

L_.str.1:                               ## @.str.1
	.asciz	"write_frame is pointing to address out of bounds\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_mmMP0_SMN_C2PMSG_101,4,2       ## @mmMP0_SMN_C2PMSG_101
	.comm	_GFX_CTRL_CMD_ID_CONSUME_CMD,4,2 ## @GFX_CTRL_CMD_ID_CONSUME_CMD
	.no_dead_strip	_psp_v12_0_cmd_submit
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function psp_v12_0_cmd_submit
_psp_v12_0_cmd_submit:                  ; @psp_v12_0_cmd_submit
	.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	x20, x3
	mov	x21, x2
	mov	x22, x1
	mov	x19, x0
	ldr	x26, [x0, #16]
	ldrsw	x8, [x0, #8]
	mov	x9, #-3689348814741910324
	movk	x9, #52429
	umulh	x9, x8, x9
	lsr	x9, x9, #5
	mov	w10, #40
	madd	x27, x9, x10, x26
	add	w9, w8, #3
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w28, w8, #2
	bl	_psp_v12_0_support_vmr_ring
Lloh0:
	adrp	x25, _MP0@GOTPAGE
Lloh1:
	ldr	x25, [x25, _MP0@GOTPAGEOFF]
Lloh2:
	adrp	x9, _mmMP0_SMN_C2PMSG_67@GOTPAGE
Lloh3:
	ldr	x9, [x9, _mmMP0_SMN_C2PMSG_67@GOTPAGEOFF]
	ldr	w8, [x25]
Lloh4:
	adrp	x10, _mmMP0_SMN_C2PMSG_102@GOTPAGE
Lloh5:
	ldr	x10, [x10, _mmMP0_SMN_C2PMSG_102@GOTPAGEOFF]
	cmp	x0, #0
	csel	x9, x9, x10, eq
	ldr	w2, [x9]
	mov	x0, x8
	mov	w1, #0
	bl	_RREG32_SOC15
	mov	x23, x0
	udiv	w8, w0, w28
	msub	w8, w8, w28, w0
	mov	x24, x26
	cbz	w8, LBB0_2
; %bb.1:
	mov	w8, #52429
	movk	w8, #52428, lsl #16
	umull	x8, w23, w8
	lsr	x8, x8, #35
	mov	w9, #40
	madd	x24, x8, x9, x26
LBB0_2:
	sub	x8, x27, #40
	cmp	x24, x26
	b.lo	LBB0_6
; %bb.3:
	cmp	x8, x24
	b.lo	LBB0_6
; %bb.4:
	mov	x0, x24
	mov	w1, #0
	mov	w2, #40
	bl	_memset
	mov	x0, x22
	bl	_upper_32_bits
	str	x0, [x24, #32]
	mov	x0, x22
	bl	_lower_32_bits
	str	x0, [x24, #24]
	mov	x0, x21
	bl	_upper_32_bits
	str	x0, [x24, #16]
	mov	x0, x21
	bl	_lower_32_bits
	str	x0, [x24, #8]
	str	w20, [x24]
	add	w8, w23, #10
	udiv	w9, w8, w28
	msub	w20, w9, w28, w8
	mov	x0, x19
	bl	_psp_v12_0_support_vmr_ring
	mov	x8, x0
	ldr	w0, [x25]
	cbz	x8, LBB0_7
; %bb.5:
Lloh6:
	adrp	x8, _mmMP0_SMN_C2PMSG_102@GOTPAGE
Lloh7:
	ldr	x8, [x8, _mmMP0_SMN_C2PMSG_102@GOTPAGEOFF]
Lloh8:
	ldr	w2, [x8]
	mov	w1, #0
	mov	x3, x20
	bl	_WREG32_SOC15
	ldr	w0, [x25]
Lloh9:
	adrp	x8, _mmMP0_SMN_C2PMSG_101@GOTPAGE
Lloh10:
	ldr	x8, [x8, _mmMP0_SMN_C2PMSG_101@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
Lloh12:
	adrp	x8, _GFX_CTRL_CMD_ID_CONSUME_CMD@GOTPAGE
Lloh13:
	ldr	x8, [x8, _GFX_CTRL_CMD_ID_CONSUME_CMD@GOTPAGEOFF]
Lloh14:
	ldr	w3, [x8]
	mov	w1, #0
	b	LBB0_8
LBB0_6:
	stp	x8, x24, [sp, #8]
	str	x26, [sp]
Lloh15:
	adrp	x0, l_.str@PAGE
Lloh16:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
Lloh17:
	adrp	x0, l_.str.1@PAGE
Lloh18:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DRM_ERROR
Lloh19:
	adrp	x8, _EINVAL@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_9
LBB0_7:
Lloh22:
	adrp	x8, _mmMP0_SMN_C2PMSG_67@GOTPAGE
Lloh23:
	ldr	x8, [x8, _mmMP0_SMN_C2PMSG_67@GOTPAGEOFF]
Lloh24:
	ldr	w2, [x8]
	mov	w1, #0
	mov	x3, x20
LBB0_8:
	bl	_WREG32_SOC15
	mov	w0, #0
LBB0_9:
	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 AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_MP0,4,2                        ; @MP0
	.comm	_mmMP0_SMN_C2PMSG_102,4,2       ; @mmMP0_SMN_C2PMSG_102
	.comm	_mmMP0_SMN_C2PMSG_67,4,2        ; @mmMP0_SMN_C2PMSG_67
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ring_buffer_start = %p; ring_buffer_end = %p; write_frame = %p\n"

l_.str.1:                               ; @.str.1
	.asciz	"write_frame is pointing to address out of bounds\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_mmMP0_SMN_C2PMSG_101,4,2       ; @mmMP0_SMN_C2PMSG_101
	.comm	_GFX_CTRL_CMD_ID_CONSUME_CMD,4,2 ; @GFX_CTRL_CMD_ID_CONSUME_CMD
	.no_dead_strip	_psp_v12_0_cmd_submit
.subsections_via_symbols
