	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gxSetAspectRatio
_gxSetAspectRatio:                      ## @gxSetAspectRatio
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	movq	_bitmap@GOTPCREL(%rip), %rcx
	movl	4(%rcx), %edx
	addl	%edx, %edx
	addl	(%rcx), %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, (%rsi)
	movq	_config@GOTPCREL(%rip), %r8
	cmpl	$0, (%r8)
	je	LBB0_17
## %bb.1:
	movq	_vdp_pal@GOTPCREL(%rip), %rcx
	cmpq	$0, (%rcx)
	movq	_gc_pal@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	je	LBB0_4
## %bb.2:
	movq	_VI_MAX_HEIGHT_PAL@GOTPCREL(%rip), %r9
	movq	_VI_MAX_HEIGHT_NTSC@GOTPCREL(%rip), %rdx
	testq	%rcx, %rcx
	je	LBB0_7
## %bb.3:
	cmpq	$0, 24(%r8)
	je	LBB0_8
	jmp	LBB0_7
LBB0_17:
	movl	12(%rcx), %eax
	addl	%eax, %eax
	addl	8(%rcx), %eax
	movl	%eax, (%rdi)
	movq	_reg@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	testb	$1, 48(%rcx)
	jne	LBB0_19
## %bb.18:
	shll	$6, %eax
	leal	(%rax,%rax,4), %ecx
	leal	(%rax,%rax,4), %eax
	addl	$255, %eax
	testl	%ecx, %ecx
	cmovnsl	%ecx, %eax
	sarl	$8, %eax
	movl	%eax, (%rdi)
LBB0_19:
	movq	_system_hw@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_SYSTEM_GG@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_25
## %bb.20:
	cmpl	$0, 32(%r8)
	jne	LBB0_25
## %bb.21:
	movl	4(%r8), %eax
	testb	$1, %al
	jne	LBB0_23
## %bb.22:
	movl	$112, (%rsi)
	movl	4(%r8), %eax
LBB0_23:
	testb	$2, %al
	jne	LBB0_25
## %bb.24:
	movl	$320, (%rdi)                    ## imm = 0x140
LBB0_25:
	movq	_gc_pal@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_28
## %bb.26:
	cmpq	$0, 24(%r8)
	jne	LBB0_28
## %bb.27:
	movq	_VI_MAX_HEIGHT_PAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	imull	(%rsi), %eax
	movq	_VI_MAX_HEIGHT_NTSC@GOTPCREL(%rip), %rcx
	cltd
	idivl	(%rcx)
	movl	%eax, (%rsi)
LBB0_28:
	movl	16(%r8), %eax
	addl	%eax, (%rdi)
	movl	8(%r8), %eax
	addl	%eax, (%rsi)
	jmp	LBB0_29
LBB0_4:
	testq	%rcx, %rcx
	je	LBB0_8
## %bb.5:
	cmpq	$0, 24(%r8)
	jne	LBB0_8
## %bb.6:
	movq	_VI_MAX_HEIGHT_NTSC@GOTPCREL(%rip), %r9
	movq	_VI_MAX_HEIGHT_PAL@GOTPCREL(%rip), %rdx
LBB0_7:
	imull	(%rdx), %eax
	cltd
	idivl	(%r9)
	movl	%eax, (%rsi)
LBB0_8:
	testb	$2, 4(%r8)
	jne	LBB0_9
## %bb.12:
	movq	_system_hw@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_SYSTEM_GG@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_14
## %bb.13:
	movl	$202, %eax
	cmpl	$0, 32(%r8)
	je	LBB0_15
LBB0_14:
	movq	_system_clock@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_MCLOCK_NTSC@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	cmpq	(%rcx), %rax
	setne	%dl
	leal	(%rdx,%rdx,2), %eax
	addl	$322, %eax                      ## imm = 0x142
	jmp	LBB0_15
LBB0_9:
	movq	_reg@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	testb	$1, 48(%rax)
	movq	_system_clock@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_MCLOCK_NTSC@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	jne	LBB0_10
## %bb.11:
	xorl	%edx, %edx
	cmpq	%rcx, %rax
	setne	%dl
	leal	357(,%rdx,4), %eax
	jmp	LBB0_15
LBB0_10:
	xorl	%edx, %edx
	cmpq	%rcx, %rax
	setne	%dl
	leal	350(,%rdx,4), %eax
LBB0_15:
	movl	%eax, (%rdi)
	testb	$2, (%r8)
	jne	LBB0_16
LBB0_29:
	popq	%rbp
	retq
