	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function d3d_device_init
_d3d_device_init:                       ## @d3d_device_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
	movl	%r9d, %r14d
	movq	%rcx, %r13
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	16(%rbp), %rax
	movq	_DDSCL_FPUPRESERVE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	(%rsi), %ecx
	movq	%r8, -56(%rbp)                  ## 8-byte Spill
	jne	LBB0_1
## %bb.2:
	movq	_d3d_device7_fpu_setup_vtbl@GOTPCREL(%rip), %rcx
	jmp	LBB0_3
LBB0_1:
	movq	_d3d_device7_fpu_preserve_vtbl@GOTPCREL(%rip), %rcx
LBB0_3:
	movq	%rcx, 216(%rbx)
	movq	_d3d_device3_vtbl@GOTPCREL(%rip), %rcx
	movq	%rcx, 208(%rbx)
	movq	_d3d_device2_vtbl@GOTPCREL(%rip), %rcx
	movq	%rcx, 200(%rbx)
	movq	_d3d_device1_vtbl@GOTPCREL(%rip), %rcx
	movq	%rcx, 192(%rbx)
	leaq	168(%rbx), %rcx
	movq	_d3d_device_inner_vtbl@GOTPCREL(%rip), %rsi
	movq	%rsi, 168(%rbx)
	movl	$1, (%rbx)
	movl	%r14d, 4(%rbx)
	testq	%rax, %rax
	cmovneq	%rax, %rcx
	movl	%edx, 184(%rbx)
	movq	%rcx, 176(%rbx)
	movq	%r15, 160(%rbx)
	leaq	156(%rbx), %rdi
	callq	_list_init
	leaq	16(%rbx), %r12
	movq	%r12, %rdi
	movl	$64, %esi
	callq	_ddraw_handle_table_init
	testl	%eax, %eax
	je	LBB0_4
## %bb.5:
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	movq	_FALSE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 152(%rbx)
	movups	_d3d_device_init.ident+48(%rip), %xmm0
	movups	%xmm0, 136(%rbx)
	movups	_d3d_device_init.ident+32(%rip), %xmm1
	movups	%xmm1, 120(%rbx)
	movups	_d3d_device_init.ident+16(%rip), %xmm2
	movups	%xmm2, 104(%rbx)
	movups	_d3d_device_init.ident(%rip), %xmm3
	movups	%xmm3, 88(%rbx)
	movups	%xmm3, 24(%rbx)
	movups	%xmm2, 40(%rbx)
	movups	%xmm1, 56(%rbx)
	movups	%xmm0, 72(%rbx)
	movl	4(%r15), %edi
	movl	%edi, 20(%rbx)
	callq	_wined3d_device_incref
	movl	4(%r15), %r14d
	movq	%r13, %rdi
	callq	_ddraw_surface_get_rendertarget_view
	movq	_TRUE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%r14d, %edi
	xorl	%esi, %esi
	movl	%eax, %edx
	callq	_wined3d_device_set_rendertarget_view
	movl	%eax, %r13d
	movl	%eax, %edi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	leaq	L_.str.1(%rip), %rdi
	movl	%r13d, %esi
	xorl	%eax, %eax
	callq	_ERR
	movq	%r12, %rdi
	callq	_ddraw_handle_table_destroy
	jmp	LBB0_15
LBB0_4:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_ERR
	movq	_DDERR_OUTOFMEMORY@GOTPCREL(%rip), %rax
	jmp	LBB0_14
LBB0_7:
	movq	_TRUE@GOTPCREL(%rip), %r13
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%rdi, 8(%rbx)
	cmpl	$1, -44(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_9
## %bb.8:
	movq	%rbx, 8(%r15)
	movl	4(%r15), %r14d
	movq	_WINED3D_RS_ZENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	%rbx, %rdi
	callq	_d3d_device_update_depth_stencil
	movl	%r14d, %edi
	movl	%r12d, %esi
	movl	%eax, %edx
	callq	_wined3d_device_set_render_state
	movq	_WINED3D_RS_COLORKEYENABLE@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_9:
	callq	_IUnknown_AddRef
	movq	%rbx, 8(%r15)
	movl	4(%r15), %r14d
	movq	_WINED3D_RS_ZENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	%rbx, %rdi
	callq	_d3d_device_update_depth_stencil
	movl	%r14d, %edi
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movl	%r12d, %esi
	movl	%eax, %edx
	callq	_wined3d_device_set_render_state
	cmpl	$2, %ebx
	jne	LBB0_16
## %bb.10:
	movq	_WINED3D_RS_SPECULARENABLE@GOTPCREL(%rip), %rax
LBB0_11:
	movl	4(%r15), %edi
	movl	(%rax), %esi
	movl	(%r13), %edx
	callq	_wined3d_device_set_render_state
LBB0_12:
	movl	4(%r15), %edi
	movq	_WINED3D_RS_NORMALIZENORMALS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r13), %edx
	callq	_wined3d_device_set_render_state
