// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/jpeg.c
// Function: handler_sos
static void handler_sos(deark *c, lctx *d,
	const struct marker_info *mi, i64 pos, i64 data_size)
{
	i64 ncomp;
	i64 i;
	u8 cs;
	u8 b;
	u8 ss, se, ax;
	u8 actable, dctable;

	if(data_size<1) goto done;

	d->scan_count++;
	ncomp = (i64)de_getbyte(pos);
	de_dbg(c, "number of components in scan: %d", (int)ncomp);
	if(data_size < 4 + 2*ncomp) goto done;

	for(i=0; i<ncomp; i++) {
		cs = de_getbyte(pos+1+i*2);
		de_dbg(c, "component #%d id: %d", (int)i, (int)cs);
		de_dbg_indent(c, 1);
		b = de_getbyte(pos+1+i*2+1);
		dctable = b>>4;
		actable = b&0x0f;
		de_dbg(c, "tables to use: DC%d, AC%d", (int)dctable, (int)actable);
		de_dbg_indent(c, -1);
	}

	ss = de_getbyte(pos+1+ncomp*2);
	se = de_getbyte(pos+1+ncomp*2+1);
	ax = de_getbyte(pos+1+ncomp*2+2);
	de_dbg(c, "spectral selection start/end: %d, %d", (int)ss, (int)se);
	de_dbg(c, "successive approx. bit pos high/low: %u, %u",
		(unsigned int)(ax>>4), (unsigned int)(ax&0x0f));

done:
	;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
cmpq $0x1, -0x28(%rbp)
jge 0xbd688
jmp 0xbd85b
movq -0x10(%rbp), %rax
movl 0x24(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x24(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x165060
movzbl %al, %eax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movl %eax, %edx
leaq 0xf9080(%rip), %rsi     # 0x1b673e
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
shlq %rcx
addq $0x4, %rcx
cmpq %rcx, %rax
jge 0xbd6de
jmp 0xbd85b
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0xbd7b3
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x1, %rsi
movq -0x38(%rbp), %rax
shlq %rax
addq %rax, %rsi
callq 0x165060
movb %al, -0x39(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl %eax, %edx
movzbl -0x39(%rbp), %ecx
leaq 0xf9034(%rip), %rsi     # 0x1b675f
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x1, %rsi
movq -0x38(%rbp), %rax
shlq %rax
addq %rax, %rsi
addq $0x1, %rsi
callq 0x165060
movb %al, -0x3a(%rbp)
movzbl -0x3a(%rbp), %eax
sarl $0x4, %eax
movb %al, -0x3f(%rbp)
movzbl -0x3a(%rbp), %eax
andl $0xf, %eax
movb %al, -0x3e(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x3f(%rbp), %edx
movzbl -0x3e(%rbp), %ecx
leaq 0xf8fe7(%rip), %rsi     # 0x1b6774
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xbd6e6
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x1, %rsi
movq -0x30(%rbp), %rax
shlq %rax
addq %rax, %rsi
callq 0x165060
movb %al, -0x3b(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x1, %rsi
movq -0x30(%rbp), %rax
shlq %rax
addq %rax, %rsi
addq $0x1, %rsi
callq 0x165060
movb %al, -0x3c(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x1, %rsi
movq -0x30(%rbp), %rax
shlq %rax
addq %rax, %rsi
addq $0x2, %rsi
callq 0x165060
movb %al, -0x3d(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x3b(%rbp), %edx
movzbl -0x3c(%rbp), %ecx
leaq 0xf8f5a(%rip), %rsi     # 0x1b678e
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movzbl -0x3d(%rbp), %edx
sarl $0x4, %edx
movzbl -0x3d(%rbp), %ecx
andl $0xf, %ecx
leaq 0xf8f5f(%rip), %rsi     # 0x1b67b3
movb $0x0, %al
callq 0x15b0d0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)