	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_InitD3D9BaseDevice             ## -- Begin function InitD3D9BaseDevice
	.p2align	4, 0x90
_InitD3D9BaseDevice:                    ## @InitD3D9BaseDevice
	.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	%r9, %rbx
	movl	%r8d, %r12d
	movl	%ecx, %r13d
	movq	%rsi, %r14
	movq	%rdi, %r15
	leaq	-48(%rbp), %rdi
	movl	$4, %esi
	callq	_AlignedAlloc
	movl	%eax, %edi
	callq	_FAILED
	testq	%rax, %rax
	jne	LBB0_2
## %bb.1:
	movq	-48(%rbp), %rdi
	movq	%r15, %rsi
	callq	_InitD3D9ResourceManager
	movl	%eax, %edi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_3
LBB0_2:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_DPRINT1
	movq	_DDERR_OUTOFMEMORY@GOTPCREL(%rip), %rax
LBB0_12:
	movl	(%rax), %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	-48(%rbp), %rax
	movq	%rax, 128(%r15)
	leaq	104(%r15), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	_Direct3DDevice9HAL_Vtbl@GOTPCREL(%rip), %rax
	movq	%rax, 104(%r15)
	movl	$1, (%r15)
	xorl	%eax, %eax
	callq	_GetCurrentThreadId
	movl	%eax, 120(%r15)
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, 112(%r15)
	leaq	96(%r15), %rdi
	callq	_InitializeCriticalSection
	movq	%r14, 88(%r15)
	movl	%r13d, 84(%r15)
	movl	%r12d, 80(%r15)
	movq	%rbx, 8(%r15)
	movq	%rbx, 16(%r15)
	movq	24(%rbp), %rcx
	movq	%rcx, 24(%r15)
	movl	$9, 32(%r15)
	movq	_D3D_OK@GOTPCREL(%rip), %rax
	testq	%rcx, %rcx
	je	LBB0_12
## %bb.4:
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	_FALSE@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	movq	%r12, %rbx
	shlq	$4, %rbx
	movq	(%r14), %rdi
	addq	%rbx, %rdi
	leaq	(,%r12,4), %rsi
	addq	72(%r15), %rsi
	callq	_CreateD3D9DeviceData
	cmpq	%rax, %r13
	je	LBB0_6
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	40(%r15), %rax
	movq	%r12, (%rax,%r12,8)
	movq	(%r14), %rax
	movq	64(%r15), %rcx
	movups	(%rax,%rbx), %xmm0
	movups	%xmm0, (%rcx,%rbx)
	movq	_RT_BUILTIN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r15, %rsi
	movq	%r12, %rdx
	callq	_CreateDirect3DSwapChain9
	movq	48(%r15), %rcx
	movl	%eax, (%rcx,%r12,4)
	movq	56(%r15), %rdx
	movl	%eax, (%rdx,%r12,4)
	movl	(%rcx,%r12,4), %edi
	movq	16(%rbp), %rsi
	callq	_Direct3DSwapChain9_Init
	movl	%eax, %edi
	callq	_FAILED
	testq	%rax, %rax
	jne	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_5 Depth=1
	incq	%r12
	cmpq	24(%rbp), %r12
	jne	LBB0_5
## %bb.11:
	movq	_D3D_OK@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_6:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_7
LBB0_9:
	leaq	L_.str.2(%rip), %rdi
LBB0_7:
	movq	%r12, %rsi
	xorl	%eax, %eax
	callq	_DPRINT1
	movq	_DDERR_GENERIC@GOTPCREL(%rip), %rax
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Could not create resource manager"

	.comm	_DDERR_OUTOFMEMORY,4,2          ## @DDERR_OUTOFMEMORY
	.comm	_Direct3DDevice9HAL_Vtbl,4,2    ## @Direct3DDevice9HAL_Vtbl
	.comm	_FALSE,8,3                      ## @FALSE
L_.str.1:                               ## @.str.1
	.asciz	"Failed to get device data for adapter: %d"

	.comm	_DDERR_GENERIC,4,2              ## @DDERR_GENERIC
	.comm	_RT_BUILTIN,4,2                 ## @RT_BUILTIN
L_.str.2:                               ## @.str.2
	.asciz	"Failed to init swap chain: %d"

	.comm	_D3D_OK,4,2                     ## @D3D_OK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_InitD3D9BaseDevice             ; -- Begin function InitD3D9BaseDevice
	.p2align	2
_InitD3D9BaseDevice:                    ; @InitD3D9BaseDevice
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x7
	mov	x20, x6
	mov	x23, x5
	mov	x24, x4
	mov	x25, x3
	mov	x21, x1
	mov	x22, x0
	add	x0, sp, #8
	mov	w1, #4
	bl	_AlignedAlloc
	bl	_FAILED
	cbnz	x0, LBB0_2
