// File: /workspace/github_c_makefile_star2_O0/nkanaev[P]tipsy/src/tigr.c
// Function: tigrBlitTint
void tigrBlitTint(Tigr* dst, Tigr* src, int dx, int dy, int sx, int sy, int w, int h, TPixel tint) {
    int cw = dst->cw >= 0 ? dst->cw : dst->w;
    int ch = dst->ch >= 0 ? dst->ch : dst->h;

    CLIP();

    int xr = EXPAND(tint.r);
    int xg = EXPAND(tint.g);
    int xb = EXPAND(tint.b);
    int xa = EXPAND(tint.a);

    TPixel* ts = &src->pix[sy * src->w + sx];
    TPixel* td = &dst->pix[dy * dst->w + dx];
    int st = src->w;
    int dt = dst->w;
    do {
        for (int x = 0; x < w; x++) {
            unsigned r = (xr * ts[x].r) >> 8;
            unsigned g = (xg * ts[x].g) >> 8;
            unsigned b = (xb * ts[x].b) >> 8;
            unsigned a = xa * EXPAND(ts[x].a);
            td[x].r += (unsigned char)((r - td[x].r) * a >> 16);
            td[x].g += (unsigned char)((g - td[x].g) * a >> 16);
            td[x].b += (unsigned char)((b - td[x].b) * a >> 16);
            td[x].a += (dst->blitMode) * (unsigned char)((ts[x].a - td[x].a) * a >> 16);
        }
        ts += st;
        td += dt;
    } while (--h);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jl 0x4a59
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x78(%rbp)
jmp 0x4a62
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jl 0x4a7e
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x7c(%rbp)
jmp 0x4a88
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x4ac4
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
subl -0x14(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %ecx
movl 0x10(%rbp), %eax
subl %ecx, %eax
movl %eax, 0x10(%rbp)
movl -0x2c(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x2c(%rbp), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x4afa
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
subl -0x18(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %ecx
movl 0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, 0x18(%rbp)
movl -0x30(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x30(%rbp), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x4b25
xorl %eax, %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %ecx
movl 0x10(%rbp), %eax
subl %ecx, %eax
movl %eax, 0x10(%rbp)
movl -0x34(%rbp), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x34(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x20(%rbp)
jge 0x4b50
xorl %eax, %eax
subl -0x20(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %ecx
movl 0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, 0x18(%rbp)
movl -0x38(%rbp), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x38(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x14(%rbp), %eax
addl 0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %ecx
addl -0x24(%rbp), %ecx
cmpl %ecx, %eax
jle 0x4b74
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
addl -0x24(%rbp), %eax
subl -0x14(%rbp), %eax
movl %eax, 0x10(%rbp)
movl -0x18(%rbp), %eax
addl 0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
movl 0xc(%rcx), %ecx
addl -0x28(%rbp), %ecx
cmpl %ecx, %eax
jle 0x4b98
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
addl -0x28(%rbp), %eax
subl -0x18(%rbp), %eax
movl %eax, 0x18(%rbp)
movl -0x1c(%rbp), %eax
addl 0x10(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jle 0x4bb2
movq -0x10(%rbp), %rax
movl (%rax), %eax
subl -0x1c(%rbp), %eax
movl %eax, 0x10(%rbp)
movl -0x20(%rbp), %eax
addl 0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jle 0x4bce
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
subl -0x20(%rbp), %eax
movl %eax, 0x18(%rbp)
cmpl $0x0, 0x10(%rbp)
jle 0x4bda
cmpl $0x0, 0x18(%rbp)
jg 0x4bdf
jmp 0x4e40
movzbl 0x20(%rbp), %eax
movzbl 0x20(%rbp), %ecx
cmpl $0x0, %ecx
setg %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
movl %eax, -0x3c(%rbp)
movzbl 0x21(%rbp), %eax
movzbl 0x21(%rbp), %ecx
cmpl $0x0, %ecx
setg %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
movl %eax, -0x40(%rbp)
movzbl 0x22(%rbp), %eax
movzbl 0x22(%rbp), %ecx
cmpl $0x0, %ecx
setg %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
movl %eax, -0x44(%rbp)
movzbl 0x23(%rbp), %eax
movzbl 0x23(%rbp), %ecx
cmpl $0x0, %ecx
setg %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
movl %eax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x20(%rbp), %ecx
movq -0x10(%rbp), %rdx
imull (%rdx), %ecx
addl -0x1c(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x18(%rbp), %ecx
movq -0x8(%rbp), %rdx
imull (%rdx), %ecx
addl -0x14(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl 0x10(%rbp), %eax
jge 0x4e04
movl -0x3c(%rbp), %eax
movq -0x50(%rbp), %rcx
movslq -0x64(%rbp), %rdx
movzbl (%rcx,%rdx,4), %ecx
imull %ecx, %eax
sarl $0x8, %eax
movl %eax, -0x68(%rbp)
movl -0x40(%rbp), %eax
movq -0x50(%rbp), %rcx
movslq -0x64(%rbp), %rdx
movzbl 0x1(%rcx,%rdx,4), %ecx
imull %ecx, %eax
sarl $0x8, %eax
movl %eax, -0x6c(%rbp)
movl -0x44(%rbp), %eax
movq -0x50(%rbp), %rcx
movslq -0x64(%rbp), %rdx
movzbl 0x2(%rcx,%rdx,4), %ecx
imull %ecx, %eax
sarl $0x8, %eax
movl %eax, -0x70(%rbp)
movl -0x48(%rbp), %eax
movq -0x50(%rbp), %rcx
movslq -0x64(%rbp), %rdx
movzbl 0x3(%rcx,%rdx,4), %ecx
movq -0x50(%rbp), %rdx
movslq -0x64(%rbp), %rsi
movzbl 0x3(%rdx,%rsi,4), %edx
cmpl $0x0, %edx
setg %dl
andb $0x1, %dl
movzbl %dl, %edx
addl %edx, %ecx
imull %ecx, %eax
movl %eax, -0x74(%rbp)
movl -0x68(%rbp), %eax
movq -0x58(%rbp), %rcx
movslq -0x64(%rbp), %rdx
movzbl (%rcx,%rdx,4), %ecx
subl %ecx, %eax
imull -0x74(%rbp), %eax
shrl $0x10, %eax
movzbl %al, %esi
movq -0x58(%rbp), %rax
movslq -0x64(%rbp), %rcx
movzbl (%rax,%rcx,4), %edx
addl %esi, %edx
movb %dl, (%rax,%rcx,4)
movl -0x6c(%rbp), %eax
movq -0x58(%rbp), %rcx
movslq -0x64(%rbp), %rdx
movzbl 0x1(%rcx,%rdx,4), %ecx
subl %ecx, %eax
imull -0x74(%rbp), %eax
shrl $0x10, %eax
movzbl %al, %esi
movq -0x58(%rbp), %rax
movslq -0x64(%rbp), %rcx
movzbl 0x1(%rax,%rcx,4), %edx
addl %esi, %edx
movb %dl, 0x1(%rax,%rcx,4)
movl -0x70(%rbp), %eax
movq -0x58(%rbp), %rcx
movslq -0x64(%rbp), %rdx
movzbl 0x2(%rcx,%rdx,4), %ecx
subl %ecx, %eax
imull -0x74(%rbp), %eax
shrl $0x10, %eax
movzbl %al, %esi
movq -0x58(%rbp), %rax
movslq -0x64(%rbp), %rcx
movzbl 0x2(%rax,%rcx,4), %edx
addl %esi, %edx
movb %dl, 0x2(%rax,%rcx,4)
movq -0x8(%rbp), %rax
movl 0x28(%rax), %esi
movq -0x50(%rbp), %rax
movslq -0x64(%rbp), %rcx
movzbl 0x3(%rax,%rcx,4), %eax
movq -0x58(%rbp), %rcx
movslq -0x64(%rbp), %rdx
movzbl 0x3(%rcx,%rdx,4), %ecx
subl %ecx, %eax
imull -0x74(%rbp), %eax
shrl $0x10, %eax
movzbl %al, %eax
imull %eax, %esi
movq -0x58(%rbp), %rax
movslq -0x64(%rbp), %rcx
movzbl 0x3(%rax,%rcx,4), %edx
addl %esi, %edx
movb %dl, 0x3(%rax,%rcx,4)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x4ca2
movl -0x5c(%rbp), %ecx
movq -0x50(%rbp), %rax
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movl -0x60(%rbp), %ecx
movq -0x58(%rbp), %rax
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movl 0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, 0x18(%rbp)
cmpl $0x0, %eax
jne 0x4c9b
popq %rbp
retq
nopw %cs:(%rax,%rax)