	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ## -- Begin function rgui_update_menu_viewport
LCPI0_0:
	.quad	0x3ff0000000000000              ## double 1
LCPI0_2:
	.quad	0x3fe0000000000000              ## double 0.5
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4
LCPI0_1:
	.quad	0x4330000000000000              ## double 4503599627370496
	.quad	0x4330000000000000              ## double 4503599627370496
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_rgui_update_menu_viewport:             ## @rgui_update_menu_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	%r14
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	xorl	%eax, %eax
	callq	_config_get_ptr
	testq	%rax, %rax
	je	LBB0_14
## %bb.1:
	movq	%rax, %rbx
	leaq	-24(%rbp), %rdi
	leaq	-20(%rbp), %rsi
	leaq	-48(%rbp), %rdx
	callq	_menu_display_get_fb_size
	leaq	-40(%rbp), %rdi
	callq	_video_driver_get_viewport_info
	movq	_ASPECT_RATIO_CUSTOM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%r14)
	movl	-24(%rbp), %edi
	movl	-40(%rbp), %ecx
	movsd	-32(%rbp), %xmm0                ## xmm0 = mem[0],zero
	testl	%edi, %edi
	je	LBB0_12
## %bb.2:
	movl	-20(%rbp), %esi
	testl	%esi, %esi
	je	LBB0_12
## %bb.3:
	testl	%ecx, %ecx
	je	LBB0_12
## %bb.4:
	xorpd	%xmm1, %xmm1
	ucomisd	%xmm1, %xmm0
	jbe	LBB0_12
## %bb.5:
	movq	(%rbx), %rax
	movq	_RGUI_ASPECT_RATIO_LOCK_INTEGER@GOTPCREL(%rip), %rdx
	movl	%esi, %ebx
	cmpq	(%rdx), %rax
	jne	LBB0_8
## %bb.6:
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rbx, %xmm1
	movl	%ecx, %eax
	xorl	%edx, %edx
	divl	%edi
	movapd	%xmm0, %xmm2
	divsd	%xmm1, %xmm2
	cvttsd2si	%xmm2, %rdx
	cmpl	%edx, %eax
	cmovbl	%eax, %edx
	testl	%edx, %edx
	je	LBB0_8
## %bb.7:
	imull	%edx, %edi
	imull	%edx, %esi
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rsi, %xmm1
	jmp	LBB0_11
LBB0_12:
	movl	$1, (%r14)
	movabsq	$4607182418800017408, %rax      ## imm = 0x3FF0000000000000
	movq	%rax, 8(%r14)
	movl	$1, %eax
	movsd	LCPI0_0(%rip), %xmm2            ## xmm2 = mem[0],zero
	jmp	LBB0_13
LBB0_8:
	movd	%edi, %xmm1
	pinsrd	$1, %ecx, %xmm1
	pmovzxdq	%xmm1, %xmm1                    ## xmm1 = xmm1[0],zero,xmm1[1],zero
	movdqa	LCPI0_1(%rip), %xmm2            ## xmm2 = [4.503599627370496E+15,4.503599627370496E+15]
	por	%xmm2, %xmm1
	subpd	%xmm2, %xmm1
	cvtpd2ps	%xmm1, %xmm1
	xorps	%xmm2, %xmm2
	cvtsd2ss	%xmm0, %xmm2
	cvtsi2ss	%rbx, %xmm3
	insertps	$16, %xmm2, %xmm3               ## xmm3 = xmm3[0],xmm2[0],xmm3[2,3]
	divps	%xmm3, %xmm1
	movshdup	%xmm1, %xmm2                    ## xmm2 = xmm1[1,1,3,3]
	ucomiss	%xmm2, %xmm1
	jbe	LBB0_10
## %bb.9:
	imull	%ecx, %esi
	movl	%esi, %eax
	xorl	%edx, %edx
	divl	%edi
                                        ## kill: def $eax killed $eax def $rax
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rax, %xmm1
	movl	%ecx, %edi
	jmp	LBB0_11
LBB0_10:
	movl	%edi, %eax
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rax, %xmm1
	xorps	%xmm2, %xmm2
	cvtsi2sd	%rbx, %xmm2
	mulsd	%xmm0, %xmm1
	divsd	%xmm2, %xmm1
	cvttsd2si	%xmm1, %rdi
	movapd	%xmm0, %xmm1
LBB0_11:
	testl	%edi, %edi
	movl	$1, %eax
	cmovnel	%edi, %eax
	movl	%eax, (%r14)
	movsd	LCPI0_0(%rip), %xmm2            ## xmm2 = mem[0],zero
	maxsd	%xmm1, %xmm2
	movsd	%xmm2, 8(%r14)
