	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function read_png
_read_png:                              ## @read_png
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rsi, %r14
	movq	%rdi, %rbx
	callq	_display_clean_read
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_display_start_read
	movq	_PNG_LIBPNG_VER_STRING@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_display_error@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_display_warning@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rsi
	callq	_png_create_read_struct
	movq	%rax, 40(%rbx)
	testq	%rax, %rax
	jne	LBB0_2
## %bb.1:
	movq	_LIBPNG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movq	%rbx, %rdi
	callq	_display_log
	movq	40(%rbx), %rax
LBB0_2:
	movq	%rax, %rdi
	callq	_png_create_info_struct
	movq	%rax, 32(%rbx)
	testq	%rax, %rax
	jne	LBB0_4
## %bb.3:
	movq	40(%rbx), %rdi
	leaq	L_.str.1(%rip), %rsi
	callq	_png_error
LBB0_4:
	movq	40(%rbx), %rdi
	movq	_read_function@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rsi
	callq	_png_set_read_fn
	movq	_PNGCP_TIME_READ@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_start_timer
	movq	32(%rbx), %rsi
	movq	40(%rbx), %rdi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_png_read_png
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_end_timer
	movq	32(%rbx), %rsi
	movq	40(%rbx), %rdi
	callq	_png_get_image_width
	movl	%eax, 48(%rbx)
	movq	32(%rbx), %rsi
	movq	40(%rbx), %rdi
	callq	_png_get_image_height
	movl	%eax, 4(%rbx)
	movq	32(%rbx), %rsi
	movq	40(%rbx), %rdi
	callq	_png_get_color_type
	movq	%rax, 8(%rbx)
	movq	32(%rbx), %rsi
	movq	40(%rbx), %rdi
	callq	_png_get_bit_depth
	movl	%eax, %r14d
	movq	32(%rbx), %rsi
	movq	40(%rbx), %rdi
	callq	_png_get_channels
	imull	%r14d, %eax
	movl	%eax, 16(%rbx)
	movq	32(%rbx), %rsi
	movq	40(%rbx), %rdi
	callq	_png_get_rowbytes
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_6
## %bb.5:
	movq	40(%rbx), %rdi
	leaq	L_.str.2(%rip), %rsi
	callq	_png_error
LBB0_6:
	movq	_MAX_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	4(%rbx), %ecx
	subl	%ecx, %eax
	cltd
	idivl	%r14d
	cmpl	%ecx, %eax
	jge	LBB0_8
## %bb.7:
	movq	40(%rbx), %rdi
	leaq	L_.str.3(%rip), %rsi
	callq	_png_error
	movl	4(%rbx), %ecx
LBB0_8:
	imull	%ecx, %r14d
	addl	%ecx, %r14d
	movl	%r14d, 20(%rbx)
	movq	%rbx, %rdi
	callq	_display_clean_read
	leaq	L_.str.4(%rip), %rax
	movq	%rax, 24(%rbx)
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PNG_LIBPNG_VER_STRING,4,2      ## @PNG_LIBPNG_VER_STRING
	.comm	_display_error,4,2              ## @display_error
	.comm	_display_warning,4,2            ## @display_warning
	.comm	_LIBPNG_ERROR,4,2               ## @LIBPNG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to create read struct"

L_.str.1:                               ## @.str.1
	.asciz	"failed to create info struct"

	.comm	_read_function,4,2              ## @read_function
	.comm	_PNGCP_TIME_READ,4,2            ## @PNGCP_TIME_READ
L_.str.2:                               ## @.str.2
	.asciz	"invalid row byte count from libpng"

	.comm	_MAX_SIZE,4,2                   ## @MAX_SIZE
L_.str.3:                               ## @.str.3
	.asciz	"image too large"

L_.str.4:                               ## @.str.4
	.asciz	"none"

	.comm	_FIX_INDEX,4,2                  ## @FIX_INDEX
	.comm	_IGNORE_INDEX,4,2               ## @IGNORE_INDEX
	.comm	_PNG_COLOR_TYPE_PALETTE,8,3     ## @PNG_COLOR_TYPE_PALETTE
	.comm	_PNG_HANDLE_CHUNK_ALWAYS,4,2    ## @PNG_HANDLE_CHUNK_ALWAYS
	.comm	_PNG_INFO_PLTE,8,3              ## @PNG_INFO_PLTE
	.no_dead_strip	_read_png
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function read_png
_read_png:                              ; @read_png
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x20, x1
	mov	x19, x0
	bl	_display_clean_read
	mov	x0, x19
	mov	x1, x20
	bl	_display_start_read
Lloh0:
	adrp	x8, _PNG_LIBPNG_VER_STRING@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PNG_LIBPNG_VER_STRING@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x8, _display_error@GOTPAGE
