	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fpga_gfx_init
_fpga_gfx_init:                         ## @fpga_gfx_init
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	movq	%rsi, %r13
	movq	%rdi, %r12
	movl	$0, -48(%rbp)
	movl	$0, -44(%rbp)
	xorl	%eax, %eax
	callq	_config_get_ptr
	movq	%rax, %r15
	movl	$1, %edi
	movl	$1, %esi
	callq	_calloc
	movq	$0, (%r13)
	movq	%rbx, -88(%rbp)                 ## 8-byte Spill
	movq	$0, (%rbx)
	movl	(%r12), %ecx
	movq	_fpga_video_width@GOTPCREL(%rip), %rdx
	movl	%ecx, (%rdx)
	movl	4(%r12), %ecx
	movq	_fpga_video_height@GOTPCREL(%rip), %rdx
	movl	%ecx, (%rdx)
	movq	24(%r12), %rdx
	xorl	%esi, %esi
	testq	%rdx, %rdx
	sete	%bl
	setne	%sil
	movb	$2, %cl
	subb	%bl, %cl
	movq	_fpga_rgb32@GOTPCREL(%rip), %rdi
	movq	%rdx, (%rdi)
	shll	$4, %esi
	addl	$16, %esi
	movq	_fpga_video_bits@GOTPCREL(%rip), %rdx
	movl	%esi, (%rdx)
	movl	(%r12), %edx
	shll	%cl, %edx
	movq	%rax, %r14
	movq	_fpga_video_pitch@GOTPCREL(%rip), %rax
	movl	%edx, (%rax)
	movq	%r14, %rdi
	callq	_fpga_gfx_create
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	movl	8(%r15), %esi
	movq	_GFX_CTX_FPGA_API@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_video_context_driver_init_first
	testq	%rax, %rax
	je	LBB0_8
## %bb.1:
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_video_context_driver_set
	movl	(%rbx), %esi
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_RARCH_LOG
	leaq	-64(%rbp), %rdi
	callq	_video_context_driver_get_video_size
	movl	-64(%rbp), %r15d
	movq	%r13, -72(%rbp)                 ## 8-byte Spill
	movl	-60(%rbp), %r13d
	movq	$0, -64(%rbp)
	leaq	L_.str.1(%rip), %rdi
	movl	%r15d, %esi
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	_RARCH_LOG
	movl	(%r12), %eax
	movl	4(%r12), %ecx
	movq	16(%r12), %rdi
	testq	%rdi, %rdi
	setne	%sil
	testl	%eax, %eax
	sete	%bl
	andb	%sil, %bl
	testl	%ecx, %ecx
	sete	%dl
	testb	%dl, %bl
	cmovnel	%r15d, %eax
	movq	-88(%rbp), %r15                 ## 8-byte Reload
	cmovnel	%r13d, %ecx
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	movl	%eax, -64(%rbp)
	movl	%ecx, -60(%rbp)
	movq	%rdi, -56(%rbp)
	leaq	-64(%rbp), %rdi
	callq	_video_context_driver_set_video_mode
	testl	%eax, %eax
	je	LBB0_8
## %bb.2:
	movq	$0, -64(%rbp)
	leaq	-64(%rbp), %rdi
	callq	_video_context_driver_get_video_size
	movl	-64(%rbp), %ecx
	movl	-60(%rbp), %eax
	movl	%ecx, -48(%rbp)
	movl	%eax, -44(%rbp)
	movq	$0, -64(%rbp)
	testl	%ecx, %ecx
	je	LBB0_5
## %bb.3:
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	leaq	-48(%rbp), %rdi
	leaq	-44(%rbp), %rsi
	callq	_video_driver_set_size
LBB0_5:
	leaq	-48(%rbp), %rdi
	leaq	-44(%rbp), %rsi
	callq	_video_driver_get_size
	movl	-48(%rbp), %esi
	movl	-44(%rbp), %edx
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_RARCH_LOG
	movq	%rbx, -96(%rbp)
	movq	%r15, -104(%rbp)
	leaq	-104(%rbp), %rdi
	callq	_video_context_driver_input_driver
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	cmpq	$0, (%rax)
	je	LBB0_7
