// File: /workspace/github_cpp_makefile_star2_O1/titusnicolae[P]imgdiff2/imgdiff.cpp
// Function: main
int main (int argc, char *argv[])
{
    if(argc<3)
    {
        cout<<"missing argument";
        return 0;
    }

    string file1(argv[1]);
    string file2(argv[2]);

    if(file1.size()>4 and file1.substr(file1.size()-4)!=".png" and
       file2.size()>4 and file2.substr(file2.size()-4)!=".png")
    {
        cout<<"File type not png";
        return 0;
    }

    PNG png1 = PNG(argv[1]);
    png1.hash();
    PNG png2 = PNG(argv[2]);
    png2.hash();
    PNG diff = PNG(png1.w, png1.h, png1.data, "diff.png");
    vector<Point> missing;
    for(auto& e: png1.asd)
    {
        if(png2.asd.find(e.first) == png2.asd.end())
        {
            for(auto& f: e.second)
            {
                missing.push_back(f);
            }
        }
    }
    for(auto& e: missing)
    {
        for(int i=0;i<8;i++)
        {
            for(int j=0;j<8;j++)
            {
                diff.red(e.x+i,e.y+j) = 255;
            }
        }
    }
    diff.save();

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x280, %rsp            # imm = 0x280
cmpl $0x2, %edi
jg 0x27a4
movq 0x1484a(%rip), %rdi     # 0x16fd8
leaq 0xe890(%rip), %rsi      # 0x11025
movl $0x10, %edx
callq 0x21f0
jmp 0x2ce1
movq %rsi, %rbx
movq 0x8(%rsi), %rsi
leaq 0x78(%rsp), %rdi
leaq 0xf8(%rsp), %rdx
callq 0x20b0
movq 0x10(%rbx), %rsi
leaq 0x58(%rsp), %rdi
leaq 0xf8(%rsp), %rdx
callq 0x20b0
movq 0x80(%rsp), %r14
cmpq $0x5, %r14
jb 0x285c
leaq -0x4(%r14), %rdx
leaq 0xd8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
movq $-0x1, %rcx
callq 0x21c0
leaq 0xe847(%rip), %rsi      # 0x1104c
leaq 0xd8(%rsp), %rdi
callq 0x2080
testl %eax, %eax
je 0x285c
movq 0x60(%rsp), %rdx
cmpq $0x5, %rdx
jb 0x285c
addq $-0x4, %rdx
leaq 0x170(%rsp), %rdi
leaq 0x58(%rsp), %rsi
movq $-0x1, %rcx
callq 0x21c0
leaq 0xe807(%rip), %rsi      # 0x1104c
leaq 0x170(%rsp), %rdi
callq 0x2080
testl %eax, %eax
setne %bpl
movb $0x1, %al
jmp 0x2860
xorl %eax, %eax
xorl %ebp, %ebp
testb %al, %al
je 0x2885
leaq 0x180(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2885
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x21b0
cmpq $0x5, %r14
jb 0x28ac
leaq 0xe8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28ac
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x21b0
testb %bpl, %bpl
je 0x28ce
movq 0x14720(%rip), %rdi     # 0x16fd8
leaq 0xe777(%rip), %rsi      # 0x11036
movl $0x11, %edx
callq 0x21f0
jmp 0x2ca5
movq 0x8(%rbx), %rsi
leaq 0xb8(%rsp), %rdi
leaq 0x208(%rsp), %rdx
callq 0x20b0
leaq 0xf8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x2e54
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x291d
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x21b0
leaq 0xf8(%rsp), %rdi
callq 0x3018
movq 0x10(%rbx), %rsi
leaq 0x98(%rsp), %rdi
leaq 0x190(%rsp), %rdx
callq 0x20b0
leaq 0x208(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x2e54
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2979
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x21b0
leaq 0x208(%rsp), %rdi
callq 0x3018
movl 0x118(%rsp), %ebx
movl 0x11c(%rsp), %ebp
movq 0x128(%rsp), %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
subq 0x120(%rsp), %r14
je 0x29ca
js 0x2cf3
movq %r14, %rdi
callq 0x21a0
movq %rax, %r15
jmp 0x29cd
xorl %r15d, %r15d
movq %r15, 0x20(%rsp)
movq %r15, 0x28(%rsp)
addq %r15, %r14
movq %r14, 0x30(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %r14
subq %rsi, %r14
je 0x29ff
movq %r15, %rdi
movq %r14, %rdx
callq 0x22c0
addq %r14, %r15
movq %r15, 0x28(%rsp)
leaq 0x48(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xe631(%rip), %rsi      # 0x11048
leaq 0xe632(%rip), %rdx      # 0x11050
leaq 0x38(%rsp), %rdi
callq 0x394a
leaq 0x190(%rsp), %rdi
leaq 0x20(%rsp), %rcx
leaq 0x38(%rsp), %r8
movl %ebx, %esi
movl %ebp, %edx
callq 0x31bc
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x2a5a
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2a71
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x148(%rsp), %r15
testq %r15, %r15
je 0x2b48
movq %rsp, %rbx
movq 0x8(%r15), %rcx
movq 0x248(%rsp), %rdi
movq 0x250(%rsp), %r8
movq %rcx, %rax
xorl %edx, %edx
divq %r8
movq %rdx, %rsi
movq (%rdi,%rdx,8), %rdx
movl $0x0, %eax
testq %rdx, %rdx
je 0x2afb
movq (%rdx), %r9
movq %rdx, %rax
cmpq 0x8(%r9), %rcx
je 0x2afb
movq %r9, %r10
movq (%r9), %r9
testq %r9, %r9
je 0x2af9
movq 0x8(%r9), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
movl $0x0, %eax
cmpq %rsi, %rdx
jne 0x2afb
movq %r10, %rax
cmpq %rdi, %rcx
jne 0x2ace
jmp 0x2afb
xorl %eax, %eax
testq %rax, %rax
je 0x2b10
cmpq $0x0, (%rax)
je 0x2b10
movq (%r15), %r15
testq %r15, %r15
jne 0x2a95
jmp 0x2b48
movq 0x10(%r15), %r14
movq 0x18(%r15), %r12
cmpq %r12, %r14
je 0x2b06
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x2b37
movq (%r14), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rsp)
jmp 0x2b42
movq %rbx, %rdi
movq %r14, %rdx
callq 0x39da
addq $0x8, %r14
jmp 0x2b18
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
cmpq %rcx, %rax
je 0x2b96
xorl %edx, %edx
xorl %esi, %esi
movl (%rax), %edi
addl %edx, %edi
movl 0x4(%rax), %r8d
addl %esi, %r8d
imull 0x1b0(%rsp), %r8d
addl %edi, %r8d
shll $0x2, %r8d
movq 0x1b8(%rsp), %rdi
movb $-0x1, (%rdi,%r8)
incl %esi
cmpl $0x8, %esi
jne 0x2b5a
incl %edx
cmpl $0x8, %edx
jne 0x2b58
addq $0x8, %rax
jmp 0x2b51
leaq 0x1b8(%rsp), %rsi
movq -0x28(%rsi), %rdi
movl -0x8(%rsi), %edx
movl -0x4(%rsi), %ecx
callq 0x2639
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2bc3
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
callq 0x32c0
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x2bec
movq 0x1c8(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
leaq 0x1a0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c0d
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x21b0
leaq 0x248(%rsp), %rbx
movq %rbx, %rdi
callq 0x32c0
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x2c36
movq 0x240(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
leaq 0x138(%rsp), %rbx
leaq 0x218(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c5f
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x32c0
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x2c84
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
leaq 0x108(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ca5
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x21b0
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2cc0
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x21b0
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ce1
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x21b0
xorl %eax, %eax
addq $0x280, %rsp            # imm = 0x280
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x20a0
movq %rax, %rbx
leaq 0xe8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e10
movq 0xe8(%rsp), %rsi
jmp 0x2db3
jmp 0x2dcb
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x2d41
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x2d41
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2df6
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
jmp 0x2df6
jmp 0x2df3
movq %rax, %rbx
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e03
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x2e03
jmp 0x2d92
movq %rax, %rbx
jmp 0x2e03
movq %rax, %rbx
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e10
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x2e10
jmp 0x2dc1
jmp 0x2dc1
movq %rax, %rbx
jmp 0x2e10
movq %rax, %rbx
jmp 0x2e2b
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2de4
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
leaq 0x190(%rsp), %rdi
callq 0x3278
jmp 0x2df6
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0x3278
leaq 0xf8(%rsp), %rdi
callq 0x3278
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e2b
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x21b0
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e4c
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x2310