	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_OpenCHM                        ## -- Begin function OpenCHM
	.p2align	4, 0x90
_OpenCHM:                               ## @OpenCHM
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r14d
	movl	$20, %edi
	callq	_heap_alloc_zero
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	movq	%rax, %rbx
	movq	_CP_ACP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%rbx)
	movl	%r14d, %edi
	callq	_strdupW
	movl	%eax, 12(%rbx)
	testl	%eax, %eax
	je	LBB0_2
## %bb.5:
	movq	_CLSCTX_INPROC_SERVER@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	8(%rbx), %r8
	movq	_CLSID_ITStorage@GOTPCREL(%rip), %rdi
	movq	_IID_IITStorage@GOTPCREL(%rip), %rcx
	xorl	%esi, %esi
	callq	_CoCreateInstance
	movl	%eax, %r15d
	movl	%eax, %edi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_9
## %bb.6:
	leaq	L_.str(%rip), %rdi
	movl	%r15d, %esi
	jmp	LBB0_7
LBB0_2:
	movq	%rbx, %rdi
	callq	_heap_free
LBB0_3:
	xorl	%ebx, %ebx
LBB0_4:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movl	8(%rbx), %edi
	movq	_STGM_READ@GOTPCREL(%rip), %r15
	movq	_STGM_SHARE_DENY_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	orl	(%r15), %ecx
	movq	%rbx, %rax
	addq	$4, %rax
	movq	%rax, (%rsp)
	movl	%r14d, %esi
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_IITStorage_StgOpenStorage
	movl	%eax, %r14d
	movl	%eax, %edi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_11
## %bb.10:
	leaq	L_.str.1(%rip), %rdi
	movl	%r14d, %esi
LBB0_7:
	xorl	%eax, %eax
	callq	_WARN
LBB0_8:
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_CloseCHM                       ## TAILCALL
LBB0_11:
	movl	4(%rbx), %edi
	movl	(%r15), %ecx
	leaq	_OpenCHM.wszSTRINGS(%rip), %rsi
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	movq	%rbx, %r9
	callq	_IStorage_OpenStream
	movl	%eax, %r14d
	movl	%eax, %edi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_13
## %bb.12:
	leaq	L_.str.2(%rip), %rdi
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	_WARN
LBB0_13:
	movq	%rbx, %rdi
	callq	_ReadChmSystem
	testl	%eax, %eax
	jne	LBB0_4
## %bb.14:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
_OpenCHM.wszSTRINGS:                    ## @OpenCHM.wszSTRINGS
	.asciz	"#STRINGS"

	.comm	_CP_ACP,4,2                     ## @CP_ACP
	.comm	_CLSID_ITStorage,4,2            ## @CLSID_ITStorage
	.comm	_CLSCTX_INPROC_SERVER,4,2       ## @CLSCTX_INPROC_SERVER
	.comm	_IID_IITStorage,4,2             ## @IID_IITStorage
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Could not create ITStorage: %08x\n"

	.comm	_STGM_READ,4,2                  ## @STGM_READ
	.comm	_STGM_SHARE_DENY_WRITE,4,2      ## @STGM_SHARE_DENY_WRITE
L_.str.1:                               ## @.str.1
	.asciz	"Could not open storage: %08x\n"

L_.str.2:                               ## @.str.2
	.asciz	"Could not open #STRINGS stream: %08x\n"

L_.str.3:                               ## @.str.3
	.asciz	"Could not read #SYSTEM\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_OpenCHM                        ; -- Begin function OpenCHM
	.p2align	2
_OpenCHM:                               ; @OpenCHM
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x20, x0
	mov	w0, #20
	bl	_heap_alloc_zero
	mov	x19, x0
	cbz	x0, LBB0_5
