	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ## -- Begin function gp2x_video_RGB_setscaling_
LCPI0_0:
	.quad	0x4090000000000000              ## double 1024
LCPI0_2:
	.quad	0x407e900000000000              ## double 489
LCPI0_5:
	.quad	0x4074000000000000              ## double 320
LCPI0_6:
	.quad	0x406e000000000000              ## double 240
LCPI0_7:
	.quad	0x43e0000000000000              ## double 9.2233720368547758E+18
	.section	__TEXT,__literal4,4byte_literals
	.p2align	2
LCPI0_1:
	.long	0x43a00000                      ## float 320
LCPI0_3:
	.long	0x43890000                      ## float 274
LCPI0_4:
	.long	0x43a58000                      ## float 331
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_gp2x_video_RGB_setscaling_:            ## @gp2x_video_RGB_setscaling_
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
                                        ## kill: def $edi killed $edi def $rdi
	movq	_memregs@GOTPCREL(%rip), %rax
	movq	(%rax), %r8
	movl	20916(%r8), %r9d
	shrl	$9, %r9d
	andl	$3, %r9d
	movq	_gp2x_screenaddrs@GOTPCREL(%rip), %rax
	movq	(%rax), %r10
	imull	%r9d, %edi
	shll	$6, %edi
	leal	(%rdi,%rdi,4), %edi
	movslq	%edi, %rdi
	movq	(%r10), %rcx
	addq	%rdi, %rcx
	movq	_gp2x_screenaddrs_use@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rcx, (%rax)
	movq	8(%r10), %rcx
	addq	%rdi, %rcx
	movq	%rcx, 8(%rax)
	movq	16(%r10), %rcx
	addq	%rdi, %rcx
	movq	%rcx, 16(%rax)
	addq	24(%r10), %rdi
	movq	%rdi, 24(%rax)
	movss	LCPI0_1(%rip), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	testb	$1, 20481(%r8)
	jne	LBB0_2
## %bb.1:
	movsd	LCPI0_0(%rip), %xmm1            ## xmm1 = mem[0],zero
	jmp	LBB0_6
LBB0_2:
	movl	20528(%r8), %edi
	movsd	LCPI0_2(%rip), %xmm1            ## xmm1 = mem[0],zero
	cmpl	$287, %edi                      ## imm = 0x11F
	je	LBB0_3
## %bb.4:
	cmpl	$239, %edi
	jne	LBB0_6
## %bb.5:
	movss	LCPI0_4(%rip), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	jmp	LBB0_6
LBB0_3:
	movss	LCPI0_3(%rip), %xmm0            ## xmm0 = mem[0],zero,zero,zero
