// File: /workspace/github_cpp_makefile_star2_O3/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 $0x248, %rsp            # imm = 0x248
cmpl $0x2, %edi
jg 0x27b6
movq 0x14838(%rip), %rdi     # 0x16fd8
leaq 0xe87e(%rip), %rsi      # 0x11025
movl $0x10, %edx
callq 0x2200
jmp 0x2cac
movq %rsi, %rbx
movq 0x8(%rsi), %rsi
leaq 0x80(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x20b0
movq 0x10(%rbx), %rsi
leaq 0x60(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x20b0
movq 0x88(%rsp), %rdx
cmpq $0x5, %rdx
jb 0x28de
addq $-0x4, %rdx
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
movq $-0x1, %rcx
callq 0x21d0
leaq 0xe82b(%rip), %rsi      # 0x1104c
leaq 0xa0(%rsp), %rdi
callq 0x2080
testl %eax, %eax
je 0x2899
movq 0x68(%rsp), %rdx
cmpq $0x5, %rdx
jb 0x2899
addq $-0x4, %rdx
leaq 0x158(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movq $-0x1, %rcx
callq 0x21d0
leaq 0xe7eb(%rip), %rsi      # 0x1104c
leaq 0x158(%rsp), %r14
movq %r14, %rdi
callq 0x2080
testl %eax, %eax
setne %bpl
movq (%r14), %rdi
leaq 0x168(%rsp), %rax
cmpq %rax, %rdi
je 0x289b
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x289b
xorl %ebp, %ebp
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28bc
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x21c0
testb %bpl, %bpl
je 0x28de
movq 0x14710(%rip), %rdi     # 0x16fd8
leaq 0xe767(%rip), %rsi      # 0x11036
movl $0x11, %edx
callq 0x2200
jmp 0x2c70
movq 0x8(%rbx), %rsi
leaq 0x138(%rsp), %rdi
leaq 0x158(%rsp), %rdx
callq 0x20b0
leaq 0xa0(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x2e2a
leaq 0x148(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x292d
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0xa0(%rsp), %rdi
callq 0x2fee
movq 0x10(%rbx), %rsi
leaq 0x118(%rsp), %rdi
leaq 0x1d0(%rsp), %rdx
callq 0x20b0
leaq 0x158(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x2e2a
leaq 0x128(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2989
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x158(%rsp), %rdi
callq 0x2fee
movl 0xc0(%rsp), %ebx
movl 0xc4(%rsp), %ebp
movq 0xd0(%rsp), %rax
movq 0xc8(%rsp), %rsi
movq %rax, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
subq %rsi, %r14
je 0x29f6
js 0x2cc0
movq %r14, %rdi
callq 0x21b0
movq %rax, %r15
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rax
movq %rax, %r12
subq %rsi, %r12
jmp 0x29fc
xorl %r15d, %r15d
movq %r14, %r12
movq %r15, 0x20(%rsp)
movq %r15, 0x28(%rsp)
addq %r15, %r14
movq %r14, 0x30(%rsp)
cmpq %rsi, %rax
je 0x2a1e
movq %r15, %rdi
movq %r12, %rdx
callq 0x22d0
addq %r12, %r15
movq %r15, 0x28(%rsp)
leaq 0x50(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xe612(%rip), %rsi      # 0x11048
leaq 0xe613(%rip), %rdx      # 0x11050
leaq 0x40(%rsp), %rdi
callq 0x3910
leaq 0x1d0(%rsp), %rdi
leaq 0x20(%rsp), %rcx
leaq 0x40(%rsp), %r8
movl %ebx, %esi
movl %ebp, %edx
callq 0x31a2
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x2a79
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2a90
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0xf0(%rsp), %r12
testq %r12, %r12
je 0x2b61
leaq 0x198(%rsp), %rbx
movq %rsp, %r14
leaq 0x8(%r12), %rsi
movq %rbx, %rdi
callq 0x39a6
testq %rax, %rax
je 0x2ad9
movq (%r12), %r12
testq %r12, %r12
jne 0x2abc
jmp 0x2b13
movq 0x10(%r12), %r15
movq 0x18(%r12), %r13
cmpq %r13, %r15
je 0x2ace
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x2b02
movq (%r15), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rsp)
jmp 0x2b0d
movq %r14, %rdi
movq %r15, %rdx
callq 0x3a02
addq $0x8, %r15
jmp 0x2ae3
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
cmpq %rcx, %rax
je 0x2b61
xorl %edx, %edx
xorl %esi, %esi
movl (%rax), %edi
addl %edx, %edi
movl 0x4(%rax), %r8d
addl %esi, %r8d
imull 0x1f0(%rsp), %r8d
addl %edi, %r8d
shll $0x2, %r8d
movq 0x1f8(%rsp), %rdi
movb $-0x1, (%rdi,%r8)
incl %esi
cmpl $0x8, %esi
jne 0x2b25
incl %edx
cmpl $0x8, %edx
jne 0x2b23
addq $0x8, %rax
jmp 0x2b1c
leaq 0x1f8(%rsp), %rsi
movq -0x28(%rsi), %rdi
movl -0x8(%rsi), %edx
movl -0x4(%rsi), %ecx
callq 0x2649
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2b8e
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
leaq 0x210(%rsp), %rbx
movq %rbx, %rdi
callq 0x32a6
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x2bb7
movq 0x208(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
leaq 0x1e0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2bd8
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x198(%rsp), %rbx
movq %rbx, %rdi
callq 0x32a6
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x2c01
movq 0x190(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
leaq 0xe0(%rsp), %rbx
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c2a
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x32a6
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0x2c4f
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c70
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c8b
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2cac
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x21c0
xorl %eax, %eax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x20a0
movq %rax, %rbx
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2de5
movq 0xb0(%rsp), %rsi
jmp 0x2d8a
jmp 0x2d94
jmp 0x2d94
jmp 0x2da0
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x2d18
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x2d18
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2dcb
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
jmp 0x2dcb
jmp 0x2dc8
movq %rax, %rbx
leaq 0x128(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2dd8
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x2dd8
jmp 0x2d69
movq %rax, %rbx
jmp 0x2dd8
movq %rax, %rbx
leaq 0x148(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2de5
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x2de5
movq %rax, %rbx
jmp 0x2de5
movq %rax, %rbx
jmp 0x2e00
jmp 0x2da0
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2db9
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
leaq 0x1d0(%rsp), %rdi
callq 0x325e
jmp 0x2dcb
movq %rax, %rbx
leaq 0x158(%rsp), %rdi
callq 0x325e
leaq 0xa0(%rsp), %rdi
callq 0x325e
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e00
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e21
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2320
nop