	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_d3drm_device_init              ## -- Begin function d3drm_device_init
	.p2align	4, 0x90
_d3drm_device_init:                     ## @d3drm_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	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r12
	movq	%rcx, %r15
	movq	%rdx, %r13
	movl	%esi, -84(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r14
	movq	_DDSCAPS_ZBUFFER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -80(%rbp)
	movq	$0, -48(%rbp)
	movq	$0, -72(%rbp)
	movq	$0, -64(%rbp)
	movq	$0, -56(%rbp)
	movq	%rdx, 32(%rdi)
	movq	%rdx, %rdi
	callq	_IDirectDraw_AddRef
	movl	24(%r14), %edi
	callq	_IDirect3DRM_AddRef
	movq	%r15, 16(%r14)
	movq	%r15, %rdi
	callq	_IDirectDrawSurface_AddRef
	movl	$24, -136(%rbp)
	leaq	-136(%rbp), %rsi
	movq	%r15, %rdi
	callq	_IDirectDrawSurface_GetSurfaceDesc
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_1
LBB0_14:
	movl	%ebx, %eax
	addq	$104, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	_DDSCAPS_3DDEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, -116(%rbp)
	je	LBB0_2
## %bb.3:
	leaq	-80(%rbp), %rsi
	leaq	-48(%rbp), %rdx
	movq	%r15, %rdi
	callq	_IDirectDrawSurface_GetAttachedSurface
	movl	%eax, %edi
	callq	_SUCCEEDED
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	movq	_FALSE@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
	movq	-48(%rbp), %rdi
	callq	_IDirectDrawSurface_Release
	movq	$0, -48(%rbp)
LBB0_5:
	testq	%r12, %r12
	je	LBB0_8
## %bb.6:
	leaq	-112(%rbp), %rbx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movl	$24, %edx
	callq	_memset
	movl	$24, -112(%rbp)
	movq	_DDSD_CAPS@GOTPCREL(%rip), %rax
	movq	_DDSD_ZBUFFERBITDEPTH@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	_DDSD_WIDTH@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movq	_DDSD_HEIGHT@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movl	%ecx, -108(%rbp)
	movq	_DDSCAPS_ZBUFFER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -92(%rbp)
	movl	$16, -96(%rbp)
	movq	-128(%rbp), %rax
	movq	%rax, -104(%rbp)
	leaq	-48(%rbp), %rdx
	movq	%r13, %rdi
	movq	%rbx, %rsi
	xorl	%ecx, %ecx
	callq	_IDirectDraw_CreateSurface
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_FAILED
	testq	%rax, %rax
	jne	LBB0_14
## %bb.7:
	movq	-48(%rbp), %rsi
	movq	%r15, %rdi
	callq	_IDirectDrawSurface_AddAttachedSurface
	movl	%eax, %ebx
	movq	-48(%rbp), %rdi
	callq	_IDirectDrawSurface_Release
	movl	%ebx, %edi
	callq	_FAILED
	testq	%rax, %rax
	jne	LBB0_14
LBB0_8:
	cmpl	$1, -84(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_12
## %bb.9:
	movq	_IID_IDirect3DRGBDevice@GOTPCREL(%rip), %rsi
	leaq	-72(%rbp), %rdx
	movq	%r15, %rdi
	callq	_IDirectDrawSurface_QueryInterface
	movl	%eax, %ebx
	movl	%eax, %edi
	jmp	LBB0_10
LBB0_2:
	movq	_DDERR_INVALIDCAPS@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_14
LBB0_12:
	movq	_IID_IDirect3D2@GOTPCREL(%rip), %rsi
	leaq	-56(%rbp), %rdx
	movq	%r13, %rdi
	callq	_IDirectDraw_QueryInterface
	movq	-56(%rbp), %rdi
	movq	_IID_IDirect3DRGBDevice@GOTPCREL(%rip), %rsi
	leaq	-64(%rbp), %rcx
	movq	%r15, %rdx
	callq	_IDirect3D2_CreateDevice
	movl	%eax, %ebx
	movq	-56(%rbp), %rdi
	callq	_IDirect3D2_Release
	movl	%ebx, %edi
	callq	_FAILED
	testq	%rax, %rax
	jne	LBB0_13
## %bb.15:
	movq	-64(%rbp), %rdi
	movq	_IID_IDirect3DDevice@GOTPCREL(%rip), %rsi
	leaq	-72(%rbp), %rdx
	callq	_IDirect3DDevice2_QueryInterface
	movl	%eax, %ebx
	movq	-64(%rbp), %rdi
	callq	_IDirect3DDevice2_Release
	movl	%ebx, %edi
LBB0_10:
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_11
LBB0_13:
	movq	-48(%rbp), %rdx
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_IDirectDrawSurface_DeleteAttachedSurface
	jmp	LBB0_14
LBB0_11:
	movq	-72(%rbp), %rax
	movq	%rax, 8(%r14)
	movl	-124(%rbp), %eax
	movl	%eax, 4(%r14)
	movl	-128(%rbp), %eax
	movl	%eax, (%r14)
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_DDSCAPS_ZBUFFER,4,2            ## @DDSCAPS_ZBUFFER
	.comm	_DDSCAPS_3DDEVICE,4,2           ## @DDSCAPS_3DDEVICE
	.comm	_DDERR_INVALIDCAPS,4,2          ## @DDERR_INVALIDCAPS
	.comm	_FALSE,8,3                      ## @FALSE
	.comm	_DDSD_CAPS,4,2                  ## @DDSD_CAPS
	.comm	_DDSD_ZBUFFERBITDEPTH,4,2       ## @DDSD_ZBUFFERBITDEPTH
	.comm	_DDSD_WIDTH,4,2                 ## @DDSD_WIDTH
	.comm	_DDSD_HEIGHT,4,2                ## @DDSD_HEIGHT
	.comm	_IID_IDirect3DRGBDevice,4,2     ## @IID_IDirect3DRGBDevice
	.comm	_IID_IDirect3D2,4,2             ## @IID_IDirect3D2
	.comm	_IID_IDirect3DDevice,4,2        ## @IID_IDirect3DDevice
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_d3drm_device_init              ; -- Begin function d3drm_device_init
	.p2align	2
_d3drm_device_init:                     ; @d3drm_device_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #176
	.cfi_def_cfa_offset 176
	stp	x26, x25, [sp, #96]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #112]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #128]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #144]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #160]            ; 16-byte Folded Spill
	add	x29, sp, #160
	.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	x24, x4
	mov	x19, x3
	mov	x21, x2
	mov	x22, x1
	mov	x20, x0
	str	xzr, [sp, #80]
Lloh0:
	adrp	x25, _DDSCAPS_ZBUFFER@GOTPAGE
Lloh1:
	ldr	x25, [x25, _DDSCAPS_ZBUFFER@GOTPAGEOFF]
	ldr	w8, [x25]
	stur	w8, [x29, #-72]
	stp	xzr, xzr, [sp, #64]
	str	xzr, [sp, #56]
	str	x2, [x0, #32]
	mov	x0, x2
	bl	_IDirectDraw_AddRef
	ldr	w0, [x20, #24]
	bl	_IDirect3DRM_AddRef
	str	x19, [x20, #16]
	mov	x0, x19
	bl	_IDirectDrawSurface_AddRef
	mov	w8, #24
	str	w8, [sp, #32]
	add	x1, sp, #32
	mov	x0, x19
	bl	_IDirectDrawSurface_GetSurfaceDesc
	mov	x23, x0
	bl	_FAILED
	cbz	x0, LBB0_2
LBB0_1:
	mov	x0, x23
	ldp	x29, x30, [sp, #160]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #144]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #128]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #112]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #96]             ; 16-byte Folded Reload
	add	sp, sp, #176
	ret
LBB0_2:
	ldr	w8, [sp, #52]
Lloh2:
	adrp	x9, _DDSCAPS_3DDEVICE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _DDSCAPS_3DDEVICE@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.3:
	sub	x1, x29, #72
	add	x2, sp, #80
	mov	x0, x19
	bl	_IDirectDrawSurface_GetAttachedSurface
	bl	_SUCCEEDED
	cbz	x0, LBB0_5
; %bb.4:
Lloh5:
	adrp	x8, _FALSE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh7:
	ldr	x24, [x8]
	ldr	x0, [sp, #80]
	bl	_IDirectDrawSurface_Release
	str	xzr, [sp, #80]
LBB0_5:
	cbz	x24, LBB0_8
; %bb.6:
	mov	w23, #24
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #24
	bl	_memset
Lloh8:
	adrp	x8, _DDSD_CAPS@GOTPAGE
Lloh9:
	ldr	x8, [x8, _DDSD_CAPS@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
Lloh11:
	adrp	x9, _DDSD_ZBUFFERBITDEPTH@GOTPAGE
Lloh12:
	ldr	x9, [x9, _DDSD_ZBUFFERBITDEPTH@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh14:
	adrp	x9, _DDSD_WIDTH@GOTPAGE
Lloh15:
	ldr	x9, [x9, _DDSD_WIDTH@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh17:
	adrp	x9, _DDSD_HEIGHT@GOTPAGE
Lloh18:
	ldr	x9, [x9, _DDSD_HEIGHT@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	orr	w8, w8, w9
	stp	w23, w8, [sp, #8]
	ldr	w8, [x25]
	mov	w9, #16
	stp	w9, w8, [sp, #24]
	ldr	d0, [sp, #40]
	str	d0, [sp, #16]
	add	x1, sp, #8
	add	x2, sp, #80
	mov	x0, x21
	mov	x3, #0
	bl	_IDirectDraw_CreateSurface
	mov	x23, x0
	bl	_FAILED
	cbnz	x0, LBB0_1
; %bb.7:
	ldr	x1, [sp, #80]
	mov	x0, x19
	bl	_IDirectDrawSurface_AddAttachedSurface
	mov	x23, x0
	ldr	x0, [sp, #80]
	bl	_IDirectDrawSurface_Release
	mov	x0, x23
	bl	_FAILED
	cbnz	x0, LBB0_1
LBB0_8:
	cmp	w22, #1
	b.ne	LBB0_11
; %bb.9:
Lloh20:
	adrp	x1, _IID_IDirect3DRGBDevice@GOTPAGE
Lloh21:
	ldr	x1, [x1, _IID_IDirect3DRGBDevice@GOTPAGEOFF]
	add	x2, sp, #72
	mov	x0, x19
	bl	_IDirectDrawSurface_QueryInterface
	mov	x23, x0
	bl	_FAILED
	cbnz	x0, LBB0_13
	b	LBB0_14
LBB0_10:
Lloh22:
	adrp	x8, _DDERR_INVALIDCAPS@GOTPAGE
Lloh23:
	ldr	x8, [x8, _DDERR_INVALIDCAPS@GOTPAGEOFF]
Lloh24:
	ldr	w23, [x8]
	b	LBB0_1
LBB0_11:
Lloh25:
	adrp	x1, _IID_IDirect3D2@GOTPAGE
Lloh26:
	ldr	x1, [x1, _IID_IDirect3D2@GOTPAGEOFF]
	add	x2, sp, #56
	mov	x0, x21
	bl	_IDirectDraw_QueryInterface
	ldr	x0, [sp, #56]
Lloh27:
	adrp	x1, _IID_IDirect3DRGBDevice@GOTPAGE
Lloh28:
	ldr	x1, [x1, _IID_IDirect3DRGBDevice@GOTPAGEOFF]
	add	x3, sp, #64
	mov	x2, x19
	bl	_IDirect3D2_CreateDevice
	mov	x23, x0
	ldr	x0, [sp, #56]
	bl	_IDirect3D2_Release
	mov	x0, x23
	bl	_FAILED
	cbnz	x0, LBB0_13
; %bb.12:
	ldr	x0, [sp, #64]
Lloh29:
	adrp	x1, _IID_IDirect3DDevice@GOTPAGE
Lloh30:
	ldr	x1, [x1, _IID_IDirect3DDevice@GOTPAGEOFF]
	add	x2, sp, #72
	bl	_IDirect3DDevice2_QueryInterface
	mov	x23, x0
	ldr	x0, [sp, #64]
	bl	_IDirect3DDevice2_Release
	mov	x0, x23
	bl	_FAILED
	cbz	x0, LBB0_14
LBB0_13:
	ldr	x2, [sp, #80]
	mov	x0, x19
	mov	w1, #0
	bl	_IDirectDrawSurface_DeleteAttachedSurface
	b	LBB0_1
LBB0_14:
	ldr	x8, [sp, #72]
	str	x8, [x20, #8]
	ldr	d0, [sp, #40]
	str	d0, [x20]
	b	LBB0_1
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_DDSCAPS_ZBUFFER,4,2            ; @DDSCAPS_ZBUFFER
	.comm	_DDSCAPS_3DDEVICE,4,2           ; @DDSCAPS_3DDEVICE
	.comm	_DDERR_INVALIDCAPS,4,2          ; @DDERR_INVALIDCAPS
	.comm	_FALSE,8,3                      ; @FALSE
	.comm	_DDSD_CAPS,4,2                  ; @DDSD_CAPS
	.comm	_DDSD_ZBUFFERBITDEPTH,4,2       ; @DDSD_ZBUFFERBITDEPTH
	.comm	_DDSD_WIDTH,4,2                 ; @DDSD_WIDTH
	.comm	_DDSD_HEIGHT,4,2                ; @DDSD_HEIGHT
	.comm	_IID_IDirect3DRGBDevice,4,2     ; @IID_IDirect3DRGBDevice
	.comm	_IID_IDirect3D2,4,2             ; @IID_IDirect3D2
	.comm	_IID_IDirect3DDevice,4,2        ; @IID_IDirect3DDevice
.subsections_via_symbols
