// File: /workspace/github_cpp_makefile_star2_O1/dannye[P]jed/src/decoder.cpp
// Function: printFrameInfo(JPGImage const*)
void printFrameInfo(const JPGImage* const image) {
    if (image == nullptr) return;
    std::cout << "SOF=============\n";
    std::cout << "Frame Type: 0x" << std::hex << (uint)image->frameType << std::dec << '\n';
    std::cout << "Height: " << image->height << '\n';
    std::cout << "Width: " << image->width << '\n';
    std::cout << "Color Components:\n";
    for (uint i = 0; i < image->numComponents; ++i) {
        if (image->colorComponents[i].usedInFrame) {
            std::cout << "Component ID: " << (i + 1) << '\n';
            std::cout << "Horizontal Sampling Factor: " << (uint)image->colorComponents[i].horizontalSamplingFactor << '\n';
            std::cout << "Vertical Sampling Factor: " << (uint)image->colorComponents[i].verticalSamplingFactor << '\n';
            std::cout << "Quantization Table ID: " << (uint)image->colorComponents[i].quantizationTableID << '\n';
        }
    }
    std::cout << "DQT=============\n";
    for (uint i = 0; i < 4; ++i) {
        if (image->quantizationTables[i].set) {
            std::cout << "Table ID: " << i << '\n';
            std::cout << "Table Data:";
            for (uint j = 0; j < 64; ++j) {
                if (j % 8 == 0) {
                    std::cout << '\n';
                }
                std::cout << image->quantizationTables[i].table[j] << ' ';
            }
            std::cout << '\n';
        }
    }
}

// Assembly:
testq %rdi, %rdi
je 0x3bab
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbp
movq 0x6764(%rip), %r15      # 0x9fd8
leaq 0x3e49(%rip), %rsi      # 0x76c4
movl $0x11, %edx
movq %r15, %rdi
callq 0x2130
leaq 0x3e47(%rip), %rsi      # 0x76d6
movl $0xe, %edx
movq %r15, %rdi
callq 0x2130
movq (%r15), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r15,%rax)
movzbl 0x2065(%rbp), %esi
movq %r15, %rdi
callq 0x20a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
movb $0xa, %bl
leaq 0xd(%rsp), %rsi
movb %bl, (%rsi)
movl $0x1, %r14d
movl $0x1, %edx
movq %rax, %rdi
callq 0x2130
leaq 0x3deb(%rip), %rsi      # 0x76e5
movl $0x8, %edx
movq %r15, %rdi
callq 0x2130
movl 0x2068(%rbp), %esi
movq %r15, %rdi
callq 0x20a0
leaq 0xe(%rsp), %rsi
movb %bl, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2130
leaq 0x3dbe(%rip), %rsi      # 0x76ee
movl $0x7, %edx
movq %r15, %rdi
callq 0x2130
movl 0x206c(%rbp), %esi
movq %r15, %rdi
callq 0x20a0
leaq 0xf(%rsp), %rsi
movb %bl, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2130
leaq 0x3d90(%rip), %rsi      # 0x76f6
movl $0x12, %edx
movq %r15, %rdi
callq 0x2130
cmpb $0x0, 0x2070(%rbp)
je 0x3a94
leaq 0x2050(%rbp), %r12
movq 0x664a(%rip), %r15      # 0x9fd8
leaq 0x8(%rsp), %r13
cmpb $0x1, 0x5(%r12)
jne 0x3a79
movl $0xe, %edx
movq %r15, %rdi
leaq 0x3d5b(%rip), %rsi      # 0x7709
callq 0x2130
movq %r15, %rdi
movq %r14, %rsi
callq 0x20a0
movb %bl, 0x5(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x5(%rsp), %rsi
callq 0x2130
movl $0x1c, %edx
movq %r15, %rdi
leaq 0x3d35(%rip), %rsi      # 0x7718
callq 0x2130
movzbl (%r12), %esi
movq %r15, %rdi
callq 0x20a0
movb %bl, 0x6(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x6(%rsp), %rsi
callq 0x2130
movl $0x1a, %edx
movq %r15, %rdi
leaq 0x3d1b(%rip), %rsi      # 0x7735
callq 0x2130
movzbl 0x1(%r12), %esi
movq %r15, %rdi
callq 0x20a0
movb %bl, 0x7(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x7(%rsp), %rsi
callq 0x2130
movl $0x17, %edx
movq %r15, %rdi
leaq 0x3cfe(%rip), %rsi      # 0x7750
callq 0x2130
movzbl 0x2(%r12), %esi
movq %r15, %rdi
callq 0x20a0
movb %bl, 0x8(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x2130
movzbl 0x2070(%rbp), %eax
leaq 0x1(%r14), %rcx
addq $0x7, %r12
cmpq %rax, %r14
movq %rcx, %r14
jb 0x3993
movq 0x653d(%rip), %r14      # 0x9fd8
leaq 0x3cc6(%rip), %rsi      # 0x7768
movl $0x11, %edx
movq %r14, %rdi
callq 0x2130
xorl %r15d, %r15d
leaq 0xb(%rsp), %r12
leaq 0xc(%rsp), %r13
movq %rbp, %rbx
movq %rbp, 0x10(%rsp)
movq %r15, %rax
shlq $0x8, %rax
leaq (%rax,%r15,4), %rax
cmpb $0x1, 0x100(%rbp,%rax)
jne 0x3b89
movl $0xa, %edx
movq %r14, %rdi
leaq 0x3d34(%rip), %rsi      # 0x7820
callq 0x2130
movq %r14, %rdi
movq %r15, %rsi
callq 0x20a0
movb $0xa, 0x9(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x9(%rsp), %rsi
callq 0x2130
movl $0xb, %edx
movq %r14, %rdi
leaq 0x3c58(%rip), %rsi      # 0x777a
callq 0x2130
xorl %ebp, %ebp
testb $0x7, %bpl
jne 0x3b44
movb $0xa, 0xb(%rsp)
movl $0x1, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x2130
movl (%rbx,%rbp,4), %esi
movq %r14, %rdi
callq 0x20a0
movb $0x20, 0xc(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x2130
incq %rbp
cmpq $0x40, %rbp
jne 0x3b29
movb $0xa, 0xa(%rsp)
movl $0x1, %edx
movq %r14, %rdi
leaq 0xa(%rsp), %rsi
callq 0x2130
movq 0x10(%rsp), %rbp
incq %r15
addq $0x104, %rbx            # imm = 0x104
cmpq $0x4, %r15
jne 0x3ac4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq