	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function goya_memset_device_memory
_goya_memset_device_memory:             ## @goya_memset_device_memory
	.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	%r8d, -48(%rbp)                 ## 4-byte Spill
	movl	%ecx, %ebx
	movl	%edx, %r14d
	movl	%esi, %r15d
	movq	%rdi, %r13
	movq	_SZ_2G@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%edx, %edi
	callq	_DIV_ROUND_UP_ULL
	movl	%eax, %r12d
	movl	%eax, %esi
	shll	$5, %esi
	orl	$4, %esi
	movq	%r13, %rdi
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	callq	_hl_cb_kernel_create
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	8(%rax), %r13
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	callq	_cpu_to_le32
	movq	%rax, (%r13)
	movq	_SZ_2G@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	subl	%eax, %r14d
	addl	%eax, %r15d
	addq	$32, %r13
	decl	%r12d
	je	LBB0_8
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	$32, %edx
	callq	_memset
	movq	_PACKET_LIN_DMA@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_GOYA_PKT_CTL_OPCODE_SHIFT@GOTPCREL(%rip), %rax
	movzbl	(%rax), %ecx
	shll	%cl, %edi
	movq	_GOYA_PKT_LIN_DMA_CTL_MEMSET_SHIFT@GOTPCREL(%rip), %rax
	movzbl	(%rax), %eax
	btsl	%eax, %edi
	movq	_GOYA_PKT_LIN_DMA_CTL_WO_SHIFT@GOTPCREL(%rip), %rax
	movzbl	(%rax), %eax
	btsl	%eax, %edi
	movq	_GOYA_PKT_CTL_RB_SHIFT@GOTPCREL(%rip), %rax
	movzbl	(%rax), %eax
	btsl	%eax, %edi
	movq	_GOYA_PKT_CTL_MB_SHIFT@GOTPCREL(%rip), %rax
	movzbl	(%rax), %eax
	btsl	%eax, %edi
	movq	_DMA_HOST_TO_DRAM@GOTPCREL(%rip), %rax
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_DMA_HOST_TO_SRAM@GOTPCREL(%rip), %rax
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=1
	movl	(%rax), %eax
	movq	_GOYA_PKT_LIN_DMA_CTL_DMA_DIR_SHIFT@GOTPCREL(%rip), %rcx
	movzbl	(%rcx), %ecx
	shll	%cl, %eax
	orl	%eax, %edi
	callq	_cpu_to_le32
	movq	%rax, 24(%r13)
	movl	%ebx, %edi
	callq	_cpu_to_le64
	movq	%rax, 16(%r13)
	movl	%r15d, %edi
	callq	_cpu_to_le64
	movq	%rax, 8(%r13)
	movl	%r14d, %edi
	cmpl	$2, %r12d
	jl	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_SZ_2G@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	jmp	LBB0_7
LBB0_8:
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_hl_cs_allocate_job
	testq	%rax, %rax
	je	LBB0_9
## %bb.10:
	movq	%rax, %rbx
	movq	$0, 32(%rax)
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, 16(%rax)
	incl	4(%r12)
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	%ecx, (%rax)
	movq	_GOYA_QUEUE_ID_DMA_0@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%rbx)
	movq	%r12, 8(%rbx)
	movl	%ecx, 4(%rbx)
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_hl_debugfs_add_job
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_goya_send_job_on_qman0
	movl	%eax, %r14d
	movq	8(%rbx), %rdi
	callq	_hl_cb_put
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_hl_debugfs_remove_job
	movq	%rbx, %rdi
	callq	_kfree
	movq	%r12, %rdi
	decl	4(%r12)
	jmp	LBB0_11
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_12
LBB0_9:
	movl	4(%r15), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
LBB0_11:
	movq	%rdi, %rbx
	callq	_hl_cb_put
	movl	(%rbx), %edx
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %edx
	movq	%r15, %rdi
	movq	%r15, %rsi
	callq	_hl_cb_destroy