; %bb.1:
Lloh0:
	adrp	x8, _CP_ACP@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CP_ACP@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [x19, #16]
	mov	x0, x20
	bl	_strdupW
	str	w0, [x19, #12]
	cbz	w0, LBB0_4
; %bb.2:
Lloh3:
	adrp	x8, _CLSCTX_INPROC_SERVER@GOTPAGE
Lloh4:
	ldr	x8, [x8, _CLSCTX_INPROC_SERVER@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	add	x4, x19, #8
Lloh6:
	adrp	x0, _CLSID_ITStorage@GOTPAGE
Lloh7:
	ldr	x0, [x0, _CLSID_ITStorage@GOTPAGEOFF]
Lloh8:
	adrp	x3, _IID_IITStorage@GOTPAGE
Lloh9:
	ldr	x3, [x3, _IID_IITStorage@GOTPAGEOFF]
	mov	x1, #0
	bl	_CoCreateInstance
	mov	x21, x0
	bl	_FAILED
	cbz	x0, LBB0_6
; %bb.3:
	str	x21, [sp]
Lloh10:
	adrp	x0, l_.str@PAGE
Lloh11:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_8
LBB0_4:
	mov	x0, x19
	bl	_heap_free
	mov	x19, #0
LBB0_5:
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_6:
	ldr	w0, [x19, #8]
Lloh12:
	adrp	x21, _STGM_READ@GOTPAGE
Lloh13:
	ldr	x21, [x21, _STGM_READ@GOTPAGEOFF]
	ldr	w8, [x21]
Lloh14:
	adrp	x9, _STGM_SHARE_DENY_WRITE@GOTPAGE
Lloh15:
	ldr	x9, [x9, _STGM_SHARE_DENY_WRITE@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	orr	w3, w9, w8
	add	x6, x19, #4
	mov	x1, x20
	mov	x2, #0
	mov	x4, #0
	mov	w5, #0
	bl	_IITStorage_StgOpenStorage
	mov	x20, x0
	bl	_FAILED
	cbz	x0, LBB0_9
; %bb.7:
	str	x20, [sp]
Lloh17:
	adrp	x0, l_.str.1@PAGE
Lloh18:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_8:
	bl	_WARN
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	b	_CloseCHM
LBB0_9:
	ldr	w0, [x19, #4]
	ldr	w3, [x21]
Lloh19:
	adrp	x1, _OpenCHM.wszSTRINGS@PAGE
Lloh20:
	add	x1, x1, _OpenCHM.wszSTRINGS@PAGEOFF
	mov	x2, #0
	mov	w4, #0
	mov	x5, x19
	bl	_IStorage_OpenStream
	mov	x20, x0
	bl	_FAILED
	cbz	x0, LBB0_11
; %bb.10:
	str	x20, [sp]
Lloh21:
	adrp	x0, l_.str.2@PAGE
Lloh22:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_WARN
LBB0_11:
	mov	x0, x19
	bl	_ReadChmSystem
	cbnz	w0, LBB0_5
; %bb.12:
Lloh23:
	adrp	x0, l_.str.3@PAGE
Lloh24:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
_OpenCHM.wszSTRINGS:                    ; @OpenCHM.wszSTRINGS
	.asciz	"#STRINGS"

	.comm	_CP_ACP,4,2                     ; @CP_ACP
	.comm	_CLSID_ITStorage,4,2            ; @CLSID_ITStorage
	.comm	_CLSCTX_INPROC_SERVER,4,2       ; @CLSCTX_INPROC_SERVER
	.comm	_IID_IITStorage,4,2             ; @IID_IITStorage
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Could not create ITStorage: %08x\n"

	.comm	_STGM_READ,4,2                  ; @STGM_READ
	.comm	_STGM_SHARE_DENY_WRITE,4,2      ; @STGM_SHARE_DENY_WRITE
l_.str.1:                               ; @.str.1
	.asciz	"Could not open storage: %08x\n"

l_.str.2:                               ; @.str.2
	.asciz	"Could not open #STRINGS stream: %08x\n"

l_.str.3:                               ; @.str.3
	.asciz	"Could not read #SYSTEM\n"

.subsections_via_symbols
