	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function DP_DestroyDirectPlay2
_DP_DestroyDirectPlay2:                 ## @DP_DestroyDirectPlay2
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	%rdi, %rbx
	movq	(%rdi), %rax
	movq	(%rax), %rdi
	movq	_INVALID_HANDLE_VALUE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rdi
	je	LBB0_2
## %bb.1:
	xorl	%esi, %esi
	callq	_TerminateThread
	movq	(%rbx), %rax
	movq	(%rax), %rdi
	callq	_CloseHandle
	movq	(%rbx), %rax
LBB0_2:
	movq	32(%rax), %rax
	cmpq	$0, 8(%rax)
	je	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rdi
	callq	_TRACE
	movq	(%rbx), %rax
	movl	24(%rax), %ecx
	movl	%ecx, -16(%rbp)
	movq	32(%rax), %rax
	leaq	-16(%rbp), %rdi
	callq	*8(%rax)
	jmp	LBB0_6
LBB0_4:
	cmpq	$0, (%rax)
	je	LBB0_6
## %bb.5:
	leaq	L_.str.1(%rip), %rdi
	callq	_TRACE
	movq	(%rbx), %rax
	movq	32(%rax), %rcx
	xorl	%eax, %eax
	callq	*(%rcx)
LBB0_6:
	movq	(%rbx), %rax
	movq	8(%rax), %rdi
	testq	%rdi, %rdi
	je	LBB0_8
## %bb.7:
	callq	_FreeLibrary
	movq	(%rbx), %rax
LBB0_8:
	movq	16(%rax), %rdi
	testq	%rdi, %rdi
	je	LBB0_10
## %bb.9:
	callq	_FreeLibrary
	movq	(%rbx), %rax
LBB0_10:
	movl	56(%rax), %edi
	callq	_NS_DeleteSessionCache
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	(%rbx), %rcx
	movq	48(%rcx), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	(%rbx), %rcx
	movq	40(%rcx), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	movq	(%rbx), %rax
	movl	24(%rax), %edi
	callq	_IDirectPlaySP_Release
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	(%rbx), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	movq	_TRUE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_INVALID_HANDLE_VALUE,8,3       ## @INVALID_HANDLE_VALUE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Calling SP ShutdownEx\n"

L_.str.1:                               ## @.str.1
	.asciz	"Calling obsolete SP Shutdown\n"

	.comm	_TRUE,4,2                       ## @TRUE
	.no_dead_strip	_DP_DestroyDirectPlay2
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function DP_DestroyDirectPlay2
_DP_DestroyDirectPlay2:                 ; @DP_DestroyDirectPlay2
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	x8, [x0]
	ldr	x0, [x8]
Lloh0:
	adrp	x9, _INVALID_HANDLE_VALUE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _INVALID_HANDLE_VALUE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x0, x9
	b.eq	LBB0_2
; %bb.1:
	mov	w1, #0
	bl	_TerminateThread
	ldr	x8, [x19]
	ldr	x0, [x8]
	bl	_CloseHandle
	ldr	x8, [x19]
LBB0_2:
	ldr	x8, [x8, #32]
	ldr	x9, [x8, #8]
	cbz	x9, LBB0_4
; %bb.3:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_TRACE
	ldr	x8, [x19]
	ldr	w9, [x8, #24]
	str	w9, [sp, #8]
	ldr	x8, [x8, #32]
	ldr	x8, [x8, #8]
	add	x0, sp, #8
	blr	x8
	b	LBB0_6
LBB0_4:
	ldr	x8, [x8]
	cbz	x8, LBB0_6
; %bb.5:
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_TRACE
	ldr	x8, [x19]
	ldr	x8, [x8, #32]
	ldr	x8, [x8]
	blr	x8
LBB0_6:
	ldr	x8, [x19]
	ldr	x0, [x8, #8]
	cbz	x0, LBB0_8
; %bb.7:
	bl	_FreeLibrary
	ldr	x8, [x19]
LBB0_8:
	ldr	x0, [x8, #16]
	cbz	x0, LBB0_10
; %bb.9:
	bl	_FreeLibrary
	ldr	x8, [x19]
LBB0_10:
	ldr	w0, [x8, #56]
	bl	_NS_DeleteSessionCache
	bl	_GetProcessHeap
	ldr	x8, [x19]
	ldr	x2, [x8, #48]
	mov	w1, #0
	bl	_HeapFree
	bl	_GetProcessHeap
	ldr	x8, [x19]
	ldr	x2, [x8, #40]
	mov	w1, #0
	bl	_HeapFree
	ldr	x8, [x19]
	ldr	w0, [x8, #24]
	bl	_IDirectPlaySP_Release
	bl	_GetProcessHeap
	ldr	x2, [x19]
	mov	w1, #0
	bl	_HeapFree
Lloh7:
	adrp	x8, _TRUE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_INVALID_HANDLE_VALUE,8,3       ; @INVALID_HANDLE_VALUE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Calling SP ShutdownEx\n"

l_.str.1:                               ; @.str.1
	.asciz	"Calling obsolete SP Shutdown\n"

	.comm	_TRUE,4,2                       ; @TRUE
	.no_dead_strip	_DP_DestroyDirectPlay2
.subsections_via_symbols
