// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzw.c
// Function: delzw_process_byte
static void delzw_process_byte(delzwctx *dc, u8 b)
{
	if(dc->state==DELZW_STATE_INIT) {
		delzw_on_decompression_start(dc);
		dc->state = DELZW_STATE_READING_HEADER;
		if(dc->errcode) return;
	}

	if(dc->state==DELZW_STATE_READING_HEADER) {
		if(dc->total_nbytes_processed < (i64)dc->header_size) {
			dc->header_buf[dc->total_nbytes_processed] = b;
			return;
		}

		// (This is the first byte after the header.)
		delzw_on_codes_start(dc);
		dc->state = DELZW_STATE_READING_CODES;
		if(dc->errcode) return;
	}

	if(dc->state==DELZW_STATE_READING_CODES) {
		if(dc->nbytes_left_to_skip>0) {
			dc->nbytes_left_to_skip--;
			return;
		}

		// Add a byte's worth of bits to the pending code
		de_bitbuf_lowlevel_add_byte(&dc->bbll, b);

		while(1) {
			DELZW_CODE code;
			UI this_codesize;

			if(dc->errcode) break;

			if(dc->special_code_is_pending && dc->fmt==DE_LZWFMT_DWC) {
				this_codesize = 3;
			}
			else {
				this_codesize = dc->curr_codesize;
			}

			if(dc->bbll.nbits_in_bitbuf < this_codesize) {
				break;
			}

			code = (DELZW_CODE)de_bitbuf_lowlevel_get_bits(&dc->bbll, this_codesize);
			dc->ncodes_in_this_bitgroup++;
			delzw_process_code(dc, code);

			if(dc->state != DELZW_STATE_READING_CODES) {
				break;
			}
			if(dc->nbytes_left_to_skip>0) {
				break;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x64(%rax)
jne 0x184b01
movq -0x8(%rbp), %rdi
callq 0x184c60
movq -0x8(%rbp), %rax
movl $0x1, 0x64(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x60(%rax)
je 0x184aff
jmp 0x184c4d
jmp 0x184b01
movq -0x8(%rbp), %rax
cmpl $0x1, 0x64(%rax)
jne 0x184b5d
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jge 0x184b38
movb -0x9(%rbp), %dl
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x68(%rcx), %rcx
movb %dl, 0xe0(%rax,%rcx)
jmp 0x184c4d
movq -0x8(%rbp), %rdi
callq 0x184db0
movq -0x8(%rbp), %rax
movl $0x2, 0x64(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x60(%rax)
je 0x184b5b
jmp 0x184c4d
jmp 0x184b5d
movq -0x8(%rbp), %rax
cmpl $0x2, 0x64(%rax)
jne 0x184c4d
movq -0x8(%rbp), %rax
cmpq $0x0, 0x80(%rax)
jle 0x184b94
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x80(%rax)
jmp 0x184c4d
movq -0x8(%rbp), %rdi
addq $0xb8, %rdi
movzbl -0x9(%rbp), %esi
callq 0x16a230
movq -0x8(%rbp), %rax
cmpl $0x0, 0x60(%rax)
je 0x184bb7
jmp 0x184c4b
movq -0x8(%rbp), %rax
movzbl 0xb0(%rax), %eax
cmpl $0x0, %eax
je 0x184bda
movq -0x8(%rbp), %rax
cmpl $0x8, 0x14(%rax)
jne 0x184bda
movl $0x3, -0x14(%rbp)
jmp 0x184be7
movq -0x8(%rbp), %rax
movl 0x90(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0xbc(%rax), %eax
cmpl -0x14(%rbp), %eax
jae 0x184bf8
jmp 0x184c4b
movq -0x8(%rbp), %rdi
addq $0xb8, %rdi
movl -0x14(%rbp), %esi
callq 0x16a2a0
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x78(%rax)
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0x185610
movq -0x8(%rbp), %rax
cmpl $0x2, 0x64(%rax)
je 0x184c36
jmp 0x184c4b
movq -0x8(%rbp), %rax
cmpq $0x0, 0x80(%rax)
jle 0x184c46
jmp 0x184c4b
jmp 0x184ba8
jmp 0x184c4d
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)