	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_png_do_rgb_to_gray             ## -- Begin function png_do_rgb_to_gray
	.p2align	4, 0x90
_png_do_rgb_to_gray:                    ## @png_do_rgb_to_gray
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %rbx
	movq	%rdi, %r12
	movq	(%rsi), %r15
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_png_debug
	movl	8(%rbx), %eax
	movq	_PNG_COLOR_MASK_COLOR@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_1
## %bb.2:
	movq	(%r12), %r9
	movq	8(%r12), %r10
	movq	16(%r12), %r11
	movq	_PNG_COLOR_TYPE_RGB@GOTPCREL(%rip), %rcx
	xorl	%r12d, %r12d
	cmpl	(%rcx), %eax
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	jne	LBB0_13
## %bb.3:
	cmpl	$8, 12(%rbx)
	jne	LBB0_4
## %bb.7:
	testq	%r15, %r15
	jle	LBB0_13
## %bb.8:
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	movq	%r14, %rdi
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_9 Depth=1
	movslq	%ecx, %r13
	movslq	%esi, %rcx
	orl	$1, %r12d
	imulq	%r9, %r13
	imulq	%r10, %rdx
	addq	%r13, %rdx
	imulq	%r11, %rcx
	addq	%rdx, %rcx
	shrq	$15, %rcx
LBB0_12:                                ##   in Loop: Header=BB0_9 Depth=1
	movl	%ecx, (%r14,%rax,4)
	incq	%rax
	addq	$12, %rdi
	cmpq	%rax, %r15
	je	LBB0_13
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rdi), %ecx
	movl	8(%rdi), %esi
	movslq	4(%rdi), %rdx
	cmpl	%edx, %ecx
	jne	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	cmpl	%esi, %ecx
	je	LBB0_12
	jmp	LBB0_11
LBB0_1:
	xorl	%r12d, %r12d
	jmp	LBB0_22
LBB0_4:
	testq	%r15, %r15
	jle	LBB0_13
## %bb.5:
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	movq	%r14, %rax
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rax), %ecx
	shll	$8, %ecx
	orl	4(%rax), %ecx
	movl	8(%rax), %edx
	shll	$8, %edx
	orl	12(%rax), %edx
	movl	16(%rax), %esi
	shll	$8, %esi
	orl	20(%rax), %esi
	movl	%edx, %ebx
	xorl	%ecx, %ebx
	movl	%esi, %edi
	xorl	%ecx, %edi
	xorl	%r8d, %r8d
	orl	%ebx, %edi
	setne	%r8b
	orl	%r8d, %r12d
	movq	%r9, %rdi
	imulq	%rcx, %rdi
	movq	%r10, %rbx
	imulq	%rdx, %rbx
	addq	%rdi, %rbx
	movq	%r11, %rcx
	imulq	%rsi, %rcx
	addq	%rbx, %rcx
	shrq	$15, %rcx
	movzbl	%ch, %edx
	movl	%edx, (%r14,%r13,8)
	movzbl	%cl, %ecx
	movl	%ecx, 4(%r14,%r13,8)
	incq	%r13
	addq	$24, %rax
	cmpq	%r13, %r15
	jne	LBB0_6
LBB0_13:
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movl	8(%rdx), %eax
	movq	_PNG_COLOR_TYPE_RGB_ALPHA@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_21
## %bb.14:
	cmpl	$8, 12(%rdx)
	jne	LBB0_15
## %bb.18:
	testq	%r15, %r15
	jle	LBB0_21
## %bb.19:
	xorl	%eax, %eax
	movq	%r15, %r8
	.p2align	4, 0x90
LBB0_20:                                ## =>This Inner Loop Header: Depth=1
	movslq	(%r14,%rax,2), %rcx
	movslq	4(%r14,%rax,2), %rdx
	movslq	8(%r14,%rax,2), %rsi
	movl	%edx, %ebx
	xorl	%ecx, %ebx
	movl	%esi, %edi
	xorl	%ecx, %edi
	xorl	%r13d, %r13d
	orl	%ebx, %edi
	setne	%r13b
	orl	%r13d, %r12d
	imulq	%r9, %rcx
	imulq	%r10, %rdx
	addq	%rcx, %rdx
	imulq	%r11, %rsi
	addq	%rdx, %rsi
	shrq	$15, %rsi
	movl	%esi, (%r14,%rax)
	movl	12(%r14,%rax,2), %ecx
	movl	%ecx, 4(%r14,%rax)
	addq	$8, %rax
	decq	%r8
	jne	LBB0_20
	jmp	LBB0_21
LBB0_15:
	testq	%r15, %r15
	jle	LBB0_21