LBB0_12:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SZ_2G,4,2                      ## @SZ_2G
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_PACKET_LIN_DMA,4,2             ## @PACKET_LIN_DMA
	.comm	_GOYA_PKT_CTL_OPCODE_SHIFT,4,2  ## @GOYA_PKT_CTL_OPCODE_SHIFT
	.comm	_GOYA_PKT_LIN_DMA_CTL_MEMSET_SHIFT,4,2 ## @GOYA_PKT_LIN_DMA_CTL_MEMSET_SHIFT
	.comm	_GOYA_PKT_LIN_DMA_CTL_WO_SHIFT,4,2 ## @GOYA_PKT_LIN_DMA_CTL_WO_SHIFT
	.comm	_GOYA_PKT_CTL_RB_SHIFT,4,2      ## @GOYA_PKT_CTL_RB_SHIFT
	.comm	_GOYA_PKT_CTL_MB_SHIFT,4,2      ## @GOYA_PKT_CTL_MB_SHIFT
	.comm	_DMA_HOST_TO_DRAM,4,2           ## @DMA_HOST_TO_DRAM
	.comm	_DMA_HOST_TO_SRAM,4,2           ## @DMA_HOST_TO_SRAM
	.comm	_GOYA_PKT_LIN_DMA_CTL_DMA_DIR_SHIFT,4,2 ## @GOYA_PKT_LIN_DMA_CTL_DMA_DIR_SHIFT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to allocate a new job\n"

	.comm	_GOYA_QUEUE_ID_DMA_0,4,2        ## @GOYA_QUEUE_ID_DMA_0
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.no_dead_strip	_goya_memset_device_memory
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function goya_memset_device_memory
_goya_memset_device_memory:             ; @goya_memset_device_memory
	.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, x4
	mov	x23, x3
	mov	x24, x2
	mov	x25, x1
	mov	x19, x0
Lloh0:
	adrp	x28, _SZ_2G@GOTPAGE
Lloh1:
	ldr	x28, [x28, _SZ_2G@GOTPAGEOFF]
	ldr	w1, [x28]
	mov	x0, x2
	bl	_DIV_ROUND_UP_ULL
	mov	x26, x0
	mov	w20, #4
	bfi	w20, w0, #5, #27
	mov	x0, x19
	mov	x1, x20
	bl	_hl_cb_kernel_create
	cbz	x0, LBB0_5
