	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cpia2_allocate_buffers         ## -- Begin function cpia2_allocate_buffers
	.p2align	4, 0x90
_cpia2_allocate_buffers:                ## @cpia2_allocate_buffers
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	cmpq	$0, 24(%rdi)
	jne	LBB0_4
## %bb.1:
	movl	(%r15), %edi
	shll	$2, %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kmalloc
	movq	%rax, 24(%r15)
	testq	%rax, %rax
	je	LBB0_2
LBB0_4:
	movq	32(%r15), %rax
	testq	%rax, %rax
	jne	LBB0_7
## %bb.5:
	movl	(%r15), %edi
	imull	4(%r15), %edi
	callq	_rvmalloc
	movq	%rax, 32(%r15)
	testq	%rax, %rax
	je	LBB0_6
LBB0_7:
	movl	(%r15), %r8d
	xorl	%r14d, %r14d
	movq	24(%r15), %rdx
	movslq	4(%r15), %r10
	movl	$0, %esi
	cmpl	$2, %r8d
	jl	LBB0_11
## %bb.8:
	decl	%r8d
	movl	%r8d, %r11d
	leaq	48(%rdx), %rsi
	xorl	%ecx, %ecx
	movq	_FRAME_EMPTY@GOTPCREL(%rip), %r9
	xorps	%xmm0, %xmm0
	movq	%rax, %rbx
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rsi, -40(%rsi)
	movq	%rbx, -8(%rsi)
	movq	(%r9), %rdi
	movq	%rdi, -16(%rsi)
	movups	%xmm0, -32(%rsi)
	movl	%ecx, -48(%rsi)
	leaq	1(%rcx), %rdi
	addq	%r10, %rbx
	addq	$48, %rsi
	movq	%rdi, %rcx
	cmpq	%rdi, %r11
	jne	LBB0_9
## %bb.10:
	movl	%r8d, %esi
LBB0_11:
	movl	%esi, %ecx
	leaq	(%rcx,%rcx,2), %rcx
	shlq	$4, %rcx
	movq	%rdx, 8(%rdx,%rcx)
	imull	%esi, %r10d
	movslq	%r10d, %rdi
	addq	%rdi, %rax
	movq	%rax, 40(%rdx,%rcx)
	movq	_FRAME_EMPTY@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 32(%rdx,%rcx)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rdx,%rcx)
	movl	%esi, (%rdx,%rcx)
	movq	%rdx, 16(%r15)
	movq	8(%rdx), %rcx
	movq	%rcx, 8(%r15)
	leaq	L_.str.2(%rip), %rdi
	movq	%rdx, %rsi
	callq	_DBG
	jmp	LBB0_12
LBB0_2:
	leaq	L_.str(%rip), %rdi
	callq	_ERR
	jmp	LBB0_3
LBB0_6:
	leaq	L_.str.1(%rip), %rdi
	callq	_ERR
	movq	24(%r15), %rdi
	callq	_kfree
	movq	$0, 24(%r15)
LBB0_3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_12:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"couldn't kmalloc frame buffer structures\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.1:                               ## @.str.1
	.asciz	"couldn't vmalloc frame buffer data area\n"

	.comm	_FRAME_EMPTY,8,3                ## @FRAME_EMPTY
L_.str.2:                               ## @.str.2
	.asciz	"buffers=%p, curbuff=%p, workbuff=%p\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cpia2_allocate_buffers         ; -- Begin function cpia2_allocate_buffers
	.p2align	2
_cpia2_allocate_buffers:                ; @cpia2_allocate_buffers
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	x8, [x0, #24]
	cbnz	x8, LBB0_2
; %bb.1:
	ldr	w8, [x19]
	lsl	w0, w8, #2
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_kmalloc
	str	x0, [x19, #24]
	cbz	x0, LBB0_9
LBB0_2:
	ldr	x0, [x19, #32]
	cbnz	x0, LBB0_4
; %bb.3:
	ldp	w9, w8, [x19]
	mul	w0, w9, w8
	bl	_rvmalloc
	str	x0, [x19, #32]
	cbz	x0, LBB0_10
LBB0_4:
	ldr	x1, [x19, #24]
	ldp	w10, w8, [x19]
                                        ; kill: def $w8 killed $w8 def $x8
	sxtw	x8, w8
Lloh3:
	adrp	x9, _FRAME_EMPTY@GOTPAGE
Lloh4:
	ldr	x9, [x9, _FRAME_EMPTY@GOTPAGEOFF]
	cmp	w10, #2
	b.lt	LBB0_7
; %bb.5:
	mov	x11, #0
	mov	w12, #0
	sub	w10, w10, #1
	mov	w13, #48
	umull	x13, w10, w13
	mov	x14, x0
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	add	x15, x1, x11
	add	x16, x15, #48
	str	x16, [x15, #8]
	ldr	x16, [x9]
	stp	x16, x14, [x15, #32]
	stp	xzr, xzr, [x15, #16]
	str	w12, [x15]
	add	w12, w12, #1
	add	x14, x14, x8
	add	x11, x11, #48
	cmp	x13, x11
	b.ne	LBB0_6
	b	LBB0_8
LBB0_7:
	mov	w10, #0
LBB0_8:
	mov	w11, #48
	umaddl	x11, w10, w11, x1
	str	x1, [x11, #8]
	mul	w8, w8, w10
	add	x8, x0, w8, sxtw
	ldr	x9, [x9]
	stp	x9, x8, [x11, #32]
	stp	xzr, xzr, [x11, #16]
	str	w10, [x11]
	ldr	x3, [x1, #8]
	stp	x3, x1, [x19, #8]
Lloh5:
	adrp	x0, l_.str.2@PAGE
Lloh6:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x2, x1
	bl	_DBG
	mov	w0, #0
	b	LBB0_12
LBB0_9:
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ERR
	b	LBB0_11
LBB0_10:
Lloh9:
	adrp	x0, l_.str.1@PAGE
Lloh10:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_ERR
	ldr	x0, [x19, #24]
	bl	_kfree
	str	xzr, [x19, #24]
LBB0_11:
Lloh11:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_12:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"couldn't kmalloc frame buffer structures\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.1:                               ; @.str.1
	.asciz	"couldn't vmalloc frame buffer data area\n"

	.comm	_FRAME_EMPTY,8,3                ; @FRAME_EMPTY
l_.str.2:                               ; @.str.2
	.asciz	"buffers=%p, curbuff=%p, workbuff=%p\n"

.subsections_via_symbols
