	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function savage_dispatch_state
_savage_dispatch_state:                 ## @savage_dispatch_state
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	(%rsi), %r15d
	testl	%r15d, %r15d
	je	LBB0_1
## %bb.2:
	movq	%rdx, %r14
	movq	%rdi, %rbx
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movl	4(%rsi), %r13d
	movl	4(%rdi), %edi
	callq	_S3_SAVAGE3D_SERIES
	testq	%rax, %rax
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	movl	%r13d, %esi
	movl	%r15d, %edx
	movq	%r14, %rcx
	je	LBB0_8
## %bb.3:
	callq	_savage_verify_state_s3d
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_22
## %bb.4:
	movq	_SAVAGE_SCSTART_S3D@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%ecx, %eax
	subl	%r13d, %eax
	jbe	LBB0_7
## %bb.5:
	leal	(%r15,%r13), %edx
	movq	_SAVAGE_SCEND_S3D@GOTPCREL(%rip), %rsi
	jmp	LBB0_6
LBB0_1:
	xorl	%r12d, %r12d
	jmp	LBB0_22
LBB0_8:
	callq	_savage_verify_state_s4
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_22
## %bb.9:
	movq	_SAVAGE_DRAWCTRL0_S4@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%ecx, %eax
	subl	%r13d, %eax
	jbe	LBB0_11
## %bb.10:
	leal	(%r15,%r13), %edx
	movq	_SAVAGE_DRAWCTRL1_S4@GOTPCREL(%rip), %rsi
LBB0_6:
	movl	(%rsi), %esi
	leal	1(%rsi), %edi
	notl	%esi
	addl	%edx, %esi
	xorl	%r12d, %r12d
	cmpl	%edi, %edx
	cmoval	%esi, %r12d
	cmpl	%ecx, %edx
	cmovbel	%r15d, %eax
	movl	%eax, %r15d
	jmp	LBB0_15
LBB0_7:
	movq	_SAVAGE_SCEND_S3D@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_11:
	movq	_SAVAGE_DRAWCTRL1_S4@GOTPCREL(%rip), %rax
LBB0_12:
	movl	(%rax), %eax
	xorl	%r12d, %r12d
	cmpl	%eax, %r13d
	ja	LBB0_15
## %bb.13:
	addl	%r15d, %r13d
	leal	1(%rax), %ecx
	xorl	%r12d, %r12d
	cmpl	%ecx, %r13d
	jbe	LBB0_22
## %bb.14:
	notl	%eax
	addl	%eax, %r13d
	xorl	%r12d, %r12d
	movl	%r13d, %r15d
	movl	%ecx, %r13d
LBB0_15:
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	leal	254(%r15), %eax
	movl	$2155905153, %ecx               ## imm = 0x80808081
	imulq	%rcx, %rax
	shrq	$39, %rax
	addl	%r15d, %eax
	addl	%r12d, %eax
	leal	254(%r12), %edi
	imulq	%rcx, %rdi
	shrq	$39, %rdi
	addl	%eax, %edi
	cmpq	$0, 8(%rdx)
	je	LBB0_17
## %bb.16:
	incl	%edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_BEGIN_DMA
	movq	_BCI_CMD_WAIT@GOTPCREL(%rip), %rax
	movq	_BCI_CMD_WAIT_3D@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	orl	(%rax), %edi
	callq	_DMA_WRITE
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	$1, (%rax)
	jmp	LBB0_18
LBB0_17:
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_BEGIN_DMA
	jmp	LBB0_18
	.p2align	4, 0x90
LBB0_20:                                ##   in Loop: Header=BB0_18 Depth=1
	addl	$2, %r13d
	addq	$8, %r14
	movl	%r12d, %r15d
	testl	%r12d, %r12d
	movl	$0, %r12d
	je	LBB0_21
LBB0_18:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_19 Depth 2
	testl	%r15d, %r15d
	je	LBB0_20
	.p2align	4, 0x90
LBB0_19:                                ##   Parent Loop BB0_18 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpl	$255, %r15d
	movl	$255, %ebx
	cmovbl	%r15d, %ebx
	movl	%r13d, %edi
	movl	%ebx, %esi
	callq	_DMA_SET_REGISTERS
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_DMA_COPY
	addl	%ebx, %r13d
	leaq	(%r14,%rbx,4), %r14
	subl	%ebx, %r15d
	jne	LBB0_19
	jmp	LBB0_20
LBB0_21:
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_DMA_COMMIT
LBB0_22:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_LOCALS,4,2                 ## @DMA_LOCALS
	.comm	_SAVAGE_SCSTART_S3D,4,2         ## @SAVAGE_SCSTART_S3D
	.comm	_SAVAGE_SCEND_S3D,4,2           ## @SAVAGE_SCEND_S3D
	.comm	_SAVAGE_DRAWCTRL0_S4,4,2        ## @SAVAGE_DRAWCTRL0_S4
	.comm	_SAVAGE_DRAWCTRL1_S4,4,2        ## @SAVAGE_DRAWCTRL1_S4
	.comm	_BCI_CMD_WAIT,4,2               ## @BCI_CMD_WAIT
	.comm	_BCI_CMD_WAIT_3D,4,2            ## @BCI_CMD_WAIT_3D
	.no_dead_strip	_savage_dispatch_state
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function savage_dispatch_state
_savage_dispatch_state:                 ; @savage_dispatch_state
	.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
	ldr	w21, [x1]
	cbz	w21, LBB0_23