; %bb.1:
	str	w20, [sp, #12]                  ; 4-byte Folded Spill
	stp	x0, x19, [sp, #16]              ; 16-byte Folded Spill
	ldr	x27, [x0, #8]
	mov	w19, #1
Lloh2:
	adrp	x21, _DMA_HOST_TO_SRAM@GOTPAGE
Lloh3:
	ldr	x21, [x21, _DMA_HOST_TO_SRAM@GOTPAGEOFF]
Lloh4:
	adrp	x20, _GOYA_PKT_LIN_DMA_CTL_DMA_DIR_SHIFT@GOTPAGE
Lloh5:
	ldr	x20, [x20, _GOYA_PKT_LIN_DMA_CTL_DMA_DIR_SHIFT@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x27
	mov	w1, #0
	mov	w2, #32
	bl	_memset
Lloh6:
	adrp	x8, _PACKET_LIN_DMA@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PACKET_LIN_DMA@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
Lloh9:
	adrp	x9, _GOYA_PKT_CTL_OPCODE_SHIFT@GOTPAGE
Lloh10:
	ldr	x9, [x9, _GOYA_PKT_CTL_OPCODE_SHIFT@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	lsl	w8, w8, w9
Lloh12:
	adrp	x9, _GOYA_PKT_LIN_DMA_CTL_MEMSET_SHIFT@GOTPAGE
Lloh13:
	ldr	x9, [x9, _GOYA_PKT_LIN_DMA_CTL_MEMSET_SHIFT@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	lsl	w9, w19, w9
	orr	w8, w9, w8
Lloh15:
	adrp	x9, _GOYA_PKT_LIN_DMA_CTL_WO_SHIFT@GOTPAGE
Lloh16:
	ldr	x9, [x9, _GOYA_PKT_LIN_DMA_CTL_WO_SHIFT@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	lsl	w9, w19, w9
	orr	w8, w8, w9
Lloh18:
	adrp	x9, _GOYA_PKT_CTL_RB_SHIFT@GOTPAGE
Lloh19:
	ldr	x9, [x9, _GOYA_PKT_CTL_RB_SHIFT@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	lsl	w9, w19, w9
	orr	w8, w8, w9
Lloh21:
	adrp	x9, _GOYA_PKT_CTL_MB_SHIFT@GOTPAGE
Lloh22:
	ldr	x9, [x9, _GOYA_PKT_CTL_MB_SHIFT@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	lsl	w9, w19, w9
	orr	w8, w8, w9
	cmp	w22, #0
Lloh24:
	adrp	x9, _DMA_HOST_TO_DRAM@GOTPAGE
Lloh25:
	ldr	x9, [x9, _DMA_HOST_TO_DRAM@GOTPAGEOFF]
	csel	x9, x21, x9, eq
	ldr	w9, [x9]
	ldr	w10, [x20]
	lsl	w9, w9, w10
	orr	w0, w8, w9
	bl	_cpu_to_le32
	str	x0, [x27, #24]
	mov	x0, x23
	bl	_cpu_to_le64
	str	x0, [x27, #16]
	mov	x0, x25
	bl	_cpu_to_le64
	str	x0, [x27, #8]
	ldr	w8, [x28]
	subs	w26, w26, #1
	csel	w0, w8, w24, gt
	bl	_cpu_to_le32
	str	x0, [x27], #32
	ldr	w8, [x28]
	sub	w24, w24, w8
	add	w25, w8, w25
	cbnz	w26, LBB0_2
; %bb.3:
	ldr	x19, [sp, #24]                  ; 8-byte Folded Reload
	mov	x0, x19
	mov	w1, #1
	bl	_hl_cs_allocate_job
	cbz	x0, LBB0_6
; %bb.4:
	mov	x22, x0
	str	xzr, [x0, #32]
	ldr	x20, [sp, #16]                  ; 8-byte Folded Reload
	ldr	w8, [x20, #4]
	add	w8, w8, #1
	str	w8, [x20, #4]
Lloh26:
	adrp	x8, _GOYA_QUEUE_ID_DMA_0@GOTPAGE
Lloh27:
	ldr	x8, [x8, _GOYA_QUEUE_ID_DMA_0@GOTPAGEOFF]
	ldr	w9, [sp, #12]                   ; 4-byte Folded Reload
	stp	w9, w9, [x0]
Lloh28:
	ldr	w8, [x8]
	str	w8, [x0, #24]
	stp	x20, x20, [x0, #8]
	mov	x0, x19
	mov	x1, x22
	bl	_hl_debugfs_add_job
	mov	x0, x19
	mov	x1, x22
	bl	_goya_send_job_on_qman0
	mov	x21, x0
	ldr	x0, [x22, #8]
	bl	_hl_cb_put
	mov	x0, x19
	mov	x1, x22
	bl	_hl_debugfs_remove_job
	mov	x0, x22
	bl	_kfree
	ldr	w8, [x20, #4]
	sub	w8, w8, #1
	str	w8, [x20, #4]
	b	LBB0_7
LBB0_5:
Lloh29:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh30:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh31:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_8
LBB0_6:
	ldr	w0, [x19, #4]
Lloh32:
	adrp	x1, l_.str@PAGE
Lloh33:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh34:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh35:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh36:
	ldr	w8, [x8]
	neg	w21, w8
	ldr	x20, [sp, #16]                  ; 8-byte Folded Reload
LBB0_7:
	mov	x0, x20
	bl	_hl_cb_put
	ldr	w8, [x20]
Lloh37:
	adrp	x9, _PAGE_SHIFT@GOTPAGE
Lloh38:
	ldr	x9, [x9, _PAGE_SHIFT@GOTPAGEOFF]
Lloh39:
	ldr	w9, [x9]
	lsl	w2, w8, w9
	mov	x0, x19
	mov	x1, x19
	bl	_hl_cb_destroy
LBB0_8:
	mov	x0, x21
	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	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.cfi_endproc
                                        ; -- End function
	.comm	_SZ_2G,4,2                      ; @SZ_2G
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_PACKET_LIN_DMA,4,2             ; @PACKET_LIN_DMA
	.comm	_GOYA_PKT_CTL_OPCODE_SHIFT,4,2  ; @GOYA_PKT_CTL_OPCODE_SHIFT
	.comm	_GOYA_PKT_LIN_DMA_CTL_MEMSET_SHIFT,4,2 ; @GOYA_PKT_LIN_DMA_CTL_MEMSET_SHIFT
	.comm	_GOYA_PKT_LIN_DMA_CTL_WO_SHIFT,4,2 ; @GOYA_PKT_LIN_DMA_CTL_WO_SHIFT
	.comm	_GOYA_PKT_CTL_RB_SHIFT,4,2      ; @GOYA_PKT_CTL_RB_SHIFT
	.comm	_GOYA_PKT_CTL_MB_SHIFT,4,2      ; @GOYA_PKT_CTL_MB_SHIFT
	.comm	_DMA_HOST_TO_DRAM,4,2           ; @DMA_HOST_TO_DRAM
	.comm	_DMA_HOST_TO_SRAM,4,2           ; @DMA_HOST_TO_SRAM
	.comm	_GOYA_PKT_LIN_DMA_CTL_DMA_DIR_SHIFT,4,2 ; @GOYA_PKT_LIN_DMA_CTL_DMA_DIR_SHIFT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to allocate a new job\n"

	.comm	_GOYA_QUEUE_ID_DMA_0,4,2        ; @GOYA_QUEUE_ID_DMA_0
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.no_dead_strip	_goya_memset_device_memory
.subsections_via_symbols
