// File: /workspace/github_c_makefile_star2_O1/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 0x84171
movq %rcx, %r12
movq %rdi, %r15
addq %rcx, 0x10(%rsp)
movq 0x18(%r15), %rdi
movq %r12, %rsi
callq 0xef0d5
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 0xa7e7d(%rip), %r12     # 0x12be69
leaq 0xab3db(%rip), %rcx     # 0x12f3ce
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 0x8fc1f(%rip), %rcx     # 0x113c3d
cmovbq %rcx, %r12
movzbl %al, %edx
movq %r15, %rdi
leaq 0xa6ad0(%rip), %rsi     # 0x12aaff
movl %ebp, %ecx
xorl %eax, %eax
callq 0xe9226
movq %r15, %rdi
movl $0x1, %esi
callq 0xe9585
movq %r15, %rdi
leaq 0xa6ac2(%rip), %rsi     # 0x12ab11
movl %r13d, %edx
movq %r12, %rcx
movq %rbp, %r12
leaq 0xa6651(%rip), %rbp     # 0x12a6b0
xorl %eax, %eax
callq 0xe9226
cmpb $0x1f, %bl
ja 0x84147
cmpl $0x2, (%r15)
jl 0x84147
leaq 0x1(%r12), %rdx
cmpb $0x1, %r14b
jne 0x840b2
movq %rdx, 0x20(%rsp)
xorl %ebx, %ebx
leaq 0x20(%rsp), %r14
movq 0x18(%r15), %rdi
movq %r14, %rsi
callq 0xef193
movl %eax, 0x60(%rsp,%rbx,4)
incq %rbx
cmpq $0x40, %rbx
jne 0x84090
leaq 0xa6a74(%rip), %r13     # 0x12ab24
jmp 0x840e0
movq 0x18(%r15), %rdi
movl $0x40, %ecx
leaq 0x20(%rsp), %rsi
callq 0xeeee8
xorl %eax, %eax
movzbl 0x20(%rsp,%rax), %ecx
movl %ecx, 0x60(%rsp,%rax,4)
incq %rax
cmpq $0x40, %rax
jne 0x840c7
leaq 0xa6934(%rip), %r13     # 0x12aa14
movq %r15, %rdi
callq 0xf6870
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 0xf6ab0
movl %r14d, %eax
notl %eax
testb $0x7, %al
jne 0x84136
movq %rbx, %rdi
callq 0xf74bd
movq %r15, %rdi
leaq 0xa6a05(%rip), %rsi     # 0x12ab29
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
callq 0xf6883
incq %r14
cmpq $0x40, %r14
jne 0x840ee
movq %rbx, %rdi
callq 0xf6bb0
movb 0xb(%rsp), %bl
orb 0xc(%rsp), %bl
movq %r15, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
addq 0x18(%rsp), %r12
cmpq 0x10(%rsp), %r12
setl %al
testb %al, %bl
jne 0x83fbe
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq