	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_G_Spawn                        ## -- Begin function G_Spawn
	.p2align	4, 0x90
_G_Spawn:                               ## @G_Spawn
	.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
	movq	_g_entities@GOTPCREL(%rip), %rax
	movq	(%rax), %r8
	movq	_MAX_CLIENTS@GOTPCREL(%rip), %rax
	movq	(%rax), %r11
	leaq	(%r11,%r11,2), %rax
	leaq	(%r8,%rax,8), %r10
	movq	_level@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movl	%esi, %eax
	movq	_ENTITYNUM_MAX_NORMAL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r9d
	subl	%r11d, %eax
	jle	LBB0_1
## %bb.12:
	movl	$2000, %ecx                     ## imm = 0x7D0
	addq	8(%r15), %rcx
	movslq	16(%r15), %r14
	movq	%r10, %rbx
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_13 Depth=1
	addq	$24, %rbx
	decl	%eax
	je	LBB0_17
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	cmpq	$0, 16(%rbx)
	jne	LBB0_16
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	(%rbx), %rdi
	cmpq	%rcx, %rdi
	jle	LBB0_11
## %bb.15:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	%r14, %rdx
	subq	%rdi, %rdx
	cmpq	$1000, %rdx                     ## imm = 0x3E8
	jl	LBB0_16
	jmp	LBB0_11
LBB0_1:
	movq	%r10, %rbx
LBB0_4:
	cmpl	%r9d, %esi
	jne	LBB0_10
## %bb.5:
	movq	_MAX_GENTITIES@GOTPCREL(%rip), %r12
	cmpl	$0, (%r12)
	jle	LBB0_9
## %bb.6:
	movl	8(%r8), %edx
	leaq	L_.str(%rip), %rdi
	xorl	%esi, %esi
	callq	_G_Printf
	cmpl	$2, (%r12)
	jl	LBB0_9
## %bb.7:
	movl	$1, %r14d
	movl	$32, %r13d
	leaq	L_.str(%rip), %r15
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	_g_entities@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax,%r13), %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_G_Printf
	incq	%r14
	movslq	(%r12), %rax
	addq	$24, %r13
	cmpq	%rax, %r14
	jl	LBB0_8
LBB0_9:
	leaq	L_.str.1(%rip), %rdi
	callq	_G_Error
	movq	_level@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
LBB0_10:
	incl	%esi
	movl	%esi, (%r15)
	movl	32(%r15), %edi
	movq	24(%r15), %rcx
	movl	$24, %edx
	movl	$4, %r8d
	callq	_trap_LocateGameData
LBB0_11:
	movq	%rbx, %rdi
	callq	_G_InitGentity
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	cmpl	%r9d, %esi
	cmovgeq	%r10, %rbx
	jl	LBB0_4
## %bb.18:
	movl	%esi, %eax
	subl	%r11d, %eax
	jle	LBB0_4
## %bb.19:
	movq	%r10, %rbx
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	$0, 16(%rbx)
	je	LBB0_11
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	addq	$24, %rbx
	decl	%eax
	jne	LBB0_2
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
	.comm	_g_entities,8,3                 ## @g_entities
	.comm	_MAX_CLIENTS,8,3                ## @MAX_CLIENTS
	.comm	_level,40,3                     ## @level
	.comm	_ENTITYNUM_MAX_NORMAL,4,2       ## @ENTITYNUM_MAX_NORMAL
	.comm	_MAX_GENTITIES,4,2              ## @MAX_GENTITIES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%4i: %s\n"

L_.str.1:                               ## @.str.1
	.asciz	"G_Spawn: no free entities"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_G_Spawn                        ; -- Begin function G_Spawn
	.p2align	2
_G_Spawn:                               ; @G_Spawn
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x23, _g_entities@GOTPAGE
Lloh1:
	ldr	x23, [x23, _g_entities@GOTPAGEOFF]
	ldr	x8, [x23]
Lloh2:
	adrp	x9, _MAX_CLIENTS@GOTPAGE
Lloh3:
	ldr	x9, [x9, _MAX_CLIENTS@GOTPAGEOFF]
