// File: /workspace/github_cpp_makefile_star2_O1/ksraj123[P]RAW12-to-bitmap-AVI/main.cpp
// Function: main
int main()
{
    std::cout << "//////// !!!! KUMAR SAURABH RAJ !!!! ///////" << std::endl;

    std::cout << "Loading Raw12 Image" << std::endl;
    ImageLoader raw12Img("test_image/test_image.raw12");
    raw12Img.LoadImage();

    ImageProcessor debayer;
    debayer.SeperateChannels(raw12Img.cfa);

    std::cout << "Printing 5 by 5 tiles\n" << std::endl;
    std::cout << "CFA" << std::endl;
    OutputWriter::Print5by5tile(raw12Img.cfa);
    std::cout << "Red Channel before debayering" << std::endl;
    OutputWriter::Print5by5tile(debayer.redChannel);
    std::cout << "Green Channel before debayering" << std::endl;
    OutputWriter::Print5by5tile(debayer.greenChannel);
    std::cout << "Blue Channel before debayering" << std::endl;
    OutputWriter::Print5by5tile(debayer.blueChannel);

    std::cout << "Debayering channels" << std::endl;
    std::cout << "Debayering Red Channel" << std::endl;
    debayer.Red();
    std::cout << "Debayering Green Channel" << std::endl;
    debayer.Green();
    std::cout << "Debayering Blue Channel" << std::endl;
    debayer.Blue();

    std::cout << "Writing output" << std::endl;
    OutputWriter debayeredImage;

    std::cout << "Writing 8 bit PPM channels" << std::endl;
    std::cout << "Writing Red channel" << std::endl;

    debayeredImage.WritePpm("red", &debayer);
    std::cout << "Writing Green channel" << std::endl;
    debayeredImage.WritePpm("blue", &debayer);
    std::cout << "Writing Blue Channel" << std::endl;
    debayeredImage.WritePpm("green", &debayer); 

    std::cout << "Writing Debayered BMP image" << std::endl;
    debayeredImage.WriteBmp(&debayer);
    std::cout << "Writing Debayered Image into AVI" << std::endl;
    debayeredImage.WriteAvi();


    std::cout << "Please check ./results folder after sometime for output images" << std::endl;
    std::cout << "!!!!Thank you for using my program!!!!" << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x2e0, %rsp            # imm = 0x2E0
movq 0x4b7f(%rip), %rbx      # 0x6fd0
leaq 0x2bac(%rip), %rsi      # 0x5004
movl $0x2c, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq 0x2b9e(%rip), %rsi      # 0x5031
movl $0x13, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq -0xa0(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x2b6c(%rip), %rsi      # 0x5045
leaq 0x2b80(%rip), %rdx      # 0x5060
leaq -0xb0(%rbp), %rbx
movq %rbx, %rdi
callq 0x2c0e
leaq -0x2e8(%rbp), %rdi
movq %rbx, %rsi
callq 0x2ca8
movq -0xb0(%rbp), %rdi
cmpq %r14, %rdi
je 0x2519
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0x2e8(%rbp), %rdi
callq 0x2dc4
leaq -0x30(%rbp), %rdi
callq 0x3e7c
movq -0xb8(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x3f38
movq 0x4a8b(%rip), %rbx      # 0x6fd0
leaq 0x2b15(%rip), %rsi      # 0x5061
movl $0x16, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x4a59(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq 0x4a45(%rip), %rbx      # 0x6fd0
leaq 0x2ae6(%rip), %rsi      # 0x5078
movl $0x3, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x4a13(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq -0xb8(%rbp), %rdi
callq 0x2f1c
movq 0x49f3(%rip), %rbx      # 0x6fd0
leaq 0x2a98(%rip), %rsi      # 0x507c
movl $0x1d, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x49c1(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq -0x30(%rbp), %rdi
callq 0x2f1c
movq 0x49a4(%rip), %rbx      # 0x6fd0
leaq 0x2a67(%rip), %rsi      # 0x509a
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x4972(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq -0x20(%rbp), %rdi
callq 0x2f1c
movq 0x4955(%rip), %rbx      # 0x6fd0
leaq 0x2a38(%rip), %rsi      # 0x50ba
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x4923(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq -0x28(%rbp), %rdi
callq 0x2f1c
movq 0x4906(%rip), %rbx      # 0x6fd0
leaq 0x2a08(%rip), %rsi      # 0x50d9
movl $0x13, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x48d4(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq 0x48c0(%rip), %rbx      # 0x6fd0
leaq 0x29d6(%rip), %rsi      # 0x50ed
movl $0x16, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x488e(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq -0x30(%rbp), %rdi
callq 0x4086
movq 0x4871(%rip), %rbx      # 0x6fd0
leaq 0x299e(%rip), %rsi      # 0x5104
movl $0x18, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x483f(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq -0x30(%rbp), %rdi
callq 0x41bc
movq 0x4822(%rip), %rbx      # 0x6fd0
leaq 0x2968(%rip), %rsi      # 0x511d
movl $0x17, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x47f0(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq -0x30(%rbp), %rdi
callq 0x4120
movq 0x47d3(%rip), %rbx      # 0x6fd0
leaq 0x2931(%rip), %rsi      # 0x5135
movl $0xe, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x47a1(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq 0x478d(%rip), %rbx      # 0x6fd0
leaq 0x28fa(%rip), %rsi      # 0x5144
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x475b(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq 0x4747(%rip), %rbx      # 0x6fd0
leaq 0x28cf(%rip), %rsi      # 0x515f
movl $0x13, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x4715(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq -0x80(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x289c(%rip), %rsi      # 0x5173
leaq 0x2898(%rip), %rdx      # 0x5176
leaq -0x90(%rbp), %rdi
callq 0x2c0e
leaq -0x18(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x2fae
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x2916
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2180
movq 0x46b3(%rip), %rbx      # 0x6fd0
leaq 0x2853(%rip), %rsi      # 0x5177
movl $0x15, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x4681(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq -0x60(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x2822(%rip), %rsi      # 0x518d
leaq 0x281f(%rip), %rdx      # 0x5191
leaq -0x70(%rbp), %rdi
callq 0x2c0e
leaq -0x18(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x2fae
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x29a1
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2180
movq 0x4628(%rip), %rbx      # 0x6fd0
leaq 0x27e3(%rip), %rsi      # 0x5192
movl $0x14, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x45f6(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq -0x40(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x27b1(%rip), %rsi      # 0x51a7
leaq 0x27af(%rip), %rdx      # 0x51ac
leaq -0x50(%rbp), %rdi
callq 0x2c0e
leaq -0x18(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x2fae
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x2a2c
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2180
movq 0x459d(%rip), %rbx      # 0x6fd0
leaq 0x2773(%rip), %rsi      # 0x51ad
movl $0x1b, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x456b(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq -0x18(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3436
movq 0x454a(%rip), %rbx      # 0x6fd0
leaq 0x273c(%rip), %rsi      # 0x51c9
movl $0x20, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x4518(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq -0x18(%rbp), %rdi
callq 0x3702
movq 0x44fb(%rip), %rbx      # 0x6fd0
leaq 0x270e(%rip), %rsi      # 0x51ea
movl $0x3e, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x44c9(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq 0x44b5(%rip), %rbx      # 0x6fd0
leaq 0x2707(%rip), %rsi      # 0x5229
movl $0x26, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x4483(%rip), %rdi      # 0x6fd0
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq -0x30(%rbp), %rdi
callq 0x3eea
leaq -0x2e8(%rbp), %rdi
callq 0x2d64
xorl %eax, %eax
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x2bf0
movq -0x40(%rbp), %rsi
jmp 0x2bb8
jmp 0x2bed
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x2bf0
movq -0x60(%rbp), %rsi
jmp 0x2bb8
jmp 0x2bed
movq %rax, %rbx
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x2bf0
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x2bf0
jmp 0x2bed
jmp 0x2bc6
movq %rax, %rbx
jmp 0x2bf9
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r14, %rdi
je 0x2c05
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x2c05
jmp 0x2bed
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x3eea
leaq -0x2e8(%rbp), %rdi
callq 0x2d64
movq %rbx, %rdi
callq 0x2240
nop