	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_libpe_open_object              ## -- Begin function libpe_open_object
	.p2align	4, 0x90
_libpe_open_object:                     ## @libpe_open_object
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movl	16(%rdi), %edi
	leaq	-48(%rbp), %rsi
	callq	_fstat
	movl	$-1, %r14d
	testq	%rax, %rax
	js	LBB0_26
## %bb.1:
	movl	-40(%rbp), %ebx
	movq	-48(%rbp), %rax
	movq	%rax, (%r15)
	movl	%ebx, %edi
	callq	_S_ISREG
	testq	%rax, %rax
	jne	LBB0_7
## %bb.2:
	movl	%ebx, %edi
	callq	_S_ISCHR
	testl	%eax, %eax
	jne	LBB0_7
## %bb.3:
	movl	%ebx, %edi
	callq	_S_ISFIFO
	testl	%eax, %eax
	jne	LBB0_7
## %bb.4:
	movl	%ebx, %edi
	callq	_S_ISSOCK
	testl	%eax, %eax
	je	LBB0_5
LBB0_7:
	movq	8(%r15), %rax
	movq	_PE_C_RDWR@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.8:
	movl	%ebx, %edi
	callq	_S_ISREG
	testq	%rax, %rax
	je	LBB0_5
LBB0_9:
	movl	%ebx, %edi
	callq	_S_ISREG
	testq	%rax, %rax
	je	LBB0_12
## %bb.10:
	cmpq	$3, (%r15)
	ja	LBB0_12
LBB0_11:
	movq	_ENOENT@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_12:
	movl	16(%r15), %edi
	leaq	-28(%rbp), %rsi
	movl	$2, %edx
	callq	_read
	cmpl	$2, %eax
	jne	LBB0_13
## %bb.14:
	movb	-28(%rbp), %cl
	movb	-27(%rbp), %al
	cmpb	$77, %cl
	jne	LBB0_18
## %bb.15:
	cmpb	$90, %al
	jne	LBB0_18
## %bb.16:
	movq	_PE_O_PE32@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 24(%r15)
	movl	16(%r15), %edi
	leaq	-26(%rbp), %rsi
	movl	$2, %edx
	callq	_read
	cmpl	$2, %eax
	jne	LBB0_13
## %bb.17:
	leaq	-28(%rbp), %rsi
	movq	%r15, %rdi
	callq	_libpe_parse_msdos_header
	jmp	LBB0_25
LBB0_5:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_18:
	cmpb	$80, %cl
	jne	LBB0_23
## %bb.19:
	cmpb	$69, %al
	jne	LBB0_23
## %bb.20:
	movl	16(%r15), %edi
	leaq	-28(%rbp), %rsi
	movl	$2, %edx
	callq	_read
	cmpl	$2, %eax
	jne	LBB0_13
## %bb.21:
	movb	-28(%rbp), %al
	orb	-27(%rbp), %al
	jne	LBB0_11
## %bb.22:
	movq	_PE_O_PE32@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 24(%r15)
	movl	16(%r15), %edi
	leaq	-28(%rbp), %rsi
	movl	$4, %edx
	callq	_read
	cmpl	$4, %eax
	je	LBB0_24
LBB0_13:
	movq	_EIO@GOTPCREL(%rip), %rax
LBB0_6:
	movl	(%rax), %eax
	movq	_errno@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
LBB0_26:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_23:
	movq	_PE_O_COFF@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 24(%r15)
	movl	16(%r15), %edi
	leaq	-26(%rbp), %rsi
	movl	$2, %edx
	callq	_read
	cmpl	$2, %eax
	jne	LBB0_13
LBB0_24:
	leaq	-28(%rbp), %rsi
	movq	%r15, %rdi
	callq	_libpe_parse_coff_header
LBB0_25:
	movl	%eax, %r14d
	jmp	LBB0_26
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_errno,4,2                      ## @errno
	.comm	_PE_C_RDWR,8,3                  ## @PE_C_RDWR
	.comm	_ENOENT,4,2                     ## @ENOENT
	.comm	_EIO,4,2                        ## @EIO
	.comm	_PE_O_PE32,8,3                  ## @PE_O_PE32
	.comm	_PE_O_COFF,8,3                  ## @PE_O_COFF
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_libpe_open_object              ; -- Begin function libpe_open_object
	.p2align	2