Lloh4:
	ldr	x12, [x9]
	mov	w9, #24
Lloh5:
	adrp	x22, _level@GOTPAGE
Lloh6:
	ldr	x22, [x22, _level@GOTPAGEOFF]
	madd	x11, x12, x9, x8
	ldr	w9, [x22]
Lloh7:
	adrp	x10, _ENTITYNUM_MAX_NORMAL@GOTPAGE
Lloh8:
	ldr	x10, [x10, _ENTITYNUM_MAX_NORMAL@GOTPAGEOFF]
Lloh9:
	ldr	w10, [x10]
	subs	w13, w9, w12
	b.le	LBB0_6
; %bb.1:
	ldr	x14, [x22, #8]
	add	x14, x14, #2000
	ldrsw	x15, [x22, #16]
	mov	x19, x11
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x19, x19, #24
	subs	w13, w13, #1
	b.eq	LBB0_15
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x16, [x19, #16]
	cbnz	x16, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x16, [x19]
	cmp	x16, x14
	b.le	LBB0_14
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	sub	x16, x15, x16
	cmp	x16, #1000
	b.lt	LBB0_2
	b	LBB0_14
LBB0_6:
	mov	x19, x11
LBB0_7:
	cmp	w9, w10
	b.ne	LBB0_13
; %bb.8:
Lloh10:
	adrp	x24, _MAX_GENTITIES@GOTPAGE
Lloh11:
	ldr	x24, [x24, _MAX_GENTITIES@GOTPAGEOFF]
	ldr	w9, [x24]
	cmp	w9, #1
	b.lt	LBB0_12
; %bb.9:
	ldr	w2, [x8, #8]
Lloh12:
	adrp	x0, l_.str@PAGE
Lloh13:
	add	x0, x0, l_.str@PAGEOFF
	mov	w1, #0
	bl	_G_Printf
	ldr	w8, [x24]
	cmp	w8, #2
	b.lt	LBB0_12
; %bb.10:
	mov	w20, #1
	mov	w25, #32
Lloh14:
	adrp	x21, l_.str@PAGE
Lloh15:
	add	x21, x21, l_.str@PAGEOFF
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x23]
	ldr	w2, [x8, x25]
	mov	x0, x21
	mov	x1, x20
	bl	_G_Printf
	add	x20, x20, #1
	ldrsw	x8, [x24]
	add	x25, x25, #24
	cmp	x20, x8
	b.lt	LBB0_11
LBB0_12:
Lloh16:
	adrp	x0, l_.str.1@PAGE
Lloh17:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_G_Error
	ldr	w9, [x22]
LBB0_13:
	add	w1, w9, #1
	str	w1, [x22]
	ldr	w0, [x22, #32]
	ldr	x3, [x22, #24]
	mov	w2, #24
	mov	w4, #4
	bl	_trap_LocateGameData
LBB0_14:
	mov	x0, x19
	bl	_G_InitGentity
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_15:
	cmp	w9, w10
	csel	x19, x19, x11, lt
	b.lt	LBB0_7
; %bb.16:
	subs	w12, w9, w12
	b.le	LBB0_7
; %bb.17:
	mov	x19, x11
LBB0_18:                                ; =>This Inner Loop Header: Depth=1
	ldr	x11, [x19, #16]
	cbz	x11, LBB0_14
; %bb.19:                               ;   in Loop: Header=BB0_18 Depth=1
	add	x19, x19, #24
	subs	w12, w12, #1
	b.ne	LBB0_18
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_g_entities,8,3                 ; @g_entities
	.comm	_MAX_CLIENTS,8,3                ; @MAX_CLIENTS
	.comm	_level,40,3                     ; @level
	.comm	_ENTITYNUM_MAX_NORMAL,4,2       ; @ENTITYNUM_MAX_NORMAL
	.comm	_MAX_GENTITIES,4,2              ; @MAX_GENTITIES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%4i: %s\n"

l_.str.1:                               ; @.str.1
	.asciz	"G_Spawn: no free entities"

.subsections_via_symbols
