// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/src/fmtutil-lzah.c
// Function: dfilter_lh1_codec
void dfilter_lh1_codec(struct de_dfilter_ctx *dfctx, void *codec_private_params)
{
	struct lzahuf_ctx *cctx = NULL;

	cctx = de_malloc(dfctx->c, sizeof(struct lzahuf_ctx));
	cctx->c = dfctx->c;
	cctx->modname = "lzhuf";
	cctx->dfctx = dfctx;
	cctx->dcmpro = dfctx->dcmpro;
	cctx->dres = dfctx->dres;

	dfctx->codec_private = (void*)cctx;
	dfctx->codec_addbuf_fn = my_lh1_codec_addbuf;
	dfctx->codec_finish_fn = my_lh1_codec_finish;
	dfctx->codec_command_fn = my_lh1_codec_command;
	dfctx->codec_destroy_fn = my_lh1_codec_destroy;

	if(codec_private_params) {
		// Use params from caller, if present.
		de_memcpy(&cctx->lh1p, codec_private_params, sizeof(struct de_lh1_params));
	}
	else {
		// Set default params.
		cctx->lh1p.history_fill_val = 0x20;
	}

	lzhuf_Decode_init(cctx);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %rdi
movl $0x11c8, %esi           # imm = 0x11C8
callq 0xe8b2b
movq %rax, %rbx
movq (%r15), %rdi
movq %rdi, (%rax)
leaq 0x1dd0d(%rip), %rax     # 0x1244fe
movq %rax, 0x8(%rbx)
movq %r15, 0x18(%rbx)
movdqu 0x8(%r15), %xmm0
pshufd $0x4e, %xmm0, %xmm0     # xmm0 = xmm0[2,3,0,1]
movdqu %xmm0, 0x20(%rbx)
movq %rbx, 0x28(%r15)
leaq 0x31b(%rip), %rax       # 0x106b2f
movq %rax, 0x30(%r15)
leaq 0x345(%rip), %rax       # 0x106b64
movq %rax, 0x40(%r15)
leaq 0x39a(%rip), %rax       # 0x106bc4
movq %rax, 0x38(%r15)
leaq 0x3ec(%rip), %rax       # 0x106c21
movq %rax, 0x48(%r15)
testq %r14, %r14
je 0x10684d
movb 0x4(%r14), %al
movb %al, 0x15(%rbx)
movl (%r14), %eax
movl %eax, 0x11(%rbx)
jmp 0x106851
movb $0x20, 0x15(%rbx)
movabsq $0xfd0000003a, %rax     # imm = 0xFD0000003A
movq %rax, 0x30(%rbx)
movaps 0x45a1a(%rip), %xmm0    # 0x14c280
movups %xmm0, 0x44(%rbx)
cmpb $0x0, 0x11(%rbx)
movb 0x12(%rbx), %al
je 0x106887
movl $0x1, 0x44(%rbx)
movl $0xfe, 0x34(%rbx)
testb %al, %al
jne 0x10689d
jmp 0x1068b2
testb %al, %al
je 0x106acd
movl $0x1, 0x44(%rbx)
movl $0xfe, 0x34(%rbx)
movabsq $0x300000005, %rax      # imm = 0x300000005
movq %rax, 0x48(%rbx)
movl $0x1f, 0x50(%rbx)
movl $0x800, %esi            # imm = 0x800
movl $0x101, %ecx            # imm = 0x101
movl $0x3a, %eax
addl %ecx, %eax
movl %eax, 0x38(%rbx)
leal -0x1(,%rax,2), %ecx
movl %ecx, 0x3c(%rbx)
leal -0x2(,%rax,2), %eax
movl %eax, 0x40(%rbx)
callq 0xfad8f
movq %rax, 0x68(%rbx)
movq %rbx, (%rax)
leaq 0xbfd(%rip), %rcx       # 0x1074ea
movq %rcx, 0x8(%rax)
movzbl 0x15(%rbx), %esi
testl %esi, %esi
je 0x106901
movq %rax, %rdi
callq 0xfadfe
movq %rbx, %rdi
addq $0x70, %rdi
movb $0x0, 0x70(%rbx)
callq 0xf1bdd
movl 0x38(%rbx), %eax
testq %rax, %rax
je 0x106979
xorl %ecx, %ecx
cmpq $0x278, %rcx            # imm = 0x278
jae 0x10694a
movw $0x1, 0x80(%rbx,%rcx,2)
movl 0x3c(%rbx), %esi
leaq (%rcx,%rsi), %rdx
cmpq $0x277, %rcx            # imm = 0x277
je 0x10694f
addl %ecx, %esi
movw %si, 0xcd6(%rbx,%rcx,2)
jmp 0x106956
movl 0x3c(%rbx), %edx
addl %ecx, %edx
movl $0x1, 0x54(%rbx)
cmpl $0x3b2, %edx            # imm = 0x3B2
ja 0x10696a
movl %edx, %edx
movw %cx, 0x570(%rbx,%rdx,2)
jmp 0x106971
movl $0x1, 0x54(%rbx)
incq %rcx
cmpq %rcx, %rax
jne 0x10691b
movl 0x40(%rbx), %edx
cmpl %edx, %eax
ja 0x106a1e
xorl %ecx, %ecx
cmpl $0x277, %ecx            # imm = 0x277
ja 0x1069a6
movl %ecx, %esi
movzwl 0x80(%rbx,%rsi,2), %edi
leal 0x1(%rcx), %esi
movzwl 0x80(%rbx,%rsi,2), %r8d
jmp 0x1069b7
movl %ecx, %esi
orl $0x1, %esi
movl $0x1, 0x54(%rbx)
xorl %edi, %edi
xorl %r8d, %r8d
cmpl $0x277, %eax            # imm = 0x277
ja 0x1069d3
addl %edi, %r8d
movl %eax, %edi
movw %r8w, 0x80(%rbx,%rdi,2)
cmpl $0x277, %eax            # imm = 0x277
jne 0x1069dc
movl $0x1, 0x54(%rbx)
jmp 0x1069e4
movw %cx, 0xcd6(%rbx,%rdi,2)
cmpl $0x3b2, %ecx            # imm = 0x3B2
ja 0x106a0a
movl %ecx, %edi
movw %ax, 0x570(%rbx,%rdi,2)
cmpl $0x3b2, %esi            # imm = 0x3B2
ja 0x106a0a
movl %esi, %esi
movw %ax, 0x570(%rbx,%rsi,2)
jmp 0x106a11
movl $0x1, 0x54(%rbx)
addl $0x2, %ecx
incl %eax
cmpl %edx, %eax
jbe 0x106986
movl 0x3c(%rbx), %eax
cmpq $0x277, %rax            # imm = 0x277
ja 0x106a35
movw $0xffff, 0x80(%rbx,%rax,2) # imm = 0xFFFF
jmp 0x106a3c
movl $0x1, 0x54(%rbx)
cmpl $0x3b2, %edx            # imm = 0x3B2
ja 0x106a50
movw $0x0, 0x570(%rbx,%rdx,2)
jmp 0x106a57
movl $0x1, 0x54(%rbx)
cmpb $0x0, 0x10(%rbx)
je 0x106ac3
movq (%rbx), %rdi
leaq 0x4585e(%rip), %rsi     # 0x14c2c5
xorl %eax, %eax
callq 0xe8617
movq (%rbx), %rdi
movl 0x3c(%rbx), %edx
leaq 0x44abc(%rip), %rsi     # 0x14b537
xorl %eax, %eax
callq 0xe8617
movl 0x40(%rbx), %esi
movq %rsp, %r8
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x10751e
leaq 0x45830(%rip), %r14     # 0x14c2cb
xorl %r15d, %r15d
movq (%rbx), %rdi
movzwl 0xcd6(%rbx,%r15,2), %ecx
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
incq %r15
cmpq $0x277, %r15            # imm = 0x277
jne 0x106a9e
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
cmpb $0x0, 0x13(%rbx)
je 0x106afc
movl $0x1, 0x44(%rbx)
movabsq $0xfe00000039, %rax     # imm = 0xFE00000039
movq %rax, 0x30(%rbx)
movl $0x1000, %esi           # imm = 0x1000
movl $0x101, %ecx            # imm = 0x101
movl $0x39, %eax
jmp 0x1068c1
movl $0x100, %ecx            # imm = 0x100
movl $0x3a, %eax
cmpb $0x0, 0x14(%rbx)
je 0x106b25
movq $0x8, 0x48(%rbx)
movl $0xff, 0x50(%rbx)
movl $0x4000, %esi           # imm = 0x4000
jmp 0x1068c1
movl $0x1000, %esi           # imm = 0x1000
jmp 0x1068c1