	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function read_file_to_bstr
_read_file_to_bstr:                     ## @read_file_to_bstr
	.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	_FALSE@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	_GENERIC_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_FILE_SHARE_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_OPEN_EXISTING@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	_FILE_ATTRIBUTE_NORMAL@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	movq	$0, (%rsp)
	xorl	%ecx, %ecx
	callq	_CreateFileW
	movq	%rax, %rbx
	movq	_INVALID_HANDLE_VALUE@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	jne	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_FIXME
	xorl	%ebx, %ebx
	jmp	LBB0_16
LBB0_2:
	leaq	-48(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_GetFileSizeEx
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	cmpl	$0, -48(%rbp)
	je	LBB0_4
## %bb.5:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	-48(%rbp), %edx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapAlloc
	movq	%rax, %r14
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movl	-48(%rbp), %edx
	leaq	-52(%rbp), %rcx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	xorl	%r8d, %r8d
	callq	_ReadFile
	movl	%eax, %r15d
LBB0_7:
	movq	%rbx, %rdi
	callq	_CloseHandle
	testl	%r15d, %r15d
	je	LBB0_8
## %bb.9:
	movl	-52(%rbp), %ecx
	cmpl	$3, %ecx
	jl	LBB0_13
## %bb.10:
	cmpb	$-1, (%r14)
	jne	LBB0_13
## %bb.11:
	cmpb	$-2, 1(%r14)
	jne	LBB0_13
## %bb.12:
	movq	%r14, %rdi
	addq	$2, %rdi
	addl	$-2, %ecx
	shrl	$2, %ecx
	movl	%ecx, %esi
	callq	_SysAllocStringLen
	movq	%rax, %rbx
	jmp	LBB0_15
LBB0_4:
	leaq	L_.str.1(%rip), %rdi
	callq	_FIXME
	movq	%rbx, %rdi
	callq	_CloseHandle
	xorl	%ebx, %ebx
	jmp	LBB0_16
LBB0_13:
	movq	_CP_ACP@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	xorl	%ebx, %ebx
	xorl	%esi, %esi
	movq	%r14, %rdx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_MultiByteToWideChar
	movl	%eax, %r15d
	xorl	%edi, %edi
	movl	%eax, %esi
	callq	_SysAllocStringLen
	testq	%rax, %rax
	je	LBB0_15
## %bb.14:
	movq	%rax, %r12
	movl	(%r13), %edi
	movl	-52(%rbp), %ecx
	xorl	%esi, %esi
	movq	%r14, %rdx
	movq	%rax, %r8
	movl	%r15d, %r9d
	callq	_MultiByteToWideChar
	movq	%r12, %rbx
	jmp	LBB0_15
LBB0_8:
	leaq	L_.str.2(%rip), %rdi
	callq	_FIXME
	xorl	%ebx, %ebx
LBB0_15:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	_HeapFree
LBB0_16:
	movq	%rbx, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FALSE,4,2                      ## @FALSE
	.comm	_GENERIC_READ,4,2               ## @GENERIC_READ
	.comm	_FILE_SHARE_READ,4,2            ## @FILE_SHARE_READ
	.comm	_OPEN_EXISTING,4,2              ## @OPEN_EXISTING
	.comm	_FILE_ATTRIBUTE_NORMAL,4,2      ## @FILE_ATTRIBUTE_NORMAL
	.comm	_INVALID_HANDLE_VALUE,8,3       ## @INVALID_HANDLE_VALUE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Could not open file\n"

L_.str.1:                               ## @.str.1
	.asciz	"Empty file\n"

L_.str.2:                               ## @.str.2
	.asciz	"Read filed\n"

	.comm	_CP_ACP,4,2                     ## @CP_ACP
	.no_dead_strip	_read_file_to_bstr
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function read_file_to_bstr
_read_file_to_bstr:                     ; @read_file_to_bstr
	.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
Lloh0:
	adrp	x8, _FALSE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh2:
	ldr	w20, [x8]
Lloh3:
	adrp	x8, _GENERIC_READ@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GENERIC_READ@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
Lloh6:
	adrp	x8, _FILE_SHARE_READ@GOTPAGE
Lloh7:
	ldr	x8, [x8, _FILE_SHARE_READ@GOTPAGEOFF]
Lloh8:
	ldr	w2, [x8]
Lloh9:
	adrp	x8, _OPEN_EXISTING@GOTPAGE
Lloh10:
	ldr	x8, [x8, _OPEN_EXISTING@GOTPAGEOFF]
Lloh11:
	ldr	w4, [x8]
Lloh12:
	adrp	x8, _FILE_ATTRIBUTE_NORMAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _FILE_ATTRIBUTE_NORMAL@GOTPAGEOFF]
