// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/cpio.c
// Function: de_run_cpio
static void de_run_cpio(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	const char *subfmt_name;
	i64 bytes_consumed;
	i64 pos;
	int ret;

	d = de_malloc(c, sizeof(lctx));

	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_UTF8);

	pos = 0;

	if(identify_cpio_internal(c, pos, &d->first_subfmt)==0) {
		de_err(c, "Not a cpio file, or unknown cpio format");
		goto done;
	}

	subfmt_name = get_subfmt_name(d->first_subfmt);
	de_declare_fmtf(c, "cpio %s", subfmt_name);

	d->crco_cksum = de_crcobj_create(c, DE_CRCOBJ_SUM_BYTES);

	while(1) {
		if(d->trailer_found) break;
		if(pos >= c->infile->len) break;
		bytes_consumed = 0;
		ret = read_member(c, d, pos, &bytes_consumed);
		if(!ret) break;
		if(bytes_consumed<1) break;
		pos += bytes_consumed;
	}

done:
	if(d) {
		de_crcobj_destroy(d->crco_cksum);
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
pushq $0x18
popq %rsi
callq 0xdecaf
movq %rax, %r14
pushq $0x2
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe08d2
movl %eax, 0x8(%r14)
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x3dd58
testl %eax, %eax
je 0x3d636
movl (%r14), %eax
decl %eax
cmpl $0x4, %eax
ja 0x3d66a
movl %eax, %eax
leaq 0xcfbbb(%rip), %rcx     # 0x10d1e8
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
jmp 0x3d671
leaq 0xcfbd1(%rip), %rsi     # 0x10d20e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
movq 0x10(%r14), %rdi
callq 0xe0e8d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xded32
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe1870(%rip), %rdx     # 0x11eee1
leaq 0xcfbbe(%rip), %rsi     # 0x10d236
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe0824
pushq $0x30
popq %rsi
movq %rbx, %rdi
callq 0xe0ae9
movq %rax, 0x10(%r14)
xorl %r13d, %r13d
movq %r14, 0x10(%rsp)
cmpl $0x0, 0x4(%r14)
jne 0x3d647
movq 0x18(%rbx), %rax
cmpq 0x18(%rax), %r13
jge 0x3d647
movq %rbx, %rdi
leaq 0x1c(%rsp), %rsi
callq 0xdebae
movq %rbx, %rdi
leaq 0xf11ac(%rip), %rsi     # 0x12e86d
movq %r13, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rbp
movl %ebp, %esi
callq 0xdeba7
movq %rbx, %rdi
leaq 0xcfbbf(%rip), %rsi     # 0x10d2a1
movq %r13, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
movl %ebp, %esi
callq 0xdeba7
movq %rbx, %rdi
pushq $0x60
popq %rsi
callq 0xdecaf
movq %rax, %r15
movq %r13, 0x8(%rax)
movq %rbx, %rdi
callq 0xdfd1a
movq %rax, 0x50(%r15)
movb $0x1, 0xc(%rax)
movq 0x8(%r15), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x3dd58
movl (%r15), %eax
decl %eax
cmpl $0x4, %eax
ja 0x3db89
leaq 0xcfa98(%rip), %rcx     # 0x10d1d4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%r15), %r12
leaq 0x6(%r12), %rsi
movq 0x18(%rbx), %rdi
pushq $0x8
popq %r14
movq %r14, %rdx
pushq $0x10
popq %rcx
leaq 0x8(%rsp), %r8
callq 0xe4553
testl %eax, %eax
je 0x3da6c
movl 0x8(%rsp), %edx
movq %rbx, %rdi
leaq 0xcfc14(%rip), %rsi     # 0x10d390
xorl %eax, %eax
callq 0xde896
leaq 0xe(%r12), %rsi
movq 0x18(%rbx), %rdi
leaq 0x38(%r15), %rbp
movq %r14, %rdx
pushq $0x10
popq %rcx
movq %rbp, %r8
callq 0xe4553
testl %eax, %eax
je 0x3da6c
movl (%rbp), %edx
movq %rbx, %rdi
leaq 0xcfbe7(%rip), %rsi     # 0x10d39a
xorl %eax, %eax
callq 0xde896
leaq 0x2e(%r12), %rsi
movq 0x18(%rbx), %rdi
movq %r14, %rdx
pushq $0x10
popq %rcx
movq %rsp, %r8
callq 0xe4553
testl %eax, %eax
je 0x3da6c
movq (%rsp), %rdi
movq 0x50(%r15), %rsi
addq $0x18, %rsi
pushq $0x1
popq %rdx
callq 0xe002e
movq 0x50(%r15), %rdi
addq $0x18, %rdi
leaq 0x20(%rsp), %r14
movq %r14, %rsi
pushq $0x40
popq %rdx
xorl %ecx, %ecx
callq 0xe0644
movl (%rsp), %edx
movq %rbx, %rdi
leaq 0xcfb9a(%rip), %rsi     # 0x10d3ae
movq %r14, %rcx
pushq $0x8
popq %r14
xorl %eax, %eax
callq 0xde896
leaq 0x36(%r12), %rsi
movq 0x18(%rbx), %rdi
leaq 0x28(%r15), %r8
movq %r14, %rdx
pushq $0x10
popq %rcx
callq 0xe4553
testl %eax, %eax
je 0x3da6c
movl 0x28(%r15), %edx
movq %rbx, %rdi
leaq 0xcfb7e(%rip), %rsi     # 0x10d3ce
xorl %eax, %eax
callq 0xde896
leaq 0x5e(%r12), %rsi
movq 0x18(%rbx), %rdi
movq %r15, %r8
addq $0x18, %r8
movq %r14, %rdx
pushq $0x10
popq %rcx
callq 0xe4553
testl %eax, %eax
je 0x3da6c
movl 0x18(%r15), %edx
movq %rbx, %rdi
leaq 0xcfb37(%rip), %rsi     # 0x10d3bf
xorl %eax, %eax
callq 0xde896
cmpl $0x5, (%r15)
jne 0x3d8cf
leaq 0x66(%r12), %rsi
movq 0x18(%rbx), %rdi
movq %r14, %rdx
pushq $0x10
popq %rcx
leaq 0x8(%rsp), %r8
callq 0xe4553
testl %eax, %eax
je 0x3da6c
movl 0x8(%rsp), %edx
movl %edx, 0x40(%r15)
movq %rbx, %rdi
leaq 0xcfb15(%rip), %rsi     # 0x10d3dd
xorl %eax, %eax
callq 0xde896
subq 0x8(%r15), %r12
addq $0x6e, %r12
movq %r12, 0x10(%r15)
addq 0x18(%r15), %r12
movq %r12, %rdi
callq 0xdfb90
subq 0x10(%r15), %rax
movq %rax, 0x20(%r15)
movq 0x28(%r15), %rdi
callq 0xdfb90
movq %rax, 0x30(%r15)
jmp 0x3da6c
movq 0x8(%r15), %rbp
leaq 0xc(%rbp), %rsi
movq 0x18(%rbx), %rdi
pushq $0x6
popq %rdx
pushq $0x8
popq %r14
movl %r14d, %ecx
leaq 0x8(%rsp), %r8
callq 0xe4553
testl %eax, %eax
je 0x3da6c
movl 0x8(%rsp), %edx
movq %rbx, %rdi
leaq 0xcfa59(%rip), %rsi     # 0x10d390
xorl %eax, %eax
callq 0xde896
leaq 0x12(%rbp), %rsi
movq 0x18(%rbx), %rdi
leaq 0x38(%r15), %r12
pushq $0x6
popq %rdx
movl %r14d, %ecx
movq %r12, %r8
callq 0xe4553
testl %eax, %eax
je 0x3da6c
movl (%r12), %edx
movq %rbx, %rdi
leaq 0xcfa2c(%rip), %rsi     # 0x10d39a
xorl %eax, %eax
callq 0xde896
leaq 0x30(%rbp), %rsi
movq 0x18(%rbx), %rdi
pushq $0xb
popq %rdx
movl %r14d, %ecx
movq %rsp, %r8
callq 0xe4553
testl %eax, %eax
je 0x3da6c
movq (%rsp), %rdi
movq 0x50(%r15), %rsi
addq $0x18, %rsi
pushq $0x1
popq %rdx
callq 0xe002e
movq 0x50(%r15), %rdi
addq $0x18, %rdi
leaq 0x20(%rsp), %r12
movq %r12, %rsi
pushq $0x40
popq %rdx
xorl %ecx, %ecx
callq 0xe0644
movl (%rsp), %edx
movq %rbx, %rdi
leaq 0xcf9e0(%rip), %rsi     # 0x10d3ae
movq %r12, %rcx
xorl %eax, %eax
callq 0xde896
leaq 0x3b(%rbp), %rsi
movq 0x18(%rbx), %rdi
leaq 0x18(%r15), %r8
pushq $0x6
popq %rdx
movl %r14d, %ecx
callq 0xe4553
testl %eax, %eax
je 0x3da6c
movl 0x18(%r15), %edx
movq %rbx, %rdi
leaq 0xcf9be(%rip), %rsi     # 0x10d3bf
xorl %eax, %eax
callq 0xde896
leaq 0x41(%rbp), %rsi
movq 0x18(%rbx), %rdi
movq %r15, %r8
addq $0x28, %r8
pushq $0xb
popq %rdx
movl %r14d, %ecx
callq 0xe4553
testl %eax, %eax
je 0x3da6c
movl 0x28(%r15), %edx
movq %rbx, %rdi
leaq 0xcf99a(%rip), %rsi     # 0x10d3ce
xorl %eax, %eax
callq 0xde896
subq 0x8(%r15), %rbp
addq $0x4c, %rbp
movq %rbp, 0x10(%r15)
movq 0x18(%r15), %rax
movq 0x28(%r15), %rcx
movq %rax, 0x20(%r15)
movq %rcx, 0x30(%r15)
jmp 0x3da6c
movl $0x1, 0x4(%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3de11
movq %rbx, %rdi
pushq $-0x1
popq %r14
movl %r14d, %esi
callq 0xdeba7
movq 0x10(%r15), %rdx
addq 0x8(%r15), %rdx
movq %rbx, %rdi
leaq 0xcf843(%rip), %rsi     # 0x10d2d0
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rbp
movl %ebp, %esi
callq 0xdeba7
movq 0x10(%r15), %rsi
movq 0x18(%r15), %rcx
cmpq $0x2, %rcx
pushq $0x1
popq %rax
cmovlq %rax, %rcx
movl $0x1f5, %eax            # imm = 0x1F5
cmpq %rax, %rcx
cmovgeq %rax, %rcx
decq %rcx
movq 0x18(%rbx), %rdi
addq 0x8(%r15), %rsi
movq 0x10(%rsp), %rax
movl 0x8(%rax), %r9d
movq %rcx, %rdx
xorl %r8d, %r8d
callq 0xe495c
movq %rax, 0x48(%r15)
movq 0x18(%rax), %rdi
callq 0xeb7e4
movq %rbx, %rdi
leaq 0xd7ac5(%rip), %rsi     # 0x1155bb
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x10(%r15), %r12
addq 0x8(%r15), %r12
addq 0x20(%r15), %r12
movq %rbx, %rdi
movl %r14d, %esi
callq 0xdeba7
movq 0x28(%r15), %rcx
movq %rbx, %rdi
leaq 0xcf7be(%rip), %rsi     # 0x10d2e3
movq %r12, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
movl %ebp, %esi
callq 0xdeba7
movq 0x28(%r15), %rax
addq %r12, %rax
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jle 0x3db59
movb $0x1, %r12b
xorl %ebp, %ebp
movq 0x10(%rsp), %r14
jmp 0x3dcc1
movq 0x38(%r15), %rax
movl %eax, %ecx
andl $0xf000, %ecx           # imm = 0xF000
cmpw $0x4000, %cx            # imm = 0x4000
je 0x3dba3
cmpl $0x8000, %ecx           # imm = 0x8000
movq 0x10(%rsp), %r14
jne 0x3dbb5
movq 0x50(%r15), %rsi
movl 0x14(%rsi), %ecx
testb $0x49, %al
je 0x3dbf8
orl $0x2, %ecx
jmp 0x3dbfb
movq 0x8(%r15), %rdx
movq %rbx, %rdi
leaq 0xcf71e(%rip), %rsi     # 0x10d2b5
xorl %eax, %eax
callq 0xdf2a5
movb $0x1, %r12b
jmp 0x3dbf1
movq 0x50(%r15), %rsi
movb $0x1, 0x9(%rsi)
pushq $0x3
popq %rcx
movq 0x10(%rsp), %r14
jmp 0x3dc01
testq %rax, %rax
jne 0x3dbdd
cmpq $0xb, 0x18(%r15)
jne 0x3dbdd
movq 0x48(%r15), %rax
movq 0x8(%rax), %rdi
leaq 0xcf72f(%rip), %rsi     # 0x10d2ff
callq 0x181a0
testl %eax, %eax
je 0x3dd28
xorl %r12d, %r12d
movq %rbx, %rdi
leaq 0xcf73b(%rip), %rsi     # 0x10d325
xorl %eax, %eax
callq 0xde896
xorl %ebp, %ebp
jmp 0x3dcc1
orl $0x1, %ecx
movl %ecx, 0x14(%rsi)
pushq $0x1
popq %rcx
movq 0x48(%r15), %rax
movq 0x18(%rax), %rdx
movq %rbx, %rdi
callq 0xdfd55
movq 0x50(%r15), %rdx
movb $0x1, 0x8(%rdx)
movq %rbx, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, %rbp
cmpl $0x5, (%r15)
jne 0x3dc4a
movq 0x10(%r14), %rdi
callq 0xe0e44
movq 0x10(%r14), %rdx
movq %rbp, %rdi
leaq 0xa867c(%rip), %rsi     # 0xe62c1
callq 0xe629a
movq 0x18(%rbx), %rdi
movq 0x28(%r15), %rdx
movq %r12, %rsi
movq %rbp, %rcx
callq 0xe45f4
cmpl $0x5, (%r15)
jne 0x3dcbe
movq 0x10(%r14), %rdi
callq 0xe0e95
movl %eax, 0x58(%r15)
xorl %r12d, %r12d
movq %rbx, %rdi
leaq 0xcf6c8(%rip), %rsi     # 0x10d345
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movl 0x58(%r15), %eax
cmpl 0x40(%r15), %eax
je 0x3dcc1
movq 0x48(%r15), %rax
movq 0x18(%rax), %rdi
callq 0xeb877
movl 0x40(%r15), %ecx
movl 0x58(%r15), %r8d
xorl %r12d, %r12d
movq %rbx, %rdi
leaq 0xcf6ad(%rip), %rsi     # 0x10d35f
movq %rax, %rdx
xorl %eax, %eax
callq 0xdf05a
jmp 0x3dcc1
xorl %r12d, %r12d
movq %rbp, %rdi
callq 0xe5591
testb %r12b, %r12b
je 0x3dcd2
xorl %ebp, %ebp
jmp 0x3dcde
movq 0x20(%r15), %rbp
addq 0x10(%r15), %rbp
addq 0x30(%r15), %rbp
movq 0x48(%r15), %rsi
movq %rbx, %rdi
callq 0xe4b94
movq 0x50(%r15), %rsi
movq %rbx, %rdi
callq 0xdfd24
movq %rbx, %rdi
movq %r15, %rsi
callq 0xded32
movl 0x1c(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
testq %rbp, %rbp
setle %al
orb %al, %r12b
addq %rbp, %r13
cmpb $0x1, %r12b
jne 0x3d699
jmp 0x3d647
xorl %r12d, %r12d
movq %rbx, %rdi
leaq 0xcf5d5(%rip), %rsi     # 0x10d30a
xorl %eax, %eax
callq 0xde896
movl $0x1, 0x4(%r14)
jmp 0x3dbf1