LBB0_13:
	subl	%eax, %ecx
	shrl	%ecx
	subsd	%xmm2, %xmm0
	mulsd	LCPI0_2(%rip), %xmm0
	movl	%ecx, 16(%r14)
	cvttsd2si	%xmm0, %eax
	movl	%eax, 20(%r14)
LBB0_14:
	addq	$32, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ASPECT_RATIO_CUSTOM,4,2        ## @ASPECT_RATIO_CUSTOM
	.comm	_RGUI_ASPECT_RATIO_LOCK_INTEGER,8,3 ## @RGUI_ASPECT_RATIO_LOCK_INTEGER
	.comm	_CONF_ASPECT_4_3,8,3            ## @CONF_ASPECT_4_3
	.no_dead_strip	_rgui_update_menu_viewport
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rgui_update_menu_viewport
_rgui_update_menu_viewport:             ; @rgui_update_menu_viewport
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	bl	_config_get_ptr
	cbz	x0, LBB0_12
; %bb.1:
	mov	x20, x0
	add	x0, sp, #20
	add	x1, sp, #16
	add	x2, sp, #24
	bl	_menu_display_get_fb_size
	mov	x0, sp
	bl	_video_driver_get_viewport_info
Lloh0:
	adrp	x8, _ASPECT_RATIO_CUSTOM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ASPECT_RATIO_CUSTOM@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [x19, #24]
	ldr	w9, [sp, #20]
	ldr	w8, [sp]
	ldr	d0, [sp, #8]
	cbz	w9, LBB0_8
; %bb.2:
	ldr	w10, [sp, #16]
	cbz	w10, LBB0_8
; %bb.3:
	cbz	w8, LBB0_8
; %bb.4:
	fcmp	d0, #0.0
	b.le	LBB0_8
; %bb.5:
	ldr	x11, [x20]
Lloh3:
	adrp	x12, _RGUI_ASPECT_RATIO_LOCK_INTEGER@GOTPAGE
Lloh4:
	ldr	x12, [x12, _RGUI_ASPECT_RATIO_LOCK_INTEGER@GOTPAGEOFF]
Lloh5:
	ldr	x12, [x12]
	ucvtf	d1, w10
	cmp	x11, x12
	b.ne	LBB0_9
; %bb.6:
	udiv	w11, w8, w9
	fdiv	d2, d0, d1
	fcvtzu	w12, d2
	cmp	w11, w12
	csel	w11, w11, w12, lo
	cbz	w11, LBB0_9
; %bb.7:
	mul	w9, w11, w9
	mul	w10, w11, w10
	ucvtf	d1, w10
	b	LBB0_10
LBB0_8:
	mov	w9, #1
	str	w9, [x19]
	mov	x10, #4607182418800017408
	str	x10, [x19, #8]
	fmov	d1, #1.00000000
	b	LBB0_11
LBB0_9:
	ucvtf	s2, w8
	fcvt	s3, d0
	fdiv	s2, s2, s3
	ucvtf	s3, w9
	ucvtf	s4, w10
	fdiv	s3, s3, s4
	fcmp	s3, s2
	ucvtf	d2, w9
	fmul	d2, d0, d2
	fdiv	d1, d2, d1
	fcvtzu	w11, d1
	mul	w10, w8, w10
	udiv	w9, w10, w9
	ucvtf	d1, w9
	fcsel	d1, d0, d1, le
	csel	w9, w11, w8, le
LBB0_10:
	cmp	w9, #0
	csinc	w9, w9, wzr, ne
	str	w9, [x19]
	fmov	d2, #1.00000000
	fmax	d1, d1, d2
	str	d1, [x19, #8]
LBB0_11:
	sub	w8, w8, w9
	fsub	d0, d0, d1
	fmov	d1, #0.50000000
	fmul	d0, d0, d1
	fcvtzs	w9, d0
	lsr	w8, w8, #1
	stp	w8, w9, [x19, #16]
LBB0_12:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_ASPECT_RATIO_CUSTOM,4,2        ; @ASPECT_RATIO_CUSTOM
	.comm	_RGUI_ASPECT_RATIO_LOCK_INTEGER,8,3 ; @RGUI_ASPECT_RATIO_LOCK_INTEGER
	.comm	_CONF_ASPECT_4_3,8,3            ; @CONF_ASPECT_4_3
	.no_dead_strip	_rgui_update_menu_viewport
.subsections_via_symbols