LBB0_13:
	movq	_D3D_OK@GOTPCREL(%rip), %rax
LBB0_14:
	movl	(%rax), %r13d
LBB0_15:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	cmpl	$7, %ebx
	jl	LBB0_12
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	2                               ## @d3d_device_init.ident
_d3d_device_init.ident:
	.long	0x3f800000                      ## float 1
	.long	0x00000000                      ## float 0
	.long	0x00000000                      ## float 0
	.long	0x00000000                      ## float 0
	.long	0x00000000                      ## float 0
	.long	0x3f800000                      ## float 1
	.long	0x00000000                      ## float 0
	.long	0x00000000                      ## float 0
	.long	0x00000000                      ## float 0
	.long	0x00000000                      ## float 0
	.long	0x3f800000                      ## float 1
	.long	0x00000000                      ## float 0
	.long	0x00000000                      ## float 0
	.long	0x00000000                      ## float 0
	.long	0x00000000                      ## float 0
	.long	0x3f800000                      ## float 1

	.comm	_DDSCL_FPUPRESERVE,4,2          ## @DDSCL_FPUPRESERVE
	.comm	_d3d_device7_fpu_preserve_vtbl,4,2 ## @d3d_device7_fpu_preserve_vtbl
	.comm	_d3d_device7_fpu_setup_vtbl,4,2 ## @d3d_device7_fpu_setup_vtbl
	.comm	_d3d_device3_vtbl,4,2           ## @d3d_device3_vtbl
	.comm	_d3d_device2_vtbl,4,2           ## @d3d_device2_vtbl
	.comm	_d3d_device1_vtbl,4,2           ## @d3d_device1_vtbl
	.comm	_d3d_device_inner_vtbl,4,2      ## @d3d_device_inner_vtbl
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to initialize handle table.\n"

	.comm	_DDERR_OUTOFMEMORY,4,2          ## @DDERR_OUTOFMEMORY
	.comm	_FALSE,4,2                      ## @FALSE
	.comm	_TRUE,4,2                       ## @TRUE
L_.str.1:                               ## @.str.1
	.asciz	"Failed to set render target, hr %#x.\n"

	.comm	_WINED3D_RS_ZENABLE,4,2         ## @WINED3D_RS_ZENABLE
	.comm	_WINED3D_RS_COLORKEYENABLE,4,2  ## @WINED3D_RS_COLORKEYENABLE
	.comm	_WINED3D_RS_SPECULARENABLE,4,2  ## @WINED3D_RS_SPECULARENABLE
	.comm	_WINED3D_RS_NORMALIZENORMALS,4,2 ## @WINED3D_RS_NORMALIZENORMALS
	.comm	_D3D_OK,4,2                     ## @D3D_OK
	.no_dead_strip	_d3d_device_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function d3d_device_init
_d3d_device_init:                       ; @d3d_device_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, x5
	mov	x22, x4
	mov	x23, x3
	mov	x19, x1
	mov	x21, x0
	ldr	w8, [x1]
Lloh0:
	adrp	x9, _DDSCL_FPUPRESERVE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _DDSCL_FPUPRESERVE@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
Lloh3:
	adrp	x10, _d3d_device7_fpu_preserve_vtbl@GOTPAGE
Lloh4:
	ldr	x10, [x10, _d3d_device7_fpu_preserve_vtbl@GOTPAGEOFF]
Lloh5:
	adrp	x11, _d3d_device7_fpu_setup_vtbl@GOTPAGE
Lloh6:
	ldr	x11, [x11, _d3d_device7_fpu_setup_vtbl@GOTPAGEOFF]
	tst	w9, w8
	csel	x8, x11, x10, eq
Lloh7:
	adrp	x9, _d3d_device3_vtbl@GOTPAGE
