// File: /workspace/github_cpp_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
cmpl $0x2, %edi
jg 0x25f9
movq 0x119f0(%rip), %rdi     # 0x13fd8
leaq 0xaa36(%rip), %rsi      # 0xd025
callq 0x2150
jmp 0x28ce
movq %rsi, %rbx
movq 0x8(%rsi), %rsi
leaq 0x50(%rsp), %rdi
leaq 0xd0(%rsp), %rdx
callq 0x2090
movq 0x10(%rbx), %rsi
leaq 0x30(%rsp), %rdi
leaq 0xd0(%rsp), %rdx
callq 0x2090
movq 0x58(%rsp), %rdx
cmpq $0x5, %rdx
jb 0x26e6
addq $-0x4, %rdx
leaq 0xd0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
pushq $-0x1
popq %rcx
callq 0x2190
leaq 0xa9f5(%rip), %rsi      # 0xd04c
leaq 0xd0(%rsp), %rdi
callq 0x29b3
testb %al, %al
je 0x26d9
movq 0x38(%rsp), %rdx
cmpq $0x5, %rdx
jb 0x26d9
addq $-0x4, %rdx
leaq 0x148(%rsp), %rdi
leaq 0x30(%rsp), %rsi
pushq $-0x1
popq %rcx
callq 0x2190
leaq 0xa9b9(%rip), %rsi      # 0xd04c
leaq 0x148(%rsp), %rdi
callq 0x29b3
movl %eax, %ebp
leaq 0x148(%rsp), %rdi
callq 0x20c0
leaq 0xd0(%rsp), %rdi
callq 0x20c0
testb %bpl, %bpl
je 0x26e6
movq 0x11910(%rip), %rdi     # 0x13fd8
leaq 0xa967(%rip), %rsi      # 0xd036
callq 0x2150
jmp 0x28ba
leaq 0xd0(%rsp), %rdi
callq 0x20c0
movq 0x8(%rbx), %rsi
leaq 0xb0(%rsp), %rdi
leaq 0x148(%rsp), %rdx
callq 0x2090
leaq 0xd0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x29be
leaq 0xb0(%rsp), %rdi
callq 0x20c0
leaq 0xd0(%rsp), %rdi
callq 0x2adc
movq 0x10(%rbx), %rsi
leaq 0x90(%rsp), %rdi
leaq 0x1c0(%rsp), %rdx
callq 0x2090
leaq 0x148(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x29be
leaq 0x90(%rsp), %rdi
callq 0x20c0
leaq 0x148(%rsp), %rdi
callq 0x2adc
leaq 0xf8(%rsp), %rsi
movl -0x8(%rsi), %ebx
movl -0x4(%rsi), %ebp
leaq 0x18(%rsp), %rdi
callq 0x2bf6
leaq 0xa8b3(%rip), %rsi      # 0xd048
leaq 0x70(%rsp), %rdi
movq %rsp, %rdx
callq 0x2090
leaq 0x1c0(%rsp), %rdi
leaq 0x18(%rsp), %rcx
leaq 0x70(%rsp), %r8
movl %ebx, %esi
movl %ebp, %edx
callq 0x2c40
leaq 0x70(%rsp), %rdi
callq 0x20c0
leaq 0x18(%rsp), %rdi
callq 0x343c
movq %rsp, %rbx
andq $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
movq 0x120(%rsp), %r12
leaq 0x188(%rsp), %r14
testq %r12, %r12
je 0x282c
leaq 0x8(%r12), %rsi
movq %r14, %rdi
callq 0x34a8
testq %rax, %rax
je 0x280c
movq (%r12), %r12
jmp 0x27ef
movq 0x10(%r12), %r15
movq 0x18(%r12), %r13
cmpq %r13, %r15
je 0x2806
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2ccc
addq $0x8, %r15
jmp 0x2816
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
cmpq %rcx, %rax
je 0x287e
xorl %edx, %edx
cmpl $0x8, %edx
je 0x2878
xorl %esi, %esi
cmpl $0x8, %esi
je 0x2874
movl (%rax), %edi
addl %edx, %edi
movl 0x4(%rax), %r8d
addl %esi, %r8d
imull 0x1e0(%rsp), %r8d
addl %edi, %r8d
shll $0x2, %r8d
movq 0x1e8(%rsp), %rdi
movb $-0x1, (%rdi,%r8)
incl %esi
jmp 0x2843
incl %edx
jmp 0x283c
addq $0x8, %rax
jmp 0x2835
leaq 0x1c0(%rsp), %rdi
callq 0x2cea
movq %rsp, %rdi
callq 0x348a
leaq 0x1c0(%rsp), %rdi
callq 0x2d00
leaq 0x148(%rsp), %rdi
callq 0x2d00
leaq 0xd0(%rsp), %rdi
callq 0x2d00
leaq 0x30(%rsp), %rdi
callq 0x20c0
leaq 0x50(%rsp), %rdi
callq 0x20c0
xorl %eax, %eax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2959
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
callq 0x20c0
jmp 0x28fb
jmp 0x28f8
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
jmp 0x2952
jmp 0x2959
jmp 0x2965
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x20c0
jmp 0x291b
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x343c
jmp 0x297d
jmp 0x2929
movq %rax, %rbx
jmp 0x297d
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x20c0
jmp 0x298a
jmp 0x2942
movq %rax, %rbx
jmp 0x298a
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x20c0
jmp 0x2997
movq %rax, %rbx
jmp 0x2997
movq %rax, %rbx
jmp 0x29a1
jmp 0x2965
movq %rax, %rbx
movq %rsp, %rdi
callq 0x348a
leaq 0x1c0(%rsp), %rdi
callq 0x2d00
leaq 0x148(%rsp), %rdi
callq 0x2d00
leaq 0xd0(%rsp), %rdi
callq 0x2d00
leaq 0x30(%rsp), %rdi
callq 0x20c0
leaq 0x50(%rsp), %rdi
callq 0x20c0
movq %rbx, %rdi
callq 0x22d0