// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzw.c
// Function: delzw_add_to_dict
static void delzw_add_to_dict(delzwctx *dc, DELZW_CODE parent, u8 value)
{
	DELZW_CODE newpos;

	if(dc->is_hashed) {
		delzw_hashed_add_code_to_dict(dc, parent, value);
		return;
	}

	if(dc->fmt==DE_LZWFMT_ZIPSHRINK) {
		delzw_find_first_free_entry(dc, &newpos);
	}
	else {
		newpos = dc->free_code_search_start;
	}
	if(dc->errcode) return;
	if(newpos >= dc->ct_capacity) {
		return;
	}

	if(newpos < dc->first_dynamic_code) {
		delzw_set_error(dc, DELZW_ERRCODE_GENERIC_ERROR, NULL);
		return;
	}

	dc->ct[newpos].parent = (DELZW_CODE_MINRANGE)parent;
	dc->ct[newpos].value = value;
	dc->ct[newpos].codetype = DELZW_CODETYPE_DYN_USED;
	dc->ct_code_count++;
	dc->last_code_added = newpos;
	dc->free_code_search_start = newpos+1;
	if(newpos > dc->highest_code_ever_used) {
		dc->highest_code_ever_used = newpos;
	}

	if(dc->auto_inc_codesize) {
		if(dc->early_codesize_inc) {
			if(dc->free_code_search_start>=DELZW_NBITS_TO_MAXCODE(dc->curr_codesize)) {
				delzw_increase_codesize(dc);
			}
		}
		else {
			if(dc->free_code_search_start>DELZW_NBITS_TO_MAXCODE(dc->curr_codesize)) {
				delzw_increase_codesize(dc);
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movb %al, -0xd(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x5b(%rax)
je 0x1866f3
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movzbl -0xd(%rbp), %edx
callq 0x186a10
jmp 0x186874
movq -0x8(%rbp), %rax
cmpl $0x3, 0x14(%rax)
jne 0x18670c
movq -0x8(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x186ae0
jmp 0x186719
movq -0x8(%rbp), %rax
movl 0xa8(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x60(%rax)
je 0x186728
jmp 0x186874
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xc8(%rcx), %eax
jb 0x18673c
jmp 0x186874
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xac(%rcx), %eax
jae 0x186762
movq -0x8(%rbp), %rdi
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x185850
jmp 0x186874
movl -0xc(%rbp), %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movq 0xd0(%rax), %rax
movl -0x14(%rbp), %edx
imulq $0x6, %rdx, %rdx
addq %rdx, %rax
movw %cx, (%rax)
movb -0xd(%rbp), %cl
movq -0x8(%rbp), %rax
movq 0xd0(%rax), %rax
movl -0x14(%rbp), %edx
imulq $0x6, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x2(%rax)
movq -0x8(%rbp), %rax
movq 0xd0(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x6, %rcx, %rcx
addq %rcx, %rax
movb $0x3, 0x3(%rax)
movq -0x8(%rbp), %rax
movl 0xcc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xcc(%rax)
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x9c(%rax)
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xa8(%rax)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xa4(%rcx), %eax
jbe 0x186800
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xa4(%rax)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x40(%rax)
je 0x186874
movq -0x8(%rbp), %rax
cmpb $0x0, 0x59(%rax)
je 0x186843
movq -0x8(%rbp), %rax
movl 0xa8(%rax), %eax
movq -0x8(%rbp), %rcx
movl 0x90(%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jb 0x186841
movq -0x8(%rbp), %rdi
callq 0x185e60
jmp 0x186872
movq -0x8(%rbp), %rax
movl 0xa8(%rax), %eax
movq -0x8(%rbp), %rcx
movl 0x90(%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jbe 0x186870
movq -0x8(%rbp), %rdi
callq 0x185e60
jmp 0x186872
jmp 0x186874
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)