	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tpg_alloc                      ## -- Begin function tpg_alloc
	.p2align	4, 0x90
_tpg_alloc:                             ## @tpg_alloc
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %r12
	movl	%esi, (%rdi)
	movq	_TPG_MAX_PAT_LINES@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_TPG_MAX_PLANES@GOTPCREL(%rip), %rax
	testl	%ecx, %ecx
	je	LBB0_2
## %bb.1:
	movl	(%rax), %eax
	xorl	%r15d, %r15d
	movl	%eax, %edx
	jmp	LBB0_12
LBB0_2:
	movl	(%rax), %eax
LBB0_3:
	testl	%eax, %eax
	je	LBB0_20
## %bb.4:
	xorl	%ebx, %ebx
	movq	_TPG_MAX_PLANES@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	testq	%rbx, %rbx
	sete	%al
	leal	(%rax,%rax), %r15d
	addl	$2, %r15d
	movl	%r15d, %edi
	movl	%r14d, %esi
	callq	_array_size
	movl	%eax, %edi
	callq	_vzalloc
	movq	24(%r12), %rcx
	movq	%rax, (%rcx,%rbx,8)
	movq	24(%r12), %rax
	cmpq	$0, (%rax,%rbx,8)
	je	LBB0_18
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	%r15d, %edi
	movl	%r14d, %esi
	callq	_array_size
	movl	%eax, %edi
	callq	_vzalloc
	movq	16(%r12), %rcx
	movq	%rax, (%rcx,%rbx,8)
	movq	16(%r12), %rax
	cmpq	$0, (%rax,%rbx,8)
	je	LBB0_18
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	%r14d, %edi
	movl	$2, %esi
	movl	%r15d, %edx
	callq	_array3_size
	movl	%eax, %edi
	callq	_vzalloc
	movq	8(%r12), %rcx
	movq	%rax, (%rcx,%rbx,8)
	movq	8(%r12), %rax
	cmpq	$0, (%rax,%rbx,8)
	je	LBB0_18
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	incq	%rbx
	movl	(%r13), %eax
	cmpq	%rax, %rbx
	jb	LBB0_5
LBB0_20:
	xorl	%eax, %eax
	jmp	LBB0_19
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	_TPG_MAX_PAT_LINES@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%eax, %edx
LBB0_11:                                ##   in Loop: Header=BB0_12 Depth=1
	incq	%r15
	movl	%ecx, %esi
	cmpq	%rsi, %r15
	jae	LBB0_3
LBB0_12:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_15 Depth 2
	testl	%edx, %edx
	movl	$0, %edx
	je	LBB0_11
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	xorl	%r13d, %r13d
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_15 Depth=2
	incl	%r13d
	movq	_TPG_MAX_PLANES@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %r13d
	jae	LBB0_10
LBB0_15:                                ##   Parent Loop BB0_12 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	xorl	%eax, %eax
	testl	%r13d, %r13d
	sete	%al
	leal	(%rax,%rax), %ebx
	addl	$2, %ebx
	movl	%r14d, %edi
	movl	$2, %esi
	movl	%ebx, %edx
	callq	_array3_size
	movl	%eax, %edi
	callq	_vzalloc
	movq	40(%r12), %rcx
	movq	(%rcx,%r15,8), %rcx
	movl	%r13d, %r13d
	movq	%rax, (%rcx,%r13,8)
	movq	40(%r12), %rax
	movq	(%rax,%r15,8), %rax
	cmpq	$0, (%rax,%r13,8)
	je	LBB0_18
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=2
	testq	%r13, %r13
	je	LBB0_14
## %bb.17:                              ##   in Loop: Header=BB0_15 Depth=2
	movl	%r14d, %edi
	movl	$2, %esi
	movl	%ebx, %edx
	callq	_array3_size
	movl	%eax, %edi
	callq	_vzalloc
	movq	32(%r12), %rcx
	movq	(%rcx,%r15,8), %rcx
	movq	%rax, (%rcx,%r13,8)
	movq	32(%r12), %rax
	movq	(%rax,%r15,8), %rax
	cmpq	$0, (%rax,%r13,8)
	jne	LBB0_14
LBB0_18:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_19:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_TPG_MAX_PAT_LINES,4,2          ## @TPG_MAX_PAT_LINES
	.comm	_TPG_MAX_PLANES,4,2             ## @TPG_MAX_PLANES
	.comm	_ENOMEM,4,2                     ## @ENOMEM
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tpg_alloc                      ; -- Begin function tpg_alloc
	.p2align	2
_tpg_alloc:                             ; @tpg_alloc
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x19, x1
	mov	x20, x0
	str	w1, [x0]
