	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_png_write_PLTE                 ## -- Begin function png_write_PLTE
	.p2align	4, 0x90
_png_write_PLTE:                        ## @png_write_PLTE
	.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	%r12
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -40(%rbp)
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_png_debug
	testq	%r15, %r15
	je	LBB0_2
## %bb.1:
	cmpq	$257, %r15                      ## imm = 0x101
	jl	LBB0_4
LBB0_2:
	movl	4(%r14), %eax
	movq	_PNG_COLOR_TYPE_PALETTE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_7
## %bb.3:
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	callq	_png_error
LBB0_4:
	movq	_PNG_COLOR_MASK_COLOR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 4(%r14)
	je	LBB0_5
## %bb.10:
	movq	%r15, 16(%r14)
	leaq	L_.str.3(%rip), %rsi
	movl	$3, %edi
	movq	%r15, %rdx
	callq	_png_debug1
	movq	_png_PLTE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	(%r15,%r15,2), %rdx
	movq	%r14, %rdi
	callq	_png_write_chunk_start
	testq	%r15, %r15
	jle	LBB0_13
## %bb.11:
	addq	$8, %rbx
	leaq	-52(%rbp), %r12
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rbx), %eax
	movl	%eax, -52(%rbp)
	movl	-4(%rbx), %eax
	movl	%eax, -48(%rbp)
	movl	-8(%rbx), %eax
	movl	%eax, -44(%rbp)
	movq	%r14, %rdi
	movq	%r12, %rsi
	movl	$3, %edx
	callq	_png_write_chunk_data
	addq	$12, %rbx
	decq	%r15
	jne	LBB0_12
LBB0_13:
	movq	%r14, %rdi
	callq	_png_write_chunk_end
	movq	_PNG_HAVE_PLTE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 8(%r14)
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-40(%rbp), %rax
	jne	LBB0_15
## %bb.14:
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-40(%rbp), %rax
	jne	LBB0_15
## %bb.6:
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_9
LBB0_7:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-40(%rbp), %rax
	jne	LBB0_15
## %bb.8:
	leaq	L_.str.1(%rip), %rsi
LBB0_9:
	movq	%r14, %rdi
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_png_warning                    ## TAILCALL
LBB0_15:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"in png_write_PLTE\n"

	.comm	_PNG_COLOR_TYPE_PALETTE,4,2     ## @PNG_COLOR_TYPE_PALETTE
L_.str.1:                               ## @.str.1
	.asciz	"Invalid number of colors in palette"

	.comm	_PNG_COLOR_MASK_COLOR,4,2       ## @PNG_COLOR_MASK_COLOR
L_.str.2:                               ## @.str.2
	.asciz	"Ignoring request to write a PLTE chunk in grayscale PNG"

L_.str.3:                               ## @.str.3
	.asciz	"num_palette = %d\n"

	.comm	_png_PLTE,4,2                   ## @png_PLTE
	.comm	_PNG_HAVE_PLTE,4,2              ## @PNG_HAVE_PLTE
	.comm	_PNG_FLAG_MNG_EMPTY_PLTE,4,2    ## @PNG_FLAG_MNG_EMPTY_PLTE
	.comm	_PNG_PLTE,4,2                   ## @PNG_PLTE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_png_write_PLTE                 ; -- Begin function png_write_PLTE
	.p2align	2
_png_write_PLTE:                        ; @png_write_PLTE
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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, x2
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_png_debug
	cbz	x20, LBB0_2
; %bb.1:
	cmp	x20, #257
	b.lt	LBB0_4
LBB0_2:
	ldr	w8, [x19, #4]
Lloh5:
	adrp	x9, _PNG_COLOR_TYPE_PALETTE@GOTPAGE
Lloh6:
	ldr	x9, [x9, _PNG_COLOR_TYPE_PALETTE@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_12
; %bb.3:
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_png_error
LBB0_4:
	ldr	w8, [x19, #4]
Lloh10:
	adrp	x9, _PNG_COLOR_MASK_COLOR@GOTPAGE
Lloh11:
	ldr	x9, [x9, _PNG_COLOR_MASK_COLOR@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.5:
	str	x20, [x19, #16]
Lloh13:
	adrp	x1, l_.str.3@PAGE
Lloh14:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #3
	mov	x2, x20
	bl	_png_debug1
Lloh15:
	adrp	x8, _png_PLTE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _png_PLTE@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	add	x2, x20, x20, lsl #1
	mov	x0, x19
	bl	_png_write_chunk_start
	cmp	x20, #1
	b.lt	LBB0_8
; %bb.6:
	add	x21, x21, #4
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	d0, [x21]
	rev64.2s	v0, v0
	str	d0, [sp, #8]
	ldur	w8, [x21, #-4]
	str	w8, [sp, #16]
	add	x1, sp, #8
	mov	x0, x19
	mov	w2, #3
	bl	_png_write_chunk_data
	add	x21, x21, #12
	subs	x20, x20, #1
	b.ne	LBB0_7
LBB0_8:
	mov	x0, x19
	bl	_png_write_chunk_end
Lloh18:
	adrp	x8, _PNG_HAVE_PLTE@GOTPAGE
Lloh19:
	ldr	x8, [x8, _PNG_HAVE_PLTE@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	ldr	w9, [x19, #8]
	orr	w8, w9, w8
	str	w8, [x19, #8]
	ldr	x8, [sp, #24]
Lloh21:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh22:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_15
; %bb.9:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_10:
	ldr	x8, [sp, #24]
Lloh24:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh25:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh26:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_15
; %bb.11:
Lloh27:
	adrp	x1, l_.str.2@PAGE
Lloh28:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_14
LBB0_12:
	ldr	x8, [sp, #24]
Lloh29:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh30:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh31:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_15
; %bb.13:
Lloh32:
	adrp	x1, l_.str.1@PAGE
Lloh33:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_14:
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	b	_png_warning
LBB0_15:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"in png_write_PLTE\n"

	.comm	_PNG_COLOR_TYPE_PALETTE,4,2     ; @PNG_COLOR_TYPE_PALETTE
l_.str.1:                               ; @.str.1
	.asciz	"Invalid number of colors in palette"

	.comm	_PNG_COLOR_MASK_COLOR,4,2       ; @PNG_COLOR_MASK_COLOR
l_.str.2:                               ; @.str.2
	.asciz	"Ignoring request to write a PLTE chunk in grayscale PNG"

l_.str.3:                               ; @.str.3
	.asciz	"num_palette = %d\n"

	.comm	_png_PLTE,4,2                   ; @png_PLTE
	.comm	_PNG_HAVE_PLTE,4,2              ; @PNG_HAVE_PLTE
	.comm	_PNG_FLAG_MNG_EMPTY_PLTE,4,2    ; @PNG_FLAG_MNG_EMPTY_PLTE
	.comm	_PNG_PLTE,4,2                   ; @PNG_PLTE
.subsections_via_symbols
