// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x2e8, %rsp            # imm = 0x2E8
movq 0x3ba1(%rip), %rbx      # 0x5fd0
leaq 0x1bce(%rip), %rsi      # 0x4004
movq %rbx, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq 0x1be4(%rip), %rsi      # 0x4031
movq %rbx, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq 0x1be1(%rip), %rsi      # 0x4045
leaq -0xb0(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x2812
leaq -0x2e8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x28ec
leaq -0xb0(%rbp), %rdi
callq 0x2090
leaq -0x2e8(%rbp), %rdi
callq 0x29c6
leaq -0x30(%rbp), %rdi
callq 0x364c
movq -0xb8(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x36f0
movq 0x3b11(%rip), %rdi      # 0x5fd0
leaq 0x1b9b(%rip), %rsi      # 0x4061
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x3af6(%rip), %rdi      # 0x5fd0
leaq 0x1b97(%rip), %rsi      # 0x4078
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq -0xb8(%rbp), %rdi
callq 0x2a7c
movq 0x3acf(%rip), %rdi      # 0x5fd0
leaq 0x1b74(%rip), %rsi      # 0x407c
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq -0x30(%rbp), %rdi
callq 0x2a7c
movq 0x3aab(%rip), %rdi      # 0x5fd0
leaq 0x1b6e(%rip), %rsi      # 0x409a
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq -0x20(%rbp), %rdi
callq 0x2a7c
movq 0x3a87(%rip), %rdi      # 0x5fd0
leaq 0x1b6a(%rip), %rsi      # 0x40ba
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq -0x28(%rbp), %rdi
callq 0x2a7c
movq 0x3a63(%rip), %rdi      # 0x5fd0
leaq 0x1b65(%rip), %rsi      # 0x40d9
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x3a48(%rip), %rdi      # 0x5fd0
leaq 0x1b5e(%rip), %rsi      # 0x40ed
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq -0x30(%rbp), %rdi
callq 0x37d0
movq 0x3a24(%rip), %rdi      # 0x5fd0
leaq 0x1b51(%rip), %rsi      # 0x4104
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq -0x30(%rbp), %rdi
callq 0x3922
movq 0x3a00(%rip), %rdi      # 0x5fd0
leaq 0x1b46(%rip), %rsi      # 0x411d
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq -0x30(%rbp), %rdi
callq 0x3874
movq 0x39dc(%rip), %rdi      # 0x5fd0
leaq 0x1b3a(%rip), %rsi      # 0x4135
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x39c1(%rip), %rdi      # 0x5fd0
leaq 0x1b2e(%rip), %rsi      # 0x4144
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x39a6(%rip), %rdi      # 0x5fd0
leaq 0x1b2e(%rip), %rsi      # 0x415f
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq 0x1b2e(%rip), %rsi      # 0x4173
leaq -0x90(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x2812
leaq -0x18(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x2aee
leaq -0x90(%rbp), %rdi
callq 0x2090
movq 0x3954(%rip), %rdi      # 0x5fd0
leaq 0x1af4(%rip), %rsi      # 0x4177
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq 0x1af6(%rip), %rsi      # 0x418d
leaq -0x70(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x2812
leaq -0x18(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x2aee
leaq -0x70(%rbp), %rdi
callq 0x2090
movq 0x390b(%rip), %rdi      # 0x5fd0
leaq 0x1ac6(%rip), %rsi      # 0x4192
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq 0x1ac7(%rip), %rsi      # 0x41a7
leaq -0x50(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x2812
leaq -0x18(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x2aee
leaq -0x50(%rbp), %rdi
callq 0x2090
movq 0x38c2(%rip), %rdi      # 0x5fd0
leaq 0x1a98(%rip), %rsi      # 0x41ad
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq -0x18(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2e34
movq 0x389a(%rip), %rdi      # 0x5fd0
leaq 0x1a8c(%rip), %rsi      # 0x41c9
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq -0x18(%rbp), %rdi
callq 0x30ac
movq 0x3876(%rip), %rdi      # 0x5fd0
leaq 0x1a89(%rip), %rsi      # 0x41ea
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x385b(%rip), %rdi      # 0x5fd0
leaq 0x1aad(%rip), %rsi      # 0x4229
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq -0x30(%rbp), %rdi
callq 0x36ba
leaq -0x2e8(%rbp), %rdi
callq 0x2984
xorl %eax, %eax
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %rbp
retq
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
jmp 0x27ca
jmp 0x27f2
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
jmp 0x27ca
jmp 0x27f2
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x2090
jmp 0x27f5
jmp 0x27f2
jmp 0x27d5
movq %rax, %rbx
jmp 0x27fe
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x2090
jmp 0x280a
movq %rax, %rbx
jmp 0x280a
jmp 0x27f2
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x36ba
leaq -0x2e8(%rbp), %rdi
callq 0x2984
movq %rbx, %rdi
callq 0x2210