Lloh4:
	ldr	x8, [x8, _display_error@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
Lloh6:
	adrp	x8, _display_warning@GOTPAGE
Lloh7:
	ldr	x8, [x8, _display_warning@GOTPAGEOFF]
Lloh8:
	ldr	w3, [x8]
	mov	x1, x19
	bl	_png_create_read_struct
	str	x0, [x19, #40]
	cbnz	x0, LBB0_2
; %bb.1:
Lloh9:
	adrp	x8, _LIBPNG_ERROR@GOTPAGE
Lloh10:
	ldr	x8, [x8, _LIBPNG_ERROR@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
Lloh12:
	adrp	x2, l_.str@PAGE
Lloh13:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	bl	_display_log
	ldr	x0, [x19, #40]
LBB0_2:
	bl	_png_create_info_struct
	str	x0, [x19, #32]
	cbnz	x0, LBB0_4
; %bb.3:
	ldr	x0, [x19, #40]
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_png_error
LBB0_4:
	ldr	x0, [x19, #40]
Lloh16:
	adrp	x8, _read_function@GOTPAGE
Lloh17:
	ldr	x8, [x8, _read_function@GOTPAGEOFF]
Lloh18:
	ldr	w2, [x8]
	mov	x1, x19
	bl	_png_set_read_fn
Lloh19:
	adrp	x20, _PNGCP_TIME_READ@GOTPAGE
Lloh20:
	ldr	x20, [x20, _PNGCP_TIME_READ@GOTPAGEOFF]
	ldr	w1, [x20]
	mov	x0, x19
	bl	_start_timer
	ldp	x1, x0, [x19, #32]
	mov	w2, #0
	mov	x3, #0
	bl	_png_read_png
	ldr	w1, [x20]
	mov	x0, x19
	bl	_end_timer
	ldp	x1, x0, [x19, #32]
	bl	_png_get_image_width
	str	w0, [x19, #48]
	ldp	x1, x0, [x19, #32]
	bl	_png_get_image_height
	str	w0, [x19, #4]
	ldp	x1, x0, [x19, #32]
	bl	_png_get_color_type
	str	x0, [x19, #8]
	ldp	x1, x0, [x19, #32]
	bl	_png_get_bit_depth
	mov	x20, x0
	ldp	x1, x0, [x19, #32]
	bl	_png_get_channels
	mul	w8, w0, w20
	str	w8, [x19, #16]
	ldp	x1, x0, [x19, #32]
	bl	_png_get_rowbytes
	mov	x20, x0
	cbnz	w0, LBB0_6
; %bb.5:
	ldr	x0, [x19, #40]
Lloh21:
	adrp	x1, l_.str.2@PAGE
Lloh22:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_png_error
LBB0_6:
Lloh23:
	adrp	x8, _MAX_SIZE@GOTPAGE
Lloh24:
	ldr	x8, [x8, _MAX_SIZE@GOTPAGEOFF]
Lloh25:
	ldr	w9, [x8]
	ldr	w8, [x19, #4]
	sub	w9, w9, w8
	sdiv	w9, w9, w20
	cmp	w9, w8
	b.ge	LBB0_8
; %bb.7:
	ldr	x0, [x19, #40]
Lloh26:
	adrp	x1, l_.str.3@PAGE
Lloh27:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_png_error
	ldr	w8, [x19, #4]
LBB0_8:
	madd	w8, w8, w20, w8
	str	w8, [x19, #20]
	mov	x0, x19
	bl	_display_clean_read
Lloh28:
	adrp	x8, l_.str.4@PAGE
Lloh29:
	add	x8, x8, l_.str.4@PAGEOFF
	str	x8, [x19, #24]
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_PNG_LIBPNG_VER_STRING,4,2      ; @PNG_LIBPNG_VER_STRING
	.comm	_display_error,4,2              ; @display_error
	.comm	_display_warning,4,2            ; @display_warning
	.comm	_LIBPNG_ERROR,4,2               ; @LIBPNG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to create read struct"

l_.str.1:                               ; @.str.1
	.asciz	"failed to create info struct"

	.comm	_read_function,4,2              ; @read_function
	.comm	_PNGCP_TIME_READ,4,2            ; @PNGCP_TIME_READ
l_.str.2:                               ; @.str.2
	.asciz	"invalid row byte count from libpng"

	.comm	_MAX_SIZE,4,2                   ; @MAX_SIZE
l_.str.3:                               ; @.str.3
	.asciz	"image too large"

l_.str.4:                               ; @.str.4
	.asciz	"none"

	.comm	_FIX_INDEX,4,2                  ; @FIX_INDEX
	.comm	_IGNORE_INDEX,4,2               ; @IGNORE_INDEX
	.comm	_PNG_COLOR_TYPE_PALETTE,8,3     ; @PNG_COLOR_TYPE_PALETTE
	.comm	_PNG_HANDLE_CHUNK_ALWAYS,4,2    ; @PNG_HANDLE_CHUNK_ALWAYS
	.comm	_PNG_INFO_PLTE,8,3              ; @PNG_INFO_PLTE
	.no_dead_strip	_read_png
.subsections_via_symbols
