// File: /workspace/github_c_makefile_star2_O3/j-hoppe[P]tu58fs/hostdir.c
// Function: snapshot_scan_pdpimage
static int snapshot_scan_pdpimage(hostdir_t *_this) {
	int i, j;
	hostdir_file_t *f;

	// see above
	for (i = 0; i < _this->snapshot.file_count; i++)
		_this->snapshot.file[i].state[side_pdp] = fs_missing;

	// not expandle, we're only creating
	// filesystem_create(_this->fs, _this->dec_device, &_this->image_data, &_this->image_data_size,/*expandable*/0) ;

	filesystem_init(_this->pdp_fs);

	// analyse an image
	if (filesystem_parse(_this->pdp_fs))
		return error_set(error_code, "Uint %d: Scanning PDP image", _this->unit);
	// if PDP file system was created with block change map, now changed files are marked
	for (i = -FILESYSTEM_MAX_SPECIALFILE_COUNT; i < *_this->pdp_fs->file_count; i++) {
		file_t *fpdp = filesystem_file_get(_this->pdp_fs, i); // include bootblock & monitor
		// for all streams
		for (j = 0; j < FILESYSTEM_MAX_DATASTREAM_COUNT; j++)
			if (fpdp && fpdp->stream[j].valid) {
				char *fname = filesystem_filename_to_host(_this->pdp_fs, fpdp->filnam,
						fpdp->ext, fpdp->stream[j].name);
				f = snapshot_file_register(&_this->snapshot, fname, side_pdp);
				f->pdp_fileidx = i;
				f->pdp_fixed = fpdp->fixed;
				f->pdp_streamidx = j;
				if (f->state[side_pdp] != fs_created) {
					if (fpdp->stream[j].changed)
						f->state[side_pdp] = fs_changed;
					else
						f->state[side_pdp] = fs_unchanged;
				}
			}
	}
	return ERROR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movslq 0x1018(%rdi), %rax
testq %rax, %rax
jle 0x9c2a
leal 0x3(%rax), %ecx
decq %rax
movq %rax, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl $0x2, %ecx
imulq $0x540, %rcx, %rax      # imm = 0x540
movdqa 0xb7f3(%rip), %xmm1     # 0x15330
movdqa 0xb7fb(%rip), %xmm2     # 0x15340
xorl %ecx, %ecx
movdqa 0xb801(%rip), %xmm3     # 0x15350
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0xb801(%rip), %xmm5     # 0x15360
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %edx
notl %edx
testb $0x1, %dl
je 0x9b9f
movl $0x1, 0x1148(%r14,%rcx)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x9bb9
movl $0x1, 0x1298(%r14,%rcx)
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %edx
testb $0x1, %dl
je 0x9bfc
movl $0x1, 0x13e8(%r14,%rcx)
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x9c12
movl $0x1, 0x1538(%r14,%rcx)
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
addq $0x540, %rcx            # imm = 0x540
cmpq %rcx, %rax
jne 0x9b5f
movq 0x1008(%r14), %rdi
callq 0xb773
movq 0x1008(%r14), %rdi
callq 0xb7b1
testl %eax, %eax
je 0x9c6e
leaq 0x145eb(%rip), %rax     # 0x1e238
movl (%rax), %edi
movl (%r14), %edx
leaq 0xbab3(%rip), %rsi      # 0x1570c
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9f73
movq 0x1008(%r14), %rdi
movq 0x18(%rdi), %rax
cmpl $-0x8, (%rax)
jl 0x9d2c
leaq 0x1010(%r14), %rax
movq %rax, (%rsp)
movl $0xfffffff7, %ebp       # imm = 0xFFFFFFF7
movl %ebp, %esi
callq 0xb8d3
movq %rax, %r15
leaq 0x78(%rax), %r13
leaq 0x50(%rax), %r12
xorl %ebx, %ebx
testq %r15, %r15
je 0x9d0a
cmpl $0x0, (%r13)
je 0x9d0a
movq 0x1008(%r14), %rdi
leaq 0x10(%r13), %rcx
movq %r15, %rsi
movq %r12, %rdx
callq 0xbc0b
movq (%rsp), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x8b3b
movl %ebp, 0x140(%rax)
movl 0x1e8(%r15), %ecx
movl %ecx, 0x148(%rax)
movl %ebx, 0x144(%rax)
cmpl $0x3, 0x128(%rax)
je 0x9d0a
xorl %ecx, %ecx
cmpb $0x0, 0x60(%r13)
setne %cl
addl %ecx, %ecx
movl %ecx, 0x128(%rax)
incq %rbx
addq $0x68, %r13
cmpq $0x3, %rbx
jne 0x9ca6
incl %ebp
movq 0x1008(%r14), %rdi
movq 0x18(%rdi), %rax
cmpl (%rax), %ebp
jl 0x9c92
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq