	.file	"extr_rgui.c_rgui_set_aspect_ratio.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	rgui_set_aspect_ratio, @function
rgui_set_aspect_ratio:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	xor	eax, eax
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	mov	r12d, esi
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	call	config_get_ptr@PLT
	mov	rbx, rax
	xor	eax, eax
	call	rgui_framebuffer_free@PLT
	xor	eax, eax
	call	rgui_background_free@PLT
	lea	rdi, fs_thumbnail[rip]
	call	rgui_thumbnail_free@PLT
	lea	rdi, mini_thumbnail[rip]
	call	rgui_thumbnail_free@PLT
	lea	rdi, mini_left_thumbnail[rip]
	call	rgui_thumbnail_free@PLT
	mov	eax, DWORD PTR 8[rbx]
	mov	DWORD PTR rgui_frame_buf[rip], 240
	mov	DWORD PTR 20[rbp], eax
	cmp	eax, 130
	je	.L2
	jg	.L3
	cmp	eax, 128
	je	.L4
	cmp	eax, 129
	jne	.L6
	mov	DWORD PTR rgui_frame_buf[rip+4], 426
	mov	edi, 102240
	mov	r13d, 426
.L8:
	mov	esi, 4
	call	calloc@PLT
	mov	QWORD PTR rgui_frame_buf[rip+8], rax
	test	rax, rax
	je	.L11
	mov	edi, DWORD PTR rgui_frame_buf[rip+4]
	call	menu_display_set_width@PLT
	mov	edi, DWORD PTR rgui_frame_buf[rip]
	call	menu_display_set_height@PLT
	mov	eax, DWORD PTR rgui_frame_buf[rip+4]
	lea	edi, 0[0+rax*4]
	call	menu_display_set_framebuffer_pitch@PLT
	lea	eax, -32[r13]
	xor	edx, edx
	pxor	xmm0, xmm0
	mov	esi, DWORD PTR FONT_HEIGHT_STRIDE[rip]
	mov	r8d, DWORD PTR FONT_WIDTH_STRIDE[rip]
	pxor	xmm1, xmm1
	cvtsi2ss	xmm0, QWORD PTR RGUI_ENTRY_VALUE_MAXLEN[rip]
	mov	r9d, DWORD PTR rgui_frame_buf[rip]
	cvtsi2ss	xmm1, r13d
	mov	edi, DWORD PTR rgui_frame_buf[rip+4]
	div	r8d
	mov	DWORD PTR rgui_background_buf[rip], edi
	mov	DWORD PTR rgui_background_buf[rip+4], r9d
	mulss	xmm0, xmm1
	mov	edx, r9d
	divss	xmm0, DWORD PTR .LC0[rip]
	cvtss2sd	xmm0, xmm0
	addsd	xmm0, QWORD PTR .LC1[rip]
	cvttsd2si	rcx, xmm0
	mov	DWORD PTR rgui_term_layout[rip+16], ecx
	mov	ecx, edi
	imul	edi, r9d
	mov	r10d, eax
	mov	DWORD PTR rgui_term_layout[rip+8], eax
	lea	eax, 30[rsi+rsi]
	sub	edx, eax
	imul	r8d, r10d
	mov	eax, edx
	xor	edx, edx
	div	esi
	sub	ecx, r8d
	shr	ecx
	mov	DWORD PTR rgui_term_layout[rip], ecx
	imul	esi, eax
	mov	DWORD PTR rgui_term_layout[rip+12], eax
	mov	eax, r9d
	sub	eax, esi
	mov	esi, 4
	shr	eax
	mov	DWORD PTR rgui_term_layout[rip+4], eax
	call	calloc@PLT
	mov	QWORD PTR rgui_background_buf[rip+8], rax
	test	rax, rax
	je	.L11
	mov	edi, DWORD PTR rgui_frame_buf[rip+4]
	mov	eax, DWORD PTR rgui_frame_buf[rip]
	mov	esi, 4
	mov	DWORD PTR fs_thumbnail[rip], edi
	imul	edi, eax
	mov	DWORD PTR fs_thumbnail[rip+4], eax
	call	calloc@PLT
	mov	QWORD PTR fs_thumbnail[rip+8], rax
	test	rax, rax
	je	.L11
	mov	eax, DWORD PTR rgui_term_layout[rip+8]
	mov	edx, DWORD PTR FONT_WIDTH_STRIDE[rip]
	pxor	xmm0, xmm0
	mov	esi, 4
	lea	edi, -4[rax]
	mov	eax, 19
	cmp	edi, 19
	cmova	edi, eax
	imul	edx, edi
	mov	eax, edx
	mov	DWORD PTR mini_thumbnail[rip], edx
	mov	QWORD PTR mini_thumbnail_max_width[rip], rax
	mov	eax, DWORD PTR rgui_term_layout[rip+12]
	imul	eax, DWORD PTR FONT_HEIGHT_STRIDE[rip]
	cvtsi2ss	xmm0, eax
	mulss	xmm0, DWORD PTR .LC2[rip]
	cvttss2si	rax, xmm0
	sub	eax, 2
	mov	rdi, rax
	mov	QWORD PTR mini_thumbnail_max_height[rip], rax
	imul	edi, edx
	mov	DWORD PTR mini_thumbnail[rip+4], eax
	call	calloc@PLT
	mov	QWORD PTR mini_thumbnail[rip+8], rax
	test	rax, rax
	je	.L11
	mov	rax, QWORD PTR mini_thumbnail_max_width[rip]
	mov	rdi, QWORD PTR mini_thumbnail_max_height[rip]
	mov	esi, 4
	mov	DWORD PTR mini_left_thumbnail[rip+4], edi
	imul	edi, eax
	mov	DWORD PTR mini_left_thumbnail[rip], eax
	call	calloc@PLT
	mov	QWORD PTR mini_left_thumbnail[rip+8], rax
	test	rax, rax
	je	.L11
	mov	rax, QWORD PTR 0[rbp]
	mov	r13d, 1
	mov	BYTE PTR [rax], 0
	movabs	rax, 4294967297
	mov	QWORD PTR 8[rbp], rax
	mov	rax, QWORD PTR RGUI_ASPECT_RATIO_LOCK_NONE[rip]
	cmp	QWORD PTR [rbx], rax
	je	.L1
	mov	rdi, rbp
	call	rgui_update_menu_viewport@PLT
	lea	rsi, 16[rbp]
	mov	edx, r12d
	mov	rdi, rbp
	call	rgui_set_video_config@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L11:
	xor	r13d, r13d
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r13d
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	.cfi_restore_state
	cmp	eax, 131
	jne	.L6
	mov	DWORD PTR rgui_frame_buf[rip+4], 384
	mov	edi, 92160
	mov	r13d, 384
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L6:
	mov	DWORD PTR rgui_frame_buf[rip+4], 320
	mov	edi, 76800
	mov	r13d, 320
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L4:
	mov	DWORD PTR rgui_frame_buf[rip+4], 426
	mov	edi, 102240
	mov	r13d, 320
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	mov	DWORD PTR rgui_frame_buf[rip+4], 384
	mov	edi, 92160
	mov	r13d, 320
	jmp	.L8
	.cfi_endproc
