// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/cpio.c
// Function: read_header_binary
static int read_header_binary(deark *c, lctx *d, struct member_data *md)
{
	i64 pos;
	i64 n;
	i64 modtime_msw, modtime_lsw;
	i64 modtime_unix;
	i64 filesize_msw, filesize_lsw;
	int retval = 0;
	char timestamp_buf[64];

	pos = md->startpos;

	pos += 2; // c_magic
	pos += 2; // c_dev

	n = dbuf_getu16x(c->infile, pos, md->is_le);
	de_dbg(c, "c_ino: %d", (int)n);
	pos += 2;

	md->mode = dbuf_getu16x(c->infile, pos, md->is_le);
	de_dbg(c, "c_mode: octal(%06o)", (unsigned int)md->mode);
	pos += 2;

	pos += 2; // c_uid
	pos += 2; // c_gid
	pos += 2; // c_nlink
	pos += 2; // c_rdev

	modtime_msw = dbuf_getu16x(c->infile, pos, md->is_le);
	modtime_lsw = dbuf_getu16x(c->infile, pos+2, md->is_le);
	modtime_unix = (modtime_msw<<16) | modtime_lsw;
	de_unix_time_to_timestamp(modtime_unix, &md->fi->timestamp[DE_TIMESTAMPIDX_MODIFY], 0x1);
	de_timestamp_to_string(&md->fi->timestamp[DE_TIMESTAMPIDX_MODIFY], timestamp_buf, sizeof(timestamp_buf), 0);
	de_dbg(c, "c_mtime: %d (%s)", (int)modtime_unix, timestamp_buf);
	pos += 4;

	md->namesize = dbuf_getu16x(c->infile, pos, md->is_le);
	de_dbg(c, "c_namesize: %d", (int)md->namesize);
	pos += 2;

	filesize_msw = dbuf_getu16x(c->infile, pos, md->is_le);
	filesize_lsw = dbuf_getu16x(c->infile, pos+2, md->is_le);
	md->filesize = (filesize_msw<<16) | filesize_lsw;
	de_dbg(c, "c_filesize: %d", (int)md->filesize);
	pos += 4;

	md->fixed_header_size = pos - md->startpos;
	md->namesize_padded = de_pad_to_2(md->namesize);
	md->filesize_padded = de_pad_to_2(md->filesize);

	retval = 1;
	return retval;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rsi), %r13
leaq 0x4(%r13), %rsi
movq 0x18(%rdi), %rdi
movl 0x4(%rbx), %edx
callq 0xef570
leaq 0xda84a(%rip), %rsi     # 0x11a360
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
leaq 0x6(%r13), %rsi
movq 0x18(%r14), %rdi
movl 0x4(%rbx), %edx
callq 0xef570
movq %rax, 0x38(%rbx)
leaq 0xda82d(%rip), %rsi     # 0x11a36a
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
leaq 0x10(%r13), %rsi
movq 0x18(%r14), %rdi
movl 0x4(%rbx), %edx
callq 0xef570
movq %rax, %r15
movq 0x18(%r14), %rdi
leaq 0x12(%r13), %rsi
movl 0x4(%rbx), %edx
callq 0xef570
shlq $0x10, %r15
orq %rax, %r15
movq 0x50(%rbx), %rsi
addq $0x18, %rsi
movq %r15, %rdi
movl $0x1, %edx
callq 0xeace2
movq 0x50(%rbx), %rdi
addq $0x18, %rdi
movq %rsp, %r12
movl $0x40, %edx
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xeb4f8
leaq 0xda7d5(%rip), %rsi     # 0x11a37e
movq %r14, %rdi
movl %r15d, %edx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe9226
leaq 0x14(%r13), %rsi
movq 0x18(%r14), %rdi
movl 0x4(%rbx), %edx
callq 0xef570
movq %rax, 0x18(%rbx)
leaq 0xda7bb(%rip), %rsi     # 0x11a38f
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
leaq 0x16(%r13), %rsi
movq 0x18(%r14), %rdi
movl 0x4(%rbx), %edx
callq 0xef570
movq %rax, %r15
movq 0x18(%r14), %rdi
leaq 0x18(%r13), %rsi
movl 0x4(%rbx), %edx
callq 0xef570
shlq $0x10, %r15
orq %rax, %r15
movq %r15, 0x28(%rbx)
leaq 0xda789(%rip), %rsi     # 0x11a39e
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe9226
subq 0x8(%rbx), %r13
addq $0x1a, %r13
movq %r13, 0x10(%rbx)
movq 0x18(%rbx), %rdi
callq 0xea7d5
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rdi
callq 0xea7d5
movq %rax, 0x30(%rbx)
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop