	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function d3d8_renderchain_init
_d3d8_renderchain_init:                 ## @d3d8_renderchain_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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r13
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	movq	(%rdi), %r15
	movq	_RETRO_PIXEL_FORMAT_RGB565@GOTPCREL(%rip), %rax
	testl	%r8d, %r8d
	je	LBB0_2
## %bb.1:
	movq	_RETRO_PIXEL_FORMAT_XRGB8888@GOTPCREL(%rip), %rax
LBB0_2:
	movl	(%rax), %r14d
	xorl	%eax, %eax
	callq	_video_viewport_get_custom
	movq	%rax, %r12
	leaq	-48(%rbp), %rdi
	leaq	-44(%rbp), %rsi
	callq	_video_driver_get_size
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, 16(%r15)
	xorl	%eax, %eax
	movq	_RETRO_PIXEL_FORMAT_RGB565@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %r14d
	setne	%al
	leal	2(%rax,%rax), %eax
	movl	%eax, (%r15)
	movl	4(%r13), %eax
	movl	%eax, 8(%r15)
	movl	(%r13), %eax
	movl	%eax, 4(%r15)
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	callq	_d3d8_renderchain_create_first_pass
	xorl	%ecx, %ecx
	testl	%eax, %eax
	je	LBB0_7
## %bb.3:
	cmpl	$0, (%r12)
	jne	LBB0_5
## %bb.4:
	movl	-48(%rbp), %eax
	movl	%eax, (%r12)
LBB0_5:
	movl	$1, %ecx
	cmpl	$0, 4(%r12)
	jne	LBB0_7
## %bb.6:
	movl	-44(%rbp), %eax
	movl	%eax, 4(%r12)
LBB0_7:
	movl	%ecx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RETRO_PIXEL_FORMAT_XRGB8888,4,2 ## @RETRO_PIXEL_FORMAT_XRGB8888
	.comm	_RETRO_PIXEL_FORMAT_RGB565,4,2  ## @RETRO_PIXEL_FORMAT_RGB565
	.no_dead_strip	_d3d8_renderchain_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function d3d8_renderchain_init
_d3d8_renderchain_init:                 ; @d3d8_renderchain_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x20, x3
	mov	x21, x2
	mov	x22, x1
	mov	x23, x0
	ldr	x24, [x0]
Lloh0:
	adrp	x8, _RETRO_PIXEL_FORMAT_XRGB8888@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RETRO_PIXEL_FORMAT_XRGB8888@GOTPAGEOFF]
Lloh2:
	adrp	x25, _RETRO_PIXEL_FORMAT_RGB565@GOTPAGE
Lloh3:
	ldr	x25, [x25, _RETRO_PIXEL_FORMAT_RGB565@GOTPAGEOFF]
	cmp	w4, #0
	csel	x8, x25, x8, eq
	ldr	w26, [x8]
	bl	_video_viewport_get_custom
	mov	x19, x0
	add	x0, sp, #12
	add	x1, sp, #8
	bl	_video_driver_get_size
	str	x21, [x24, #16]
	ldr	w8, [x25]
	mov	w9, #4
	mov	w10, #2
	cmp	w26, w8
	csel	w8, w10, w9, eq
	str	w8, [x24]
	ldr	d0, [x20]
	stur	d0, [x24, #4]
	mov	x0, x23
	mov	x1, x24
	mov	x2, x22
	bl	_d3d8_renderchain_create_first_pass
	cbz	w0, LBB0_4
; %bb.1:
	ldr	w8, [x19]
	cbz	w8, LBB0_5
; %bb.2:
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_6
LBB0_3:
	mov	w0, #1
LBB0_4:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_5:
	ldr	w8, [sp, #12]
	str	w8, [x19]
	ldr	w8, [x19, #4]
	cbnz	w8, LBB0_3
LBB0_6:
	ldr	w8, [sp, #8]
	str	w8, [x19, #4]
	b	LBB0_3
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_RETRO_PIXEL_FORMAT_XRGB8888,4,2 ; @RETRO_PIXEL_FORMAT_XRGB8888
	.comm	_RETRO_PIXEL_FORMAT_RGB565,4,2  ; @RETRO_PIXEL_FORMAT_RGB565
	.no_dead_strip	_d3d8_renderchain_init
.subsections_via_symbols
