// File: /workspace/github_cpp_makefile_star2_O2/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 0x30f7
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r13
movq 0x614b(%rip), %r14      # 0x8fd8
leaq 0x3790(%rip), %rsi      # 0x6624
movq %r14, %rdi
callq 0x20e0
leaq 0x3793(%rip), %rsi      # 0x6636
movq %r14, %rdi
callq 0x20e0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movzbl 0x2065(%r13), %esi
movq %rax, %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)
pushq $0xa
popq %rbp
movq %rax, %rdi
movl %ebp, %esi
callq 0x2120
leaq 0x374c(%rip), %rsi      # 0x6645
movq %r14, %rdi
callq 0x20e0
movl 0x2068(%r13), %esi
movq %rax, %rdi
callq 0x20a0
movq %rax, %rdi
movl %ebp, %esi
callq 0x2120
leaq 0x372d(%rip), %rsi      # 0x664e
movq %r14, %rdi
callq 0x20e0
movl 0x206c(%r13), %esi
movq %rax, %rdi
callq 0x20a0
movq %rax, %rdi
movl %ebp, %esi
callq 0x2120
leaq 0x370d(%rip), %rsi      # 0x6656
movq %r14, %rdi
callq 0x20e0
leaq 0x2050(%r13), %r12
xorl %r15d, %r15d
movzbl 0x2070(%r13), %eax
cmpq %rax, %r15
jae 0x3021
imulq $0x7, %r15, %rbx
cmpb $0x0, 0x5(%r12,%rbx)
je 0x3019
addq %r12, %rbx
movq %r14, %rdi
leaq 0x36e0(%rip), %rsi      # 0x6669
callq 0x20e0
incq %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x20a0
movq %rax, %rdi
movl %ebp, %esi
callq 0x2120
movq %r14, %rdi
leaq 0x36c8(%rip), %rsi      # 0x6678
callq 0x20e0
movzbl (%rbx), %esi
movq %rax, %rdi
callq 0x20a0
movq %rax, %rdi
movl %ebp, %esi
callq 0x2120
movq %r14, %rdi
leaq 0x36c1(%rip), %rsi      # 0x6695
callq 0x20e0
movzbl 0x1(%rbx), %esi
movq %rax, %rdi
callq 0x20a0
movq %rax, %rdi
movl %ebp, %esi
callq 0x2120
movq %r14, %rdi
leaq 0x36b7(%rip), %rsi      # 0x66b0
callq 0x20e0
movzbl 0x2(%rbx), %esi
movq %rax, %rdi
callq 0x20a0
movq %rax, %rdi
movl %ebp, %esi
callq 0x2120
jmp 0x2f5b
incq %r15
jmp 0x2f5b
movq 0x5fb0(%rip), %r14      # 0x8fd8
leaq 0x3699(%rip), %rsi      # 0x66c8
movq %r14, %rdi
callq 0x20e0
xorl %r15d, %r15d
pushq $0xa
popq %rbp
pushq $0x20
popq %r12
movq %r13, %rbx
movq %r13, (%rsp)
cmpq $0x4, %r15
je 0x30e9
imulq $0x104, %r15, %rax      # imm = 0x104
cmpb $0x1, 0x100(%r13,%rax)
jne 0x30da
movq %r14, %rdi
leaq 0x3712(%rip), %rsi      # 0x6780
callq 0x20e0
movq %rax, %rdi
movq %r15, %rsi
callq 0x20a0
movq %rax, %rdi
movl %ebp, %esi
callq 0x2120
movq %r14, %rdi
leaq 0x3648(%rip), %rsi      # 0x66da
callq 0x20e0
xorl %r13d, %r13d
cmpq $0x40, %r13
je 0x30cc
testb $0x7, %r13b
jne 0x30b0
movq %r14, %rdi
movl %ebp, %esi
callq 0x2120
movl (%rbx,%r13,4), %esi
movq %r14, %rdi
callq 0x20a0
movq %rax, %rdi
movl %r12d, %esi
callq 0x2120
incq %r13
jmp 0x309a
movq %r14, %rdi
movl %ebp, %esi
callq 0x2120
movq (%rsp), %r13
incq %r15
addq $0x104, %rbx            # imm = 0x104
jmp 0x3048
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq