	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_BG_UpdateItems                 ## -- Begin function BG_UpdateItems
	.p2align	4, 0x90
_BG_UpdateItems:                        ## @BG_UpdateItems
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_bg_numItems@GOTPCREL(%rip), %r15
	movl	(%r15), %ebx
	movq	_bg_defaultNumItems@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	xorl	%eax, %eax
	callq	_dmlab_itemcount
	cmpl	%eax, %ebx
	je	LBB0_9
## %bb.1:
	xorl	%eax, %eax
	callq	_dmlab_itemcount
	cmpl	%eax, %ebx
	jge	LBB0_8
## %bb.2:
	leaq	-68(%rbp), %r12
	movq	_MAX_ITEMS@GOTPCREL(%rip), %r13
	leaq	-72(%rbp), %r14
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	incl	%ebx
	xorl	%eax, %eax
	callq	_dmlab_itemcount
	cmpl	%eax, %ebx
	jge	LBB0_8
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %eax
	decl	%eax
	cmpl	%eax, (%r15)
	jge	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	-48(%rbp), %esi
	movl	-56(%rbp), %r9d
	movl	-52(%rbp), %ecx
	subq	$8, %rsp
	movl	%ebx, %edi
	movl	$4, %edx
	movl	$4, %r8d
	pushq	%r14
	pushq	%r12
	leaq	-64(%rbp), %rax
	pushq	%rax
	leaq	-60(%rbp), %rax
	pushq	%rax
	pushq	$4
	callq	_dmlab_item
	addq	$48, %rsp
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movslq	(%r15), %rsi
	leal	1(%rsi), %eax
	movl	%eax, (%r15)
	shlq	$3, %rsi
	movq	_bg_itemlist@GOTPCREL(%rip), %rax
	addq	(%rax), %rsi
	movq	%r14, %rdi
	callq	_BG_CreateItem
	jmp	LBB0_7
LBB0_4:
	movq	_ERR_DROP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_Com_Error
LBB0_8:
	movq	_bg_itemlist@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	(%r15), %rcx
	movq	$0, 8(%rax,%rcx,8)
LBB0_9:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_bg_numItems,4,2                ## @bg_numItems
	.comm	_bg_defaultNumItems,4,2         ## @bg_defaultNumItems
	.comm	_MAX_ITEMS,4,2                  ## @MAX_ITEMS
	.comm	_ERR_DROP,4,2                   ## @ERR_DROP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Ran out of space to allocate new item!"

	.comm	_bg_itemlist,8,3                ## @bg_itemlist
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_BG_UpdateItems                 ; -- Begin function BG_UpdateItems
	.p2align	2
_BG_UpdateItems:                        ; @BG_UpdateItems
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
Lloh0:
	adrp	x21, _bg_numItems@GOTPAGE
Lloh1:
	ldr	x21, [x21, _bg_numItems@GOTPAGEOFF]
	ldr	w8, [x21]
Lloh2:
	adrp	x9, _bg_defaultNumItems@GOTPAGE
Lloh3:
	ldr	x9, [x9, _bg_defaultNumItems@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	sub	w19, w8, w9
	bl	_dmlab_itemcount
	cmp	w19, w0
	b.eq	LBB0_9
; %bb.1:
	bl	_dmlab_itemcount
Lloh5:
	adrp	x22, _bg_itemlist@GOTPAGE
Lloh6:
	ldr	x22, [x22, _bg_itemlist@GOTPAGEOFF]
	cmp	w19, w0
	b.ge	LBB0_8
; %bb.2:
	add	x23, sp, #32
	add	x20, x23, #12
	add	x24, x23, #8
	orr	x25, x23, #0x4
Lloh7:
	adrp	x26, _MAX_ITEMS@GOTPAGE
Lloh8:
	ldr	x26, [x26, _MAX_ITEMS@GOTPAGEOFF]
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	w19, w19, #1
	bl	_dmlab_itemcount
	cmp	w19, w0
	b.ge	LBB0_8
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x21]
	ldr	w9, [x26]
	sub	w9, w9, #1
	cmp	w8, w9
	b.ge	LBB0_7
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldp	w3, w1, [sp, #52]
	ldr	w5, [sp, #48]
	stp	x25, x23, [sp, #8]
	str	x24, [sp]
	mov	x0, x19
	mov	w2, #4
	mov	w4, #4
	mov	w6, #4
	mov	x7, x20
	bl	_dmlab_item
	cbz	x0, LBB0_3
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x8, [x22]
	ldrsw	x9, [x21]
	add	w10, w9, #1
	str	w10, [x21]
	add	x1, x8, x9, lsl #3
	add	x0, sp, #32
	bl	_BG_CreateItem
	b	LBB0_3
LBB0_7:
Lloh9:
	adrp	x8, _ERR_DROP@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ERR_DROP@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
	bl	_Com_Error
LBB0_8:
	ldr	x8, [x22]
	ldrsw	x9, [x21]
	add	x8, x8, x9, lsl #3
	str	xzr, [x8, #8]
LBB0_9:
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_bg_numItems,4,2                ; @bg_numItems
	.comm	_bg_defaultNumItems,4,2         ; @bg_defaultNumItems
	.comm	_MAX_ITEMS,4,2                  ; @MAX_ITEMS
	.comm	_ERR_DROP,4,2                   ; @ERR_DROP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Ran out of space to allocate new item!"

	.comm	_bg_itemlist,8,3                ; @bg_itemlist
.subsections_via_symbols