## %bb.6:
	movl	8(%r12), %edx
	movq	_FONT_DRIVER_RENDER_FPGA@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	xorl	%edi, %edi
	xorl	%esi, %esi
	callq	_font_driver_init_osd
LBB0_7:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_RARCH_LOG
	jmp	LBB0_11
LBB0_8:
	xorl	%eax, %eax
	callq	_video_context_driver_destroy
	testq	%r14, %r14
	je	LBB0_10
## %bb.9:
	movq	%r14, %rdi
	callq	_free
LBB0_10:
	xorl	%r14d, %r14d
LBB0_11:
	movq	%r14, %rax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_fpga_video_width,4,2           ## @fpga_video_width
	.comm	_fpga_video_height,4,2          ## @fpga_video_height
	.comm	_fpga_rgb32,8,3                 ## @fpga_rgb32
	.comm	_fpga_video_bits,4,2            ## @fpga_video_bits
	.comm	_fpga_video_pitch,4,2           ## @fpga_video_pitch
	.comm	_GFX_CTX_FPGA_API,4,2           ## @GFX_CTX_FPGA_API
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"[FPGA]: Found FPGA context: %s\n"

L_.str.1:                               ## @.str.1
	.asciz	"[FPGA]: Detecting screen resolution %ux%u.\n"

L_.str.2:                               ## @.str.2
	.asciz	"[FPGA]: Using resolution %ux%u\n"

	.comm	_FONT_DRIVER_RENDER_FPGA,4,2    ## @FONT_DRIVER_RENDER_FPGA
L_.str.3:                               ## @.str.3
	.asciz	"[FPGA]: Init complete.\n"

	.no_dead_strip	_fpga_gfx_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fpga_gfx_init
