	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_lodepng_encode                 ## -- Begin function lodepng_encode
	.p2align	4, 0x90
_lodepng_encode:                        ## @lodepng_encode
	.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	$232, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, %rbx
	movl	%r8d, -48(%rbp)                 ## 4-byte Spill
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movq	%rdx, %r12
	movq	%rdi, %r15
	movq	$0, -56(%rbp)
	movq	$0, -96(%rbp)
	movq	$0, (%rdi)
	movq	%rsi, -88(%rbp)                 ## 8-byte Spill
	movq	$0, (%rsi)
	movl	$0, (%r9)
	leaq	-256(%rbp), %r14
	movq	%r14, %rdi
	callq	_lodepng_info_init
	leaq	64(%rbx), %r13
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_lodepng_info_copy
	movq	-144(%rbp), %rax
	movq	_LCT_PALETTE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_2
## %bb.1:
	cmpq	$0, 32(%rbx)
	je	LBB0_5
LBB0_2:
	movl	-136(%rbp), %eax
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	cmpl	$257, %eax                      ## imm = 0x101
	jge	LBB0_4
LBB0_5:
	leaq	-144(%rbp), %rdi
	movl	40(%rbx), %r9d
	movq	_LAC_NO@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r9d
	jne	LBB0_6
## %bb.7:
	movq	%rdi, %r14
	movl	(%rbx), %eax
	testl	%eax, %eax
	jne	LBB0_43
	jmp	LBB0_9
LBB0_4:
	movl	$68, (%rbx)
	movl	$68, %eax
	jmp	LBB0_43
LBB0_6:
	leaq	48(%rbx), %r8
	movq	%rdi, %r14
	movq	%r12, %rsi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
	callq	_lodepng_auto_choose_color
                                        ## kill: def $eax killed $eax def $rax
	movl	%eax, (%rbx)
	testl	%eax, %eax
	jne	LBB0_43
LBB0_9:
	leaq	8(%rbx), %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	cmpl	$32769, (%rax)                  ## imm = 0x8001
	jge	LBB0_10
## %bb.11:
	cmpl	$3, 12(%rbx)
	jge	LBB0_12
LBB0_13:
	cmpl	$2, (%r13)
	jl	LBB0_15
LBB0_14:
	movl	(%rbx), %edi
	movl	$71, %esi
	callq	_CERROR_RETURN_ERROR
LBB0_15:
	movq	-144(%rbp), %rdi
	movl	-116(%rbp), %esi
	callq	_checkColorValidity
	movl	%eax, (%rbx)
	testl	%eax, %eax
	jne	LBB0_43
## %bb.16:
	movq	48(%rbx), %rdi
	movl	56(%rbx), %esi
	callq	_checkColorValidity
	movl	%eax, (%rbx)
	testl	%eax, %eax
	jne	LBB0_43
## %bb.17:
	leaq	48(%rbx), %rdi
	movq	%rdi, -104(%rbp)                ## 8-byte Spill
	movq	%r14, %r13
	movq	%r14, %rsi
	callq	_lodepng_color_mode_equal
	testl	%eax, %eax
	je	LBB0_18
