	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function d3d8_initialize
_d3d8_initialize:                       ## @d3d8_initialize
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %rbx
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_config_get_ptr
	testq	%rbx, %rbx
	je	LBB0_12
## %bb.1:
	movq	_g_pD3D8@GOTPCREL(%rip), %r13
	cmpq	$0, (%r13)
	je	LBB0_2
## %bb.3:
	cmpq	$0, 32(%rbx)
	je	LBB0_8
## %bb.4:
	leaq	-52(%rbp), %r12
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	callq	_d3d8_make_d3dpp
	movl	(%rbx), %edi
	movq	%r12, %rsi
	callq	_d3d8_reset
	movl	$1, %r12d
	testl	%eax, %eax
	jne	LBB0_7
## %bb.5:
	movq	%rbx, %rdi
	callq	_d3d8_deinitialize
	movq	(%r13), %rsi
	xorl	%r12d, %r12d
	xorl	%edi, %edi
	callq	_d3d8_device_free
	movq	$0, (%r13)
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_d3d8_init_base
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:
	movl	%eax, %r13d
	leaq	L_.str(%rip), %rdi
	callq	_RARCH_LOG
	movl	%r13d, %r12d
	jmp	LBB0_7
LBB0_2:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_d3d8_init_base
	movl	%eax, %r12d
LBB0_7:
	testl	%r12d, %r12d
	je	LBB0_12
LBB0_8:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_d3d8_init_chain
	testl	%eax, %eax
	je	LBB0_9
## %bb.10:
	leaq	-48(%rbp), %rdi
	leaq	-44(%rbp), %rsi
	callq	_video_driver_get_size
	movl	-48(%rbp), %esi
	movl	-44(%rbp), %edx
	xorl	%r14d, %r14d
	movq	%rbx, %rdi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	_d3d8_set_viewport
	movl	(%r15), %edx
	movq	_FONT_DRIVER_RENDER_D3D8_API@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_font_driver_init_osd
	movq	$0, 24(%rbx)
	movl	$1024, 16(%rbx)                 ## imm = 0x400
	movl	(%rbx), %edi
	movq	_D3DUSAGE_WRITEONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_D3DFVF_XYZ@GOTPCREL(%rip), %rax
	movq	_D3DFVF_TEX1@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	_D3DFVF_DIFFUSE@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movq	_D3DPOOL_DEFAULT@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movl	$4096, %esi                     ## imm = 0x1000
	xorl	%r9d, %r9d
	callq	_d3d8_vertex_buffer_new
	movl	%eax, 20(%rbx)
	testl	%eax, %eax
	je	LBB0_12
## %bb.11:
	leaq	4(%rbx), %r14
	movl	$1, (%rsp)
	movq	%r14, %rdi
	xorl	%esi, %esi
	movl	$1, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	xorl	%r9d, %r9d
	callq	_d3d_matrix_ortho_off_center_lh
	leaq	8(%rbx), %rdi
	movq	%r14, %rsi
	callq	_d3d_matrix_transpose
	movl	(%rbx), %edi
	movq	_D3DRS_CULLMODE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_D3DCULL_NONE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_d3d8_set_render_state
	movl	$1, %r14d
	jmp	LBB0_12
LBB0_9:
	leaq	L_.str.1(%rip), %rdi
	callq	_RARCH_ERR
LBB0_12:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_g_pD3D8,8,3                    ## @g_pD3D8
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"[D3D8]: Recovered from dead state.\n"

L_.str.1:                               ## @.str.1
	.asciz	"[D3D8]: Failed to initialize render chain.\n"

	.comm	_FONT_DRIVER_RENDER_D3D8_API,4,2 ## @FONT_DRIVER_RENDER_D3D8_API
	.comm	_D3DUSAGE_WRITEONLY,4,2         ## @D3DUSAGE_WRITEONLY
	.comm	_D3DFVF_XYZ,4,2                 ## @D3DFVF_XYZ
	.comm	_D3DFVF_TEX1,4,2                ## @D3DFVF_TEX1
	.comm	_D3DFVF_DIFFUSE,4,2             ## @D3DFVF_DIFFUSE
	.comm	_D3DPOOL_DEFAULT,4,2            ## @D3DPOOL_DEFAULT
	.comm	_D3DRS_CULLMODE,4,2             ## @D3DRS_CULLMODE
	.comm	_D3DCULL_NONE,4,2               ## @D3DCULL_NONE
	.comm	_RARCH_MENU_CTL_DEINIT,4,2      ## @RARCH_MENU_CTL_DEINIT
	.no_dead_strip	_d3d8_initialize
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function d3d8_initialize
_d3d8_initialize:                       ; @d3d8_initialize
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x20, x1
	mov	x19, x0
	bl	_config_get_ptr
	cbz	x19, LBB0_13
; %bb.1:
Lloh0:
	adrp	x21, _g_pD3D8@GOTPAGE
Lloh1:
	ldr	x21, [x21, _g_pD3D8@GOTPAGEOFF]
	ldr	x8, [x21]
	cbz	x8, LBB0_5
; %bb.2:
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_9
; %bb.3:
	add	x2, sp, #4
	mov	x0, x19
	mov	x1, x20
	bl	_d3d8_make_d3dpp
	ldr	w0, [x19]
	add	x1, sp, #4
	bl	_d3d8_reset
	cbz	w0, LBB0_6
; %bb.4:
	mov	w21, #1
	b	LBB0_8
