	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function d3d8_calculate_rect
LCPI0_0:
	.long	0x7fffffff                      ## float NaN
	.long	0x7fffffff                      ## float NaN
	.long	0x7fffffff                      ## float NaN
	.long	0x7fffffff                      ## float NaN
	.section	__TEXT,__literal4,4byte_literals
	.p2align	2
LCPI0_1:
	.long	0x38d1b717                      ## float 9.99999974E-5
LCPI0_2:
	.long	0xbf800000                      ## float -1
LCPI0_3:
	.long	0x3f000000                      ## float 0.5
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_d3d8_calculate_rect:                   ## @d3d8_calculate_rect
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r9d, -44(%rbp)                 ## 4-byte Spill
	movq	%r8, %r14
	movq	%rcx, %rbx
	movq	%rdx, %r13
	movq	%rsi, %r15
	movq	%rdi, -80(%rbp)                 ## 8-byte Spill
	movl	(%rsi), %eax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movl	(%rdx), %eax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	callq	_config_get_ptr
	movq	%rax, %r12
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	movq	%r13, %rsi
	movq	%rbx, %r13
	callq	_video_driver_get_size
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movl	$0, (%rbx)
	movq	%r14, -72(%rbp)                 ## 8-byte Spill
	movl	$0, (%r14)
	testl	%eax, %eax
	jne	LBB0_3
## %bb.1:
	cmpq	$0, 8(%r12)
	je	LBB0_3
## %bb.2:
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -112(%rbp)
	movaps	%xmm0, -128(%rbp)
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movl	(%r14), %r15d
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movl	(%rbx), %r12d
	xorl	%eax, %eax
	callq	_video_driver_get_aspect_ratio
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rcx
	leaq	-128(%rbp), %rdi
	movl	%r15d, %esi
	movl	%r12d, %edx
	callq	_video_viewport_get_scaled_integer
	movl	-128(%rbp), %eax
	movl	%eax, (%r13)
	movl	-124(%rbp), %eax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	movl	-120(%rbp), %eax
	movl	%eax, (%r14)
	movl	-116(%rbp), %eax
	movl	%eax, (%rbx)
	jmp	LBB0_10
LBB0_3:
	testl	%eax, %eax
	jne	LBB0_10
## %bb.4:
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	cmpq	$0, (%rax)
	je	LBB0_10
## %bb.5:
	cvtsi2ssq	-88(%rbp), %xmm1        ## 8-byte Folded Reload
	cvtsi2ssq	-96(%rbp), %xmm0        ## 8-byte Folded Reload
	divss	%xmm0, %xmm1
	movss	%xmm1, -44(%rbp)                ## 4-byte Spill
	xorl	%eax, %eax
	callq	_video_driver_get_aspect_ratio
	movss	-44(%rbp), %xmm2                ## 4-byte Reload
                                        ## xmm2 = mem[0],zero,zero,zero
	movaps	%xmm0, %xmm3
	movaps	%xmm2, %xmm0
	subss	%xmm3, %xmm0
	andps	LCPI0_0(%rip), %xmm0
	movss	LCPI0_1(%rip), %xmm1            ## xmm1 = mem[0],zero,zero,zero
	ucomiss	%xmm0, %xmm1
	ja	LBB0_10
## %bb.6:
	ucomiss	%xmm3, %xmm2
	jbe	LBB0_8
## %bb.7:
	divss	%xmm2, %xmm3
	addss	LCPI0_2(%rip), %xmm3
	movss	LCPI0_3(%rip), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movl	(%rbx), %eax
	xorps	%xmm1, %xmm1
	cvtsi2ss	%rax, %xmm1
	mulss	%xmm0, %xmm3
	addss	%xmm0, %xmm3
	movss	%xmm3, -44(%rbp)                ## 4-byte Spill
	subss	%xmm3, %xmm0
	mulss	%xmm1, %xmm0
	callq	_roundf
	movl	%eax, (%r13)
	jmp	LBB0_9