## %bb.25:
	movq	-80(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, (%rsp)
	leaq	-56(%rbp), %rdi
	leaq	-96(%rbp), %rsi
	leaq	-256(%rbp), %r9
	movq	%r12, %rdx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	-48(%rbp), %r8d                 ## 4-byte Reload
	callq	_preProcessScanlines
	movq	-88(%rbp), %r13                 ## 8-byte Reload
	jmp	LBB0_26
LBB0_10:
	xorl	%edi, %edi
	movl	$60, %esi
	callq	_CERROR_RETURN_ERROR
	cmpl	$3, 12(%rbx)
	jl	LBB0_13
LBB0_12:
	movl	(%rbx), %edi
	movl	$61, %esi
	callq	_CERROR_RETURN_ERROR
	cmpl	$2, (%r13)
	jge	LBB0_14
	jmp	LBB0_15
LBB0_18:
	movl	-48(%rbp), %r14d                ## 4-byte Reload
	imull	-44(%rbp), %r14d                ## 4-byte Folded Reload
	movq	%r13, %rdi
	callq	_lodepng_get_bpp
	movl	%eax, %r13d
	imull	%r14d, %r13d
	addl	$7, %r13d
	movl	%r13d, %edi
	shrl	$3, %edi
	callq	_lodepng_malloc
	testq	%rax, %rax
	jne	LBB0_21
## %bb.19:
	cmpl	$8, %r13d
	jb	LBB0_21
## %bb.20:
	movl	$83, (%rbx)
	movq	-88(%rbp), %r13                 ## 8-byte Reload
	movq	-80(%rbp), %r14                 ## 8-byte Reload
	jmp	LBB0_24
LBB0_21:
	cmpl	$0, (%rbx)
	movq	-88(%rbp), %r13                 ## 8-byte Reload
	movq	-80(%rbp), %r14                 ## 8-byte Reload
	jne	LBB0_24
## %bb.22:
	movl	$0, (%rsp)
	movq	%rax, %rdi
	movq	%r12, %rsi
	leaq	-144(%rbp), %rdx
	movq	-104(%rbp), %rcx                ## 8-byte Reload
	movl	-44(%rbp), %r8d                 ## 4-byte Reload
	movl	-48(%rbp), %r9d                 ## 4-byte Reload
	movq	%rax, %r12
	callq	_lodepng_convert
	movl	%eax, (%rbx)
	testl	%eax, %eax
	movq	%r12, %rax
	jne	LBB0_24
## %bb.23:
	movq	%r14, (%rsp)
	leaq	-56(%rbp), %rdi
	leaq	-96(%rbp), %rsi
	leaq	-256(%rbp), %r9
	movq	%rax, %rdx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	-48(%rbp), %r8d                 ## 4-byte Reload
	callq	_preProcessScanlines
	movq	%r12, %rax
LBB0_24:
	movq	%rax, %rdi
	callq	_lodepng_free
LBB0_26:
	leaq	-72(%rbp), %rdi
	callq	_ucvector_init
	cmpl	$0, (%rbx)
	jne	LBB0_42
## %bb.27:
	leaq	-72(%rbp), %r12
	movq	%r12, %rdi
	callq	_writeSignature
	movq	-144(%rbp), %rcx
	movl	-116(%rbp), %r8d
	movl	-112(%rbp), %r9d
	movq	%r12, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	callq	_addChunk_IHDR
	movq	-144(%rbp), %rax
	movq	_LCT_PALETTE@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rax
	jne	LBB0_29
## %bb.28:
	leaq	-72(%rbp), %rdi
	leaq	-144(%rbp), %rsi
	callq	_addChunk_PLTE
	movq	_LCT_PALETTE@GOTPCREL(%rip), %rdx
LBB0_29:
	cmpq	$0, 32(%rbx)
	je	LBB0_33
## %bb.30:
	movq	-144(%rbp), %rax
	movq	_LCT_RGB@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_32
## %bb.31:
	movq	_LCT_RGBA@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_33
LBB0_32:
	leaq	-72(%rbp), %rdi
	leaq	-144(%rbp), %rsi
	callq	_addChunk_PLTE
	movq	_LCT_PALETTE@GOTPCREL(%rip), %rdx
LBB0_33:
	movq	-144(%rbp), %rax
	cmpq	(%rdx), %rax
	jne	LBB0_36
## %bb.34:
	movl	-136(%rbp), %esi
	movl	-120(%rbp), %edi
	callq	_getPaletteTranslucency
	testq	%rax, %rax
	je	LBB0_36
## %bb.35:
	leaq	-72(%rbp), %rdi
	leaq	-144(%rbp), %rsi
	callq	_addChunk_tRNS
LBB0_36:
	movq	-144(%rbp), %rax
	movq	_LCT_GREY@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_38
## %bb.37:
	movq	_LCT_RGB@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_40
LBB0_38:
	cmpq	$0, -128(%rbp)
	je	LBB0_40
## %bb.39:
	leaq	-72(%rbp), %rdi
	leaq	-144(%rbp), %rsi
	callq	_addChunk_tRNS
LBB0_40:
	movq	-56(%rbp), %rsi
	movq	-96(%rbp), %rdx
	leaq	-72(%rbp), %rdi
	movq	%r14, %rcx
	callq	_addChunk_IDAT
	movl	%eax, (%rbx)
	testl	%eax, %eax
	jne	LBB0_42
## %bb.41:
	leaq	-72(%rbp), %rdi
	callq	_addChunk_IEND
LBB0_42:
	leaq	-256(%rbp), %rdi
	callq	_lodepng_info_cleanup
	movq	-56(%rbp), %rdi
	callq	_lodepng_free
	movq	-72(%rbp), %rax
	movq	%rax, (%r15)
	movq	-64(%rbp), %rax
	movq	%rax, (%r13)
	movl	(%rbx), %eax
LBB0_43:
                                        ## kill: def $eax killed $eax killed $rax
	addq	$232, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_LCT_PALETTE,8,3                ## @LCT_PALETTE
	.comm	_LAC_NO,4,2                     ## @LAC_NO
	.comm	_LCT_RGB,8,3                    ## @LCT_RGB
	.comm	_LCT_RGBA,8,3                   ## @LCT_RGBA
	.comm	_LCT_GREY,8,3                   ## @LCT_GREY
	.comm	_VERSION_STRING,4,2             ## @VERSION_STRING
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_lodepng_encode                 ; -- Begin function lodepng_encode
	.p2align	2
_lodepng_encode:                        ; @lodepng_encode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #304
	.cfi_def_cfa_offset 304
	stp	x28, x27, [sp, #208]            ; 16-byte Folded Spill
	stp	x26, x25, [sp, #224]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #240]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #256]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #272]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #288]            ; 16-byte Folded Spill
	add	x29, sp, #288
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x5
	mov	x24, x4
	mov	x25, x3
	mov	x26, x2
	mov	x20, x1
	mov	x21, x0
	stp	xzr, xzr, [sp, #16]
	str	xzr, [x0]
	str	xzr, [x1]
	mov	x27, x5
	str	wzr, [x27], #64
	add	x22, sp, #48
	add	x0, sp, #48
	bl	_lodepng_info_init
	add	x0, sp, #48
	mov	x1, x27
	bl	_lodepng_info_copy
	ldr	x8, [sp, #160]
Lloh0:
	adrp	x28, _LCT_PALETTE@GOTPAGE
Lloh1:
	ldr	x28, [x28, _LCT_PALETTE@GOTPAGEOFF]
	ldr	x9, [x28]
	cmp	x8, x9
	b.eq	LBB0_2
; %bb.1:
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_4
LBB0_2:
	ldr	w8, [sp, #168]
	cbz	w8, LBB0_6
; %bb.3:
	cmp	w8, #257
	b.ge	LBB0_6
LBB0_4:
	add	x22, x22, #112
	ldr	w5, [x19, #40]
Lloh2:
	adrp	x8, _LAC_NO@GOTPAGE
Lloh3:
	ldr	x8, [x8, _LAC_NO@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	cmp	w5, w8
	b.ne	LBB0_7
; %bb.5:
	ldr	w0, [x19]
	cbnz	w0, LBB0_42
	b	LBB0_8
LBB0_6:
	mov	w0, #68
	str	w0, [x19]
	b	LBB0_42
LBB0_7:
	add	x4, x19, #48
	mov	x0, x22
	mov	x1, x26
	mov	x2, x25
	mov	x3, x24
	bl	_lodepng_auto_choose_color
                                        ; kill: def $w0 killed $w0 def $x0
	str	w0, [x19]
	cbnz	w0, LBB0_42
LBB0_8:
	add	x23, x19, #8
	ldr	w8, [x23]
	cmp	w8, #8, lsl #12                 ; =32768
	b.le	LBB0_10
; %bb.9:
	mov	w0, #0
	mov	w1, #60
	bl	_CERROR_RETURN_ERROR
LBB0_10:
	ldr	w8, [x19, #12]
	cmp	w8, #2
	b.le	LBB0_12
; %bb.11:
	ldr	w0, [x19]
	mov	w1, #61
	bl	_CERROR_RETURN_ERROR
LBB0_12:
	ldr	w8, [x27]
	cmp	w8, #2
	b.lt	LBB0_14
; %bb.13:
	ldr	w0, [x19]
	mov	w1, #71
	bl	_CERROR_RETURN_ERROR
LBB0_14:
	ldr	x0, [sp, #160]
	ldr	w1, [sp, #188]
	bl	_checkColorValidity
	str	w0, [x19]
	cbnz	w0, LBB0_42
; %bb.15:
	mov	x27, x19
	ldr	x0, [x27, #48]!
	ldr	w1, [x19, #56]
	bl	_checkColorValidity
	mov	x8, x0
	str	w8, [x19]
	cbnz	w8, LBB0_42
; %bb.16:
	mov	x0, x27
	mov	x1, x22
	bl	_lodepng_color_mode_equal
	cbz	w0, LBB0_18
; %bb.17:
	add	x0, sp, #24
	add	x1, sp, #16
	add	x5, sp, #48
	mov	x2, x26
	mov	x3, x25
	mov	x4, x24
	mov	x6, x23
	bl	_preProcessScanlines
	b	LBB0_25
LBB0_18:
	mul	w8, w24, w25
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	mov	x0, x22
	bl	_lodepng_get_bpp
	orr	w8, wzr, #0x7
	ldr	w9, [sp, #12]                   ; 4-byte Folded Reload
	madd	w8, w9, w0, w8
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	lsr	w0, w8, #3
	bl	_lodepng_malloc
	mov	x9, x0
	cbnz	x0, LBB0_21
; %bb.19:
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	cmp	w8, #8
	b.lo	LBB0_21
; %bb.20:
	mov	w8, #83
	str	w8, [x19]
	b	LBB0_24
LBB0_21:
	ldr	w8, [x19]
	cbnz	w8, LBB0_24
; %bb.22:
	mov	x0, x9
	mov	x1, x26
	mov	x26, x9
	mov	x2, x22
	mov	x3, x27
	mov	x4, x25
	mov	x5, x24
	mov	w6, #0
	bl	_lodepng_convert
	mov	x9, x26
	str	w0, [x19]
	cbnz	w0, LBB0_24
; %bb.23:
	add	x0, sp, #24
	add	x1, sp, #16
	add	x5, sp, #48
	mov	x2, x26
	mov	x3, x25
	mov	x4, x24
	mov	x6, x23
	bl	_preProcessScanlines
	mov	x9, x26
LBB0_24:
	mov	x0, x9
	bl	_lodepng_free
LBB0_25:
	add	x0, sp, #32
	bl	_ucvector_init
	ldr	w8, [x19]
	cbnz	w8, LBB0_41
; %bb.26:
	add	x0, sp, #32
	bl	_writeSignature
	ldr	x3, [sp, #160]
	ldp	w4, w5, [sp, #188]
	add	x0, sp, #32
	mov	x1, x25
	mov	x2, x24
	bl	_addChunk_IHDR
	ldr	x8, [sp, #160]
	ldr	x9, [x28]
	cmp	x8, x9
	b.ne	LBB0_28
; %bb.27:
	add	x0, sp, #32
	mov	x1, x22
	bl	_addChunk_PLTE
LBB0_28:
	ldr	x8, [x19, #32]
Lloh5:
	adrp	x24, _LCT_RGB@GOTPAGE
Lloh6:
	ldr	x24, [x24, _LCT_RGB@GOTPAGEOFF]
	cbz	x8, LBB0_32
; %bb.29:
	ldr	x8, [sp, #160]
	ldr	x9, [x24]
	cmp	x8, x9
	b.eq	LBB0_31
; %bb.30:
Lloh7:
	adrp	x9, _LCT_RGBA@GOTPAGE
Lloh8:
	ldr	x9, [x9, _LCT_RGBA@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_32
LBB0_31:
	add	x0, sp, #32
	mov	x1, x22
	bl	_addChunk_PLTE
LBB0_32:
	ldr	x8, [sp, #160]
	ldr	x9, [x28]
	cmp	x8, x9
	b.ne	LBB0_35
; %bb.33:
	ldr	w0, [sp, #184]
	ldr	w1, [sp, #168]
	bl	_getPaletteTranslucency
	cbz	x0, LBB0_35
; %bb.34:
	add	x0, sp, #32
	mov	x1, x22
	bl	_addChunk_tRNS
LBB0_35:
	ldr	x8, [sp, #160]
Lloh10:
	adrp	x9, _LCT_GREY@GOTPAGE
Lloh11:
	ldr	x9, [x9, _LCT_GREY@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_37
; %bb.36:
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_39
LBB0_37:
	ldr	x8, [sp, #176]
	cbz	x8, LBB0_39
; %bb.38:
	add	x0, sp, #32
	mov	x1, x22
	bl	_addChunk_tRNS
LBB0_39:
	ldp	x2, x1, [sp, #16]
	add	x0, sp, #32
	mov	x3, x23
	bl	_addChunk_IDAT
	str	w0, [x19]
	cbnz	w0, LBB0_41
; %bb.40:
	add	x0, sp, #32
	bl	_addChunk_IEND
LBB0_41:
	add	x0, sp, #48
	bl	_lodepng_info_cleanup
	ldr	x0, [sp, #24]
	bl	_lodepng_free
	ldp	x8, x9, [sp, #32]
	str	x8, [x21]
	str	x9, [x20]
	ldr	w0, [x19]
LBB0_42:
                                        ; kill: def $w0 killed $w0 killed $x0
	ldp	x29, x30, [sp, #288]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #272]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #256]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #240]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #224]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #208]            ; 16-byte Folded Reload
	add	sp, sp, #304
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_LCT_PALETTE,8,3                ; @LCT_PALETTE
	.comm	_LAC_NO,4,2                     ; @LAC_NO
	.comm	_LCT_RGB,8,3                    ; @LCT_RGB
	.comm	_LCT_RGBA,8,3                   ; @LCT_RGBA
	.comm	_LCT_GREY,8,3                   ; @LCT_GREY
	.comm	_VERSION_STRING,4,2             ; @VERSION_STRING
.subsections_via_symbols