## %bb.16:
	xorl	%edi, %edi
	movq	%r15, %r8
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r14,%rdi,2), %edx
	movl	8(%r14,%rdi,2), %r13d
	shll	$8, %edx
	orl	4(%r14,%rdi,2), %edx
	shll	$8, %r13d
	orl	12(%r14,%rdi,2), %r13d
	movl	16(%r14,%rdi,2), %esi
	shll	$8, %esi
	orl	20(%r14,%rdi,2), %esi
	movl	%r13d, %ebx
	xorl	%edx, %ebx
	movl	%esi, %eax
	xorl	%edx, %eax
	xorl	%ecx, %ecx
	orl	%ebx, %eax
	setne	%cl
	orl	%ecx, %r12d
	movq	%r9, %rax
	imulq	%rdx, %rax
	movq	%r10, %rdx
	imulq	%r13, %rdx
	addq	%rax, %rdx
	movq	%r11, %rcx
	imulq	%rsi, %rcx
	addq	%rdx, %rcx
	shrq	$15, %rcx
	movzbl	%ch, %eax
	movl	%eax, (%r14,%rdi)
	movzbl	%cl, %eax
	movl	%eax, 4(%r14,%rdi)
	movl	24(%r14,%rdi,2), %eax
	movl	%eax, 8(%r14,%rdi)
	movl	28(%r14,%rdi,2), %eax
	movl	%eax, 12(%r14,%rdi)
	addq	$16, %rdi
	decq	%r8
	jne	LBB0_17
LBB0_21:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movl	16(%rbx), %eax
	addl	$-2, %eax
	movl	%eax, 16(%rbx)
	movq	_PNG_COLOR_MASK_COLOR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	notl	%ecx
	andl	%ecx, 8(%rbx)
	movslq	12(%rbx), %rcx
	movslq	%eax, %rdi
	imulq	%rcx, %rdi
	movq	%rdi, 24(%rbx)
	movq	%r15, %rsi
	callq	_PNG_ROWBYTES
	movl	%eax, 32(%rbx)
LBB0_22:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"in png_do_rgb_to_gray\n"

	.comm	_PNG_COLOR_MASK_COLOR,4,2       ## @PNG_COLOR_MASK_COLOR
	.comm	_PNG_COLOR_TYPE_RGB,4,2         ## @PNG_COLOR_TYPE_RGB
	.comm	_PNG_COLOR_TYPE_RGB_ALPHA,4,2   ## @PNG_COLOR_TYPE_RGB_ALPHA
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_png_do_rgb_to_gray             ; -- Begin function png_do_rgb_to_gray
	.p2align	2
_png_do_rgb_to_gray:                    ; @png_do_rgb_to_gray
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x21, x2
	mov	x19, x1
	mov	x22, x0
	ldr	x20, [x1]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_png_debug
	ldr	w12, [x19, #8]
Lloh2:
	adrp	x8, _PNG_COLOR_MASK_COLOR@GOTPAGE
Lloh3:
	ldr	x8, [x8, _PNG_COLOR_MASK_COLOR@GOTPAGEOFF]
	ldr	w9, [x8]
	tst	w9, w12
	b.eq	LBB0_8
; %bb.1:
	ldp	x9, x10, [x22]
	ldr	x11, [x22, #16]
Lloh4:
	adrp	x13, _PNG_COLOR_TYPE_RGB@GOTPAGE
Lloh5:
	ldr	x13, [x13, _PNG_COLOR_TYPE_RGB@GOTPAGEOFF]
Lloh6:
	ldr	w13, [x13]
	cmp	w12, w13
	b.ne	LBB0_12
; %bb.2:
	ldr	w12, [x19, #12]
	cmp	w12, #8
	b.ne	LBB0_9
; %bb.3:
	cmp	x20, #1
	b.lt	LBB0_12
; %bb.4:
	mov	w22, #0
	mov	x12, x20
	mov	x13, x21
	mov	x14, x21
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	str	w15, [x14], #4
	add	x13, x13, #12
	subs	x12, x12, #1
	b.eq	LBB0_13
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldp	w15, w16, [x13]
                                        ; kill: def $w16 killed $w16 def $x16
	sxtw	x16, w16
	ldr	w17, [x13, #8]
	cmp	w15, w16
	ccmp	w15, w17, #0, eq
	b.eq	LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	sxtw	x15, w15
	sxtw	x17, w17
	orr	w22, w22, #0x1
	mul	x15, x9, x15
	madd	x15, x10, x16, x15
	madd	x15, x11, x17, x15
	lsr	x15, x15, #15
                                        ; kill: def $w15 killed $w15 killed $x15 def $x15
	b	LBB0_5
LBB0_8:
	mov	w22, #0
	b	LBB0_22
LBB0_9:
	cmp	x20, #1
	b.lt	LBB0_12
; %bb.10:
	mov	w22, #0
	mov	x12, x20
	mov	x13, x21
	mov	x14, x21
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldp	w15, w16, [x13]
	orr	w15, w16, w15, lsl #8
	ldp	w16, w17, [x13, #8]
	orr	w16, w17, w16, lsl #8
	ldp	w17, w0, [x13, #16]
	orr	w17, w0, w17, lsl #8
	cmp	w15, w16
	ccmp	w15, w17, #0, eq
	cset	w0, ne
	orr	w22, w22, w0
	mul	x15, x9, x15
	madd	x15, x10, x16, x15
	madd	x15, x11, x17, x15
	lsr	x16, x15, #15
	ubfx	w16, w16, #8, #8
	ubfx	x15, x15, #15, #8
	stp	w16, w15, [x14], #8
	add	x13, x13, #24
	subs	x12, x12, #1
	b.ne	LBB0_11
	b	LBB0_13
LBB0_12:
	mov	w22, #0
LBB0_13:
	ldr	w12, [x19, #8]
Lloh7:
	adrp	x13, _PNG_COLOR_TYPE_RGB_ALPHA@GOTPAGE
Lloh8:
	ldr	x13, [x13, _PNG_COLOR_TYPE_RGB_ALPHA@GOTPAGEOFF]
Lloh9:
	ldr	w13, [x13]
	cmp	w12, w13
	b.ne	LBB0_21
; %bb.14:
	ldr	w12, [x19, #12]
	cmp	w12, #8
	b.ne	LBB0_18
; %bb.15:
	cmp	x20, #1
	b.lt	LBB0_21
; %bb.16:
	mov	x12, x20
	mov	x13, x21
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	ldpsw	x14, x15, [x21]
	ldrsw	x16, [x21, #8]
	cmp	w14, w15
	ccmp	w14, w16, #0, eq
	cset	w17, ne
	orr	w22, w22, w17
	mul	x14, x9, x14
	madd	x14, x10, x15, x14
	madd	x14, x11, x16, x14
	lsr	x14, x14, #15
	str	w14, [x13]
	ldr	w14, [x21, #12]
	str	w14, [x13, #4]
	add	x21, x21, #16
	add	x13, x13, #8
	subs	x12, x12, #1
	b.ne	LBB0_17
	b	LBB0_21
LBB0_18:
	cmp	x20, #1
	b.lt	LBB0_21
; %bb.19:
	mov	x12, x20
	mov	x13, x21
LBB0_20:                                ; =>This Inner Loop Header: Depth=1
	ldp	w14, w15, [x13]
	orr	w14, w15, w14, lsl #8
	ldp	w15, w16, [x13, #8]
	orr	w15, w16, w15, lsl #8
	ldp	w16, w17, [x13, #16]
	orr	w16, w17, w16, lsl #8
	cmp	w14, w15
	ccmp	w14, w16, #0, eq
	cset	w17, ne
	orr	w22, w22, w17
	mul	x14, x9, x14
	madd	x14, x10, x15, x14
	madd	x14, x11, x16, x14
	lsr	x15, x14, #15
	ubfx	w15, w15, #8, #8
	ubfx	x14, x14, #15, #8
	stp	w15, w14, [x21]
	ldr	w14, [x13, #24]
	str	w14, [x21, #8]
	ldr	w14, [x13, #28]
	str	w14, [x21, #12]
	add	x13, x13, #32
	add	x21, x21, #16
	subs	x12, x12, #1
	b.ne	LBB0_20
LBB0_21:
	ldp	w11, w9, [x19, #12]
                                        ; kill: def $w11 killed $w11 def $x11
	sxtw	x11, w11
	sub	w9, w9, #2
	str	w9, [x19, #16]
	ldr	w8, [x8]
	ldr	w10, [x19, #8]
	bic	w8, w10, w8
	str	w8, [x19, #8]
	sxtw	x8, w9
	mul	x0, x11, x8
	str	x0, [x19, #24]
	mov	x1, x20
	bl	_PNG_ROWBYTES
	str	w0, [x19, #32]
LBB0_22:
	mov	x0, x22
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"in png_do_rgb_to_gray\n"

	.comm	_PNG_COLOR_MASK_COLOR,4,2       ; @PNG_COLOR_MASK_COLOR
	.comm	_PNG_COLOR_TYPE_RGB,4,2         ; @PNG_COLOR_TYPE_RGB
	.comm	_PNG_COLOR_TYPE_RGB_ALPHA,4,2   ; @PNG_COLOR_TYPE_RGB_ALPHA
.subsections_via_symbols