LBB0_16:
	leal	(%rax,%rax,2), %eax
	shrl	$2, %eax
	movl	%eax, (%rdi)
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_bitmap,16,2                    ## @bitmap
	.comm	_config,40,3                    ## @config
	.comm	_vdp_pal,8,3                    ## @vdp_pal
	.comm	_gc_pal,8,3                     ## @gc_pal
	.comm	_VI_MAX_HEIGHT_NTSC,4,2         ## @VI_MAX_HEIGHT_NTSC
	.comm	_VI_MAX_HEIGHT_PAL,4,2          ## @VI_MAX_HEIGHT_PAL
	.comm	_reg,8,3                        ## @reg
	.comm	_system_clock,8,3               ## @system_clock
	.comm	_MCLOCK_NTSC,8,3                ## @MCLOCK_NTSC
	.comm	_system_hw,8,3                  ## @system_hw
	.comm	_SYSTEM_GG,8,3                  ## @SYSTEM_GG
	.no_dead_strip	_gxSetAspectRatio
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gxSetAspectRatio
_gxSetAspectRatio:                      ; @gxSetAspectRatio
	.cfi_startproc
; %bb.0:
Lloh0:
	adrp	x10, _bitmap@GOTPAGE
Lloh1:
	ldr	x10, [x10, _bitmap@GOTPAGEOFF]
	ldp	w8, w9, [x10]
	add	w8, w8, w9, lsl #1
	cmp	w8, #0
	cinc	w8, w8, lt
	asr	w9, w8, #1
	str	w9, [x1]
Lloh2:
	adrp	x8, _config@GOTPAGE
Lloh3:
	ldr	x8, [x8, _config@GOTPAGEOFF]
	ldr	w11, [x8]
	cbz	w11, LBB0_4
; %bb.1:
Lloh4:
	adrp	x10, _vdp_pal@GOTPAGE
Lloh5:
	ldr	x10, [x10, _vdp_pal@GOTPAGEOFF]
Lloh6:
	ldr	x11, [x10]
Lloh7:
	adrp	x10, _gc_pal@GOTPAGE
Lloh8:
	ldr	x10, [x10, _gc_pal@GOTPAGEOFF]
Lloh9:
	ldr	x10, [x10]
	cbz	x11, LBB0_15