Lloh14:
	ldr	w5, [x8]
	mov	x3, #0
	mov	x6, #0
	bl	_CreateFileW
Lloh15:
	adrp	x8, _INVALID_HANDLE_VALUE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _INVALID_HANDLE_VALUE@GOTPAGEOFF]
Lloh17:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_2
; %bb.1:
Lloh18:
	adrp	x0, l_.str@PAGE
Lloh19:
	add	x0, x0, l_.str@PAGEOFF
	bl	_FIXME
	b	LBB0_15
LBB0_2:
	mov	x21, x0
	add	x1, sp, #8
	bl	_GetFileSizeEx
	ldr	w8, [sp, #8]
	cmp	w0, #0
	ccmp	w8, #0, #4, ne
	b.ne	LBB0_4
; %bb.3:
Lloh20:
	adrp	x0, l_.str.1@PAGE
Lloh21:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_FIXME
	mov	x0, x21
	bl	_CloseHandle
	b	LBB0_15
LBB0_4:
	bl	_GetProcessHeap
	ldr	w2, [sp, #8]
	mov	w1, #0
	bl	_HeapAlloc
	mov	x19, x0
	cbz	x0, LBB0_6
; %bb.5:
	ldr	w2, [sp, #8]
	add	x3, sp, #4
	mov	x0, x21
	mov	x1, x19
	mov	x4, #0
	bl	_ReadFile
	mov	x20, x0
LBB0_6:
	mov	x0, x21
	bl	_CloseHandle
	cbz	w20, LBB0_14
; %bb.7:
	ldr	w3, [sp, #4]
	cmp	w3, #3
	b.lt	LBB0_11
; %bb.8:
	ldrb	w8, [x19]
	cmp	w8, #255
	b.ne	LBB0_11
; %bb.9:
	ldrb	w8, [x19, #1]
	cmp	w8, #254
	b.ne	LBB0_11
; %bb.10:
	add	x0, x19, #2
	sub	w8, w3, #2
	lsr	w1, w8, #2
	bl	_SysAllocStringLen
	mov	x20, x0
	b	LBB0_13
LBB0_11:
Lloh22:
	adrp	x22, _CP_ACP@GOTPAGE
Lloh23:
	ldr	x22, [x22, _CP_ACP@GOTPAGEOFF]
	ldr	w0, [x22]
	mov	w1, #0
	mov	x2, x19
	mov	x4, #0
	mov	w5, #0
	bl	_MultiByteToWideChar
	mov	x21, x0
	mov	x0, #0
	mov	x1, x21
	bl	_SysAllocStringLen
	mov	x20, x0
	cbz	x0, LBB0_13
; %bb.12:
	ldr	w0, [x22]
	ldr	w3, [sp, #4]
	mov	w1, #0
	mov	x2, x19
	mov	x4, x20
	mov	x5, x21
	bl	_MultiByteToWideChar
LBB0_13:
	bl	_GetProcessHeap
	mov	w1, #0
	mov	x2, x19
	bl	_HeapFree
	b	LBB0_16
LBB0_14:
Lloh24:
	adrp	x0, l_.str.2@PAGE
Lloh25:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_FIXME
	bl	_GetProcessHeap
	mov	w1, #0
	mov	x2, x19
	bl	_HeapFree
LBB0_15:
	mov	x20, #0
LBB0_16:
	mov	x0, x20
	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
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_FALSE,4,2                      ; @FALSE
	.comm	_GENERIC_READ,4,2               ; @GENERIC_READ
	.comm	_FILE_SHARE_READ,4,2            ; @FILE_SHARE_READ
	.comm	_OPEN_EXISTING,4,2              ; @OPEN_EXISTING
	.comm	_FILE_ATTRIBUTE_NORMAL,4,2      ; @FILE_ATTRIBUTE_NORMAL
	.comm	_INVALID_HANDLE_VALUE,8,3       ; @INVALID_HANDLE_VALUE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Could not open file\n"

l_.str.1:                               ; @.str.1
	.asciz	"Empty file\n"

l_.str.2:                               ; @.str.2
	.asciz	"Read filed\n"

	.comm	_CP_ACP,4,2                     ; @CP_ACP
	.no_dead_strip	_read_file_to_bstr
.subsections_via_symbols