LBB0_8:
	divss	%xmm3, %xmm2
	addss	LCPI0_2(%rip), %xmm2
	movss	LCPI0_3(%rip), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movl	(%rbx), %eax
	xorps	%xmm1, %xmm1
	cvtsi2ss	%rax, %xmm1
	mulss	%xmm0, %xmm2
	addss	%xmm0, %xmm2
	movss	%xmm2, -44(%rbp)                ## 4-byte Spill
	subss	%xmm2, %xmm0
	mulss	%xmm1, %xmm0
	callq	_roundf
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
LBB0_9:
	movl	(%rbx), %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%rax, %xmm0
	addss	%xmm0, %xmm0
	mulss	-44(%rbp), %xmm0                ## 4-byte Folded Reload
	callq	_roundf
	movl	%eax, (%rbx)
LBB0_10:
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ASPECT_RATIO_CUSTOM,8,3        ## @ASPECT_RATIO_CUSTOM
	.no_dead_strip	_d3d8_calculate_rect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function d3d8_calculate_rect
_d3d8_calculate_rect:                   ; @d3d8_calculate_rect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	d9, d8, [sp, #32]               ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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 b8, -88
	.cfi_offset b9, -96
	mov	x24, x5
	mov	x21, x4
	mov	x22, x3
	mov	x19, x2
	mov	x20, x1
	mov	x23, x0
	ldr	s8, [x1]
	ldr	s9, [x2]
	bl	_config_get_ptr
	mov	x25, x0
	mov	x0, x20
	mov	x1, x19
	bl	_video_driver_get_size
	str	wzr, [x22]
	str	wzr, [x21]
	cbnz	w24, LBB0_3
; %bb.1:
	ldr	x8, [x25, #8]
	cbz	x8, LBB0_3
; %bb.2:
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [sp]
	ldr	w24, [x20]
	ldr	w25, [x19]
	bl	_video_driver_get_aspect_ratio
	ldr	x3, [x23]
	mov	x0, sp
	mov	x1, x24
	mov	x2, x25
	bl	_video_viewport_get_scaled_integer
	ldp	w8, w9, [sp]
	str	w8, [x22]
	str	w9, [x21]
	ldp	w8, w9, [sp, #8]
	str	w8, [x20]
	str	w9, [x19]
	b	LBB0_9
LBB0_3:
	cbnz	w24, LBB0_9
; %bb.4:
	ldr	x8, [x23]
	cbz	x8, LBB0_9
; %bb.5:
	ucvtf	s0, s8
	ucvtf	s1, s9
	fdiv	s8, s0, s1
	bl	_video_driver_get_aspect_ratio
	fabd	s1, s8, s0
	mov	w8, #46871
	movk	w8, #14545, lsl #16
	fmov	s2, w8
	fcmp	s1, s2
	b.mi	LBB0_9
; %bb.6:
	fcmp	s8, s0
	b.le	LBB0_8
; %bb.7:
	fdiv	s0, s0, s8
	fmov	s1, #-1.00000000
	fadd	s0, s0, s1
	fmov	s1, #0.50000000
	fmul	s0, s0, s1
	fadd	s8, s0, s1
	ldr	s0, [x20]
	ucvtf	s0, s0
	fsub	s1, s1, s8
	fmul	s0, s1, s0
	bl	_roundf
	str	w0, [x22]
	ldr	s0, [x20]
	ucvtf	s0, s0
	fadd	s0, s0, s0
	fmul	s0, s8, s0
	bl	_roundf
	str	w0, [x20]
	b	LBB0_9
LBB0_8:
	fdiv	s0, s8, s0
	fmov	s1, #-1.00000000
	fadd	s0, s0, s1
	fmov	s1, #0.50000000
	fmul	s0, s0, s1
	fadd	s8, s0, s1
	ldr	s0, [x19]
	ucvtf	s0, s0
	fsub	s1, s1, s8
	fmul	s0, s1, s0
	bl	_roundf
	str	w0, [x21]
	ldr	s0, [x19]
	ucvtf	s0, s0
	fadd	s0, s0, s0
	fmul	s0, s8, s0
	bl	_roundf
	str	w0, [x19]
LBB0_9:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	d9, d8, [sp, #32]               ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.cfi_endproc
                                        ; -- End function
	.comm	_ASPECT_RATIO_CUSTOM,8,3        ; @ASPECT_RATIO_CUSTOM
	.no_dead_strip	_d3d8_calculate_rect
.subsections_via_symbols
