	.file	"extr_d3d8.c_d3d8_calculate_rect.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	d3d8_calculate_rect, @function
d3d8_calculate_rect:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	mov	r14d, r9d
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13, rcx
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12, r8
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rsi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdx
	sub	rsp, 72
	.cfi_def_cfa_offset 128
	mov	QWORD PTR [rsp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 56[rsp], rax
	xor	eax, eax
	mov	eax, DWORD PTR [rsi]
	mov	DWORD PTR 8[rsp], eax
	mov	eax, DWORD PTR [rdx]
	mov	DWORD PTR 12[rsp], eax
	xor	eax, eax
	call	config_get_ptr@PLT
	mov	rsi, rbx
	mov	rdi, rbp
	mov	r15, rax
	call	video_driver_get_size@PLT
	cmp	QWORD PTR 8[r15], 0
	mov	DWORD PTR 0[r13], 0
	mov	DWORD PTR [r12], 0
	je	.L2
	test	r14d, r14d
	je	.L31
.L1:
	mov	rax, QWORD PTR 56[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L32
	add	rsp, 72
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	mov	rax, QWORD PTR [rsp]
	cmp	QWORD PTR [rax], 0
	je	.L1
	test	r14d, r14d
	jne	.L1
	mov	eax, DWORD PTR 8[rsp]
	pxor	xmm1, xmm1
	pxor	xmm0, xmm0
	cvtsi2ss	xmm1, rax
	mov	eax, DWORD PTR 12[rsp]
	cvtsi2ss	xmm0, rax
	xor	eax, eax
	divss	xmm1, xmm0
	movss	DWORD PTR [rsp], xmm1
	call	video_driver_get_aspect_ratio@PLT
	movss	xmm1, DWORD PTR [rsp]
	movss	xmm3, DWORD PTR .LC1[rip]
	movaps	xmm2, xmm1
	subss	xmm2, xmm0
	andps	xmm2, XMMWORD PTR .LC0[rip]
	comiss	xmm3, xmm2
	ja	.L1
	comiss	xmm1, xmm0
	jbe	.L28
	divss	xmm0, xmm1
	movss	xmm2, DWORD PTR .LC3[rip]
	mov	eax, DWORD PTR 0[rbp]
	movaps	xmm1, xmm0
	subss	xmm1, DWORD PTR .LC2[rip]
	pxor	xmm0, xmm0
	cvtsi2ss	xmm0, rax
	mulss	xmm1, xmm2
	addss	xmm1, xmm2
	subss	xmm2, xmm1
	movss	DWORD PTR [rsp], xmm1
	mulss	xmm0, xmm2
	call	roundf@PLT
	pxor	xmm0, xmm0
	movss	xmm1, DWORD PTR [rsp]
	mov	DWORD PTR 0[r13], eax
	mov	eax, DWORD PTR 0[rbp]
	cvtsi2ss	xmm0, rax
	addss	xmm0, xmm0
	mulss	xmm0, xmm1
	call	roundf@PLT
	mov	DWORD PTR 0[rbp], eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L31:
	mov	QWORD PTR 16[rsp], 0
	mov	rax, QWORD PTR [rsp]
	mov	QWORD PTR 24[rsp], 0
	mov	QWORD PTR 32[rsp], 0
	mov	r14, QWORD PTR [rax]
	xor	eax, eax
	mov	QWORD PTR 40[rsp], 0
	call	video_driver_get_aspect_ratio@PLT
	mov	edx, DWORD PTR [rbx]
	mov	esi, DWORD PTR 0[rbp]
	lea	rdi, 16[rsp]
	mov	rcx, r14
	call	video_viewport_get_scaled_integer@PLT
	mov	eax, DWORD PTR 16[rsp]
	mov	DWORD PTR 0[r13], eax
	mov	eax, DWORD PTR 20[rsp]
	mov	DWORD PTR [r12], eax
	mov	eax, DWORD PTR 24[rsp]
	mov	DWORD PTR 0[rbp], eax
	mov	eax, DWORD PTR 28[rsp]
	mov	DWORD PTR [rbx], eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L28:
	divss	xmm1, xmm0
	movss	xmm2, DWORD PTR .LC3[rip]
	mov	eax, DWORD PTR [rbx]
	pxor	xmm0, xmm0
	cvtsi2ss	xmm0, rax
	subss	xmm1, DWORD PTR .LC2[rip]
	mulss	xmm1, xmm2
	addss	xmm1, xmm2
	subss	xmm2, xmm1
	movss	DWORD PTR [rsp], xmm1
	mulss	xmm0, xmm2
	call	roundf@PLT
	pxor	xmm0, xmm0
	movss	xmm1, DWORD PTR [rsp]
	mov	DWORD PTR [r12], eax
	mov	eax, DWORD PTR [rbx]
	cvtsi2ss	xmm0, rax
	addss	xmm0, xmm0
	mulss	xmm0, xmm1
	call	roundf@PLT
	mov	DWORD PTR [rbx], eax
	jmp	.L1
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	d3d8_calculate_rect, .-d3d8_calculate_rect
	.comm	ASPECT_RATIO_CUSTOM,8,8
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	2147483647
	.long	0
	.long	0
	.long	0
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC1:
	.long	953267991
	.align 4
.LC2:
	.long	1065353216
	.align 4
.LC3:
	.long	1056964608
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_d3d8.c_d3d8_calculate_rect.c"
	.text
	.global	__aeabi_ui2f
	.global	__aeabi_fdiv
	.global	__aeabi_fsub
	.global	__aeabi_fcmplt
	.global	__aeabi_fcmpgt
	.global	__aeabi_fmul
	.global	__aeabi_fadd
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	d3d8_calculate_rect, %function
d3d8_calculate_rect:
	@ args = 12, pretend = 0, frame = 32
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r7, r3
	ldr	r3, .L18
	sub	sp, sp, #44
	mov	r5, r2
	mov	r6, r1
	ldr	r3, [r3]
	str	r3, [sp, #36]
	mov	r3,#0
	ldr	r10, [r2]
	ldr	fp, [r1]
	ldr	r9, [sp, #80]
	mov	r8, r0
	bl	config_get_ptr
	mov	r4, r0
	mov	r1, r5
	mov	r0, r6
	bl	video_driver_get_size
	mov	r2, #0
	ldr	r3, [r4, #4]
	str	r2, [r7]
	cmp	r3, r2
	str	r2, [r9]
	ldr	r3, [sp, #84]
	beq	.L2
	cmp	r3, r2
	beq	.L16
.L1:
	ldr	r3, .L18
	ldr	r2, [r3]
	ldr	r3, [sp, #36]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L17
	add	sp, sp, #44
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L2:
	clz	r4, r3
	ldr	r3, [r8]
	lsr	r4, r4, #5
	cmp	r3, #0
	moveq	r4, #0
	cmp	r4, #0
	beq	.L1
	mov	r0, fp
	bl	__aeabi_ui2f
	mov	r4, r0
	mov	r0, r10
	bl	__aeabi_ui2f
	mov	r1, r0
	mov	r0, r4
	bl	__aeabi_fdiv
	mov	r4, r0
	bl	video_driver_get_aspect_ratio
	mov	r8, r0
	mov	r0, r4
	mov	r1, r8
	bl	__aeabi_fsub
	ldr	r1, .L18+4
	bic	r0, r0, #-2147483648
	bl	__aeabi_fcmplt
	cmp	r0, #0
	bne	.L1
	mov	r1, r8
	mov	r0, r4
	bl	__aeabi_fcmpgt
	cmp	r0, #0
	beq	.L13
	mov	r1, r4
	mov	r0, r8
	bl	__aeabi_fdiv
	mov	r1, #1065353216
	bl	__aeabi_fsub
	mov	r1, #1056964608
	bl	__aeabi_fmul
	mov	r1, #1056964608
	bl	__aeabi_fadd
	mov	r4, r0
	ldr	r0, [r6]
	bl	__aeabi_ui2f
	mov	r1, r4
	mov	r5, r0
	mov	r0, #1056964608
	bl	__aeabi_fsub
	mov	r1, r0
	mov	r0, r5
	bl	__aeabi_fmul
	bl	roundf
	str	r0, [r7]
	ldr	r0, [r6]
	bl	__aeabi_ui2f
	mov	r1, r0
	bl	__aeabi_fadd
	mov	r1, r4
	bl	__aeabi_fmul
	bl	roundf
	str	r0, [r6]
	b	.L1
.L16:
	ldr	r4, [r6]
	ldr	r10, [r5]
	str	r3, [sp, #12]
	str	r3, [sp, #16]
	str	r3, [sp, #20]
	str	r3, [sp, #24]
	str	r3, [sp, #32]
	str	r3, [sp, #28]
	bl	video_driver_get_aspect_ratio
	ldr	ip, [r8]
	mov	r3, r0
	mov	r2, r10
	mov	r1, r4
	str	ip, [sp]
	add	r0, sp, #12
	bl	video_viewport_get_scaled_integer
	add	r0, sp, #12
	ldm	r0, {r0, r1, r2, r3}
	str	r0, [r7]
	str	r1, [r9]
	str	r2, [r6]
	str	r3, [r5]
	b	.L1
.L13:
	mov	r1, r8
	mov	r0, r4
	bl	__aeabi_fdiv
	mov	r1, #1065353216
	bl	__aeabi_fsub
	mov	r1, #1056964608
	bl	__aeabi_fmul
	mov	r1, #1056964608
	bl	__aeabi_fadd
	mov	r4, r0
	ldr	r0, [r5]
	bl	__aeabi_ui2f
	mov	r1, r4
	mov	r6, r0
	mov	r0, #1056964608
	bl	__aeabi_fsub
	mov	r1, r0
	mov	r0, r6
	bl	__aeabi_fmul
	bl	roundf
	str	r0, [r9]
	ldr	r0, [r5]
	bl	__aeabi_ui2f
	mov	r1, r0
	bl	__aeabi_fadd
	mov	r1, r4
	bl	__aeabi_fmul
	bl	roundf
	str	r0, [r5]
	b	.L1
.L17:
	bl	__stack_chk_fail
.L19:
	.align	2
.L18:
	.word	.LC0
	.word	953267991
	.size	d3d8_calculate_rect, .-d3d8_calculate_rect
	.comm	ASPECT_RATIO_CUSTOM,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