; %bb.1:
	ldr	x0, [sp, #8]
	mov	x1, x22
	bl	_InitD3D9ResourceManager
	bl	_FAILED
	cbz	x0, LBB0_4
LBB0_2:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DPRINT1
Lloh2:
	adrp	x24, _DDERR_OUTOFMEMORY@GOTPAGE
Lloh3:
	ldr	x24, [x24, _DDERR_OUTOFMEMORY@GOTPAGEOFF]
LBB0_3:
	ldr	w0, [x24]
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_4:
	ldr	x8, [sp, #8]
Lloh4:
	adrp	x9, _Direct3DDevice9HAL_Vtbl@GOTPAGE
Lloh5:
	ldr	x9, [x9, _Direct3DDevice9HAL_Vtbl@GOTPAGEOFF]
	str	x8, [x22, #128]
	mov	x26, x22
	str	x9, [x26, #104]!
	mov	w8, #1
	str	w8, [x22]
	bl	_GetCurrentThreadId
	str	w0, [x22, #120]
	str	x26, [x22, #112]
	add	x0, x22, #96
	bl	_InitializeCriticalSection
	str	x21, [x22, #88]
	stp	w24, w25, [x22, #80]
	stp	x23, x23, [x22, #8]
	str	x19, [x22, #24]
	mov	w8, #9
	str	w8, [x22, #32]
	cbz	x19, LBB0_9
; %bb.5:
	mov	x23, #0
Lloh6:
	adrp	x25, _FALSE@GOTPAGE
Lloh7:
	ldr	x25, [x25, _FALSE@GOTPAGEOFF]
Lloh8:
	adrp	x26, _RT_BUILTIN@GOTPAGE
Lloh9:
	ldr	x26, [x26, _RT_BUILTIN@GOTPAGEOFF]
Lloh10:
	adrp	x24, _D3D_OK@GOTPAGE
Lloh11:
	ldr	x24, [x24, _D3D_OK@GOTPAGEOFF]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x27, [x25]
	ldr	x8, [x21]
	add	x0, x8, x23, lsl #4
	ldr	x8, [x22, #72]
	add	x1, x8, x23, lsl #2
	bl	_CreateD3D9DeviceData
	cmp	x27, x0
	b.eq	LBB0_10
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x22, #40]
	str	x23, [x8, x23, lsl #3]
	ldr	x8, [x21]
	ldr	x9, [x22, #64]
	lsl	x10, x23, #4
	ldr	q0, [x8, x10]
	str	q0, [x9, x10]
	ldr	w0, [x26]
	mov	x1, x22
	mov	x2, x23
	bl	_CreateDirect3DSwapChain9
	lsl	x8, x23, #2
	ldp	x9, x10, [x22, #48]
	str	w0, [x9, x8]
	str	w0, [x10, x8]
	ldr	w0, [x9, x8]
	mov	x1, x20
	bl	_Direct3DSwapChain9_Init
	bl	_FAILED
	cbnz	x0, LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	add	x23, x23, #1
	cmp	x23, x19
	b.ne	LBB0_6
	b	LBB0_3
LBB0_9:
Lloh12:
	adrp	x24, _D3D_OK@GOTPAGE
Lloh13:
	ldr	x24, [x24, _D3D_OK@GOTPAGEOFF]
	b	LBB0_3
LBB0_10:
	str	x23, [sp]
Lloh14:
	adrp	x0, l_.str.1@PAGE
Lloh15:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_12
LBB0_11:
	str	x23, [sp]
Lloh16:
	adrp	x0, l_.str.2@PAGE
Lloh17:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_12:
	bl	_DPRINT1
Lloh18:
	adrp	x24, _DDERR_GENERIC@GOTPAGE
Lloh19:
	ldr	x24, [x24, _DDERR_GENERIC@GOTPAGEOFF]
	b	LBB0_3
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Could not create resource manager"

	.comm	_DDERR_OUTOFMEMORY,4,2          ; @DDERR_OUTOFMEMORY
	.comm	_Direct3DDevice9HAL_Vtbl,4,2    ; @Direct3DDevice9HAL_Vtbl
	.comm	_FALSE,8,3                      ; @FALSE
l_.str.1:                               ; @.str.1
	.asciz	"Failed to get device data for adapter: %d"

	.comm	_DDERR_GENERIC,4,2              ; @DDERR_GENERIC
	.comm	_RT_BUILTIN,4,2                 ; @RT_BUILTIN
l_.str.2:                               ; @.str.2
	.asciz	"Failed to init swap chain: %d"

	.comm	_D3D_OK,4,2                     ; @D3D_OK
.subsections_via_symbols
