	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function PngBeforeWrite
_PngBeforeWrite:                        ## @PngBeforeWrite
	.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	%rdi, %r13
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_HPDF_PNG_BYTES_TO_CHECK@GOTPCREL(%rip), %r12
	movl	(%r12), %ebx
	movq	%rbx, %rax
	shlq	$2, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r14
	movl	%ebx, -52(%rbp)
	leaq	L_.str(%rip), %rdi
	callq	_HPDF_PTRACE
	movl	12(%r13), %edi
	callq	_HPDF_MemStream_FreeData
	movq	_HPDF_OCLASS_STRING@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	L_.str.1(%rip), %rsi
	movq	%r13, %rdi
	callq	_HPDF_Dict_GetItem
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movl	8(%r13), %edi
	movq	(%rax), %rsi
	callq	_HPDF_FileReader_New
	movl	%eax, %r15d
	movl	%eax, %edi
	callq	_HPDF_Stream_Validate
	testl	%eax, %eax
	je	LBB0_4
## %bb.5:
	movl	(%r12), %edx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_HPDF_MemSet
	leaq	-52(%rbp), %rdx
	movl	%r15d, %edi
	movq	%r14, %rsi
	callq	_HPDF_Stream_Read
	movq	_HPDF_OK@GOTPCREL(%rip), %rbx
	cmpq	(%rbx), %rax
	jne	LBB0_7
## %bb.6:
	movl	(%r12), %edx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_png_sig_cmp
	testq	%rax, %rax
	je	LBB0_8
LBB0_7:
	movl	%r15d, %edi
	callq	_HPDF_Stream_Free
	movq	(%r13), %rdi
	movq	_HPDF_INVALID_PNG_IMAGE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_HPDF_SetError
	movq	%rax, %rbx
	jmp	LBB0_10
LBB0_1:
	movq	(%r13), %rdi
	movq	_HPDF_MISSING_FILE_NAME_ENTRY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_12
## %bb.2:
	xorl	%edx, %edx
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_HPDF_SetError                  ## TAILCALL
LBB0_4:
	movq	(%r13), %rax
	movq	(%rax), %rbx
LBB0_10:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_12
## %bb.11:
	movq	%rbx, %rax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	_HPDF_FALSE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	%r15d, %edx
	callq	_LoadPngData
	movq	%rbx, %r12
	movq	%rax, %rbx
	movq	(%r12), %r14
	movl	%r15d, %edi
	callq	_HPDF_Stream_Free
	cmpq	%r14, %rbx
	jne	LBB0_10
## %bb.9:
	movq	(%r12), %rbx
	jmp	LBB0_10
LBB0_12:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_HPDF_PNG_BYTES_TO_CHECK,4,2    ## @HPDF_PNG_BYTES_TO_CHECK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	" PngBeforeWrite\n"

L_.str.1:                               ## @.str.1
	.asciz	"_FILE_NAME"

	.comm	_HPDF_OCLASS_STRING,4,2         ## @HPDF_OCLASS_STRING
	.comm	_HPDF_MISSING_FILE_NAME_ENTRY,4,2 ## @HPDF_MISSING_FILE_NAME_ENTRY
	.comm	_HPDF_OK,8,3                    ## @HPDF_OK
	.comm	_HPDF_INVALID_PNG_IMAGE,4,2     ## @HPDF_INVALID_PNG_IMAGE
	.comm	_HPDF_FALSE,4,2                 ## @HPDF_FALSE
	.no_dead_strip	_PngBeforeWrite
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function PngBeforeWrite
_PngBeforeWrite:                        ; @PngBeforeWrite
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	sub	sp, sp, #16
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-56]
Lloh3:
	adrp	x22, _HPDF_PNG_BYTES_TO_CHECK@GOTPAGE