; %bb.2:
	ldr	x11, [x8, #24]
	cmp	x10, #0
	ccmp	x11, #0, #0, ne
	b.eq	LBB0_18
; %bb.3:
Lloh10:
	adrp	x10, _VI_MAX_HEIGHT_PAL@GOTPAGE
Lloh11:
	ldr	x10, [x10, _VI_MAX_HEIGHT_PAL@GOTPAGEOFF]
Lloh12:
	adrp	x11, _VI_MAX_HEIGHT_NTSC@GOTPAGE
Lloh13:
	ldr	x11, [x11, _VI_MAX_HEIGHT_NTSC@GOTPAGEOFF]
	b	LBB0_17
LBB0_4:
	ldp	w9, w10, [x10, #8]
	add	w9, w9, w10, lsl #1
	str	w9, [x0]
Lloh14:
	adrp	x10, _reg@GOTPAGE
Lloh15:
	ldr	x10, [x10, _reg@GOTPAGEOFF]
Lloh16:
	ldr	x10, [x10]
	ldrb	w10, [x10, #48]
	tbnz	w10, #0, LBB0_6
; %bb.5:
	add	w9, w9, w9, lsl #2
	lsl	w9, w9, #6
	add	w10, w9, #255
	cmp	w9, #0
	csel	w9, w10, w9, lt
	asr	w9, w9, #8
	str	w9, [x0]
LBB0_6:
Lloh17:
	adrp	x9, _system_hw@GOTPAGE
Lloh18:
	ldr	x9, [x9, _system_hw@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
Lloh20:
	adrp	x10, _SYSTEM_GG@GOTPAGE
Lloh21:
	ldr	x10, [x10, _SYSTEM_GG@GOTPAGEOFF]
Lloh22:
	ldr	x10, [x10]
	ldr	w11, [x8, #32]
	cmp	x9, x10
	ccmp	w11, #0, #0, eq
	b.ne	LBB0_11
; %bb.7:
	ldr	w9, [x8, #4]
	tbnz	w9, #0, LBB0_9
; %bb.8:
	mov	w9, #112
	str	w9, [x1]
	ldr	w9, [x8, #4]
LBB0_9:
	tbnz	w9, #1, LBB0_11
; %bb.10:
	mov	w9, #320
	str	w9, [x0]
LBB0_11:
Lloh23:
	adrp	x9, _gc_pal@GOTPAGE
Lloh24:
	ldr	x9, [x9, _gc_pal@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
	cbz	x9, LBB0_14
; %bb.12:
	ldr	x9, [x8, #24]
	cbnz	x9, LBB0_14
; %bb.13:
	ldr	w9, [x1]
Lloh26:
	adrp	x10, _VI_MAX_HEIGHT_PAL@GOTPAGE
Lloh27:
	ldr	x10, [x10, _VI_MAX_HEIGHT_PAL@GOTPAGEOFF]
Lloh28:
	ldr	w10, [x10]
	mul	w9, w10, w9
Lloh29:
	adrp	x10, _VI_MAX_HEIGHT_NTSC@GOTPAGE
Lloh30:
	ldr	x10, [x10, _VI_MAX_HEIGHT_NTSC@GOTPAGEOFF]
Lloh31:
	ldr	w10, [x10]
	sdiv	w9, w9, w10
	str	w9, [x1]
LBB0_14:
	ldr	w9, [x8, #16]
	ldr	w10, [x0]
	add	w9, w10, w9
	str	w9, [x0]
	ldr	w8, [x8, #8]
	ldr	w9, [x1]
	add	w8, w9, w8
	str	w8, [x1]
	b	LBB0_25
LBB0_15:
	ldr	x11, [x8, #24]
	cmp	x10, #0
	ccmp	x11, #0, #0, ne
	b.ne	LBB0_18
; %bb.16:
Lloh32:
	adrp	x10, _VI_MAX_HEIGHT_NTSC@GOTPAGE
Lloh33:
	ldr	x10, [x10, _VI_MAX_HEIGHT_NTSC@GOTPAGEOFF]
Lloh34:
	adrp	x11, _VI_MAX_HEIGHT_PAL@GOTPAGE
Lloh35:
	ldr	x11, [x11, _VI_MAX_HEIGHT_PAL@GOTPAGEOFF]
LBB0_17:
	ldr	w11, [x11]
	mul	w9, w11, w9
	ldr	w10, [x10]
	sdiv	w9, w9, w10
	str	w9, [x1]
LBB0_18:
	ldrb	w9, [x8, #4]
	tbnz	w9, #1, LBB0_22
; %bb.19:
Lloh36:
	adrp	x9, _system_hw@GOTPAGE
Lloh37:
	ldr	x9, [x9, _system_hw@GOTPAGEOFF]
Lloh38:
	ldr	x9, [x9]
Lloh39:
	adrp	x10, _SYSTEM_GG@GOTPAGE
Lloh40:
	ldr	x10, [x10, _SYSTEM_GG@GOTPAGEOFF]
Lloh41:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_23
; %bb.20:
	ldr	w9, [x8, #32]
	cbnz	w9, LBB0_23
; %bb.21:
	mov	w9, #202
	b	LBB0_24
LBB0_22:
Lloh42:
	adrp	x9, _reg@GOTPAGE
Lloh43:
	ldr	x9, [x9, _reg@GOTPAGEOFF]
Lloh44:
	ldr	x9, [x9]
Lloh45:
	adrp	x10, _system_clock@GOTPAGE
Lloh46:
	ldr	x10, [x10, _system_clock@GOTPAGEOFF]
Lloh47:
	adrp	x11, _MCLOCK_NTSC@GOTPAGE
Lloh48:
	ldr	x11, [x11, _MCLOCK_NTSC@GOTPAGEOFF]
Lloh49:
	ldr	x10, [x10]
Lloh50:
	ldr	x11, [x11]
	ldrb	w9, [x9, #48]
	cmp	x10, x11
	mov	w10, #361
	mov	w11, #357
	csel	w10, w11, w10, eq
	mov	w11, #354
	mov	w12, #350
	csel	w11, w12, w11, eq
	tst	w9, #0x1
	csel	w9, w10, w11, eq
	b	LBB0_24
LBB0_23:
Lloh51:
	adrp	x9, _system_clock@GOTPAGE
Lloh52:
	ldr	x9, [x9, _system_clock@GOTPAGEOFF]
Lloh53:
	adrp	x10, _MCLOCK_NTSC@GOTPAGE
Lloh54:
	ldr	x10, [x10, _MCLOCK_NTSC@GOTPAGEOFF]
Lloh55:
	ldr	x9, [x9]
Lloh56:
	ldr	x10, [x10]
	cmp	x9, x10
	mov	w9, #325
	mov	w10, #322
	csel	w9, w10, w9, eq
LBB0_24:
	str	w9, [x0]
	ldrb	w8, [x8]
	tbnz	w8, #1, LBB0_26
LBB0_25:
	ret
LBB0_26:
	add	w8, w9, w9, lsl #1
	lsr	w8, w8, #2
	str	w8, [x0]
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh34, Lloh35
	.loh AdrpLdrGot	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh50
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh49
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh53, Lloh54, Lloh56
	.loh AdrpLdrGotLdr	Lloh51, Lloh52, Lloh55
	.cfi_endproc
                                        ; -- End function
	.comm	_bitmap,16,2                    ; @bitmap
	.comm	_config,40,3                    ; @config
	.comm	_vdp_pal,8,3                    ; @vdp_pal
	.comm	_gc_pal,8,3                     ; @gc_pal
	.comm	_VI_MAX_HEIGHT_NTSC,4,2         ; @VI_MAX_HEIGHT_NTSC
	.comm	_VI_MAX_HEIGHT_PAL,4,2          ; @VI_MAX_HEIGHT_PAL
	.comm	_reg,8,3                        ; @reg
	.comm	_system_clock,8,3               ; @system_clock
	.comm	_MCLOCK_NTSC,8,3                ; @MCLOCK_NTSC
	.comm	_system_hw,8,3                  ; @system_hw
	.comm	_SYSTEM_GG,8,3                  ; @SYSTEM_GG
	.no_dead_strip	_gxSetAspectRatio
.subsections_via_symbols
