// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-data.c
// Function: de_decode_base16
void de_decode_base16(deark *c, dbuf *inf, i64 pos1, i64 len,
	dbuf *outf, unsigned int flags)
{
	i64 pos = pos1;
	u8 b;
	int bad_warned = 0;
	struct base16_ctx {
		int cbuf_count;
		u8 cbuf[5];
	};
	struct base16_ctx *d = NULL;

	d = de_malloc(c, sizeof(struct base16_ctx));
	pos = pos1;
	d->cbuf_count = 0;
	while(pos<pos1+len) {
		b = dbuf_getbyte_p(inf, &pos);
		if(b>='0' && b<='9') {
			d->cbuf[d->cbuf_count++] = b-48;
		}
		else if(b>='A' && b<='F') {
			d->cbuf[d->cbuf_count++] = b-55;
		}
		else if(b>='a' && b<='f') {
			d->cbuf[d->cbuf_count++] = b-87;
		}
		else if(b==9 || b==10 || b==13 || b==32) {
			; // ignore whitespace
		}
		else {
			if(!bad_warned) {
				de_warn(c, "Bad hex character(s) found (offset %d)", (int)pos);
				bad_warned = 1;
			}
		}

		if(d->cbuf_count>=2) {
			dbuf_writebyte(outf, (d->cbuf[0]<<4)|(d->cbuf[1]));
			d->cbuf_count=0;
		}
	}

	if(d->cbuf_count>0) {
		de_warn(c, "Unexpected end of hex data");
	}

	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movl $0xc, %esi
callq 0x15b780
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
movl $0x0, (%rax)
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
addq -0x20(%rbp), %rcx
cmpq %rcx, %rax
jge 0x1621e1
movq -0x10(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x165170
movb %al, -0x39(%rbp)
movzbl -0x39(%rbp), %eax
cmpl $0x30, %eax
jl 0x1620e8
movzbl -0x39(%rbp), %eax
cmpl $0x39, %eax
jg 0x1620e8
movzbl -0x39(%rbp), %eax
subl $0x30, %eax
movb %al, %dl
movq -0x48(%rbp), %rax
movq -0x48(%rbp), %rsi
movl (%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rsi)
movslq %ecx, %rcx
movb %dl, 0x4(%rax,%rcx)
jmp 0x1621a8
movzbl -0x39(%rbp), %eax
cmpl $0x41, %eax
jl 0x162120
movzbl -0x39(%rbp), %eax
cmpl $0x46, %eax
jg 0x162120
movzbl -0x39(%rbp), %eax
subl $0x37, %eax
movb %al, %dl
movq -0x48(%rbp), %rax
movq -0x48(%rbp), %rsi
movl (%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rsi)
movslq %ecx, %rcx
movb %dl, 0x4(%rax,%rcx)
jmp 0x1621a6
movzbl -0x39(%rbp), %eax
cmpl $0x61, %eax
jl 0x162155
movzbl -0x39(%rbp), %eax
cmpl $0x66, %eax
jg 0x162155
movzbl -0x39(%rbp), %eax
subl $0x57, %eax
movb %al, %dl
movq -0x48(%rbp), %rax
movq -0x48(%rbp), %rsi
movl (%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rsi)
movslq %ecx, %rcx
movb %dl, 0x4(%rax,%rcx)
jmp 0x1621a4
movzbl -0x39(%rbp), %eax
cmpl $0x9, %eax
je 0x162179
movzbl -0x39(%rbp), %eax
cmpl $0xa, %eax
je 0x162179
movzbl -0x39(%rbp), %eax
cmpl $0xd, %eax
je 0x162179
movzbl -0x39(%rbp), %eax
cmpl $0x20, %eax
jne 0x16217b
jmp 0x1621a2
cmpl $0x0, -0x40(%rbp)
jne 0x1621a0
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl %eax, %edx
leaq 0x726f3(%rip), %rsi     # 0x1d4885
movb $0x0, %al
callq 0x15bc10
movl $0x1, -0x40(%rbp)
jmp 0x1621a2
jmp 0x1621a4
jmp 0x1621a6
jmp 0x1621a8
movq -0x48(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x1621dc
movq -0x28(%rbp), %rdi
movq -0x48(%rbp), %rax
movzbl 0x4(%rax), %eax
shll $0x4, %eax
movq -0x48(%rbp), %rcx
movzbl 0x5(%rcx), %ecx
orl %ecx, %eax
movzbl %al, %esi
callq 0x168380
movq -0x48(%rbp), %rax
movl $0x0, (%rax)
jmp 0x16208b
movq -0x48(%rbp), %rax
cmpl $0x0, (%rax)
jle 0x1621fc
movq -0x8(%rbp), %rdi
leaq 0x726b7(%rip), %rsi     # 0x1d48ac
movb $0x0, %al
callq 0x15bc10
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x15b820
addq $0x50, %rsp
popq %rbp
retq
nop