LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_copy
void dbuf_copy(dbuf *inf, i64 input_offset, i64 input_len, dbuf *outf)
{
	u8 tmpbuf[256];

	// Fast paths, if the data to copy is all in memory

	if(inf->rcache &&
		(input_offset>=0) && (input_offset+input_len<=inf->rcache_bytes_used))
	{
		dbuf_write(outf, &inf->rcache[input_offset], input_len);
		return;
	}

	if(inf->btype==DBUF_TYPE_MEMBUF &&
		(input_offset>=0) && (input_offset+input_len<=inf->len))
	{
		dbuf_write(outf, &inf->membuf_buf[input_offset], input_len);
		return;
	}

	if(input_len<=(i64)sizeof(tmpbuf)) {
		// Fast path for small sizes
		dbuf_read(inf, tmpbuf, input_offset, input_len);
		dbuf_write(outf, tmpbuf, input_len);
		return;
	}

	dbuf_buffered_read(inf, input_offset, input_len, copy_cbfn, (void*)outf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0xc8(%rax)
je 0x1660d6
cmpq $0x0, -0x10(%rbp)
jl 0x1660d6
movq -0x10(%rbp), %rax
addq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0xc0(%rcx), %rax
jg 0x1660d6
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0xc8(%rax), %rsi
addq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x166170
jmp 0x166167
movq -0x8(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x166113
cmpq $0x0, -0x10(%rbp)
jl 0x166113
movq -0x10(%rbp), %rax
addq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jg 0x166113
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rsi
addq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x166170
jmp 0x166167
cmpq $0x100, -0x18(%rbp)     # imm = 0x100
jg 0x16614b
movq -0x8(%rbp), %rdi
leaq -0x120(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x164d10
movq -0x20(%rbp), %rdi
leaq -0x120(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x166170
jmp 0x166167
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %r8
leaq 0x26e(%rip), %rcx       # 0x1663d0
callq 0x166260
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_write
void dbuf_write(dbuf *f, const u8 *m, i64 len)
{
	if(!f->wbuffer) {
		dbuf_write_unbuffered(f, m, len);
		return;
	}

	if(len<=0) return;

	if(len > DE_WBUFFER_SIZE/2) {
		// This item doesn't fit in the buffer, even by itself, or we
		// consider it "large".
		// Flush the buffer, write the item, done.
		// TODO: Decide what the "large" threshold should be, or if there should
		// even be one.
		if(f->wbuffer_bytes_used!=0) dbuf_flush(f);
		dbuf_write_unbuffered(f, m, len);
		return;
	}

	if(f->wbuffer_bytes_used + len > DE_WBUFFER_SIZE) {
		// This item fits in the buffer by itself, but currently the buffer
		// is too full.
		// Flush the buffer, copy the item to the buffer, done.
		dbuf_flush(f);
		de_memcpy(f->wbuffer, m, (size_t)len);
		f->wbuffer_bytes_used = len;
		return;
	}

	// There is room for this item in the buffer, even without flushing it first.
	de_memcpy(&f->wbuffer[f->wbuffer_bytes_used], m, (size_t)len);
	f->wbuffer_bytes_used += len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x1661a5
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x168150
jmp 0x16624f
cmpq $0x0, -0x18(%rbp)
jg 0x1661b1
jmp 0x16624f
cmpq $0x100, -0x18(%rbp)     # imm = 0x100
jle 0x1661e2
movq -0x8(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x1661cf
movq -0x8(%rbp), %rdi
callq 0x167c30
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x168150
jmp 0x16624f
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
addq -0x18(%rbp), %rax
cmpq $0x200, %rax            # imm = 0x200
jle 0x166222
movq -0x8(%rbp), %rdi
callq 0x167c30
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x191e0
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x40(%rax)
jmp 0x16624f
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x8(%rbp), %rax
addq 0x40(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x191e0
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0x40(%rax), %rcx
movq %rcx, 0x40(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_buffered_read
int dbuf_buffered_read(dbuf *f, i64 pos1, i64 len,
	de_buffered_read_cbfn cbfn, void *userdata)
{
	struct de_bufferedreadctx brctx;

	brctx.c = f->c;
	brctx.userdata = userdata;

	if((pos1 < -DE_ALLOWED_VIRTUAL_BYTES) ||
		(pos1 > f->len+DE_ALLOWED_VIRTUAL_BYTES) ||
		(len > f->len+DE_ALLOWED_VIRTUAL_BYTES) ||
		(pos1+len > f->len+DE_ALLOWED_VIRTUAL_BYTES))
	{
		len = 0;
	}

	if(len<=0) { // Get this special case out of the way.
		return buffered_read_zero_len(&brctx, cbfn);
	}

	// Use an optimized routine if all the data we need to read is already in memory.
	if(f->rcache && (pos1>=0) && (pos1+len<=f->rcache_bytes_used)) {
		return buffered_read_from_mem(&brctx, f, f->rcache, pos1, len, cbfn);
	}

	// Not an "optimization", since we promise this behavior for MEMBUFs.
	if(f->btype==DBUF_TYPE_MEMBUF && (pos1>=0) && (pos1+len<=f->len)) {
		return buffered_read_from_mem(&brctx, f, f->membuf_buf, pos1, len, cbfn);
	}

	// The general case:
	return buffered_read_internal(&brctx, f, pos1, len, cbfn);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $-0x4000, -0x18(%rbp)   # imm = 0xC000
jl 0x1662e6
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
addq $0x4000, %rcx           # imm = 0x4000
cmpq %rcx, %rax
jg 0x1662e6
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
addq $0x4000, %rcx           # imm = 0x4000
cmpq %rcx, %rax
jg 0x1662e6
movq -0x18(%rbp), %rax
addq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
addq $0x4000, %rcx           # imm = 0x4000
cmpq %rcx, %rax
jle 0x1662ee
movq $0x0, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jg 0x16630a
movq -0x28(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x1699d0
movl %eax, -0x4(%rbp)
jmp 0x1663c1
movq -0x10(%rbp), %rax
cmpq $0x0, 0xc8(%rax)
je 0x16635d
cmpq $0x0, -0x18(%rbp)
jl 0x16635d
movq -0x18(%rbp), %rax
addq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0xc0(%rcx), %rax
jg 0x16635d
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movq -0x28(%rbp), %r9
leaq -0x58(%rbp), %rdi
callq 0x169a40
movl %eax, -0x4(%rbp)
jmp 0x1663c1
movq -0x10(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x1663a5
cmpq $0x0, -0x18(%rbp)
jl 0x1663a5
movq -0x18(%rbp), %rax
addq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jg 0x1663a5
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movq -0x28(%rbp), %r9
leaq -0x58(%rbp), %rdi
callq 0x169a40
movl %eax, -0x4(%rbp)
jmp 0x1663c1
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq -0x58(%rbp), %rdi
callq 0x169b10
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: copy_at_cbfn
static int copy_at_cbfn(struct de_bufferedreadctx *brctx, const u8 *buf,
	i64 buf_len)
{
	struct copy_at_ctx *ctx = (struct copy_at_ctx*)brctx->userdata;

	dbuf_write_at(ctx->outf, ctx->outpos, buf, buf_len);
	ctx->outpos += buf_len;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x1683f0
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movl $0x1, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_search_byte
int dbuf_search_byte(dbuf *f, const u8 b, i64 startpos,
	i64 haystack_len, i64 *foundpos)
{
	i64 i;

	for(i=0; i<haystack_len; i++) {
		if(b == dbuf_getbyte(f, startpos+i)) {
			*foundpos = startpos+i;
			return 1;
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x16681c
movzbl -0x11(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq -0x38(%rbp), %rsi
callq 0x165060
movb %al, %cl
movl -0x3c(%rbp), %eax
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x16680c
movq -0x20(%rbp), %rcx
addq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x166823
jmp 0x16680e
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x1667c6
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: de_destroy_stringreaderdata
void de_destroy_stringreaderdata(deark *c, struct de_stringreaderdata *srd)
{
	if(!srd) return;
	de_free(c, srd->sz);
	de_free(c, srd->sz_utf8);
	ucstring_destroy(srd->str);
	de_free(c, srd);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x166849
jmp 0x166885
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x15b820
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x15b820
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x171750
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x15b820
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_memcmp
int dbuf_memcmp(dbuf *f, i64 pos, const void *s, size_t n)
{
	u8 buf1[128];

	if(f->rcache &&
		pos >= 0 &&
		pos + (i64)n <= f->rcache_bytes_used)
	{
		// Fastest path: Compare directly to cache.
		return de_memcmp(s, &f->rcache[pos], n);
	}

	if(n<=sizeof(buf1)) {
		// Use a stack buffer if small enough.
		dbuf_read(f, buf1, pos, n);
		return de_memcmp(buf1, s, n);
	}

	// Fallback method.
	return !dbuf_buffered_read(f, pos, n, dbufmemcmp_cbfn, (void*)s);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xc8(%rax)
je 0x166b16
cmpq $0x0, -0x18(%rbp)
jl 0x166b16
movq -0x18(%rbp), %rax
addq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0xc0(%rcx), %rax
jg 0x166b16
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rsi
addq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x19170
movl %eax, -0x4(%rbp)
jmp 0x166b7d
cmpq $0x80, -0x28(%rbp)
ja 0x166b51
movq -0x10(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x164d10
leaq -0xb0(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x19170
movl %eax, -0x4(%rbp)
jmp 0x166b7d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %r8
leaq 0x28(%rip), %rcx        # 0x166b90
callq 0x166260
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbufmemcmp_cbfn
static int dbufmemcmp_cbfn(struct de_bufferedreadctx *brctx, const u8 *buf,
	i64 buf_len)
{
	// Return 0 if there is a mismatch.
	return !de_memcmp(buf,
		&(((const u8*)brctx->userdata)[brctx->offset]),
		(size_t)buf_len);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x8(%rbp), %rax
addq 0x10(%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x19170
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_create_file_from_slice
int dbuf_create_file_from_slice(dbuf *inf, i64 pos, i64 data_size,
	const char *ext, de_finfo *fi, unsigned int createflags)
{
	dbuf *f;
	f = dbuf_create_output_file(inf->c, ext, fi, createflags);
	if(!f) return 0;
	dbuf_copy(inf, pos, data_size, f);
	dbuf_close(f);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0x34(%rbp), %ecx
callq 0x166c60
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x166c2c
movl $0x0, -0x4(%rbp)
jmp 0x166c51
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x166070
movq -0x40(%rbp), %rdi
callq 0x1676a0
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_create_unmanaged_file
dbuf *dbuf_create_unmanaged_file(deark *c, const char *fname, int overwrite_mode,
	unsigned int flags)
{
	dbuf *f;
	char msgbuf[200];

	f = create_dbuf_lowlevel(c);
	f->is_managed = 0;
	f->name = de_strdup(c, fname);

	f->btype = DBUF_TYPE_OFILE;
	f->max_len_hard = c->max_output_file_size;
	f->fp = de_fopen_for_write(c, f->name, msgbuf, sizeof(msgbuf),
		c->overwrite_mode, flags);

	if(!f->fp) {
		de_err(c, "Failed to write %s: %s", f->name, msgbuf);
		f->btype = DBUF_TYPE_NULL;
		c->serious_error_flag = 1;
	}

	return f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x167ad0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x15c630
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x20(%rbp), %rax
movl $0x2, (%rax)
movq -0x8(%rbp), %rax
movq 0xb0(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rsi
leaq -0xf0(%rbp), %rdx
movq -0x8(%rbp), %rax
movl 0xd8(%rax), %r8d
movl -0x18(%rbp), %r9d
movl $0xc8, %ecx
callq 0x18fc80
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x167ab8
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rdx
leaq -0xf0(%rbp), %rcx
leaq 0x6d2bf(%rip), %rsi     # 0x1d4d5e
movb $0x0, %al
callq 0x15bfb0
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rax
movb $0x1, 0x4c(%rax)
movq -0x20(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: create_dbuf_lowlevel
static dbuf *create_dbuf_lowlevel(deark *c)
{
	dbuf *f;

	f = de_malloc(c, sizeof(dbuf));
	f->c = c;
	f->file_id = -1;
	return f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movl $0xd8, %esi
callq 0x15b780
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x64(%rax) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_create_unmanaged_file_stdout
dbuf *dbuf_create_unmanaged_file_stdout(deark *c, const char *name)
{
	dbuf *f;

	f = create_dbuf_lowlevel(c);
	f->is_managed = 0;
	f->name = de_strdup(c, name);
	f->btype = DBUF_TYPE_STDOUT;
	f->max_len_hard = c->max_output_file_size;
	f->fp = stdout;
	return f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x167ad0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x15c630
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x18(%rbp), %rax
movl $0x5, (%rax)
movq -0x8(%rbp), %rax
movq 0xb0(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq 0xbd45f(%rip), %rax     # 0x224fd0
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_disable_wbuffer
void dbuf_disable_wbuffer(dbuf *f)
{
	if(!f->wbuffer) return;
	dbuf_flush(f);
	de_free(f->c, f->wbuffer);
	f->wbuffer = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x167bf9
jmp 0x167c23
movq -0x8(%rbp), %rdi
callq 0x167c30
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rsi
callq 0x15b820
movq -0x8(%rbp), %rax
movq $0x0, 0x48(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: sanitize_ext
static void sanitize_ext(const char *ext1, char *ext, size_t extlen)
{
	size_t k;

	de_strlcpy(ext, ext1, extlen);
	// This part of the filename should come from Deark, and should only
	// use a limited set of characters. Just to be sure:
	for(k=0; ext[k]; k++) {
		if((ext[k]>='0' && ext[k]<='9') ||
			(ext[k]>='A' && ext[k]<='Z') ||
			(ext[k]>='a' && ext[k]<='z') ||
			ext[k]=='.' || ext[k]=='_' || ext[k]=='-' || ext[k]=='+')
		{
			;
		}
		else {
			ext[k] = '_';
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x15aa30
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x167d8e
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x30, %eax
jl 0x167ce5
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x39, %eax
jle 0x167d6d
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x41, %eax
jl 0x167d07
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x5a, %eax
jle 0x167d6d
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x61, %eax
jl 0x167d29
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x7a, %eax
jle 0x167d6d
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2e, %eax
je 0x167d6d
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x5f, %eax
je 0x167d6d
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2d, %eax
je 0x167d6d
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2b, %eax
jne 0x167d6f
jmp 0x167d7b
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movb $0x5f, (%rax,%rcx)
jmp 0x167d7d
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x167cad
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: finfo_shallow_copy
static void finfo_shallow_copy(deark *c, de_finfo *src, de_finfo *dst)
{
	UI k;

	dst->is_directory = src->is_directory;
	dst->is_volume_label = src->is_volume_label;
	dst->has_riscos_data = src->has_riscos_data;
	dst->riscos_appended_type = src->riscos_appended_type;
	dst->riscos_attribs = src->riscos_attribs;
	dst->mode_flags = src->mode_flags;
	for(k=0; k<DE_TIMESTAMPIDX_COUNT; k++) {
		dst->timestamp[k] = src->timestamp[k];
	}
	dst->internal_mod_time = src->internal_mod_time;
	dst->density = src->density;
	dst->has_hotspot = src->has_hotspot;
	dst->hotspot_x = src->hotspot_x;
	dst->hotspot_y = src->hotspot_y;
	dst->load_addr = src->load_addr;
	dst->exec_addr = src->exec_addr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movb 0x9(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x9(%rax)
movq -0x10(%rbp), %rax
movb 0xa(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, 0xa(%rax)
movq -0x10(%rbp), %rax
movb 0x10(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x10(%rax)
movq -0x10(%rbp), %rax
movb 0x11(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x11(%rax)
movq -0x10(%rbp), %rax
movl 0xa0(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xa0(%rax)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x14(%rax)
movl $0x0, -0x1c(%rbp)
cmpl $0x5, -0x1c(%rbp)
jae 0x167e54
movq -0x18(%rbp), %rax
addq $0x18, %rax
movl -0x1c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
addq $0x18, %rcx
movl -0x1c(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x167e11
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x68(%rcx), %rdx
movq %rdx, 0x68(%rax)
movq 0x70(%rcx), %rcx
movq %rcx, 0x70(%rax)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x78(%rcx), %rdx
movq %rdx, 0x78(%rax)
movq 0x80(%rcx), %rdx
movq %rdx, 0x80(%rax)
movq 0x88(%rcx), %rcx
movq %rcx, 0x88(%rax)
movq -0x10(%rbp), %rax
movb 0xe(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, 0xe(%rax)
movq -0x10(%rbp), %rax
movl 0x98(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x98(%rax)
movq -0x10(%rbp), %rax
movl 0x9c(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x9c(%rax)
movq -0x10(%rbp), %rax
movl 0xa4(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xa4(%rax)
movq -0x10(%rbp), %rax
movl 0xa8(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xa8(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_create_membuf
dbuf *dbuf_create_membuf(deark *c, i64 initialsize, unsigned int flags)
{
	dbuf *f;

	f = create_dbuf_lowlevel(c);
	f->btype = DBUF_TYPE_MEMBUF;
	f->max_len_hard = DE_MAX_MEMBUF_SIZE;

	if(initialsize>0) {
		if(initialsize > f->max_len_hard) {
			do_on_dbuf_size_exceeded(f);
		}
		f->membuf_buf = de_malloc(c, initialsize);
		f->membuf_alloc = initialsize;
	}

	if(flags&0x01) {
		dbuf_set_length_limit(f, initialsize);
	}

	return f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
callq 0x167ad0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x3, (%rax)
movq -0x20(%rbp), %rax
movq $0x77359400, 0x20(%rax) # imm = 0x77359400
cmpq $0x0, -0x10(%rbp)
jle 0x168098
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jle 0x168074
movq -0x20(%rbp), %rdi
callq 0x1680c0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x15b780
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x70(%rax)
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1680b0
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x168120
movq -0x20(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: do_on_dbuf_size_exceeded
static void do_on_dbuf_size_exceeded(dbuf *f)
{
	de_err(f->c, "Maximum %s size of %"I64_FMT" bytes exceeded",
		(f->btype==DBUF_TYPE_MEMBUF)?"membuf":"output file",
		f->max_len_hard);
	de_fatalerror(f->c);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movl (%rax), %ecx
leaq 0x52ceb(%rip), %rdx     # 0x1badcc
leaq 0x6cef8(%rip), %rax     # 0x1d4fe0
cmpl $0x3, %ecx
cmoveq %rax, %rdx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rcx
leaq 0x6cebc(%rip), %rsi     # 0x1d4fba
movb $0x0, %al
callq 0x15bfb0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x15c250
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_writebyte
void dbuf_writebyte(dbuf *f, u8 n)
{
	// Optimization
	if(f->wbuffer && f->wbuffer_bytes_used<DE_WBUFFER_SIZE) {
		f->wbuffer[f->wbuffer_bytes_used++] = n;
		return;
	}

	dbuf_write(f, &n, 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x1683ce
movq -0x8(%rbp), %rax
cmpq $0x200, 0x40(%rax)      # imm = 0x200
jge 0x1683ce
movb -0x9(%rbp), %dl
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x8(%rbp), %rsi
movq 0x40(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x40(%rsi)
movb %dl, (%rax,%rcx)
jmp 0x1683e0
movq -0x8(%rbp), %rdi
leaq -0x9(%rbp), %rsi
movl $0x1, %edx
callq 0x166170
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: membuf_append
static void membuf_append(dbuf *f, const u8 *m, i64 mlen)
{
	i64 new_alloc_size;

	if(f->has_len_limit) {
		if(f->len + mlen > f->len_limit) {
			mlen = f->len_limit - f->len;
		}
	}

	if(mlen<=0) return;

	if(mlen > f->membuf_alloc - f->len) {
		// Need to allocate more space
		new_alloc_size = (f->membuf_alloc + mlen)*2;
		if(new_alloc_size<1024) new_alloc_size=1024;
		if(new_alloc_size > f->max_len_hard) new_alloc_size = f->max_len_hard;
		if(f->c->debug_level>=4) {
			de_dbgx(f->c, 4, "increasing membuf size %"I64_FMT" -> %"I64_FMT,
				f->membuf_alloc, new_alloc_size);
		}
		if(f->len + mlen > f->max_len_hard) {
			do_on_dbuf_size_exceeded(f);
		}
		f->membuf_buf = de_realloc(f->c, f->membuf_buf, f->membuf_alloc, new_alloc_size);
		f->membuf_alloc = new_alloc_size;
	}

	de_memcpy(&f->membuf_buf[f->len], m, (size_t)mlen);
	f->len += mlen;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x30(%rax)
je 0x16866a
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
addq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x28(%rcx), %rax
jle 0x168668
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x8(%rbp), %rcx
subq 0x18(%rcx), %rax
movq %rax, -0x18(%rbp)
jmp 0x16866a
cmpq $0x0, -0x18(%rbp)
jg 0x168676
jmp 0x16878a
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x70(%rcx), %rcx
movq -0x8(%rbp), %rdx
subq 0x18(%rdx), %rcx
cmpq %rcx, %rax
jle 0x16875d
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
addq -0x18(%rbp), %rax
shlq %rax
movq %rax, -0x20(%rbp)
cmpq $0x400, -0x20(%rbp)     # imm = 0x400
jge 0x1686b8
movq $0x400, -0x20(%rbp)     # imm = 0x400
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jle 0x1686d2
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x4, (%rax)
jl 0x168706
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rcx
movq -0x20(%rbp), %r8
movl $0x4, %esi
leaq 0x6c93f(%rip), %rdx     # 0x1d503e
movb $0x0, %al
callq 0x15b4b0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
addq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jle 0x168725
movq -0x8(%rbp), %rdi
callq 0x1680c0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rdx
movq -0x20(%rbp), %rcx
callq 0x15c570
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdi
movq -0x8(%rbp), %rax
addq 0x18(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x191e0
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0x18(%rax), %rcx
movq %rcx, 0x18(%rax)
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_writebyte_at
void dbuf_writebyte_at(dbuf *f, i64 pos, u8 n)
{
	if(f->btype==DBUF_TYPE_MEMBUF && pos>=0 && pos<f->len) {
		// Fast path when overwriting a byte in a membuf
		f->membuf_buf[pos] = n;
		return;
	}

	dbuf_write_at(f, pos, &n, 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x1687d7
cmpq $0x0, -0x10(%rbp)
jl 0x1687d7
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jge 0x1687d7
movb -0x11(%rbp), %dl
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movq -0x10(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x1687ed
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x11(%rbp), %rdx
movl $0x1, %ecx
callq 0x1683f0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_write_run
void dbuf_write_run(dbuf *f, u8 n, i64 len)
{
	u8 buf[1024];
	i64 amt_left;
	i64 amt_to_write;

	if(len<=0) return;
	de_memset(buf, n, (size_t)len<sizeof(buf) ? (size_t)len : sizeof(buf));
	amt_left = len;
	while(amt_left > 0) {
		if(amt_left < (i64)sizeof(buf))
			amt_to_write = amt_left;
		else
			amt_to_write = (i64)sizeof(buf);
		dbuf_write(f, buf, amt_to_write);
		amt_left -= amt_to_write;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq %rdx, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jg 0x168825
jmp 0x1688ec
leaq -0x420(%rbp), %rax
movq %rax, -0x440(%rbp)
movzbl -0x9(%rbp), %eax
movb %al, -0x431(%rbp)
cmpq $0x400, -0x18(%rbp)     # imm = 0x400
jae 0x168854
movq -0x18(%rbp), %rax
movq %rax, -0x448(%rbp)
jmp 0x168862
movl $0x400, %eax            # imm = 0x400
movq %rax, -0x448(%rbp)
jmp 0x168862
movb -0x431(%rbp), %al
movq -0x440(%rbp), %rdi
movq -0x448(%rbp), %rdx
movzbl %al, %esi
callq 0x19140
movq -0x18(%rbp), %rax
movq %rax, -0x428(%rbp)
cmpq $0x0, -0x428(%rbp)
jle 0x1688ec
cmpq $0x400, -0x428(%rbp) # imm = 0x400
jge 0x1688b0
movq -0x428(%rbp), %rax
movq %rax, -0x430(%rbp)
jmp 0x1688bb
movq $0x400, -0x430(%rbp) # imm = 0x400
movq -0x8(%rbp), %rdi
leaq -0x420(%rbp), %rsi
movq -0x430(%rbp), %rdx
callq 0x166170
movq -0x430(%rbp), %rcx
movq -0x428(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x428(%rbp)
jmp 0x168889
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_truncate
void dbuf_truncate(dbuf *f, i64 desired_len)
{
	dbuf_flush(f);
	if(desired_len<0) desired_len=0;
	if(desired_len>f->len) {
		dbuf_write_zeroes(f, desired_len - f->len);
	}
	else if(desired_len<f->len) {
		if(f->btype==DBUF_TYPE_MEMBUF || f->btype==DBUF_TYPE_CUSTOM) {
			f->len = desired_len;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x167c30
cmpq $0x0, -0x10(%rbp)
jge 0x168928
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jle 0x16894d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rax
subq 0x18(%rax), %rsi
callq 0x1685f0
jmp 0x16897d
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jge 0x16897b
movq -0x8(%rbp), %rax
cmpl $0x3, (%rax)
je 0x16896d
movq -0x8(%rbp), %rax
cmpl $0x9, (%rax)
jne 0x168979
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x16897b
jmp 0x16897d
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: de_writeu32be_direct
void de_writeu32be_direct(u8 *m, i64 n)
{
	m[0] = (u8)((n & 0xff000000)>>24);
	m[1] = (u8)((n & 0x00ff0000)>>16);
	m[2] = (u8)((n & 0x0000ff00)>>8);
	m[3] = (u8)(n & 0x000000ff);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movabsq $0xff000000, %rax       # imm = 0xFF000000
andq -0x10(%rbp), %rax
sarq $0x18, %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movq -0x10(%rbp), %rax
andq $0xff0000, %rax         # imm = 0xFF0000
sarq $0x10, %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x10(%rbp), %rax
andq $0xff00, %rax           # imm = 0xFF00
sarq $0x8, %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x10(%rbp), %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x3(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_open_input_file
dbuf *dbuf_open_input_file(deark *c, const char *fn)
{
	dbuf *f;
	unsigned int returned_flags = 0;
	char msgbuf[200];

	if(!fn) {
		c->serious_error_flag = 1;
		return NULL;
	}
	f = create_dbuf_lowlevel(c);
	f->btype = DBUF_TYPE_IFILE;
	f->rcache_policy = DE_RCACHE_POLICY_ENABLED;

	f->fp = de_fopen_for_read(c, fn, &f->len, msgbuf, sizeof(msgbuf), &returned_flags);

	if(!f->fp) {
		de_err(c, "Can't read %s: %s", fn, msgbuf);
		de_free(c, f);
		c->serious_error_flag = 1;
		return NULL;
	}

	if(returned_flags & 0x1) {
		// This "file" is actually a pipe.
		f->btype = DBUF_TYPE_FIFO;
		f->rcache_policy = DE_RCACHE_POLICY_NONE;
		populate_rcache_from_pipe(f);
	}

	if(!f->rcache && f->rcache_policy==DE_RCACHE_POLICY_ENABLED) {
		populate_rcache(f);
	}

	return f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x168e16
movq -0x10(%rbp), %rax
movb $0x1, 0x4c(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x168f0b
movq -0x10(%rbp), %rdi
callq 0x167ad0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
movq -0x20(%rbp), %rax
movl $0x1, 0xb8(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
addq $0x18, %rdx
leaq -0xf0(%rbp), %rcx
movl $0xc8, %r8d
leaq -0x24(%rbp), %r9
callq 0x18fa30
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x168eb3
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0xf0(%rbp), %rcx
leaq 0x6c02e(%rip), %rsi     # 0x1d4ebb
movb $0x0, %al
callq 0x15bfb0
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x15b820
movq -0x10(%rbp), %rax
movb $0x1, 0x4c(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x168f0b
movl -0x24(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x168edf
movq -0x20(%rbp), %rax
movl $0x7, (%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0xb8(%rax)
movq -0x20(%rbp), %rdi
callq 0x168f20
movq -0x20(%rbp), %rax
cmpq $0x0, 0xc8(%rax)
jne 0x168f03
movq -0x20(%rbp), %rax
cmpl $0x1, 0xb8(%rax)
jne 0x168f03
movq -0x20(%rbp), %rdi
callq 0x1690a0
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: populate_rcache_from_pipe
static void populate_rcache_from_pipe(dbuf *f)
{
	FILE *fp;
	i64 cache_bytes_alloc = 0;

	if(f->btype==DBUF_TYPE_STDIN) {
		fp = stdin;
	}
	else if(f->btype==DBUF_TYPE_FIFO) {
		fp = f->fp;
	}
	else {
		return;
	}

	f->rcache_bytes_used = 0;

	while(1) {
		i64 bytes_to_read, bytes_read;

		if(f->rcache_bytes_used >= cache_bytes_alloc) {
			i64 old_cache_size, new_cache_size;

			// Cache is full. Increase its size.
			old_cache_size = cache_bytes_alloc;
			new_cache_size = old_cache_size*2;
			if(new_cache_size<DE_RCACHE_SIZE) new_cache_size = DE_RCACHE_SIZE;
			f->rcache = de_realloc(f->c, f->rcache, old_cache_size, new_cache_size);
			cache_bytes_alloc = new_cache_size;
		}

		// Try to read as many bytes as it would take to fill the cache.
		bytes_to_read = cache_bytes_alloc - f->rcache_bytes_used;
		if(bytes_to_read<1) break; // Shouldn't happen

		bytes_read = fread(&f->rcache[f->rcache_bytes_used], 1, (size_t)bytes_to_read, fp);
		if(bytes_read<1 || bytes_read>bytes_to_read) break;
		f->rcache_bytes_used += bytes_read;
		if(feof(fp) || ferror(fp)) break;
	}

	f->len = f->rcache_bytes_used;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x6, (%rax)
jne 0x168f4d
movq 0xbc094(%rip), %rax     # 0x224fd8
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x168f6b
movq -0x8(%rbp), %rax
cmpl $0x7, (%rax)
jne 0x168f64
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x168f69
jmp 0x16908d
jmp 0x168f6b
movq -0x8(%rbp), %rax
movq $0x0, 0xc0(%rax)
movq -0x8(%rbp), %rax
movq 0xc0(%rax), %rax
cmpq -0x18(%rbp), %rax
jl 0x168fe6
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
shlq %rax
movq %rax, -0x38(%rbp)
cmpq $0x40000, -0x38(%rbp)   # imm = 0x40000
jge 0x168fb0
movq $0x40000, -0x38(%rbp)   # imm = 0x40000
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0xc8(%rax), %rsi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x15c570
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xc8(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
subq 0xc0(%rcx), %rax
movq %rax, -0x20(%rbp)
cmpq $0x1, -0x20(%rbp)
jge 0x169002
jmp 0x16907a
movq -0x8(%rbp), %rax
movq 0xc8(%rax), %rdi
movq -0x8(%rbp), %rax
addq 0xc0(%rax), %rdi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rcx
movl $0x1, %esi
callq 0x19080
movq %rax, -0x28(%rbp)
cmpq $0x1, -0x28(%rbp)
jl 0x16903f
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jle 0x169041
jmp 0x16907a
movq -0x28(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0xc0(%rax), %rcx
movq %rcx, 0xc0(%rax)
movq -0x10(%rbp), %rdi
callq 0x191c0
cmpl $0x0, %eax
jne 0x169073
movq -0x10(%rbp), %rdi
callq 0x19060
cmpl $0x0, %eax
je 0x169075
jmp 0x16907a
jmp 0x168f7a
movq -0x8(%rbp), %rax
movq 0xc0(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: populate_rcache
static void populate_rcache(dbuf *f)
{
	i64 bytes_to_read;
	i64 bytes_read;

	if(f->btype!=DBUF_TYPE_IFILE) return;

	bytes_to_read = DE_RCACHE_SIZE;
	if(f->len < bytes_to_read) {
		bytes_to_read = f->len;
	}

	f->rcache = de_malloc(f->c, DE_RCACHE_SIZE);
	de_fseek(f->fp, 0, SEEK_SET);
	bytes_read = fread(f->rcache, 1, (size_t)bytes_to_read, f->fp);
	f->rcache_bytes_used = bytes_read;
	f->file_pos_known = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x1, (%rax)
je 0x1690ba
jmp 0x16914e
movq $0x40000, -0x10(%rbp)   # imm = 0x40000
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
cmpq -0x10(%rbp), %rax
jge 0x1690dc
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x40000, %esi          # imm = 0x40000
callq 0x15b780
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xc8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x18fdf0
movq -0x8(%rbp), %rax
movq 0xc8(%rax), %rdi
movq -0x10(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
movl $0x1, %esi
callq 0x19080
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xc0(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x34(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_open_input_stdin
dbuf *dbuf_open_input_stdin(deark *c)
{
	dbuf *f;

	f = create_dbuf_lowlevel(c);
	f->btype = DBUF_TYPE_STDIN;

	// Set to NONE, to make sure we don't try to auto-populate the cache later.
	f->rcache_policy = DE_RCACHE_POLICY_NONE;

	populate_rcache_from_pipe(f);

	return f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x167ad0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0x6, (%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0xb8(%rax)
movq -0x10(%rbp), %rdi
callq 0x168f20
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_open_input_subfile
dbuf *dbuf_open_input_subfile(dbuf *parent, i64 offset, i64 size)
{
	dbuf *f;
	deark *c;

	c = parent->c;
	f = create_dbuf_lowlevel(c);
	f->btype = DBUF_TYPE_IDBUF;
	f->parent_dbuf = parent;
	f->offset_into_parent_dbuf = offset;
	f->len = size;
	return f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x167ad0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x4, (%rax)
movq -0x8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_create_custom_dbuf
dbuf *dbuf_create_custom_dbuf(deark *c, i64 apparent_size, unsigned int flags)
{
	dbuf *f;

	f = create_dbuf_lowlevel(c);
	f->btype = DBUF_TYPE_CUSTOM;
	f->len = apparent_size;
	f->max_len_hard = DE_DUMMY_MAX_FILE_SIZE;
	return f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
callq 0x167ad0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x9, (%rax)
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movabsq $0x100000000000000, %rcx # imm = 0x100000000000000
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_search
int dbuf_search(dbuf *f, const u8 *needle, i64 needle_len,
	i64 startpos, i64 haystack_len, i64 *foundpos)
{
	int retval = 0;
	struct search_ctx sctx;

	*foundpos = 0;

	if(startpos < 0) {
		haystack_len += startpos;
		if(haystack_len < 0) {
			goto done;
		}
		startpos = 0;
	}
	if(startpos > f->len) {
		goto done;
	}
	if(haystack_len > f->len - startpos) {
		haystack_len = f->len - startpos;
	}
	if(needle_len > haystack_len) {
		goto done;
	}
	if(needle_len > DE_BUFFERED_READ_MIN_BLKSIZE) {
		goto done;
	}
	if(needle_len<1) {
		retval = 1;
		*foundpos = startpos;
		goto done;
	}

	de_zeromem(&sctx, sizeof(struct search_ctx));
	sctx.needle = needle;
	sctx.needle_len = needle_len;
	(void)dbuf_buffered_read(f, startpos, haystack_len, search_cbfn, (void*)&sctx);
	if(sctx.foundflag) {
		*foundpos = startpos + sctx.foundpos_rel;
		retval = 1;
	}

done:
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
cmpq $0x0, -0x20(%rbp)
jge 0x1693c9
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jge 0x1693c1
jmp 0x169491
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jle 0x1693dc
jmp 0x169491
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
subq -0x20(%rbp), %rcx
cmpq %rcx, %rax
jle 0x169401
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
subq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x28(%rbp), %rax
jle 0x169410
jmp 0x169491
cmpq $0x400, -0x18(%rbp)     # imm = 0x400
jle 0x16941c
jmp 0x169491
cmpq $0x1, -0x18(%rbp)
jge 0x169437
movl $0x1, -0x34(%rbp)
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
jmp 0x169491
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x19140
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq 0x36(%rip), %rcx        # 0x1694a0
leaq -0x58(%rbp), %r8
callq 0x166260
cmpl $0x0, -0x48(%rbp)
je 0x16948f
movq -0x20(%rbp), %rcx
addq -0x40(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x34(%rbp)
jmp 0x169491
movl -0x34(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: search_cbfn
static int search_cbfn(struct de_bufferedreadctx *brctx, const u8 *buf,
	i64 buf_len)
{
	struct search_ctx *sctx = (struct search_ctx*)brctx->userdata;
	i64 i;
	i64 num_starting_positions_to_check;

	if(buf_len < sctx->needle_len) return 0;
	num_starting_positions_to_check = buf_len + 1 - sctx->needle_len;

	for(i=0; i<num_starting_positions_to_check; i++) {
		if(sctx->needle[0]==buf[i] &&
			!de_memcmp(sctx->needle, &buf[i], (size_t)sctx->needle_len))
		{
			sctx->foundpos_rel = brctx->offset+i;
			sctx->foundflag = 1;
			return 0;
		}
	}

	if(brctx->eof_flag) return 0;
	brctx->bytes_consumed = num_starting_positions_to_check;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x1694d9
movl $0x0, -0x4(%rbp)
jmp 0x169598
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq -0x28(%rbp), %rcx
subq 0x8(%rcx), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
jge 0x169572
movq -0x28(%rbp), %rax
movq (%rax), %rax
movzbl (%rax), %eax
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x169562
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x19170
cmpl $0x0, %eax
jne 0x169562
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
addq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movl $0x1, 0x10(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x169598
jmp 0x169564
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1694f5
movq -0x10(%rbp), %rax
cmpb $0x0, 0x20(%rax)
je 0x169585
movl $0x0, -0x4(%rbp)
jmp 0x169598
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_get_utf16_NULterm_len
int dbuf_get_utf16_NULterm_len(dbuf *f, i64 pos1, i64 bytes_avail,
	i64 *bytes_consumed)
{
	i64 x;
	i64 pos = pos1;

	*bytes_consumed = bytes_avail;
	while(1) {
		if(pos1+bytes_avail-pos < 2) {
			break;
		}
		x = dbuf_getu16le(f, pos);
		pos += 2;
		if(x==0) {
			*bytes_consumed = pos - pos1;
			return 1;
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
addq -0x20(%rbp), %rax
subq -0x38(%rbp), %rax
cmpq $0x2, %rax
jge 0x1695ef
jmp 0x16962d
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x165280
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x16962b
movq -0x38(%rbp), %rcx
subq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x169634
jmp 0x1695db
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)