; %bb.1:
	mov	x19, x2
	mov	x23, x1
	mov	x22, x0
	ldr	w20, [x1, #4]
	ldr	w0, [x0, #4]
	bl	_S3_SAVAGE3D_SERIES
	cbz	x0, LBB0_5
; %bb.2:
	mov	x0, x22
	mov	x1, x20
	mov	x2, x21
	mov	x3, x19
	bl	_savage_verify_state_s3d
	cbnz	w0, LBB0_24
; %bb.3:
Lloh0:
	adrp	x8, _SAVAGE_SCSTART_S3D@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SAVAGE_SCSTART_S3D@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	subs	w9, w8, w20
	b.ls	LBB0_9
; %bb.4:
Lloh3:
	adrp	x10, _SAVAGE_SCEND_S3D@GOTPAGE
Lloh4:
	ldr	x10, [x10, _SAVAGE_SCEND_S3D@GOTPAGEOFF]
	b	LBB0_8
LBB0_5:
	mov	x0, x22
	mov	x1, x20
	mov	x2, x21
	mov	x3, x19
	bl	_savage_verify_state_s4
	cbnz	w0, LBB0_24
; %bb.6:
Lloh5:
	adrp	x8, _SAVAGE_DRAWCTRL0_S4@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SAVAGE_DRAWCTRL0_S4@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	subs	w9, w8, w20
	b.ls	LBB0_10
; %bb.7:
Lloh8:
	adrp	x10, _SAVAGE_DRAWCTRL1_S4@GOTPAGE
Lloh9:
	ldr	x10, [x10, _SAVAGE_DRAWCTRL1_S4@GOTPAGEOFF]
LBB0_8:
	ldr	w10, [x10]
	add	w11, w10, #1
	mvn	w10, w10
	add	w12, w20, w21
	add	w10, w12, w10
	cmp	w12, w11
	csel	w24, w10, wzr, hi
	cmp	w12, w8
	csel	w21, w9, w21, hi
	b	LBB0_15
LBB0_9:
Lloh10:
	adrp	x8, _SAVAGE_SCEND_S3D@GOTPAGE
Lloh11:
	ldr	x8, [x8, _SAVAGE_SCEND_S3D@GOTPAGEOFF]
	b	LBB0_11
LBB0_10:
Lloh12:
	adrp	x8, _SAVAGE_DRAWCTRL1_S4@GOTPAGE
Lloh13:
	ldr	x8, [x8, _SAVAGE_DRAWCTRL1_S4@GOTPAGEOFF]
LBB0_11:
	ldr	w8, [x8]
	cmp	w20, w8
	b.ls	LBB0_13
; %bb.12:
	mov	w24, #0
	b	LBB0_15
LBB0_13:
	add	w9, w20, w21
	add	w20, w8, #1
	cmp	w9, w20
	b.ls	LBB0_23
; %bb.14:
	mov	w24, #0
	mvn	w8, w8
	add	w21, w9, w8
LBB0_15:
	add	w8, w21, #254
	mov	w9, #32897
	movk	w9, #32896, lsl #16
	umull	x8, w8, w9
	lsr	x8, x8, #39
	add	w8, w8, w21
	add	w8, w8, w24
	add	w10, w24, #254
	umull	x9, w10, w9
	lsr	x9, x9, #39
	add	w0, w8, w9
	ldr	x8, [x23, #8]
	cbz	x8, LBB0_17
; %bb.16:
	add	w0, w0, #1
	bl	_BEGIN_DMA
Lloh14:
	adrp	x8, _BCI_CMD_WAIT@GOTPAGE
Lloh15:
	ldr	x8, [x8, _BCI_CMD_WAIT@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
Lloh17:
	adrp	x9, _BCI_CMD_WAIT_3D@GOTPAGE
Lloh18:
	ldr	x9, [x9, _BCI_CMD_WAIT_3D@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	orr	w0, w9, w8
	bl	_DMA_WRITE
	mov	w8, #1
	str	w8, [x22]
	b	LBB0_18
LBB0_17:
	bl	_BEGIN_DMA
LBB0_18:
	mov	w23, #255
	b	LBB0_20
LBB0_19:                                ;   in Loop: Header=BB0_20 Depth=1
	mov	w24, #0
	add	w20, w20, #2
	add	x19, x19, #8
	mov	x21, x25
	cbz	w25, LBB0_22
LBB0_20:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_21 Depth 2
	mov	x25, x24
	cbz	w21, LBB0_19
LBB0_21:                                ;   Parent Loop BB0_20 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	cmp	w21, #255
	csel	w22, w21, w23, lo
	mov	x0, x20
	mov	x1, x22
	bl	_DMA_SET_REGISTERS
	mov	x0, x19
	mov	x1, x22
	bl	_DMA_COPY
	add	w20, w20, w22
	add	x19, x19, w22, uxtw #2
	subs	w21, w21, w22
	b.ne	LBB0_21
	b	LBB0_19
LBB0_22:
	bl	_DMA_COMMIT
LBB0_23:
	mov	w0, #0
LBB0_24:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_LOCALS,4,2                 ; @DMA_LOCALS
	.comm	_SAVAGE_SCSTART_S3D,4,2         ; @SAVAGE_SCSTART_S3D
	.comm	_SAVAGE_SCEND_S3D,4,2           ; @SAVAGE_SCEND_S3D
	.comm	_SAVAGE_DRAWCTRL0_S4,4,2        ; @SAVAGE_DRAWCTRL0_S4
	.comm	_SAVAGE_DRAWCTRL1_S4,4,2        ; @SAVAGE_DRAWCTRL1_S4
	.comm	_BCI_CMD_WAIT,4,2               ; @BCI_CMD_WAIT
	.comm	_BCI_CMD_WAIT_3D,4,2            ; @BCI_CMD_WAIT_3D
	.no_dead_strip	_savage_dispatch_state
.subsections_via_symbols