Lloh0:
	adrp	x8, _TPG_MAX_PAT_LINES@GOTPAGE
Lloh1:
	ldr	x8, [x8, _TPG_MAX_PAT_LINES@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x8]
	cbz	w9, LBB0_2
; %bb.1:
	mov	x23, #0
Lloh3:
	adrp	x24, _TPG_MAX_PLANES@GOTPAGE
Lloh4:
	ldr	x24, [x24, _TPG_MAX_PLANES@GOTPAGEOFF]
	ldr	w8, [x24]
	mov	w25, #2
	mov	w26, #4
	mov	x10, x8
	b	LBB0_12
LBB0_2:
Lloh5:
	adrp	x8, _TPG_MAX_PLANES@GOTPAGE
Lloh6:
	ldr	x8, [x8, _TPG_MAX_PLANES@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
LBB0_3:
	cbz	w8, LBB0_9
; %bb.4:
	mov	x22, #0
	mov	w23, #2
	mov	w24, #4
Lloh8:
	adrp	x25, _TPG_MAX_PLANES@GOTPAGE
Lloh9:
	ldr	x25, [x25, _TPG_MAX_PLANES@GOTPAGEOFF]
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	cmp	x22, #0
	csel	w21, w24, w23, eq
	mov	x0, x21
	mov	x1, x19
	bl	_array_size
	bl	_vzalloc
	ldr	x8, [x20, #24]
	lsl	x26, x22, #3
	str	x0, [x8, x26]
	ldr	x8, [x20, #24]
	ldr	x8, [x8, x26]
	cbz	x8, LBB0_18
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x21
	mov	x1, x19
	bl	_array_size
	bl	_vzalloc
	ldr	x8, [x20, #16]
	str	x0, [x8, x26]
	ldr	x8, [x20, #16]
	ldr	x8, [x8, x26]
	cbz	x8, LBB0_18
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	mov	w1, #2
	mov	x2, x21
	bl	_array3_size
	bl	_vzalloc
	ldr	x8, [x20, #8]
	str	x0, [x8, x26]
	ldr	x8, [x20, #8]
	ldr	x8, [x8, x26]
	cbz	x8, LBB0_18
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x22, x22, #1
	ldr	w8, [x25]
	cmp	x22, x8
	b.lo	LBB0_5
LBB0_9:
	mov	w0, #0
	b	LBB0_19
LBB0_10:                                ;   in Loop: Header=BB0_12 Depth=1
Lloh10:
	adrp	x9, _TPG_MAX_PAT_LINES@GOTPAGE
Lloh11:
	ldr	x9, [x9, _TPG_MAX_PAT_LINES@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	mov	x10, x8
LBB0_11:                                ;   in Loop: Header=BB0_12 Depth=1
	add	x23, x23, #1
	cmp	x23, w9, uxtw
	b.hs	LBB0_3
LBB0_12:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_15 Depth 2
	cbz	w10, LBB0_11
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	mov	w22, #0
	b	LBB0_15
LBB0_14:                                ;   in Loop: Header=BB0_15 Depth=2
	add	w22, w27, #1
	ldr	w8, [x24]
	cmp	w22, w8
	b.hs	LBB0_10
LBB0_15:                                ;   Parent Loop BB0_12 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	cmp	w22, #0
	csel	w21, w26, w25, eq
	mov	x0, x19
	mov	w1, #2
	mov	x2, x21
	bl	_array3_size
	bl	_vzalloc
	ldr	x8, [x20, #40]
	lsl	x28, x23, #3
	ldr	x8, [x8, x28]
	mov	w27, w22
	lsl	x22, x27, #3
	str	x0, [x8, x22]
	ldr	x8, [x20, #40]
	ldr	x8, [x8, x28]
	ldr	x8, [x8, x22]
	cbz	x8, LBB0_18
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=2
	cbz	w27, LBB0_14
; %bb.17:                               ;   in Loop: Header=BB0_15 Depth=2
	mov	x0, x19
	mov	w1, #2
	mov	x2, x21
	bl	_array3_size
	bl	_vzalloc
	ldr	x8, [x20, #32]
	ldr	x8, [x8, x28]
	str	x0, [x8, x22]
	ldr	x8, [x20, #32]
	ldr	x8, [x8, x28]
	ldr	x8, [x8, x22]
	cbnz	x8, LBB0_14
LBB0_18:
Lloh13:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_19:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_TPG_MAX_PAT_LINES,4,2          ; @TPG_MAX_PAT_LINES
	.comm	_TPG_MAX_PLANES,4,2             ; @TPG_MAX_PLANES
	.comm	_ENOMEM,4,2                     ; @ENOMEM
.subsections_via_symbols