LBB0_6:
	cvtsi2sd	%esi, %xmm2
	divsd	LCPI0_5(%rip), %xmm2
	mulsd	%xmm1, %xmm2
	cvttsd2si	%xmm2, %eax
	cmpl	$240, %edx
	setne	%dil
	cmpl	$320, %esi                      ## imm = 0x140
	sete	%cl
	andb	%dil, %cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
	movzwl	%ax, %eax
	xorps	%xmm1, %xmm1
	cvtsi2ss	%r9d, %xmm1
	movl	%eax, 21004(%r8)
	mulss	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtsi2sd	%edx, %xmm0
	cvtss2sd	%xmm1, %xmm1
	divsd	LCPI0_6(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	cvttsd2si	%xmm0, %rax
	movq	%rax, %rcx
	subsd	LCPI0_7(%rip), %xmm0
	sarq	$63, %rcx
	cvttsd2si	%xmm0, %rdx
	andq	%rcx, %rdx
	orq	%rax, %rdx
	movq	_memregl@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rdx, 21008(%rax)
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_memregs,8,3                    ## @memregs
	.comm	_gp2x_screenaddrs,8,3           ## @gp2x_screenaddrs
	.comm	_gp2x_screenaddrs_use,8,3       ## @gp2x_screenaddrs_use
	.comm	_memregl,8,3                    ## @memregl
	.no_dead_strip	_gp2x_video_RGB_setscaling_
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gp2x_video_RGB_setscaling_
_gp2x_video_RGB_setscaling_:            ; @gp2x_video_RGB_setscaling_
	.cfi_startproc
; %bb.0:
Lloh0:
	adrp	x8, _memregs@GOTPAGE
Lloh1:
	ldr	x8, [x8, _memregs@GOTPAGEOFF]
Lloh2:
	ldr	x10, [x8]
	add	x8, x10, #5, lsl #12            ; =20480
	mov	w9, #20916
	ldr	w9, [x10, x9]
Lloh3:
	adrp	x11, _gp2x_screenaddrs@GOTPAGE
Lloh4:
	ldr	x11, [x11, _gp2x_screenaddrs@GOTPAGEOFF]
	ubfx	w9, w9, #9, #2
Lloh5:
	ldr	x11, [x11]
	ldr	x12, [x11]
	mul	w13, w0, w9
	add	w13, w13, w13, lsl #2
	lsl	w13, w13, #6
	sxtw	x13, w13
	add	x12, x12, x13
Lloh6:
	adrp	x14, _gp2x_screenaddrs_use@GOTPAGE
Lloh7:
	ldr	x14, [x14, _gp2x_screenaddrs_use@GOTPAGEOFF]
Lloh8:
	ldr	x14, [x14]
	str	x12, [x14]
	ldr	x12, [x11, #8]
	add	x12, x12, x13
	str	x12, [x14, #8]
	ldr	x12, [x11, #16]
	add	x12, x12, x13
	str	x12, [x14, #16]
	ldr	x11, [x11, #24]
	add	x11, x11, x13
	str	x11, [x14, #24]
	mov	w11, #20481
	ldrb	w10, [x10, x11]
	tbnz	w10, #0, LBB0_2
; %bb.1:
	mov	x10, #4652218415073722368
	fmov	d1, x10
	mov	w10, #1134559232
	fmov	s0, w10
	b	LBB0_3
LBB0_2:
	ldr	w10, [x8, #48]
	mov	x11, #158329674399744
	movk	x11, #16510, lsl #48
	fmov	d1, x11
	mov	w11, #1133051904
	fmov	s0, w11
	cmp	w10, #239
	mov	x11, #158329674399744
	movk	x11, #16510, lsl #48
	fmov	d2, x11
	mov	w11, #1134559232
	fmov	s3, w11
	mov	x11, #158329674399744
	movk	x11, #16510, lsl #48
	fmov	d4, x11
	mov	w11, #32768
	movk	w11, #17317, lsl #16
	fmov	s5, w11
	fcsel	s3, s3, s5, ne
	fcsel	d2, d2, d4, ne
	cmp	w10, #287
	fcsel	s0, s0, s3, eq
	fcsel	d1, d1, d2, eq
LBB0_3:
	scvtf	d2, w1
	mov	x10, #4644337115725824000
	fmov	d3, x10
	fdiv	d2, d2, d3
	fmul	d1, d2, d1
	fcvtzs	w10, d1
	cmp	w1, #320
	mov	w11, #240
	ccmp	w2, w11, #4, eq
	cset	w11, ne
	sub	w10, w10, w11
	and	w10, w10, #0xffff
	str	w10, [x8, #524]
	scvtf	s1, w9
	fmul	s0, s0, s1
	fcvt	d0, s0
	scvtf	d1, w2
	mov	x8, #4642648265865560064
	fmov	d2, x8
	fdiv	d1, d1, d2
	fmul	d0, d1, d0
	fcvtzu	x8, d0
Lloh9:
	adrp	x9, _memregl@GOTPAGE
Lloh10:
	ldr	x9, [x9, _memregl@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	str	x8, [x9, #21008]
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_memregs,8,3                    ; @memregs
	.comm	_gp2x_screenaddrs,8,3           ; @gp2x_screenaddrs
	.comm	_gp2x_screenaddrs_use,8,3       ; @gp2x_screenaddrs_use
	.comm	_memregl,8,3                    ; @memregl
	.no_dead_strip	_gp2x_video_RGB_setscaling_
.subsections_via_symbols
