	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function alloc_cmd_buf
_alloc_cmd_buf:                         ## @alloc_cmd_buf
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	16(%rdi), %rax
	movq	(%rax), %r12
	movq	_API_CMD_BUF_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-36(%rbp), %rdx
	movq	%r12, %rdi
	callq	_dma_alloc_coherent
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	8(%rbx), %rcx
	movslq	%r14d, %rdx
	shlq	$4, %rdx
	movq	%rax, 8(%rcx,%rdx)
	movl	-36(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	cmpl	$128, (%rbx)
	jne	LBB0_4
## %bb.3:
	movl	-36(%rbp), %edi
	callq	_cpu_to_be64
	movl	%eax, (%r15)
	xorl	%eax, %eax
	jmp	LBB0_6
LBB0_1:
	leaq	L_.str(%rip), %rsi
	movq	%r12, %rdi
	callq	_dev_err
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	jmp	LBB0_5
LBB0_4:
	leaq	L_.str.1(%rip), %rsi
	movq	%r12, %rdi
	callq	_dev_err
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_free_cmd_buf
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_5:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_6:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_API_CMD_BUF_SIZE,4,2           ## @API_CMD_BUF_SIZE
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to allocate API CMD DMA memory\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.1:                               ## @.str.1
	.asciz	"Unsupported API CMD chain type\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_alloc_cmd_buf
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function alloc_cmd_buf
_alloc_cmd_buf:                         ; @alloc_cmd_buf
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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, x2
	mov	x21, x1
	mov	x20, x0
	ldr	x8, [x0, #16]
	ldr	x22, [x8]
Lloh0:
	adrp	x8, _API_CMD_BUF_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _API_CMD_BUF_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh5:
	ldr	w3, [x8]
	add	x2, sp, #12
	mov	x0, x22
	bl	_dma_alloc_coherent
	cbz	x0, LBB0_3
; %bb.1:
	ldr	x8, [x20, #8]
	add	x8, x8, w19, sxtw #4
	str	x0, [x8, #8]
	ldr	w9, [sp, #12]
	str	w9, [x8]
	ldr	w8, [x20]
	cmp	w8, #128
	b.ne	LBB0_4
; %bb.2:
	ldr	w0, [sp, #12]
	bl	_cpu_to_be64
	mov	x8, x0
	mov	w0, #0
	str	w8, [x21]
	b	LBB0_6
LBB0_3:
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x22
	bl	_dev_err
Lloh8:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x22
	bl	_dev_err
	mov	x0, x20
	mov	x1, x19
	bl	_free_cmd_buf
Lloh12:
	adrp	x8, _EINVAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_6:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_API_CMD_BUF_SIZE,4,2           ; @API_CMD_BUF_SIZE
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to allocate API CMD DMA memory\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.1:                               ; @.str.1
	.asciz	"Unsupported API CMD chain type\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_alloc_cmd_buf
.subsections_via_symbols
