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

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

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

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

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

    auto x32 = x16->Upsample();
    x32->WriteBmp("images/small_up_32.bmp");
    delete x16;
    delete x32;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xf0, %rsp
leaq 0x1907b(%rip), %rsi     # 0x1e0b5
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 0x5249
movl (%r14), %esi
movl 0x4(%r14), %edx
leaq 0x18f6c(%rip), %rdi     # 0x1e015
xorl %eax, %eax
callq 0x4050
movq %r14, %rdi
callq 0x6a36
movq %rax, %rbx
leaq 0x19004(%rip), %rsi     # 0x1e0c6
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 0x6a36
movq %rax, %r14
leaq 0x18fc7(%rip), %rsi     # 0x1e0dd
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 0x6a36
movq %rax, %rbx
leaq 0x18f93(%rip), %rsi     # 0x1e0f4
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 0x6a36
movq %rax, %r14
leaq 0x18f5f(%rip), %rsi     # 0x1e10b
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 0x6a36
movq %rax, %rbx
leaq 0x18f2c(%rip), %rsi     # 0x1e123
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 0x5255
leaq 0x18f34(%rip), %rdi     # 0x1e184
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 0x52c3
jmp 0x52da
jmp 0x52da
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x52c3
jmp 0x52da
jmp 0x52da
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
jmp 0x52c3
jmp 0x52da
jmp 0x52da
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
jmp 0x52c3
jmp 0x52da
jmp 0x52da
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
jmp 0x52c3
jmp 0x52da
jmp 0x52da
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x9f30
jmp 0x52dd
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x83e0
jmp 0x52dd
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x9f30
movq %rbx, %rdi
callq 0x4310