LBB0_5:
	mov	x0, x19
	mov	x1, x20
	bl	_d3d8_init_base
	mov	x21, x0
	b	LBB0_8
LBB0_6:
	mov	x0, x19
	bl	_d3d8_deinitialize
	ldr	x1, [x21]
	mov	x0, #0
	bl	_d3d8_device_free
	str	xzr, [x21]
	mov	x0, x19
	mov	x1, x20
	bl	_d3d8_init_base
	mov	x21, x0
	cbz	w0, LBB0_8
; %bb.7:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_RARCH_LOG
LBB0_8:
	cbz	w21, LBB0_13
LBB0_9:
	mov	x0, x19
	mov	x1, x20
	bl	_d3d8_init_chain
	cbz	w0, LBB0_12
; %bb.10:
	add	x0, sp, #12
	add	x1, sp, #8
	bl	_video_driver_get_size
	ldp	w2, w1, [sp, #8]
	mov	x0, x19
	mov	w3, #0
	mov	w4, #1
	bl	_d3d8_set_viewport
	ldr	w2, [x20]
Lloh4:
	adrp	x8, _FONT_DRIVER_RENDER_D3D8_API@GOTPAGE
Lloh5:
	ldr	x8, [x8, _FONT_DRIVER_RENDER_D3D8_API@GOTPAGEOFF]
Lloh6:
	ldr	w3, [x8]
	mov	x0, x19
	mov	w1, #0
	bl	_font_driver_init_osd
	str	xzr, [x19, #24]
	mov	w8, #1024
	str	w8, [x19, #16]
	ldr	w0, [x19]
Lloh7:
	adrp	x8, _D3DUSAGE_WRITEONLY@GOTPAGE
Lloh8:
	ldr	x8, [x8, _D3DUSAGE_WRITEONLY@GOTPAGEOFF]
Lloh9:
	adrp	x9, _D3DFVF_XYZ@GOTPAGE
Lloh10:
	ldr	x9, [x9, _D3DFVF_XYZ@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
Lloh12:
	adrp	x10, _D3DFVF_TEX1@GOTPAGE
Lloh13:
	ldr	x10, [x10, _D3DFVF_TEX1@GOTPAGEOFF]
Lloh14:
	ldr	w10, [x10]
	orr	w9, w10, w9
Lloh15:
	adrp	x10, _D3DFVF_DIFFUSE@GOTPAGE
Lloh16:
	ldr	x10, [x10, _D3DFVF_DIFFUSE@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
Lloh18:
	ldr	w8, [x10]
	orr	w3, w9, w8
Lloh19:
	adrp	x8, _D3DPOOL_DEFAULT@GOTPAGE
Lloh20:
	ldr	x8, [x8, _D3DPOOL_DEFAULT@GOTPAGEOFF]
Lloh21:
	ldr	w4, [x8]
	mov	w1, #4096
	mov	x5, #0
	bl	_d3d8_vertex_buffer_new
	str	w0, [x19, #20]
	cbz	w0, LBB0_13
; %bb.11:
	add	x21, x19, #4
	mov	w20, #1
	mov	x0, x21
	mov	w1, #0
	mov	w2, #1
	mov	w3, #0
	mov	w4, #1
	mov	w5, #0
	mov	w6, #1
	bl	_d3d_matrix_ortho_off_center_lh
	add	x0, x19, #8
	mov	x1, x21
	bl	_d3d_matrix_transpose
	ldr	w0, [x19]
Lloh22:
	adrp	x8, _D3DRS_CULLMODE@GOTPAGE
Lloh23:
	ldr	x8, [x8, _D3DRS_CULLMODE@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
Lloh25:
	adrp	x8, _D3DCULL_NONE@GOTPAGE
Lloh26:
	ldr	x8, [x8, _D3DCULL_NONE@GOTPAGEOFF]
Lloh27:
	ldr	w2, [x8]
	bl	_d3d8_set_render_state
	b	LBB0_14
LBB0_12:
Lloh28:
	adrp	x0, l_.str.1@PAGE
Lloh29:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_RARCH_ERR
LBB0_13:
	mov	w20, #0
LBB0_14:
	mov	x0, x20
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh18
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh17
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_g_pD3D8,8,3                    ; @g_pD3D8
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"[D3D8]: Recovered from dead state.\n"

l_.str.1:                               ; @.str.1
	.asciz	"[D3D8]: Failed to initialize render chain.\n"

	.comm	_FONT_DRIVER_RENDER_D3D8_API,4,2 ; @FONT_DRIVER_RENDER_D3D8_API
	.comm	_D3DUSAGE_WRITEONLY,4,2         ; @D3DUSAGE_WRITEONLY
	.comm	_D3DFVF_XYZ,4,2                 ; @D3DFVF_XYZ
	.comm	_D3DFVF_TEX1,4,2                ; @D3DFVF_TEX1
	.comm	_D3DFVF_DIFFUSE,4,2             ; @D3DFVF_DIFFUSE
	.comm	_D3DPOOL_DEFAULT,4,2            ; @D3DPOOL_DEFAULT
	.comm	_D3DRS_CULLMODE,4,2             ; @D3DRS_CULLMODE
	.comm	_D3DCULL_NONE,4,2               ; @D3DCULL_NONE
	.comm	_RARCH_MENU_CTL_DEINIT,4,2      ; @RARCH_MENU_CTL_DEINIT
	.no_dead_strip	_d3d8_initialize
.subsections_via_symbols
