// File: /workspace/github_c_makefile_star2_O0/nkanaev[P]tipsy/src/tigr.c
// Function: savePngData
static long savePngData(Save* s, Tigr* bmp, long dataPos) {
    int x, y;
    long dataSize;
    begin(s, "IDAT", 0);
    put(s, 0x08);      // zlib compression method
    put(s, 0x1d);      // zlib compression flags
    putbits(s, 3, 3);  // zlib last block + fixed dictionary
    for (y = 0; y < bmp->h; y++) {
        TPixel* row = &bmp->pix[y * bmp->w];
        TPixel prev = tigrRGBA(0, 0, 0, 0);

        encodeByte(s, 1);  // sub filter
        for (x = 0; x < bmp->w; x++) {
            encodeByte(s, row[x].r - prev.r);
            encodeByte(s, row[x].g - prev.g);
            encodeByte(s, row[x].b - prev.b);
            encodeByte(s, row[x].a - prev.a);
            prev = row[x];
        }
    }
    endrun(s);
    literal(s, 256);  // terminator
    while (s->bits != 0x80)
        putbits(s, 0, 1);
    put32(s, s->adler);
    dataSize = (ftell(s->out) - dataPos) - 8;
    put32(s, ~s->crc);
    return dataSize;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq 0xac8c(%rip), %rsi      # 0x1063b
xorl %edx, %edx
callq 0x5b70
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x56b0
movq -0x8(%rbp), %rdi
movl $0x1d, %esi
callq 0x56b0
movq -0x8(%rbp), %rdi
movl $0x3, %edx
movl %edx, %esi
callq 0x5630
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x5af4
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x20(%rbp), %ecx
movq -0x10(%rbp), %rdx
imull (%rdx), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
xorl %ecx, %ecx
movl %ecx, %edi
movl %ecx, %esi
movl %ecx, %edx
callq 0x4f70
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x9de0
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x5ae4
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl (%rax,%rcx,4), %eax
movzbl -0x34(%rbp), %ecx
subl %ecx, %eax
movzbl %al, %esi
callq 0x9de0
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl 0x1(%rax,%rcx,4), %eax
movzbl -0x33(%rbp), %ecx
subl %ecx, %eax
movzbl %al, %esi
callq 0x9de0
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl 0x2(%rax,%rcx,4), %eax
movzbl -0x32(%rbp), %ecx
subl %ecx, %eax
movzbl %al, %esi
callq 0x9de0
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl 0x3(%rax,%rcx,4), %eax
movzbl -0x31(%rbp), %ecx
subl %ecx, %eax
movzbl %al, %esi
callq 0x9de0
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5a3e
jmp 0x5ae6
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x59e9
movq -0x8(%rbp), %rdi
callq 0x9e60
movq -0x8(%rbp), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x9fa0
movq -0x8(%rbp), %rax
cmpl $0x80, 0x8(%rax)
je 0x5b2a
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x5630
jmp 0x5b0b
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x4(%rax), %esi
callq 0x5bf0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x3030
subq -0x18(%rbp), %rax
subq $0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movl (%rax), %esi
xorl $-0x1, %esi
callq 0x5bf0
movq -0x28(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nop