_fpga_gfx_init:                         ; @fpga_gfx_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x21, x2
	mov	x22, x1
	mov	x20, x0
	str	xzr, [sp, #24]
	bl	_config_get_ptr
	mov	x23, x0
	mov	w24, #1
	mov	w0, #1
	mov	w1, #1
	bl	_calloc
	mov	x19, x0
	str	xzr, [x22]
Lloh0:
	adrp	x8, _fpga_video_width@GOTPAGE
Lloh1:
	ldr	x8, [x8, _fpga_video_width@GOTPAGEOFF]
	str	xzr, [x21]
	ldp	w9, w10, [x20]
Lloh2:
	str	w9, [x8]
Lloh3:
	adrp	x8, _fpga_video_height@GOTPAGE
Lloh4:
	ldr	x8, [x8, _fpga_video_height@GOTPAGEOFF]
Lloh5:
	str	w10, [x8]
	ldr	x8, [x20, #24]
Lloh6:
	adrp	x9, _fpga_rgb32@GOTPAGE
Lloh7:
	ldr	x9, [x9, _fpga_rgb32@GOTPAGEOFF]
Lloh8:
	str	x8, [x9]
	cmp	x8, #0
	mov	w8, #32
	mov	w9, #16
	csel	w8, w9, w8, eq
Lloh9:
	adrp	x9, _fpga_video_bits@GOTPAGE
Lloh10:
	ldr	x9, [x9, _fpga_video_bits@GOTPAGEOFF]
Lloh11:
	str	w8, [x9]
	ldr	w8, [x20]
	cinc	w9, w24, ne
	lsl	w8, w8, w9
Lloh12:
	adrp	x9, _fpga_video_pitch@GOTPAGE
Lloh13:
	ldr	x9, [x9, _fpga_video_pitch@GOTPAGEOFF]
Lloh14:
	str	w8, [x9]
	bl	_fpga_gfx_create
	ldr	w1, [x23, #8]
Lloh15:
	adrp	x8, _GFX_CTX_FPGA_API@GOTPAGE
Lloh16:
	ldr	x8, [x8, _GFX_CTX_FPGA_API@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w3, #1
	mov	w4, #0
	mov	w5, #0
	bl	_video_context_driver_init_first
	cbz	x0, LBB0_8
; %bb.1:
	mov	x24, x0
	bl	_video_context_driver_set
	ldr	w8, [x24]
	str	x8, [sp]
Lloh18:
	adrp	x0, l_.str@PAGE
Lloh19:
	add	x0, x0, l_.str@PAGEOFF
	bl	_RARCH_LOG
	add	x0, sp, #32
	bl	_video_context_driver_get_video_size
	ldp	w24, w25, [sp, #32]
	str	xzr, [sp, #32]
	stp	x24, x25, [sp]
Lloh20:
	adrp	x0, l_.str.1@PAGE
Lloh21:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_RARCH_LOG
	ldp	w8, w9, [x20]
	ldr	x10, [x20, #16]
	cmp	x10, #0
	ccmp	w8, #0, #0, ne
	cset	w11, eq
	cmp	w9, #0
	cset	w12, eq
	tst	w11, w12
	csel	w8, w24, w8, ne
	csel	w9, w25, w9, ne
	stp	w8, w9, [sp, #32]
	str	x10, [sp, #40]
	add	x0, sp, #32
	bl	_video_context_driver_set_video_mode
	cbz	w0, LBB0_8
; %bb.2:
	movi.2d	v0, #0000000000000000
	str	d0, [sp, #32]
	add	x0, sp, #32
	bl	_video_context_driver_get_video_size
	ldp	w9, w8, [sp, #32]
	stp	w8, w9, [sp, #24]
	movi.2d	v0, #0000000000000000
	str	d0, [sp, #32]
	cbz	w9, LBB0_5
; %bb.3:
	cbz	w8, LBB0_5
; %bb.4:
	add	x0, sp, #28
	add	x1, sp, #24
	bl	_video_driver_set_size
LBB0_5:
	add	x0, sp, #28
	add	x1, sp, #24
	bl	_video_driver_get_size
	ldp	w9, w8, [sp, #24]
	stp	x8, x9, [sp]
Lloh22:
	adrp	x0, l_.str.2@PAGE
Lloh23:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_RARCH_LOG
	stp	x21, x22, [sp, #48]
	add	x0, sp, #48
	bl	_video_context_driver_input_driver
	ldr	x8, [x23]
	cbz	x8, LBB0_7
; %bb.6:
	ldr	w2, [x20, #8]
Lloh24:
	adrp	x8, _FONT_DRIVER_RENDER_FPGA@GOTPAGE
Lloh25:
	ldr	x8, [x8, _FONT_DRIVER_RENDER_FPGA@GOTPAGEOFF]
Lloh26:
	ldr	w3, [x8]
	mov	x0, #0
	mov	w1, #0
	bl	_font_driver_init_osd
LBB0_7:
Lloh27:
	adrp	x0, l_.str.3@PAGE
Lloh28:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_RARCH_LOG
	b	LBB0_10
LBB0_8:
	bl	_video_context_driver_destroy
	cbz	x19, LBB0_10
; %bb.9:
	mov	x0, x19
	bl	_free
	mov	x19, #0
LBB0_10:
	mov	x0, x19
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotStr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotStr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotStr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotStr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotStr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_fpga_video_width,4,2           ; @fpga_video_width
	.comm	_fpga_video_height,4,2          ; @fpga_video_height
	.comm	_fpga_rgb32,8,3                 ; @fpga_rgb32
	.comm	_fpga_video_bits,4,2            ; @fpga_video_bits
	.comm	_fpga_video_pitch,4,2           ; @fpga_video_pitch
	.comm	_GFX_CTX_FPGA_API,4,2           ; @GFX_CTX_FPGA_API
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"[FPGA]: Found FPGA context: %s\n"

l_.str.1:                               ; @.str.1
	.asciz	"[FPGA]: Detecting screen resolution %ux%u.\n"

l_.str.2:                               ; @.str.2
	.asciz	"[FPGA]: Using resolution %ux%u\n"

	.comm	_FONT_DRIVER_RENDER_FPGA,4,2    ; @FONT_DRIVER_RENDER_FPGA
l_.str.3:                               ; @.str.3
	.asciz	"[FPGA]: Init complete.\n"

	.no_dead_strip	_fpga_gfx_init
.subsections_via_symbols