Lloh4:
	ldr	x22, [x22, _HPDF_PNG_BYTES_TO_CHECK@GOTPAGEOFF]
	ldr	w12, [x22]
	lsl	x8, x12, #2
	mov	x9, x8
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x7fffffff0
	sub	x20, x9, x8
	mov	sp, x20
	stur	w12, [x29, #-60]
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	bl	_HPDF_PTRACE
	ldr	w0, [x19, #12]
	bl	_HPDF_MemStream_FreeData
Lloh9:
	adrp	x8, _HPDF_OCLASS_STRING@GOTPAGE
Lloh10:
	ldr	x8, [x8, _HPDF_OCLASS_STRING@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_HPDF_Dict_GetItem
	cbz	x0, LBB0_5
; %bb.1:
	ldr	w8, [x19, #8]
	ldr	x1, [x0]
	mov	x0, x8
	bl	_HPDF_FileReader_New
	mov	x21, x0
	bl	_HPDF_Stream_Validate
	cbz	w0, LBB0_7
; %bb.2:
	ldr	w2, [x22]
	mov	x0, x20
	mov	w1, #0
	bl	_HPDF_MemSet
	sub	x2, x29, #60
	mov	x0, x21
	mov	x1, x20
	bl	_HPDF_Stream_Read
Lloh14:
	adrp	x23, _HPDF_OK@GOTPAGE
Lloh15:
	ldr	x23, [x23, _HPDF_OK@GOTPAGEOFF]
	ldr	x8, [x23]
	cmp	x0, x8
	b.ne	LBB0_4
; %bb.3:
	ldr	w2, [x22]
	mov	x0, x20
	mov	w1, #0
	bl	_png_sig_cmp
	cbz	x0, LBB0_8
LBB0_4:
	mov	x0, x21
	bl	_HPDF_Stream_Free
	ldr	x0, [x19]
Lloh16:
	adrp	x8, _HPDF_INVALID_PNG_IMAGE@GOTPAGE
Lloh17:
	ldr	x8, [x8, _HPDF_INVALID_PNG_IMAGE@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_HPDF_SetError
	b	LBB0_9
LBB0_5:
	ldr	x0, [x19]
Lloh19:
	adrp	x8, _HPDF_MISSING_FILE_NAME_ENTRY@GOTPAGE
Lloh20:
	ldr	x8, [x8, _HPDF_MISSING_FILE_NAME_ENTRY@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x8]
	ldur	x8, [x29, #-56]
Lloh22:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh23:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh24:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_11
; %bb.6:
	mov	w2, #0
	sub	sp, x29, #48
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_HPDF_SetError
LBB0_7:
	ldr	x8, [x19]
	ldr	x0, [x8]
	b	LBB0_9
LBB0_8:
Lloh25:
	adrp	x8, _HPDF_FALSE@GOTPAGE
Lloh26:
	ldr	x8, [x8, _HPDF_FALSE@GOTPAGEOFF]
Lloh27:
	ldr	w3, [x8]
	mov	x0, x19
	mov	x1, #0
	mov	x2, x21
	bl	_LoadPngData
	mov	x19, x0
	ldr	x20, [x23]
	mov	x0, x21
	bl	_HPDF_Stream_Free
	ldr	x8, [x23]
	cmp	x19, x20
	csel	x0, x8, x19, eq
LBB0_9:
	ldur	x8, [x29, #-56]
Lloh28:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh29:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh30:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_11
; %bb.10:
	sub	sp, x29, #48
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_11:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_HPDF_PNG_BYTES_TO_CHECK,4,2    ; @HPDF_PNG_BYTES_TO_CHECK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	" PngBeforeWrite\n"

l_.str.1:                               ; @.str.1
	.asciz	"_FILE_NAME"

	.comm	_HPDF_OCLASS_STRING,4,2         ; @HPDF_OCLASS_STRING
	.comm	_HPDF_MISSING_FILE_NAME_ENTRY,4,2 ; @HPDF_MISSING_FILE_NAME_ENTRY
	.comm	_HPDF_OK,8,3                    ; @HPDF_OK
	.comm	_HPDF_INVALID_PNG_IMAGE,4,2     ; @HPDF_INVALID_PNG_IMAGE
	.comm	_HPDF_FALSE,4,2                 ; @HPDF_FALSE
	.no_dead_strip	_PngBeforeWrite
.subsections_via_symbols