Lloh8:
	ldr	x9, [x9, _d3d_device3_vtbl@GOTPAGEOFF]
	stp	x9, x8, [x0, #208]
Lloh9:
	adrp	x8, _d3d_device2_vtbl@GOTPAGE
Lloh10:
	ldr	x8, [x8, _d3d_device2_vtbl@GOTPAGEOFF]
Lloh11:
	adrp	x9, _d3d_device1_vtbl@GOTPAGE
Lloh12:
	ldr	x9, [x9, _d3d_device1_vtbl@GOTPAGEOFF]
	stp	x9, x8, [x0, #192]
Lloh13:
	adrp	x8, _d3d_device_inner_vtbl@GOTPAGE
Lloh14:
	ldr	x8, [x8, _d3d_device_inner_vtbl@GOTPAGEOFF]
	mov	x9, x0
	str	x8, [x9, #168]!
	mov	w8, #1
	stp	w8, w5, [x0]
	str	w2, [x0, #184]
	cmp	x6, #0
	csel	x8, x9, x6, eq
	str	x8, [x0, #176]
	str	x1, [x0, #160]
	add	x0, x0, #156
	bl	_list_init
	add	x24, x21, #16
	mov	x0, x24
	mov	w1, #64
	bl	_ddraw_handle_table_init
	cbz	w0, LBB0_3
; %bb.1:
Lloh15:
	adrp	x8, _FALSE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	str	w8, [x21, #152]
Lloh18:
	adrp	x8, _d3d_device_init.ident@PAGE
Lloh19:
	add	x8, x8, _d3d_device_init.ident@PAGEOFF
	ldp	q0, q1, [x8]
	stur	q0, [x21, #88]
	stur	q1, [x21, #104]
	ldp	q2, q3, [x8, #32]
	stur	q2, [x21, #120]
	stur	q3, [x21, #136]
	stur	q0, [x21, #24]
	stur	q1, [x21, #40]
	stur	q2, [x21, #56]
	stur	q3, [x21, #72]
	ldr	w0, [x19, #4]
	str	w0, [x21, #20]
	bl	_wined3d_device_incref
	ldr	w25, [x19, #4]
	mov	x0, x23
	bl	_ddraw_surface_get_rendertarget_view
	mov	x2, x0
Lloh20:
	adrp	x26, _TRUE@GOTPAGE
Lloh21:
	ldr	x26, [x26, _TRUE@GOTPAGEOFF]
	ldr	w3, [x26]
	mov	x0, x25
	mov	w1, #0
	bl	_wined3d_device_set_rendertarget_view
	mov	x23, x0
	bl	_FAILED
	cbz	x0, LBB0_4
; %bb.2:
	str	x23, [sp]
Lloh22:
	adrp	x0, l_.str.1@PAGE
Lloh23:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_ERR
	mov	x0, x24
	bl	_ddraw_handle_table_destroy
	b	LBB0_12
LBB0_3:
Lloh24:
	adrp	x0, l_.str@PAGE
Lloh25:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ERR
Lloh26:
	adrp	x8, _DDERR_OUTOFMEMORY@GOTPAGE
Lloh27:
	ldr	x8, [x8, _DDERR_OUTOFMEMORY@GOTPAGEOFF]
	b	LBB0_11
LBB0_4:
	str	x22, [x21, #8]
	cmp	w20, #1
	b.ne	LBB0_6
; %bb.5:
	str	x21, [x19, #8]
	ldr	w20, [x19, #4]
Lloh28:
	adrp	x8, _WINED3D_RS_ZENABLE@GOTPAGE
Lloh29:
	ldr	x8, [x8, _WINED3D_RS_ZENABLE@GOTPAGEOFF]
Lloh30:
	ldr	w22, [x8]
	mov	x0, x21
	bl	_d3d_device_update_depth_stencil
	mov	x2, x0
	mov	x0, x20
	mov	x1, x22
	bl	_wined3d_device_set_render_state
Lloh31:
	adrp	x8, _WINED3D_RS_COLORKEYENABLE@GOTPAGE
Lloh32:
	ldr	x8, [x8, _WINED3D_RS_COLORKEYENABLE@GOTPAGEOFF]
	b	LBB0_8
LBB0_6:
	mov	x0, x22
	bl	_IUnknown_AddRef
	str	x21, [x19, #8]
	ldr	w22, [x19, #4]
Lloh33:
	adrp	x8, _WINED3D_RS_ZENABLE@GOTPAGE
Lloh34:
	ldr	x8, [x8, _WINED3D_RS_ZENABLE@GOTPAGEOFF]
Lloh35:
	ldr	w23, [x8]
	mov	x0, x21
	bl	_d3d_device_update_depth_stencil
	mov	x2, x0
	mov	x0, x22
	mov	x1, x23
	bl	_wined3d_device_set_render_state
	cmp	w20, #2
	b.ne	LBB0_13
; %bb.7:
Lloh36:
	adrp	x8, _WINED3D_RS_SPECULARENABLE@GOTPAGE
Lloh37:
	ldr	x8, [x8, _WINED3D_RS_SPECULARENABLE@GOTPAGEOFF]
LBB0_8:
	ldr	w0, [x19, #4]
	ldr	w1, [x8]
	ldr	w2, [x26]
	bl	_wined3d_device_set_render_state
LBB0_9:
	ldr	w0, [x19, #4]
Lloh38:
	adrp	x8, _WINED3D_RS_NORMALIZENORMALS@GOTPAGE
Lloh39:
	ldr	x8, [x8, _WINED3D_RS_NORMALIZENORMALS@GOTPAGEOFF]
Lloh40:
	ldr	w1, [x8]
	ldr	w2, [x26]
	bl	_wined3d_device_set_render_state
LBB0_10:
Lloh41:
	adrp	x8, _D3D_OK@GOTPAGE
Lloh42:
	ldr	x8, [x8, _D3D_OK@GOTPAGEOFF]
LBB0_11:
	ldr	w23, [x8]
LBB0_12:
	mov	x0, x23
	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_13:
	cmp	w20, #7
	b.lt	LBB0_9
	b	LBB0_10
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGot	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGot	Lloh41, Lloh42
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	2                               ; @d3d_device_init.ident
_d3d_device_init.ident:
	.long	0x3f800000                      ; float 1
	.long	0x00000000                      ; float 0
	.long	0x00000000                      ; float 0
	.long	0x00000000                      ; float 0
	.long	0x00000000                      ; float 0
	.long	0x3f800000                      ; float 1
	.long	0x00000000                      ; float 0
	.long	0x00000000                      ; float 0
	.long	0x00000000                      ; float 0
	.long	0x00000000                      ; float 0
	.long	0x3f800000                      ; float 1
	.long	0x00000000                      ; float 0
	.long	0x00000000                      ; float 0
	.long	0x00000000                      ; float 0
	.long	0x00000000                      ; float 0
	.long	0x3f800000                      ; float 1

	.comm	_DDSCL_FPUPRESERVE,4,2          ; @DDSCL_FPUPRESERVE
	.comm	_d3d_device7_fpu_preserve_vtbl,4,2 ; @d3d_device7_fpu_preserve_vtbl
	.comm	_d3d_device7_fpu_setup_vtbl,4,2 ; @d3d_device7_fpu_setup_vtbl
	.comm	_d3d_device3_vtbl,4,2           ; @d3d_device3_vtbl
	.comm	_d3d_device2_vtbl,4,2           ; @d3d_device2_vtbl
	.comm	_d3d_device1_vtbl,4,2           ; @d3d_device1_vtbl
	.comm	_d3d_device_inner_vtbl,4,2      ; @d3d_device_inner_vtbl
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to initialize handle table.\n"

	.comm	_DDERR_OUTOFMEMORY,4,2          ; @DDERR_OUTOFMEMORY
	.comm	_FALSE,4,2                      ; @FALSE
	.comm	_TRUE,4,2                       ; @TRUE
l_.str.1:                               ; @.str.1
	.asciz	"Failed to set render target, hr %#x.\n"

	.comm	_WINED3D_RS_ZENABLE,4,2         ; @WINED3D_RS_ZENABLE
	.comm	_WINED3D_RS_COLORKEYENABLE,4,2  ; @WINED3D_RS_COLORKEYENABLE
	.comm	_WINED3D_RS_SPECULARENABLE,4,2  ; @WINED3D_RS_SPECULARENABLE
	.comm	_WINED3D_RS_NORMALIZENORMALS,4,2 ; @WINED3D_RS_NORMALIZENORMALS
	.comm	_D3D_OK,4,2                     ; @D3D_OK
	.no_dead_strip	_d3d_device_init
.subsections_via_symbols
