// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1018(%rcx), %eax
jge 0xc8b3
movq -0x10(%rbp), %rax
addq $0x1010, %rax           # imm = 0x1010
addq $0x10, %rax
movslq -0x14(%rbp), %rcx
imulq $0x150, %rcx, %rcx      # imm = 0x150
addq %rcx, %rax
movl $0x1, 0x128(%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xc873
movq -0x10(%rbp), %rax
movq 0x1008(%rax), %rdi
callq 0xedf0
movq -0x10(%rbp), %rax
movq 0x1008(%rax), %rdi
callq 0xee60
cmpl $0x0, %eax
je 0xc8fd
leaq 0x18c59(%rip), %rax     # 0x25538
movl (%rax), %edi
movq -0x10(%rbp), %rax
movl (%rax), %edx
leaq 0xfcdf(%rip), %rsi      # 0x1c5cd
movb $0x0, %al
callq 0xcd70
movl %eax, -0x4(%rbp)
jmp 0xca5b
movl $0xfffffff7, -0x14(%rbp) # imm = 0xFFFFFFF7
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x1008(%rcx), %rcx
movq 0x18(%rcx), %rcx
cmpl (%rcx), %eax
jge 0xca54
movq -0x10(%rbp), %rax
movq 0x1008(%rax), %rdi
movl -0x14(%rbp), %esi
callq 0xefe0
movq %rax, -0x28(%rbp)
movl $0x0, -0x18(%rbp)
cmpl $0x3, -0x18(%rbp)
jge 0xca44
cmpq $0x0, -0x28(%rbp)
je 0xca34
movq -0x28(%rbp), %rax
addq $0x78, %rax
movslq -0x18(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
je 0xca34
movq -0x10(%rbp), %rax
movq 0x1008(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x28(%rbp), %rdx
addq $0x50, %rdx
movq -0x28(%rbp), %rcx
addq $0x78, %rcx
movslq -0x18(%rbp), %rax
imulq $0x68, %rax, %rax
addq %rax, %rcx
addq $0x10, %rcx
callq 0xf500
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
addq $0x1010, %rdi           # imm = 0x1010
movq -0x30(%rbp), %rsi
xorl %edx, %edx
callq 0xb1a0
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x140(%rax)
movq -0x28(%rbp), %rax
movl 0x1e8(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x148(%rax)
movl -0x18(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x144(%rax)
movq -0x20(%rbp), %rax
cmpl $0x3, 0x128(%rax)
je 0xca32
movq -0x28(%rbp), %rax
addq $0x78, %rax
movslq -0x18(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
cmpb $0x0, 0x60(%rax)
je 0xca22
movq -0x20(%rbp), %rax
movl $0x2, 0x128(%rax)
jmp 0xca30
movq -0x20(%rbp), %rax
movl $0x0, 0x128(%rax)
jmp 0xca32
jmp 0xca34
jmp 0xca36
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xc93c
jmp 0xca46
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xc904
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)