// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: handler_dqt
static void handler_dqt(deark *c, lctx *d,
	const struct marker_info *mi, i64 pos1, i64 data_size)
{
	i64 pos = pos1;
	u8 b;
	u8 precision_code;
	u8 table_id;
	i64 qsize;
	const char *s;

	while(1) {
		if(pos >= pos1+data_size) goto done;

		b = de_getbyte(pos);
		precision_code = b>>4;
		table_id = b&0x0f;
		if(precision_code==0) {
			s="8-bit";
			qsize = 64;
		}
		else if(precision_code==1) {
			s="16-bit";
			qsize = 128;
		}
		else {
			s="?";
			qsize = 0;
		}
		de_dbg(c, "table: Q%d, at %d", table_id, (int)pos);

		de_dbg_indent(c, 1);
		de_dbg(c, "precision: %d (%s)", (int)precision_code, s);
		dump_qtable_data(c, d, pos+1, precision_code);
		de_dbg_indent(c, -1);

		if(qsize==0) goto done;

		pos += 1 + qsize;
	}

done:
	;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %r8, 0x10(%rsp)
testq %r8, %r8
jle 0x83acd
movq %rcx, %r12
movq %rdi, %r15
addq %rcx, 0x10(%rsp)
movq 0x18(%r15), %rdi
movq %r12, %rsi
callq 0xeead3
movl %eax, %ebx
movl %eax, %r14d
shrb $0x4, %r14b
andb $0xf, %al
movzbl %r14b, %r13d
xorl %edx, %edx
cmpb $0x1, %r13b
sete %dl
movq %r12, %rbp
leaq 0xa8819(%rip), %r12     # 0x12c151
leaq 0xabd72(%rip), %rcx     # 0x12f6b1
cmoveq %rcx, %r12
movl %edx, 0xc(%rsp)
shll $0x7, %edx
incq %rdx
cmpb $0x10, %bl
movl $0x41, %ecx
cmovbq %rcx, %rdx
movq %rdx, 0x18(%rsp)
setb 0xb(%rsp)
leaq 0x90383(%rip), %rcx     # 0x113ced
cmovbq %rcx, %r12
movzbl %al, %edx
movq %r15, %rdi
leaq 0xa7454(%rip), %rsi     # 0x12adcf
movl %ebp, %ecx
xorl %eax, %eax
callq 0xe8617
movq %r15, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r15, %rdi
leaq 0xa7446(%rip), %rsi     # 0x12ade1
movl %r13d, %edx
movq %r12, %rcx
movq %rbp, %r12
leaq 0xa7005(%rip), %rbp     # 0x12a9b0
xorl %eax, %eax
callq 0xe8617
cmpb $0x1f, %bl
ja 0x83aa3
cmpl $0x2, (%r15)
jl 0x83aa3
leaq 0x1(%r12), %rdx
cmpb $0x1, %r14b
jne 0x839fe
movq %rdx, 0x20(%rsp)
xorl %ebx, %ebx
leaq 0x20(%rsp), %r14
movq 0x18(%r15), %rdi
movq %r14, %rsi
callq 0xeeb91
movl %eax, 0x60(%rsp,%rbx,4)
incq %rbx
cmpq $0x40, %rbx
jne 0x839dc
leaq 0xa73f8(%rip), %r13     # 0x12adf4
jmp 0x83a3c
movq 0x18(%r15), %rdi
movl $0x40, %ecx
leaq 0x20(%rsp), %rsi
callq 0xee8d4
xorl %eax, %eax
pxor %xmm1, %xmm1
movd 0x20(%rsp,%rax), %xmm0
punpcklbw %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
punpcklwd %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
movdqa %xmm0, 0x60(%rsp,%rax,4)
addq $0x4, %rax
cmpq $0x40, %rax
jne 0x83a17
leaq 0xa72a8(%rip), %r13     # 0x12ace4
movq %r15, %rdi
callq 0xf6410
movq %rax, %rbx
xorl %r14d, %r14d
movzbl (%r14,%rbp), %eax
movl 0x60(%rsp,%rax,4), %ecx
movq %rbx, %rdi
movl $0x5, %esi
movq %r13, %rdx
xorl %eax, %eax
callq 0xf6653
movl %r14d, %eax
notl %eax
testb $0x7, %al
jne 0x83a92
movq %rbx, %rdi
callq 0xf705c
movq %r15, %rdi
leaq 0xa7379(%rip), %rsi     # 0x12adf9
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
callq 0xf6423
incq %r14
cmpq $0x40, %r14
jne 0x83a4a
movq %rbx, %rdi
callq 0xf6753
movb 0xb(%rsp), %bl
orb 0xc(%rsp), %bl
movq %r15, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
addq 0x18(%rsp), %r12
cmpq 0x10(%rsp), %r12
setl %al
testb %al, %bl
jne 0x8390a
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq