	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function calculate_viewport
_calculate_viewport:                    ## @calculate_viewport
	.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	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	(%rdi), %rax
	movq	16(%rdi), %rcx
	xorl	%ebx, %ebx
	movl	$0, %edx
	testq	%rcx, %rcx
	je	LBB0_2
## %bb.1:
	xorl	%edx, %edx
	cmpq	%rax, (%rcx)
	sete	%dl
LBB0_2:
	movq	_PIXEL_FORMAT_420BPP8@GOTPCREL(%rip), %r9
	movq	_PIXEL_FORMAT_420BPP10@GOTPCREL(%rip), %r8
	movq	80(%r15), %rsi
	movq	8(%r15), %rdi
	testq	%rdi, %rdi
	je	LBB0_4
## %bb.3:
	xorl	%ebx, %ebx
	cmpq	%rax, (%rdi)
	sete	%bl
LBB0_4:
	movl	%ebx, -100(%rbp)                ## 4-byte Spill
	movl	56(%rax), %ecx
	movl	%ecx, -92(%rbp)                 ## 4-byte Spill
	movl	60(%rax), %ecx
	movl	%ecx, -96(%rbp)                 ## 4-byte Spill
	movq	_VIEW_3D_FORMAT_SIDE_BY_SIDE@GOTPCREL(%rip), %rdi
	movq	(%rsi), %rbx
	movq	8(%rsi), %rcx
	cmpq	(%rdi), %rbx
	sete	%r10b
	movq	_VIEW_3D_FORMAT_TOP_AND_BOTTOM@GOTPCREL(%rip), %rdi
	cmpq	(%rdi), %rbx
	sete	%bl
	xorl	%edi, %edi
	orb	%r10b, %bl
	movb	%bl, -41(%rbp)                  ## 1-byte Spill
	cmovnel	%edi, %edx
	movl	%edx, -104(%rbp)                ## 4-byte Spill
	movq	8(%rax), %r12
	cmpq	%r12, %rcx
	movq	%r12, %rbx
	cmovgq	%rcx, %rbx
	addq	16(%rsi), %rcx
	addq	16(%rax), %r12
	movl	64(%rax), %edx
	movl	%edx, -88(%rbp)                 ## 4-byte Spill
	cmpq	%r12, %rcx
	cmovlq	%rcx, %r12
	subl	%ebx, %r12d
	movq	24(%rsi), %rcx
	movq	24(%rax), %r14
	cmpq	%r14, %rcx
	movq	%r14, %r13
	cmovgq	%rcx, %r13
	addq	32(%rsi), %rcx
	movl	68(%rax), %edx
	movl	%edx, -84(%rbp)                 ## 4-byte Spill
	movq	(%r9), %rdx
	movq	%rdx, -72(%rbp)                 ## 8-byte Spill
	addq	32(%rax), %r14
	movq	(%r8), %rdx
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	cmpq	%r14, %rcx
	cmovlq	%rcx, %r14
	movl	40(%rax), %ecx
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	subl	%r13d, %r14d
	movl	44(%rax), %ecx
	movq	%rcx, -128(%rbp)                ## 8-byte Spill
	movl	48(%rax), %ecx
	movq	%rcx, -120(%rbp)                ## 8-byte Spill
	movl	52(%rax), %ecx
	movq	%rcx, -136(%rbp)                ## 8-byte Spill
	movl	(%rax), %esi
	movl	4(%rax), %edi
	movq	24(%r15), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	leaq	-48(%rbp), %rdx
	leaq	-112(%rbp), %rcx
	leaq	-108(%rbp), %r8
	callq	_get_vp_scan_direction
	cmpl	$0, -48(%rbp)
	je	LBB0_6
## %bb.5:
	movl	%ebx, %edi
	movl	%r13d, %esi
	callq	_swap
	movl	%r12d, %edi
	movl	%r14d, %esi
	callq	_swap
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
                                        ## kill: def $edi killed $edi killed $rdi
	movq	-120(%rbp), %rsi                ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_swap
	movq	-128(%rbp), %rdi                ## 8-byte Reload
                                        ## kill: def $edi killed $edi killed $rdi
	movq	-136(%rbp), %rsi                ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_swap
LBB0_6:
	movq	-128(%rbp), %rdi                ## 8-byte Reload
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
	leal	(%rdi,%rdx), %eax
	subl	%ebx, %eax
	subl	%r12d, %eax
	movq	-136(%rbp), %r8                 ## 8-byte Reload
	movq	-120(%rbp), %r10                ## 8-byte Reload
	leal	(%r8,%r10), %esi
	subl	%r13d, %esi
	subl	%r14d, %esi
	subl	%edx, %ebx
	movl	-108(%rbp), %ecx
	movl	%ecx, -80(%rbp)                 ## 4-byte Spill
	testl	%ecx, %ecx
	cmovnel	%eax, %ebx
	movl	-96(%rbp), %ecx                 ## 4-byte Reload
	imull	%ecx, %ebx
	movl	%ebx, %eax
	cltd
	movl	-112(%rbp), %r9d
	idivl	%edi
	movl	%eax, %r11d
	addl	-92(%rbp), %r11d                ## 4-byte Folded Reload
	imull	%r12d, %ecx
	subl	%r10d, %r13d
	movl	%ecx, %eax
	cltd
	idivl	%edi
	movl	%eax, %r10d
	testl	%r9d, %r9d
	movl	%r11d, 32(%r15)
	movl	%eax, 36(%r15)
	cmovnel	%esi, %r13d
	movl	-84(%rbp), %ecx                 ## 4-byte Reload
	imull	%ecx, %r13d
	movl	%r13d, %eax
	cltd
	idivl	%r8d
	movl	%eax, %r12d
	addl	-88(%rbp), %r12d                ## 4-byte Folded Reload
	movl	%r12d, 40(%r15)
	imull	%r14d, %ecx
	movl	%ecx, %eax
	cltd
	idivl	%r8d
                                        ## kill: def $eax killed $eax def $rax
	cmpl	$0, -100(%rbp)                  ## 4-byte Folded Reload
	movl	%eax, 44(%r15)
	setne	%cl
	movl	-104(%rbp), %edx                ## 4-byte Reload
	testl	%edx, %edx
	jne	LBB0_9
## %bb.7:
	movb	-41(%rbp), %bl                  ## 1-byte Reload
	notb	%bl
	andb	%cl, %bl
	jne	LBB0_9
## %bb.8:
	movl	%eax, %ebx
	jmp	LBB0_15
LBB0_9:
	cmpl	$0, -48(%rbp)
	je	LBB0_12
## %bb.10:
	movl	%eax, %ebx
	shrl	$31, %ebx
	addl	%eax, %ebx
	sarl	%ebx
	cmpl	%edx, %r9d
	jne	LBB0_14
## %bb.11:
	addl	%ebx, %r12d
	movl	%r12d, 40(%r15)
	movl	%eax, %ecx
	incl	%ecx
	shrl	$31, %ecx
	leal	(%rax,%rcx), %ebx
	incl	%ebx
	sarl	%ebx
LBB0_14:
	movl	%ebx, 44(%r15)
LBB0_15:
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
LBB0_16:
	cmpq	%rdx, %rdi
	sete	%al
	cmpq	%rsi, %rdi
	sete	%cl
	orb	%al, %cl
	movzbl	%cl, %ecx
	leal	1(%rcx), %esi
	movl	%r11d, %eax
	cltd
	idivl	%esi
	movl	%eax, 48(%r15)
	movl	%r12d, %eax
	cltd
	idivl	%esi
	movl	%eax, 52(%r15)
	testl	%ecx, %r11d
	movq	_dc_fixpt_half@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	_dc_fixpt_zero@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movq	%rdi, %rax
	cmoveq	%rdx, %rax
	movq	%rax, 72(%r15)
	testl	%ecx, %r12d
	cmoveq	%rdx, %rdi
	movq	%rdi, 64(%r15)
	addl	%ecx, %r10d
	movl	%r10d, %eax
	cltd
	idivl	%esi
	movl	%eax, 56(%r15)
	addl	%ecx, %ebx
	movl	%ebx, %eax
	cltd
	idivl	%esi
	movl	%eax, 60(%r15)
	addq	$104, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	movl	%r10d, %ecx
	shrl	$31, %ecx
	addl	%r10d, %ecx
	sarl	%ecx
	cmpl	%edx, -80(%rbp)                 ## 4-byte Folded Reload
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	jne	LBB0_17
## %bb.13:
	addl	%ecx, %r11d
	movl	%r11d, 32(%r15)
	movl	%r10d, %ecx
	incl	%ecx
	shrl	$31, %ecx
	addl	%ecx, %r10d
	incl	%r10d
	sarl	%r10d
	movl	%r10d, 36(%r15)
	movl	%eax, %ebx
	jmp	LBB0_16
LBB0_17:
	movl	%ecx, 36(%r15)
	movl	%eax, %ebx
	movl	%ecx, %r10d
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_PIXEL_FORMAT_420BPP8,8,3       ## @PIXEL_FORMAT_420BPP8
	.comm	_PIXEL_FORMAT_420BPP10,8,3      ## @PIXEL_FORMAT_420BPP10
	.comm	_VIEW_3D_FORMAT_SIDE_BY_SIDE,8,3 ## @VIEW_3D_FORMAT_SIDE_BY_SIDE
	.comm	_VIEW_3D_FORMAT_TOP_AND_BOTTOM,8,3 ## @VIEW_3D_FORMAT_TOP_AND_BOTTOM
	.comm	_dc_fixpt_half,8,3              ## @dc_fixpt_half
	.comm	_dc_fixpt_zero,8,3              ## @dc_fixpt_zero
	.no_dead_strip	_calculate_viewport
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calculate_viewport
_calculate_viewport:                    ; @calculate_viewport
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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, x0
	ldr	x8, [x0]
	ldr	x9, [x0, #80]
	ldr	x10, [x0, #16]
	cbz	x10, LBB0_2
; %bb.1:
	ldr	x10, [x10]
	cmp	x10, x8
	cset	w10, eq
LBB0_2:
Lloh0:
	adrp	x11, _PIXEL_FORMAT_420BPP8@GOTPAGE
Lloh1:
	ldr	x11, [x11, _PIXEL_FORMAT_420BPP8@GOTPAGEOFF]
Lloh2:
	adrp	x12, _PIXEL_FORMAT_420BPP10@GOTPAGE
Lloh3:
	ldr	x12, [x12, _PIXEL_FORMAT_420BPP10@GOTPAGEOFF]
	ldr	x13, [x19, #8]
	cbz	x13, LBB0_4
; %bb.3:
	ldr	x13, [x13]
	cmp	x13, x8
	cset	w13, eq
	str	w13, [sp, #32]                  ; 4-byte Folded Spill
	b	LBB0_5
LBB0_4:
	str	wzr, [sp, #32]                  ; 4-byte Folded Spill
LBB0_5:
	ldp	w14, w28, [x8, #56]
	ldr	w13, [x8, #64]
	stp	w14, w13, [sp, #36]             ; 8-byte Folded Spill
	ldr	w13, [x8, #68]
	str	w13, [sp, #44]                  ; 4-byte Folded Spill
	ldr	x13, [x19, #24]
	ldr	x11, [x11]
	str	x11, [sp, #24]                  ; 8-byte Folded Spill
	ldr	x11, [x12]
	stp	x13, x11, [sp, #8]              ; 16-byte Folded Spill
Lloh4:
	adrp	x11, _VIEW_3D_FORMAT_SIDE_BY_SIDE@GOTPAGE
Lloh5:
	ldr	x11, [x11, _VIEW_3D_FORMAT_SIDE_BY_SIDE@GOTPAGEOFF]
Lloh6:
	ldr	x11, [x11]
	ldp	x12, x13, [x9]
	cmp	x12, x11
Lloh7:
	adrp	x11, _VIEW_3D_FORMAT_TOP_AND_BOTTOM@GOTPAGE
Lloh8:
	ldr	x11, [x11, _VIEW_3D_FORMAT_TOP_AND_BOTTOM@GOTPAGEOFF]
Lloh9:
	ldr	x11, [x11]
	ccmp	x12, x11, #4, ne
	cset	w11, eq
	str	w11, [sp, #4]                   ; 4-byte Folded Spill
	csel	w10, wzr, w10, eq
	str	w10, [sp, #48]                  ; 4-byte Folded Spill
	ldp	w23, w22, [x8, #40]
	ldp	w21, w20, [x8, #48]
	ldp	x10, x11, [x9, #16]
	add	x10, x10, x13
	ldp	x12, x14, [x8, #8]
	cmp	x13, x12
	csel	x27, x13, x12, gt
	add	x12, x14, x12
	cmp	x10, x12
	csel	x10, x10, x12, lt
	sub	w25, w10, w27
	ldr	x9, [x9, #32]
	add	x9, x9, x11
	ldp	x10, x12, [x8, #24]
	cmp	x11, x10
	csel	x26, x11, x10, gt
	add	x10, x12, x10
	cmp	x9, x10
	csel	x9, x9, x10, lt
	sub	w24, w9, w26
	ldp	w1, w0, [x8]
	add	x2, sp, #60
	add	x3, sp, #56
	add	x4, sp, #52
	bl	_get_vp_scan_direction
	ldr	w8, [sp, #60]
	cbz	w8, LBB0_7
; %bb.6:
	mov	x0, x27
	mov	x1, x26
	bl	_swap
	mov	x0, x25
	mov	x1, x24
	bl	_swap
	mov	x0, x23
	mov	x1, x21
	bl	_swap
	mov	x0, x22
	mov	x1, x20
	bl	_swap
LBB0_7:
	ldp	w12, w13, [sp, #52]
	add	w8, w22, w23
	add	w9, w27, w25
	sub	w8, w8, w9
	add	w9, w20, w21
	add	w10, w26, w24
	sub	w10, w9, w10
	sub	w9, w27, w23
	cmp	w12, #0
	csel	w8, w9, w8, eq
	mul	w8, w8, w28
	sdiv	w8, w8, w22
	ldp	w9, w14, [sp, #36]              ; 8-byte Folded Reload
	add	w8, w8, w9
	mul	w9, w28, w25
	sdiv	w9, w9, w22
	stp	w8, w9, [x19, #32]
	sub	w11, w26, w21
	cmp	w13, #0
	csel	w10, w11, w10, eq
	ldp	w11, w15, [sp, #44]             ; 8-byte Folded Reload
	mul	w10, w10, w11
	sdiv	w10, w10, w20
	add	w10, w10, w14
	mul	w11, w11, w24
	sdiv	w11, w11, w20
	stp	w10, w11, [x19, #40]
	ldr	w14, [sp, #32]                  ; 4-byte Folded Reload
	cmp	w14, #0
	cset	w14, ne
	cbnz	w15, LBB0_10
; %bb.8:
	ldr	w16, [sp, #4]                   ; 4-byte Folded Reload
	bic	w14, w14, w16
	cbnz	w14, LBB0_10
; %bb.9:
	ldr	x14, [sp, #8]                   ; 8-byte Folded Reload
	b	LBB0_16
LBB0_10:
	ldr	w14, [sp, #60]
	cbz	w14, LBB0_13
; %bb.11:
	cmp	w11, #0
	cinc	w12, w11, lt
	asr	w12, w12, #1
	cmp	w13, w15
	ldr	x14, [sp, #8]                   ; 8-byte Folded Reload
	b.ne	LBB0_15
; %bb.12:
	add	w10, w12, w10
	add	w12, w11, #1
	add	w13, w11, #2
	cmp	w12, #0
	csinc	w11, w13, w11, lt
	asr	w11, w11, #1
	stp	w10, w11, [x19, #40]
	b	LBB0_16
LBB0_13:
	cmp	w9, #0
	cinc	w13, w9, lt
	asr	w13, w13, #1
	cmp	w12, w15
	ldp	x14, x16, [sp, #8]              ; 16-byte Folded Reload
	ldr	x15, [sp, #24]                  ; 8-byte Folded Reload
	b.ne	LBB0_18
; %bb.14:
	add	w8, w13, w8
	add	w12, w9, #1
	add	w13, w9, #2
	cmp	w12, #0
	csinc	w9, w13, w9, lt
	asr	w9, w9, #1
	stp	w8, w9, [x19, #32]
	b	LBB0_17
LBB0_15:
	str	w12, [x19, #44]
	mov	x11, x12
LBB0_16:
	ldp	x16, x15, [sp, #16]             ; 16-byte Folded Reload
LBB0_17:
	cmp	x14, x16
	ccmp	x14, x15, #4, ne
	mov	w12, #1
	cinc	w12, w12, eq
	sdiv	w13, w8, w12
	sdiv	w14, w10, w12
	stp	w13, w14, [x19, #48]
	sub	w13, w12, #1
Lloh10:
	adrp	x14, _dc_fixpt_half@GOTPAGE
Lloh11:
	ldr	x14, [x14, _dc_fixpt_half@GOTPAGEOFF]
Lloh12:
	ldr	x14, [x14]
Lloh13:
	adrp	x15, _dc_fixpt_zero@GOTPAGE
Lloh14:
	ldr	x15, [x15, _dc_fixpt_zero@GOTPAGEOFF]
Lloh15:
	ldr	x15, [x15]
	tst	w8, w13
	csel	x8, x15, x14, eq
	tst	w10, w13
	csel	x10, x15, x14, eq
	stp	x10, x8, [x19, #64]
	add	w8, w13, w9
	sdiv	w8, w8, w12
	add	w9, w13, w11
	sdiv	w9, w9, w12
	stp	w8, w9, [x19, #56]
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_18:
	str	w13, [x19, #36]
	mov	x9, x13
	b	LBB0_17
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_PIXEL_FORMAT_420BPP8,8,3       ; @PIXEL_FORMAT_420BPP8
	.comm	_PIXEL_FORMAT_420BPP10,8,3      ; @PIXEL_FORMAT_420BPP10
	.comm	_VIEW_3D_FORMAT_SIDE_BY_SIDE,8,3 ; @VIEW_3D_FORMAT_SIDE_BY_SIDE
	.comm	_VIEW_3D_FORMAT_TOP_AND_BOTTOM,8,3 ; @VIEW_3D_FORMAT_TOP_AND_BOTTOM
	.comm	_dc_fixpt_half,8,3              ; @dc_fixpt_half
	.comm	_dc_fixpt_zero,8,3              ; @dc_fixpt_zero
	.no_dead_strip	_calculate_viewport
.subsections_via_symbols