_libpe_open_object:                     ; @libpe_open_object
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	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
	mov	x19, x0
	ldr	w0, [x0, #16]
	add	x1, sp, #16
	bl	_fstat
	tbnz	x0, #63, LBB0_23
; %bb.1:
	ldr	w20, [sp, #24]
	ldr	x8, [sp, #16]
	str	x8, [x19]
	mov	x0, x20
	bl	_S_ISREG
	cbnz	x0, LBB0_5
; %bb.2:
	mov	x0, x20
	bl	_S_ISCHR
	cbnz	w0, LBB0_5
; %bb.3:
	mov	x0, x20
	bl	_S_ISFIFO
	cbnz	w0, LBB0_5
; %bb.4:
	mov	x0, x20
	bl	_S_ISSOCK
	cbz	w0, LBB0_15
LBB0_5:
	ldr	x8, [x19, #8]
Lloh0:
	adrp	x9, _PE_C_RDWR@GOTPAGE
Lloh1:
	ldr	x9, [x9, _PE_C_RDWR@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.6:
	mov	x0, x20
	bl	_S_ISREG
	cbz	x0, LBB0_15
LBB0_7:
	mov	x0, x20
	bl	_S_ISREG
	cbz	x0, LBB0_10
; %bb.8:
	ldr	x8, [x19]
	cmp	x8, #3
	b.hi	LBB0_10
LBB0_9:
Lloh3:
	adrp	x8, _ENOENT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
	b	LBB0_22
LBB0_10:
	ldr	w0, [x19, #16]
	add	x1, sp, #12
	mov	w2, #2
	bl	_read
	cmp	w0, #2
	b.ne	LBB0_21
; %bb.11:
	ldrb	w9, [sp, #12]
	ldrb	w8, [sp, #13]
	cmp	w9, #77
	b.ne	LBB0_16
; %bb.12:
	cmp	w8, #90
	b.ne	LBB0_16
; %bb.13:
Lloh5:
	adrp	x8, _PE_O_PE32@GOTPAGE
Lloh6:
	ldr	x8, [x8, _PE_O_PE32@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	str	x8, [x19, #24]
	ldr	w0, [x19, #16]
	add	x8, sp, #12
	add	x1, x8, #2
	mov	w2, #2
	bl	_read
	cmp	w0, #2
	b.ne	LBB0_21
; %bb.14:
	add	x1, sp, #12
	mov	x0, x19
	bl	_libpe_parse_msdos_header
	b	LBB0_24
LBB0_15:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_22
LBB0_16:
	cmp	w9, #80
	b.ne	LBB0_25
; %bb.17:
	cmp	w8, #69
	b.ne	LBB0_25
; %bb.18:
	ldr	w0, [x19, #16]
	add	x1, sp, #12
	mov	w2, #2
	bl	_read
	cmp	w0, #2
	b.ne	LBB0_21
; %bb.19:
	ldrb	w8, [sp, #12]
	ldrb	w9, [sp, #13]
	orr	w8, w8, w9
	cbnz	w8, LBB0_9
; %bb.20:
Lloh10:
	adrp	x8, _PE_O_PE32@GOTPAGE
Lloh11:
	ldr	x8, [x8, _PE_O_PE32@GOTPAGEOFF]
Lloh12:
	ldr	x8, [x8]
	str	x8, [x19, #24]
	ldr	w0, [x19, #16]
	add	x1, sp, #12
	mov	w2, #4
	bl	_read
	cmp	w0, #4
	b.eq	LBB0_26
LBB0_21:
Lloh13:
	adrp	x8, _EIO@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_22:
	ldr	w8, [x8]
Lloh15:
	adrp	x9, _errno@GOTPAGE
Lloh16:
	ldr	x9, [x9, _errno@GOTPAGEOFF]
Lloh17:
	str	w8, [x9]
LBB0_23:
	mov	w0, #-1
LBB0_24:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_25:
Lloh18:
	adrp	x8, _PE_O_COFF@GOTPAGE
Lloh19:
	ldr	x8, [x8, _PE_O_COFF@GOTPAGEOFF]
Lloh20:
	ldr	x8, [x8]
	str	x8, [x19, #24]
	ldr	w0, [x19, #16]
	add	x8, sp, #12
	add	x1, x8, #2
	mov	w2, #2
	bl	_read
	cmp	w0, #2
	b.ne	LBB0_21
LBB0_26:
	add	x1, sp, #12
	mov	x0, x19
	bl	_libpe_parse_coff_header
	b	LBB0_24
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotStr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_errno,4,2                      ; @errno
	.comm	_PE_C_RDWR,8,3                  ; @PE_C_RDWR
	.comm	_ENOENT,4,2                     ; @ENOENT
	.comm	_EIO,4,2                        ; @EIO
	.comm	_PE_O_PE32,8,3                  ; @PE_O_PE32
	.comm	_PE_O_COFF,8,3                  ; @PE_O_COFF
.subsections_via_symbols
