// File: CodyNault[P]Image-Filter-Dataflow/src/main.cpp
// Function: main
int main(int argc, char *argv[])
{
    PNMreader reader(argv[1]);

    Crop crop;
    crop.SetRegion(300, 1400, 50, 400);
    crop.SetInput(reader.GetOutput());

    Transpose t;
    t.SetInput(crop.GetOutput());

    Invert i;
    i.SetInput(t.GetOutput());

    Color color(50, 1101, 0, 0, 128);
    
    LRConcat lr;
    lr.SetInput(color.GetOutput());
    lr.SetInput2(i.GetOutput());

    Color white(401, 1101, 255, 255, 255);

    Checkerboard cb;
    cb.SetInput(lr.GetOutput());
    cb.SetInput2(white.GetOutput());

    cb.GetOutput()->Update();

    PNMwriter writer;
    writer.SetInput(cb.GetOutput());
    writer.Write(argv[2]);

    CheckSum cs;
    cs.SetInput(cb.GetOutput());
    cs.OutputCheckSum();
    Logger::Finalize();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x40(%rbp), %rdi
callq 0x5910
leaq -0x90(%rbp), %rdi
callq 0x3850
jmp 0x33f1
leaq -0x90(%rbp), %rdi
movl $0x12c, %esi            # imm = 0x12C
movl $0x578, %edx            # imm = 0x578
movl $0x32, %ecx
movl $0x190, %r8d            # imm = 0x190
callq 0x38b0
jmp 0x3414
leaq -0x68(%rbp), %rax
movq %rax, -0x260(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4320
movq %rax, -0x258(%rbp)
jmp 0x3431
movq -0x258(%rbp), %rsi
movq -0x260(%rbp), %rdi
callq 0x3f60
jmp 0x3446
leaq -0xe0(%rbp), %rdi
callq 0x38f0
jmp 0x3454
leaq -0xb8(%rbp), %rax
movq %rax, -0x270(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x4320
movq %rax, -0x268(%rbp)
jmp 0x3477
movq -0x268(%rbp), %rsi
movq -0x270(%rbp), %rdi
callq 0x3f60
jmp 0x348c
leaq -0x120(%rbp), %rdi
callq 0x3930
jmp 0x349a
leaq -0xf8(%rbp), %rax
movq %rax, -0x280(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x4320
movq %rax, -0x278(%rbp)
jmp 0x34bd
movq -0x278(%rbp), %rsi
movq -0x280(%rbp), %rdi
callq 0x3f60
jmp 0x34d2
leaq -0x160(%rbp), %rdi
movl $0x32, %esi
movl $0x44d, %edx            # imm = 0x44D
xorl %r8d, %r8d
movl $0x80, %r9d
movl %r8d, %ecx
callq 0x7b30
jmp 0x34f6
leaq -0x1a0(%rbp), %rdi
callq 0x3970
jmp 0x3504
leaq -0x178(%rbp), %rax
movq %rax, -0x290(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x4320
movq %rax, -0x288(%rbp)
jmp 0x3527
movq -0x288(%rbp), %rsi
movq -0x290(%rbp), %rdi
callq 0x3f60
jmp 0x353c
leaq -0x178(%rbp), %rax
movq %rax, -0x2a0(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x4320
movq %rax, -0x298(%rbp)
jmp 0x355f
movq -0x298(%rbp), %rsi
movq -0x2a0(%rbp), %rdi
callq 0x3f80
jmp 0x3574
leaq -0x1e0(%rbp), %rdi
movl $0x191, %esi            # imm = 0x191
movl $0x44d, %edx            # imm = 0x44D
movl $0xff, %r9d
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x7b30
jmp 0x3598
leaq -0x220(%rbp), %rdi
callq 0x39b0
jmp 0x35a6
leaq -0x1f8(%rbp), %rax
movq %rax, -0x2b0(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x4320
movq %rax, -0x2a8(%rbp)
jmp 0x35c9
movq -0x2a8(%rbp), %rsi
movq -0x2b0(%rbp), %rdi
callq 0x3f60
jmp 0x35de
leaq -0x1f8(%rbp), %rax
movq %rax, -0x2c0(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x4320
movq %rax, -0x2b8(%rbp)
jmp 0x3601
movq -0x2b8(%rbp), %rsi
movq -0x2c0(%rbp), %rdi
callq 0x3f80
jmp 0x3616
leaq -0x220(%rbp), %rdi
callq 0x4320
movq %rax, -0x2c8(%rbp)
jmp 0x362b
movq -0x2c8(%rbp), %rdi
callq 0x3f00
jmp 0x3639
leaq -0x238(%rbp), %rdi
callq 0x39f0
jmp 0x3647
leaq -0x220(%rbp), %rdi
callq 0x4320
movq %rax, -0x2d0(%rbp)
jmp 0x365c
movq -0x2d0(%rbp), %rsi
leaq -0x238(%rbp), %rdi
callq 0x3f60
jmp 0x3671
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x238(%rbp), %rdi
callq 0x5d90
jmp 0x3687
leaq -0x250(%rbp), %rdi
callq 0x3a30
jmp 0x3695
leaq -0x220(%rbp), %rdi
callq 0x4320
movq %rax, -0x2d8(%rbp)
jmp 0x36aa
movq -0x2d8(%rbp), %rsi
leaq -0x250(%rbp), %rdi
callq 0x3f60
jmp 0x36bf
leaq -0x250(%rbp), %rdi
callq 0x7e30
jmp 0x36cd
callq 0x8590
jmp 0x36d4
leaq -0x220(%rbp), %rdi
callq 0x3a70
leaq -0x1e0(%rbp), %rdi
callq 0x3a90
leaq -0x1a0(%rbp), %rdi
callq 0x3ab0
leaq -0x160(%rbp), %rdi
callq 0x3a90
leaq -0x120(%rbp), %rdi
callq 0x3ad0
leaq -0xe0(%rbp), %rdi
callq 0x3af0
leaq -0x90(%rbp), %rdi
callq 0x3b10
leaq -0x40(%rbp), %rdi
callq 0x59a0
xorl %eax, %eax
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3837
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x382b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x381f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3813
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3807
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x37fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x37ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x3a70
leaq -0x1e0(%rbp), %rdi
callq 0x3a90
leaq -0x1a0(%rbp), %rdi
callq 0x3ab0
leaq -0x160(%rbp), %rdi
callq 0x3a90
leaq -0x120(%rbp), %rdi
callq 0x3ad0
leaq -0xe0(%rbp), %rdi
callq 0x3af0
leaq -0x90(%rbp), %rdi
callq 0x3b10
leaq -0x40(%rbp), %rdi
callq 0x59a0
movq -0x98(%rbp), %rdi
callq 0x31d0
nopl (%rax)