// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/demo.cpp
// Function: doDownsample()
void doDownsample() {
    std::string filename = "images/large.bmp";
    auto image = new CLinear16();
    if (!image->ReadBmp(filename)) {
        printf("could not read downsample image\n");
        return;
    }
    printf("loaded image, width %d height %d\n", image->mWidth, image->mHeight);

    auto x2 = image->Downsample();
    x2->WriteBmp("images/large_down_x2.bmp");
    delete image;

    auto x4 = x2->Downsample();
    x4->WriteBmp("images/large_down_x4.bmp");
    delete x2;

    auto x8 = x4->Downsample();
    x8->WriteBmp("images/large_down_x8.bmp");
    delete x4;

    auto x16 = x8->Downsample();
    x16->WriteBmp("images/large_down_x16.bmp");
    delete x8;

    auto x32 = x16->Downsample();
    x32->WriteBmp("images/large_down_32.bmp");
    delete x16;
    delete x32;

}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xf0, %rsp
leaq 0x19295(%rip), %rsi     # 0x1e004
leaq 0xd0(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5302
pushq $0x20
popq %rdi
callq 0x90f0
movq %rax, %r14
movq %rax, %rdi
callq 0x6488
leaq 0xb0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0xc6c0
leaq 0xb0(%rsp), %rsi
movq %r14, %rdi
callq 0x6506
movl %eax, %ebx
leaq 0xb0(%rsp), %rdi
callq 0x9f30
testb %bl, %bl
je 0x4f7e
movl (%r14), %esi
movl 0x4(%r14), %edx
leaq 0x19237(%rip), %rdi     # 0x1e015
xorl %eax, %eax
callq 0x4050
movq %r14, %rdi
callq 0x6f60
movq %rax, %rbx
leaq 0x19240(%rip), %rsi     # 0x1e037
leaq 0x90(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5302
leaq 0x90(%rsp), %rsi
movq %rbx, %rdi
callq 0x68bc
leaq 0x90(%rsp), %rdi
callq 0x9f30
movq %r14, %rdi
callq 0x64ec
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x83e0
movq %rbx, %rdi
callq 0x6f60
movq %rax, %r14
leaq 0x19205(%rip), %rsi     # 0x1e050
leaq 0x70(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5302
leaq 0x70(%rsp), %rsi
movq %r14, %rdi
callq 0x68bc
leaq 0x70(%rsp), %rdi
callq 0x9f30
movq %rbx, %rdi
callq 0x64ec
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0x83e0
movq %r14, %rdi
callq 0x6f60
movq %rax, %rbx
leaq 0x191d3(%rip), %rsi     # 0x1e069
leaq 0x50(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5302
leaq 0x50(%rsp), %rsi
movq %rbx, %rdi
callq 0x68bc
leaq 0x50(%rsp), %rdi
callq 0x9f30
movq %r14, %rdi
callq 0x64ec
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x83e0
movq %rbx, %rdi
callq 0x6f60
movq %rax, %r14
leaq 0x191a1(%rip), %rsi     # 0x1e082
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5302
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x68bc
leaq 0x30(%rsp), %rdi
callq 0x9f30
movq %rbx, %rdi
callq 0x64ec
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0x83e0
movq %r14, %rdi
callq 0x6f60
movq %rax, %rbx
leaq 0x19170(%rip), %rsi     # 0x1e09c
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5302
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x68bc
leaq 0x10(%rsp), %rdi
callq 0x9f30
movq %r14, %rdi
callq 0x64ec
pushq $0x20
popq %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x83e0
movq %rbx, %rdi
callq 0x64ec
movq %rbx, %rdi
movq %r15, %rsi
callq 0x83e0
jmp 0x4f8a
leaq 0x191df(%rip), %rdi     # 0x1e164
callq 0x40e0
leaq 0xd0(%rsp), %rdi
callq 0x9f30
addq $0xf0, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0x4ff8
jmp 0x500f
jmp 0x500f
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x4ff8
jmp 0x500f
jmp 0x500f
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
jmp 0x4ff8
jmp 0x500f
jmp 0x500f
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
jmp 0x4ff8
jmp 0x500f
jmp 0x500f
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
jmp 0x4ff8
jmp 0x500f
jmp 0x500f
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x9f30
jmp 0x5012
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x83e0
jmp 0x5012
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x9f30
movq %rbx, %rdi
callq 0x4310