.LFE0:
	.size	rgui_set_aspect_ratio, .-rgui_set_aspect_ratio
	.comm	rgui_term_layout,20,16
	.comm	rgui_frame_buf,16,16
	.comm	rgui_background_buf,16,16
	.comm	mini_thumbnail_max_width,8,8
	.comm	mini_thumbnail_max_height,8,8
	.comm	mini_thumbnail,16,16
	.comm	mini_left_thumbnail,16,16
	.comm	fs_thumbnail,16,16
	.comm	RGUI_ENTRY_VALUE_MAXLEN,8,8
	.comm	RGUI_ASPECT_RATIO_LOCK_NONE,8,8
	.comm	FONT_WIDTH_STRIDE,4,4
	.comm	FONT_HEIGHT_STRIDE,4,4
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC0:
	.long	1134559232
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1071644672
	.section	.rodata.cst4
	.align 4
.LC2:
	.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_rgui.c_rgui_set_aspect_ratio.c"
	.text
	.global	__aeabi_uidiv
	.global	__aeabi_i2f
	.global	__aeabi_ui2f
	.global	__aeabi_fmul
	.global	__aeabi_fdiv
	.global	__aeabi_f2d
	.global	__aeabi_dadd
	.global	__aeabi_d2uiz
	.global	__aeabi_f2uiz
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	rgui_set_aspect_ratio, %function
rgui_set_aspect_ratio:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	sub	sp, sp, #20
	str	r1, [sp, #12]
	mov	r4, r0
	bl	config_get_ptr
	mov	r9, r0
	bl	rgui_framebuffer_free
	bl	rgui_background_free
	ldr	r0, .L27
	bl	rgui_thumbnail_free
	ldr	r0, .L27+4
	bl	rgui_thumbnail_free
	ldr	r0, .L27+8
	bl	rgui_thumbnail_free
	mov	r1, #240
	ldr	r2, [r9, #4]
	ldr	r5, .L27+12
	sub	r3, r2, #128
	str	r2, [r4, #16]
	str	r1, [r5]
	cmp	r3, #3
	ldrls	pc, [pc, r3, asl #2]
	b	.L2
.L4:
	.word	.L7
	.word	.L6
	.word	.L5
	.word	.L3
.L3:
	mov	r3, #384
	mov	r0, #92160
	mov	r6, r3
	mov	fp, r3
	str	r3, [r5, #4]
.L8:
	mov	r1, #4
	bl	calloc
	cmp	r0, #0
	str	r0, [r5, #8]
	beq	.L11
	mov	r0, r6
	bl	menu_display_set_width
	ldr	r0, [r5]
	bl	menu_display_set_height
	ldr	r0, [r5, #4]
	ldr	r8, .L27+16
	lsl	r0, r0, #2
	bl	menu_display_set_framebuffer_pitch
	ldr	r2, .L27+20
	ldr	r3, .L27+24
	ldr	r10, [r2]
	sub	r0, fp, #32
	mov	r1, r10
	ldr	r6, [r3]
	bl	__aeabi_uidiv
	mov	r3, r0
	ldr	r7, [r5]
	add	r0, r6, #15
	mov	r1, r6
	str	r3, [r8, #8]
	sub	r0, r7, r0, lsl #1
	str	r3, [sp, #4]
	bl	__aeabi_uidiv
	ldr	r3, .L27+28
	str	r0, [sp, #8]
	str	r0, [r8, #12]
	ldr	r0, [r3]
	bl	__aeabi_i2f
	mov	r3, r0
	mov	r0, fp
	mov	fp, r3
	bl	__aeabi_ui2f
	mov	r1, r0
	mov	r0, fp
	bl	__aeabi_fmul
	ldr	r1, .L27+32
	bl	__aeabi_fdiv
	bl	__aeabi_f2d
	mov	r2, #0
	ldr	r3, .L27+36
	bl	__aeabi_dadd
	bl	__aeabi_d2uiz
	ldr	r1, [sp, #8]
	ldr	r2, [sp, #4]
	ldr	r5, [r5, #4]
	mul	r1, r6, r1
	mul	r2, r10, r2
	mul	r3, r7, r5
	ldr	fp, .L27+40
	sub	ip, r7, r1
	sub	r2, r5, r2
	lsr	r2, r2, #1
	lsr	ip, ip, #1
	str	r0, [r8, #16]
	mov	r6, r1
	mov	r0, r3
	mov	r1, #4
	stm	fp, {r5, r7}
	str	r3, [sp, #8]
	str	r2, [r8]
	str	ip, [r8, #4]
	bl	calloc
	cmp	r0, #0
	str	r0, [fp, #8]
	beq	.L11
	ldr	r3, [sp, #8]
	ldr	r8, .L27
	mov	r0, r3
	mov	r1, #4
	stm	r8, {r5, r7}
	bl	calloc
	cmp	r0, #0
	str	r0, [r8, #8]
	beq	.L11
	ldr	r2, [sp, #4]
	ldr	r3, .L27+44
	sub	r0, r2, #4
	cmp	r0, #19
	movcs	r0, #19
	mul	r10, r0, r10
	mov	r0, r6
	str	r10, [r3]
	bl	__aeabi_i2f
	mov	r1, #1056964608
	bl	__aeabi_fmul
	bl	__aeabi_f2uiz
	sub	r5, r0, #2
	mul	r7, r5, r10
	ldr	r6, .L27+4
	ldr	r3, .L27+48
	mov	r0, r7
	mov	r1, #4
	str	r5, [r3]
	str	r10, [r6]
	str	r5, [r6, #4]
	bl	calloc
	cmp	r0, #0
	str	r0, [r6, #8]
	beq	.L11
	ldr	r6, .L27+8
	mov	r0, r7
	mov	r1, #4
	str	r10, [r6]
	str	r5, [r6, #4]
	bl	calloc
	cmp	r0, #0
	str	r0, [r6, #8]
	beq	.L11
	mov	r1, #0
	mov	r5, #1
	ldr	r2, [r4]
	ldr	r3, .L27+52
	strb	r1, [r2]
	ldr	r2, [r9]
	ldr	r3, [r3]
	str	r5, [r4, #4]
	cmp	r2, r3
	moveq	r0, r5
	str	r5, [r4, #8]
	beq	.L1
	mov	r0, r4
	bl	rgui_update_menu_viewport
	mov	r0, r4
	ldr	r2, [sp, #12]
	add	r1, r4, #12
	bl	rgui_set_video_config
	mov	r0, r5
.L1:
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L7:
	ldr	r6, .L27+56
	mov	fp, #320
	ldr	r0, .L27+60
	str	r6, [r5, #4]
	b	.L8
.L6:
	ldr	r3, .L27+56
	ldr	r0, .L27+60
	mov	r6, r3
	mov	fp, r3
	str	r3, [r5, #4]
	b	.L8
.L5:
	mov	r6, #384
	mov	r0, #92160
	mov	fp, #320
	str	r6, [r5, #4]
	b	.L8
.L11:
	mov	r0, #0
	b	.L1
.L2:
	mov	r3, #320
	mov	r0, #76800
	mov	r6, r3
	mov	fp, r3
	str	r3, [r5, #4]
	b	.L8
.L28:
	.align	2
.L27:
	.word	fs_thumbnail
	.word	mini_thumbnail
	.word	mini_left_thumbnail
	.word	rgui_frame_buf
	.word	rgui_term_layout
	.word	FONT_WIDTH_STRIDE
	.word	FONT_HEIGHT_STRIDE
	.word	RGUI_ENTRY_VALUE_MAXLEN
	.word	1134559232
	.word	1071644672
	.word	rgui_background_buf
	.word	mini_thumbnail_max_width
	.word	mini_thumbnail_max_height
	.word	RGUI_ASPECT_RATIO_LOCK_NONE
	.word	426
	.word	102240
	.size	rgui_set_aspect_ratio, .-rgui_set_aspect_ratio
	.comm	rgui_term_layout,20,4
	.comm	rgui_frame_buf,12,4
	.comm	rgui_background_buf,12,4
	.comm	mini_thumbnail_max_width,4,4
	.comm	mini_thumbnail_max_height,4,4
	.comm	mini_thumbnail,12,4
	.comm	mini_left_thumbnail,12,4
	.comm	fs_thumbnail,12,4
	.comm	RGUI_ENTRY_VALUE_MAXLEN,4,4
	.comm	RGUI_ASPECT_RATIO_LOCK_NONE,4,4
	.comm	FONT_WIDTH_STRIDE,4,4
	.comm	FONT_HEIGHT_STRIDE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
