// File: /workspace/github_cpp_makefile_star2_O3/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 0x3b36
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbp
movq 0x67df(%rip), %r14      # 0x9fd8
leaq 0x3ec4(%rip), %rsi      # 0x76c4
movl $0x11, %edx
movq %r14, %rdi
callq 0x2130
leaq 0x3ec2(%rip), %rsi      # 0x76d6
movl $0xe, %edx
movq %r14, %rdi
callq 0x2130
movq (%r14), %rax
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r14,%rax)
movzbl 0x2065(%rbp), %esi
movq %r14, %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, %edx
movq %rax, %rdi
callq 0x2130
leaq 0x3e6c(%rip), %rsi      # 0x76e5
movl $0x8, %edx
movq %r14, %rdi
callq 0x2130
movl 0x2068(%rbp), %esi
movq %r14, %rdi
callq 0x20a0
leaq 0xe(%rsp), %rsi
movb %bl, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2130
leaq 0x3e3f(%rip), %rsi      # 0x76ee
movl $0x7, %edx
movq %r14, %rdi
callq 0x2130
movl 0x206c(%rbp), %esi
movq %r14, %rdi
callq 0x20a0
leaq 0xf(%rsp), %rsi
movb %bl, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2130
leaq 0x3e11(%rip), %rsi      # 0x76f6
movl $0x12, %edx
movq %r14, %rdi
callq 0x2130
movb 0x2070(%rbp), %al
testb %al, %al
je 0x3a1f
leaq 0x2050(%rbp), %r12
xorl %r14d, %r14d
movq 0x66c7(%rip), %r15      # 0x9fd8
leaq (,%r14,8), %r13
subq %r14, %r13
cmpb $0x0, 0x5(%r12,%r13)
je 0x3a10
addq %r12, %r13
movl $0xe, %edx
movq %r15, %rdi
leaq 0x3dcf(%rip), %rsi      # 0x7709
callq 0x2130
incq %r14
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 0x3da6(%rip), %rsi      # 0x7718
callq 0x2130
movzbl (%r13), %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 0x3d8c(%rip), %rsi      # 0x7735
callq 0x2130
movzbl 0x1(%r13), %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 0x3d70(%rip), %rsi      # 0x7750
callq 0x2130
movzbl 0x2(%r13), %esi
movq %r15, %rdi
callq 0x20a0
movb %bl, 0x8(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8(%rsp), %rsi
callq 0x2130
movb 0x2070(%rbp), %al
jmp 0x3a13
incq %r14
movzbl %al, %ecx
cmpq %rcx, %r14
jb 0x3911
movq 0x65b2(%rip), %r14      # 0x9fd8
leaq 0x3d3b(%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 0x3b14
movl $0xa, %edx
movq %r14, %rdi
leaq 0x3da9(%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 0x3ccd(%rip), %rsi      # 0x777a
callq 0x2130
xorl %ebp, %ebp
testb $0x7, %bpl
jne 0x3acf
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 0x3ab4
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 0x3a4f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq