// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-png.c
// Function: compress_png_row
static void compress_png_row(struct deark_png_encode_info *pei, struct fmtutil_tdefl_ctx *tdctx,
	int y)
{
	static const char nulbyte = '\0';

	// Filter byte
	fmtutil_tdefl_compress_buffer(tdctx, &nulbyte, 1, FMTUTIL_TDEFL_NO_FLUSH);

	if(pei->encode_as_bwimg) {
		int x;

		if(pei->tmprow) {
			de_zeromem(pei->tmprow, pei->dst_rowspan);
		}
		else {
			pei->tmprow = de_malloc(pei->c, pei->dst_rowspan);
		}

		for(x=0; x<pei->width; x++) {
			u8 k;

			// We just use the red sample, like DE_COLOR_K().
			k = pei->img->bitmap[y*pei->src_rowspan + x*pei->img->bytes_per_pixel];
			if(k>=0x80) {
				pei->tmprow[x/8] |= 1U<<(7-x%8);
			}
		}

		fmtutil_tdefl_compress_buffer(tdctx, pei->tmprow, pei->dst_rowspan, FMTUTIL_TDEFL_NO_FLUSH);
	}
	else if(pei->imglo) {
		int x;

		if(pei->tmprow) {
			de_zeromem(pei->tmprow, pei->dst_rowspan);
		}
		else {
			pei->tmprow = de_malloc(pei->c, pei->dst_rowspan);
		}

		for(x=0; x<pei->samples_per_row; x++) {
			pei->tmprow[x*2] = pei->img->bitmap[y*pei->src_rowspan + x];
			pei->tmprow[x*2+1] = pei->imglo->bitmap[y*pei->src_rowspan + x];
		}

		fmtutil_tdefl_compress_buffer(tdctx, pei->tmprow, pei->dst_rowspan, FMTUTIL_TDEFL_NO_FLUSH);
	}
	else {
		fmtutil_tdefl_compress_buffer(tdctx, &pei->img->bitmap[y*pei->src_rowspan],
			pei->dst_rowspan, FMTUTIL_TDEFL_NO_FLUSH);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x4224e(%rip), %rsi     # 0x1dda6c
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x198220
movq -0x8(%rbp), %rax
cmpb $0x0, 0x62(%rax)
je 0x19b94f
movq -0x8(%rbp), %rax
cmpq $0x0, 0x80(%rax)
je 0x19b862
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdx
xorl %esi, %esi
callq 0x19140
jmp 0x19b884
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rsi
callq 0x15b780
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x80(%rax)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jge 0x19b92c
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rax), %rax
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rdx
imull 0x28(%rdx), %ecx
movl -0x18(%rbp), %edx
movq -0x8(%rbp), %rsi
movq 0x10(%rsi), %rsi
imull 0x24(%rsi), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %eax
cmpl $0x80, %eax
jl 0x19b91c
movl -0x18(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl $0x7, %ecx
subl %edx, %ecx
movl $0x1, %esi
shll %cl, %esi
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x18(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
movzbl (%rax,%rcx), %edx
orl %esi, %edx
movb %dl, (%rax,%rcx)
jmp 0x19b91e
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x19b88b
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdx
xorl %ecx, %ecx
callq 0x198220
jmp 0x19ba8b
movq -0x8(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x19ba5a
movq -0x8(%rbp), %rax
cmpq $0x0, 0x80(%rax)
je 0x19b988
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdx
xorl %esi, %esi
callq 0x19140
jmp 0x19b9aa
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rsi
callq 0x15b780
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x80(%rax)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jge 0x19ba3a
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rax), %rax
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rdx
imull 0x28(%rdx), %ecx
addl -0x20(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movl -0x20(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rax
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rdx
imull 0x28(%rdx), %ecx
addl -0x20(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movl -0x20(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x19b9b1
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdx
xorl %ecx, %ecx
callq 0x198220
jmp 0x19ba89
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rax), %rsi
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
imull 0x28(%rcx), %eax
cltq
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdx
xorl %ecx, %ecx
callq 0x198220
jmp 0x19ba8b
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)