// File: akw0088[P]openssl/huffman.c
// Function: huffman_read_tree
static struct _huffman_node *_huffman_read_tree(const unsigned char *in,unsigned long *inbitctr,unsigned long inlen,unsigned char **heapptr,unsigned char *heapend)
{
	struct _huffman_node *n;
	unsigned int i;
	unsigned long byte_index;

	n = (struct _huffman_node *)(*heapptr);
	*heapptr += sizeof(struct _huffman_node);
	if (*heapptr > heapend)
		 return (struct _huffman_node *)0;

	byte_index = *inbitctr >> 3;
	byte_index *= (byte_index < inlen);
	if (((in[byte_index] >> (~((*inbitctr)++) & 7)) & 1))
	{
		n->lr[0] = (struct _huffman_node *)0;
		n->lr[1] = (struct _huffman_node *)0;
		n->c = 0;
		for(i = 0; i < 9; ++i)
		{
			byte_index = *inbitctr >> 3;
			if (byte_index >= inlen)
				return (struct _huffman_node *)0;
			n->c |= (((unsigned int)(in[byte_index] >> (~((*inbitctr)++) & 7))) & 1) << i;
		}
	}
	else
	{
		n->lr[0] = _huffman_read_tree(in,inbitctr,inlen,heapptr,heapend);
		n->lr[1] = _huffman_read_tree(in,inbitctr,inlen,heapptr,heapend);
		if (!((n->lr[0])&&(n->lr[1])))
			return (struct _huffman_node *)0;
	}

	return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rcx
addq $0x30, %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpq -0x30(%rbp), %rax
jbe 0x1e4f
movq $0x0, -0x8(%rbp)
jmp 0x1fbe
movq -0x18(%rbp), %rax
movq (%rax), %rax
shrq $0x3, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x20(%rbp), %rax
setb %al
andb $0x1, %al
movzbl %al, %eax
cltq
imulq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq -0x48(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x18(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
xorq $-0x1, %rcx
andq $0x7, %rcx
sarl %cl, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1f4e
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x28(%rax)
movl $0x0, -0x3c(%rbp)
cmpl $0x9, -0x3c(%rbp)
jae 0x1f4c
movq -0x18(%rbp), %rax
movq (%rax), %rax
shrq $0x3, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x20(%rbp), %rax
jb 0x1f02
movq $0x0, -0x8(%rbp)
jmp 0x1fbe
movq -0x10(%rbp), %rax
movq -0x48(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x18(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
xorq $-0x1, %rcx
andq $0x7, %rcx
sarl %cl, %eax
andl $0x1, %eax
movl -0x3c(%rbp), %ecx
shll %cl, %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
orq 0x28(%rax), %rcx
movq %rcx, 0x28(%rax)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x1ed6
jmp 0x1fb6
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
callq 0x1e00
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
callq 0x1e00
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, (%rax)
je 0x1faa
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1fb4
movq $0x0, -0x8(%rbp)
jmp 0x1fbe
jmp 0x1fb6
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq