LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/xxdp.c
// Function: xxdp_blocklist_get
static int xxdp_blocklist_get(xxdp_filesystem_t *_this, xxdp_blocklist_t *bl,
		xxdp_blocknr_t start) {
	xxdp_blocknr_t blocknr = start;
	unsigned n = 0; // count blocks
	do {
		bl->blocknr[n++] = blocknr;
		// follwo link to next block
		blocknr = xxdp_image_get_word(_this, blocknr, 0);
	} while (n < XXDP_MAX_BLOCKS_PER_LIST && blocknr > 0);
	bl->count = n;
	if (blocknr)
		return error_set(ERROR_FILESYSTEM_FORMAT,
				"xxdp_blocklist_get(): block list too long or recursion");
	return ERROR_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %dx, %ax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movw %ax, -0x1a(%rbp)
movw -0x1a(%rbp), %ax
movw %ax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movw -0x1c(%rbp), %dx
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movl %ecx, %ecx
movw %dx, 0x4(%rax,%rcx,2)
movq -0x10(%rbp), %rdi
xorl %edx, %edx
movzwl -0x1c(%rbp), %esi
callq 0x13420
movw %ax, -0x1c(%rbp)
xorl %eax, %eax
cmpl $0x400, -0x20(%rbp)     # imm = 0x400
movb %al, -0x21(%rbp)
jae 0x133de
movzwl -0x1c(%rbp), %eax
cmpl $0x0, %eax
setg %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x13396
movl -0x20(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
cmpw $0x0, -0x1c(%rbp)
je 0x1340d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
leaq 0x9b61(%rip), %rsi      # 0x1cf62
movb $0x0, %al
callq 0xcd70
movl %eax, -0x4(%rbp)
jmp 0x13414
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/xxdp.c
// Function: xxdp_blocklist_set
static void xxdp_blocklist_set(xxdp_filesystem_t *_this, xxdp_blocklist_t *bl) {
	unsigned i;
	for (i = 0; i < (bl->count - 1); i++)
		// write link field of each block with next
		xxdp_image_set_word(_this, bl->blocknr[i], 0, bl->blocknr[i + 1]);
	// clear link field of last block
	xxdp_image_set_word(_this, bl->blocknr[bl->count - 1], 0, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jae 0x1350d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movw 0x4(%rax,%rcx,2), %si
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
xorl %edx, %edx
movzwl %si, %esi
movzwl 0x4(%rax,%rcx,2), %ecx
callq 0x13540
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x134c7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movl %ecx, %edx
xorl %ecx, %ecx
movzwl 0x4(%rax,%rdx,2), %esi
movl %ecx, %edx
callq 0x13540
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/xxdp.c
// Function: xxdp_image_set_word
static void xxdp_image_set_word(xxdp_filesystem_t *_this, xxdp_blocknr_t blocknr,
		uint8_t wordnr, uint16_t val) {
	uint32_t idx = XXDP_BLOCKSIZE * blocknr + (wordnr * 2);
	assert((idx + 1) < _this->image_size);

	_this->image_data[idx] = val & 0xff;
	_this->image_data[idx + 1] = (val >> 8) & 0xff;
	//fprintf(stderr, "set 0x%x to 0x%x\n", idx, val) ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %cx, %ax
movb %dl, %cl
movw %si, %dx
movq %rdi, -0x8(%rbp)
movw %dx, -0xa(%rbp)
movb %cl, -0xb(%rbp)
movw %ax, -0xe(%rbp)
movzwl -0xa(%rbp), %eax
shll $0x9, %eax
movzbl -0xb(%rbp), %ecx
shll %ecx
addl %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jae 0x13582
jmp 0x135a1
leaq 0x9c74(%rip), %rdi      # 0x1d1fd
leaq 0x948b(%rip), %rsi      # 0x1ca1b
movl $0x74, %edx
leaq 0x9c7f(%rip), %rcx      # 0x1d21b
callq 0x3200
movzwl -0xe(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
movb %dl, (%rax,%rcx)
movzwl -0xe(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/xxdp.c
// Function: xxdp_date_text
static char *xxdp_date_text(struct tm t) {
	char *mon[] = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV",
			"DEC" };
	static char buff[80];
	sprintf(buff, "%02d-%3s-%02d", t.tm_mday, mon[t.tm_mon], t.tm_year);
	return buff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq 0xf725(%rip), %rsi      # 0x22d20
movl $0x60, %edx
callq 0x3330
movq -0x68(%rbp), %rax
movl 0xc(%rax), %edx
movslq 0x10(%rax), %rcx
movq -0x60(%rbp,%rcx,8), %rcx
movl 0x14(%rax), %r8d
leaq 0x29940(%rip), %rdi     # 0x3cf60
leaq 0x9fb7(%rip), %rsi      # 0x1d5de
movb $0x0, %al
callq 0x3520
leaq 0x2992b(%rip), %rax     # 0x3cf60
addq $0x70, %rsp
popq %rbp
retq
nop
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_file_create
rt11_file_t *rt11_file_create() {
	rt11_file_t *file = malloc(sizeof(rt11_file_t));
	file->data = NULL;
	file->dir_ext = NULL;
	file->prefix = NULL;
	file->filnam[0] = 0;
	file->ext[0] = 0;
	file->block_count = 0;
	memset(&file->date, 0, sizeof(struct tm));
	file->fixed = 0;
	file->readonly = 0;
	return file;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0xd8, %edi
callq 0x33a0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, 0x80(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x90(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x88(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x2(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x52(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x7c(%rax)
movq -0x8(%rbp), %rdi
addq $0x98, %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x3220
movq -0x8(%rbp), %rax
movl $0x0, 0xd4(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0xd0(%rax)
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: stream_init
static void stream_init(rt11_stream_t *stream) {
	stream->blocknr = 0;
	stream->byte_offset = 0;
	stream->data = NULL;
	stream->data_size = 0;
	stream->name[0] = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw $0x0, (%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x14(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_filesystem_destroy
void rt11_filesystem_destroy(rt11_filesystem_t *_this) {
	rt11_filesystem_init(_this); // free files
#ifdef DEFAULTBOOTLOADER
			free(_this->nobootblock);
#endif

	free(_this->bootblock);
	free(_this->monitor);
	free(_this);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x138b0
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdi
callq 0x3040
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rdi
callq 0x3040
movq -0x8(%rbp), %rdi
callq 0x3040
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_file_destroy
static void rt11_file_destroy(rt11_file_t * file) {
	if (file) {
		stream_destroy(file->data);
		stream_destroy(file->dir_ext);
		stream_destroy(file->prefix);
		free(file);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x13b0c
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rdi
callq 0x16700
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rdi
callq 0x16700
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rdi
callq 0x16700
movq -0x8(%rbp), %rdi
callq 0x3040
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_filesystem_parse
int rt11_filesystem_parse(rt11_filesystem_t *_this) {
	rt11_filesystem_init(_this);

	// read bootblock at 0, length 1 block. may consists of 00's
	// allocates bootblock->data
	stream_parse(_this, _this->bootblock, 0, 0, RT11_BLOCKSIZE);

	// read more boot code from blocks 2..5, length 4 block.
	stream_parse(_this, _this->monitor, 2, 0, 4 * RT11_BLOCKSIZE);

	if (parse_homeblock(_this))
		return error_code;
	if (parse_directory(_this))
		return error_code;

	// image must be patched, but filesystem files always unpatched
	// and directory struct needed to find DD.SYS files
	rt11_filesystem_unpatch(_this); 	// restore original DD[X].SYS

	parse_file_data(_this);

	rt11_filesystem_patch(_this); 	// re-patch iamge

	// rt11_filesystem_print_diag(_this, stderr);

	// mark file->data , ->prefix as changed, for changed image blocks
	rt11_filesystem_mark_filestreams_as_changed(_this);

	return ERROR_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x138b0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rsi
xorl %ecx, %ecx
movl $0x200, %r8d            # imm = 0x200
movl %ecx, %edx
callq 0x13be0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rsi
movl $0x2, %edx
xorl %ecx, %ecx
movl $0x800, %r8d            # imm = 0x800
callq 0x13be0
movq -0x10(%rbp), %rdi
callq 0x13c80
cmpl $0x0, %eax
je 0x13b8d
leaq 0x119b2(%rip), %rax     # 0x25538
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x13bd4
movq -0x10(%rbp), %rdi
callq 0x13e70
cmpl $0x0, %eax
je 0x13ba9
leaq 0x11996(%rip), %rax     # 0x25538
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x13bd4
movq -0x10(%rbp), %rdi
callq 0x14500
movq -0x10(%rbp), %rdi
callq 0x14550
movq -0x10(%rbp), %rdi
callq 0x146f0
movq -0x10(%rbp), %rdi
callq 0x14750
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: stream_parse
static void stream_parse(rt11_filesystem_t *_this, rt11_stream_t *stream, rt11_blocknr_t start,
		uint32_t byte_offset, uint32_t data_size) {
	stream->blocknr = start;
	stream->byte_offset = byte_offset;
	stream->data_size = data_size;
	stream->data = malloc(stream->data_size);
	memcpy(stream->data, IMAGE_BLOCKNR2PTR(_this, start) + byte_offset, stream->data_size);
	stream->name[0] = 0; // must be set by caller
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %dx, %ax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movw -0x12(%rbp), %cx
movq -0x10(%rbp), %rax
movw %cx, (%rax)
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edi
callq 0x33a0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movzwl -0x12(%rbp), %eax
shll $0x9, %eax
cltq
addq %rax, %rsi
movl -0x18(%rbp), %eax
addq %rax, %rsi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
callq 0x3330
movq -0x10(%rbp), %rax
movb $0x0, 0x14(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: parse_file_data
static void parse_file_data(rt11_filesystem_t *_this) {
	int i;
	rt11_blocknr_t prefix_block_count;
	uint8_t *data_ptr;

	for (i = 0; i < _this->file_count; i++) {
		rt11_file_t *f = _this->file[i];
		// fprintf(stderr, "%d %s.%s\n", i, f->filnam, f->ext) ;
		// data area may have "prefix" block.
		// format not mandatory, use DEC recommendation
		if (f->status & RT11_FILE_EPRE) {
			data_ptr = IMAGE_BLOCKNR2PTR(_this, f->block_nr);
			prefix_block_count = *data_ptr; // first byte in block
			// DEC: low byte of first word = blockcount
			assert(f->prefix == NULL);
			f->prefix = stream_create();
			// stream is everything behind first word
			stream_parse(_this, f->prefix, f->block_nr, 2,
					prefix_block_count * RT11_BLOCKSIZE - 2);
			strcpy(f->prefix->name, RT11_STREAMNAME_PREFIX);
		} else
			prefix_block_count = 0;

		// after prefix: remaining blocks are data
		assert(f->data == NULL);
		f->data = stream_create();
		stream_parse(_this, f->data, f->block_nr + prefix_block_count, 0,
				(f->block_count - prefix_block_count) * RT11_BLOCKSIZE);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8c(%rcx), %eax
jge 0x146e5
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq 0x90(%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzwl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x14654
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movzwl 0x7a(%rcx), %ecx
shll $0x9, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
movw %ax, -0xe(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x88(%rax)
jne 0x145d4
jmp 0x145f3
leaq 0x93ee(%rip), %rdi      # 0x1d9c9
leaq 0x9056(%rip), %rsi      # 0x1d638
movl $0x2a3, %edx            # imm = 0x2A3
leaq 0x93ed(%rip), %rcx      # 0x1d9db
callq 0x3200
callq 0x17040
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x88(%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rsi
movq -0x20(%rbp), %rax
movw 0x7a(%rax), %ax
movzwl -0xe(%rbp), %r8d
shll $0x9, %r8d
subl $0x2, %r8d
movl $0x2, %ecx
movzwl %ax, %edx
callq 0x13be0
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rdi
addq $0x14, %rdi
leaq 0x8317(%rip), %rsi      # 0x1c964
callq 0x30c0
jmp 0x1465a
movw $0x0, -0xe(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x80(%rax)
jne 0x1466a
jmp 0x14689
leaq 0x9394(%rip), %rdi      # 0x1da05
leaq 0x8fc0(%rip), %rsi      # 0x1d638
movl $0x2ad, %edx            # imm = 0x2AD
leaq 0x9357(%rip), %rcx      # 0x1d9db
callq 0x3200
callq 0x17040
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x80(%rax), %rsi
movq -0x20(%rbp), %rax
movzwl 0x7a(%rax), %eax
movzwl -0xe(%rbp), %ecx
addl %ecx, %eax
movq -0x20(%rbp), %rcx
movzwl 0x7c(%rcx), %r8d
movzwl -0xe(%rbp), %ecx
subl %ecx, %r8d
shll $0x9, %r8d
xorl %ecx, %ecx
movzwl %ax, %edx
callq 0x13be0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x14563
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_filesystem_mark_filestreams_as_changed
static void rt11_filesystem_mark_filestreams_as_changed(rt11_filesystem_t *_this) {
	int i;
	rt11_blocknr_t blknr;

	if (_this->image_changed_blocks == NULL)
		return;

	// boolarray_print_diag(_this->image_changed_blocks,stderr, _this->blockcount, "RT11") ;
	// bootblock
	rt11_filesystem_mark_filestream_as_changed(_this, _this->bootblock);
	rt11_filesystem_mark_filestream_as_changed(_this, _this->monitor);

	// Homeblock changed?
	_this->struct_changed = BOOLARRAY_BIT_GET(_this->image_changed_blocks, 1);
	// any dir entries changed?
	for (blknr = _this->first_dir_blocknr;
			blknr < _this->first_dir_blocknr + 2 * _this->dir_total_seg_num; blknr++)
		_this->struct_changed |= BOOLARRAY_BIT_GET(_this->image_changed_blocks, blknr);

	// rt11_filesystem_mark_filestream_as_changed(_this, _this->monitor);
	for (i = 0; i < _this->file_count; i++) {
		rt11_file_t *f = _this->file[i];
		rt11_filesystem_mark_filestream_as_changed(_this, f->prefix);
		rt11_filesystem_mark_filestream_as_changed(_this, f->data);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x1476c
jmp 0x148b5
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rsi
callq 0x167c0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rsi
callq 0x167c0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x88(%rax)
movq -0x8(%rbp), %rax
movw 0x34(%rax), %ax
movw %ax, -0xe(%rbp)
movzwl -0xe(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0x34(%rcx), %ecx
movq -0x8(%rbp), %rdx
movzwl 0x64(%rdx), %edx
shll %edx
addl %edx, %ecx
cmpl %ecx, %eax
jge 0x14858
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movzwl -0xe(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x1c(%rbp)
movzwl -0xe(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
movl -0x1c(%rbp), %eax
movl %edx, %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x8(%rbp), %rax
orl 0x88(%rax), %ecx
movl %ecx, 0x88(%rax)
movw -0xe(%rbp), %ax
addw $0x1, %ax
movw %ax, -0xe(%rbp)
jmp 0x147c6
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8c(%rcx), %eax
jge 0x148b5
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq 0x90(%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rsi
callq 0x167c0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rsi
callq 0x167c0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1485f
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_filesystem_render
int rt11_filesystem_render(rt11_filesystem_t *_this) {

	// format media, all 0's
	memset(_this->image_data, 0, _this->image_size);

	if (rt11_filesystem_layout(_this))
		return error_code; // oversized

	if (_this->bootblock->data_size)
		stream_render(_this, _this->bootblock);
#ifdef DEFAULTBOOTLOADER
	else
	// volume not bootable
	stream_render(_this, _this->nobootblock);
#endif
	if (_this->monitor->data_size)
		stream_render(_this, _this->monitor);
	render_homeblock(_this);
	if (render_directory(_this))
		return error_code;
	render_file_data(_this);

	// modify DD[X].SYS
	rt11_filesystem_patch(_this);

	return ERROR_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %edx
xorl %esi, %esi
callq 0x3220
movq -0x10(%rbp), %rdi
callq 0x14990
cmpl $0x0, %eax
je 0x14902
leaq 0x10c40(%rip), %rax     # 0x25538
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x14984
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
cmpl $0x0, 0x10(%rax)
je 0x14921
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rsi
callq 0x14be0
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rax
cmpl $0x0, 0x10(%rax)
je 0x14946
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rsi
callq 0x14be0
movq -0x10(%rbp), %rdi
callq 0x14c40
movq -0x10(%rbp), %rdi
callq 0x14e50
cmpl $0x0, %eax
je 0x1496b
leaq 0x10bd4(%rip), %rax     # 0x25538
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x14984
movq -0x10(%rbp), %rdi
callq 0x14f10
movq -0x10(%rbp), %rdi
callq 0x146f0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: render_directory
static int render_directory(rt11_filesystem_t *_this) {
	int i;
	int dir_entries_per_segment = rt11_dir_entries_per_segment(_this); // cache
	int ds_nr; // # of segment
	int de_nr; // # of entry
	for (i = 0; i < _this->file_count; i++) {
		rt11_file_t *f = _this->file[i];
		// which segment?
		ds_nr = (i / dir_entries_per_segment) + 1; // runs from 1
		// which entry in the segment?
		de_nr = i % dir_entries_per_segment; // runs from 0

		render_directory_entry(_this, f, ds_nr, de_nr);
	}
	// last entry: start of empty free chain
	ds_nr = _this->file_count / dir_entries_per_segment + 1;
	de_nr = _this->file_count % dir_entries_per_segment;
	render_directory_entry(_this, NULL, ds_nr, de_nr);

	return ERROR_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x16960
movl %eax, -0x10(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8c(%rcx), %eax
jge 0x14ec7
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq 0x90(%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movl -0xc(%rbp), %eax
cltd
idivl -0x10(%rbp)
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %eax
cltd
idivl -0x10(%rbp)
movl %edx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
callq 0x16990
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x14e6f
movq -0x8(%rbp), %rax
movl 0x8c(%rax), %eax
cltd
idivl -0x10(%rbp)
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0x8c(%rax), %eax
cltd
idivl -0x10(%rbp)
movl %edx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
xorl %eax, %eax
movl %eax, %esi
callq 0x16990
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: render_file_data
static void render_file_data(rt11_filesystem_t *_this) {
	int i;
	for (i = 0; i < _this->file_count; i++) {
		rt11_file_t *f = _this->file[i];
		if (f->prefix) { 		// prefix block?
			// low byte of 1st word on volume is blockcount,
			uint16_t prefix_block_count = NEEDED_BLOCKS(RT11_BLOCKSIZE,
					f->prefix->data_size + 2);
			if (prefix_block_count > 255)
				fatal("Render: Prefix of file \"%s.%s\" = %d blocks, maximum 255",
						f->filnam, f->ext, prefix_block_count);

			IMAGE_PUT_WORD(IMAGE_BLOCKNR2PTR(_this,f->prefix->blocknr), prefix_block_count);
			// start block and byte offset 2 already set by layout()
			stream_render(_this, f->prefix);
		}
		if (f->data)
			stream_render(_this, f->data);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8c(%rcx), %eax
jge 0x15045
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq 0x90(%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0x15013
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
movl 0x10(%rax), %eax
addl $0x2, %eax
addl $0x200, %eax            # imm = 0x200
subl $0x1, %eax
shrl $0x9, %eax
movw %ax, -0x1a(%rbp)
movzwl -0x1a(%rbp), %eax
cmpl $0xff, %eax
jle 0x14fa9
movq -0x18(%rbp), %rsi
addq $0x2, %rsi
movq -0x18(%rbp), %rdx
addq $0x52, %rdx
movzwl -0x1a(%rbp), %ecx
leaq 0x8bca(%rip), %rdi      # 0x1db6c
movb $0x0, %al
callq 0xd140
movzwl -0x1a(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x88(%rcx), %rcx
movzwl (%rcx), %ecx
shll $0x9, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movzwl -0x1a(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x88(%rcx), %rcx
movzwl (%rcx), %ecx
shll $0x9, %ecx
movslq %ecx, %rcx
movb %dl, 0x1(%rax,%rcx)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rsi
callq 0x14be0
movq -0x18(%rbp), %rax
cmpq $0x0, 0x80(%rax)
je 0x15035
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rsi
callq 0x14be0
jmp 0x15037
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x14f23
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: patch_dd_sys
static int patch_dd_sys(rt11_filesystem_t *_this, char *filnam, char*ext,
		rt11_blocknr_t blockcount) {
	rt11_file_t *f;
	f = rt11_filesystem_file_by_name(_this, filnam, ext);

	if (f) {
		if (f->block_count < 4) // is 5
			return error_set(ERROR_FILESYSTEM_FORMAT, "DD.SYS < 4 blocks");
		// patch position in image: startblock of file + offset
		// lsb at offset 0x2c, msb at offset 0x2d
		rt11_image_set_word_at(_this, f->block_nr, 0x2c, blockcount);
		/*
		 // debug: make file visible
		 {
		 char pathbuff[4096];
		 sprintf(pathbuff, "dbg_%s", rt11_filename_to_host(filnam, ext, NULL));
		 // works only because file is plain stream in image
		 file_write(pathbuff, f->data->data, f->data->data_size);
		 }
		 */
	}
	return ERROR_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %cx, %ax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movw %ax, -0x22(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x16f60
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x150c9
movq -0x30(%rbp), %rax
movzwl 0x7c(%rax), %eax
cmpl $0x4, %eax
jge 0x150ac
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
leaq 0x8b04(%rip), %rsi      # 0x1dba4
movb $0x0, %al
callq 0xcd70
movl %eax, -0x4(%rbp)
jmp 0x150d0
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movw 0x7a(%rax), %ax
movl $0x2c, %edx
movzwl %ax, %esi
movzwl -0x22(%rbp), %ecx
callq 0x168c0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_filesystem_print_dir
void rt11_filesystem_print_dir(rt11_filesystem_t *_this, FILE *stream) {
	int fileidx;
	char line[80];
	// no header
	line[0] = 0;
	for (fileidx = 0; fileidx < _this->file_count; fileidx++) {
		if (fileidx & 1) {
			// odd file #: right column, print
			strcat(line, "      ");
			strcat(line, rt11_dir_entry_text(_this, fileidx));
			fprintf(stream, "%s\n", line);
			line[0] = 0;
		} else {
			// even: left column
			strcpy(line, rt11_dir_entry_text(_this, fileidx));
		}
	}
	if (strlen(line)) // print pending left column
		fprintf(stream, "%s\n", line);
	fprintf(stream, " %d files, %d blocks\n", _this->file_count, _this->used_file_blocks);
	fprintf(stream, " %d Free blocks\n", _this->free_blocks);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x70(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8c(%rcx), %eax
jge 0x16478
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x16448
leaq -0x70(%rbp), %rdi
leaq 0x7358(%rip), %rsi      # 0x1d75f
callq 0x3500
leaq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x164f0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x3500
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rdx
leaq 0x6859(%rip), %rsi      # 0x1cc94
movb $0x0, %al
callq 0x3300
movb $0x0, -0x70(%rbp)
jmp 0x16468
leaq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x164f0
movq -0x80(%rbp), %rdi
movq %rax, %rsi
callq 0x30c0
jmp 0x1646a
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x163de
leaq -0x70(%rbp), %rdi
callq 0x3190
cmpq $0x0, %rax
je 0x1649d
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rdx
leaq 0x67fe(%rip), %rsi      # 0x1cc94
movb $0x0, %al
callq 0x3300
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x8c(%rax), %edx
movq -0x8(%rbp), %rax
movzwl 0x1fd0(%rax), %ecx
leaq 0x7342(%rip), %rsi      # 0x1d7ff
movb $0x0, %al
callq 0x3300
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movzwl 0x1fd2(%rax), %edx
leaq 0x733b(%rip), %rsi      # 0x1d815
movb $0x0, %al
callq 0x3300
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_dir_entry_text
static char *rt11_dir_entry_text(rt11_filesystem_t *_this, int fileidx) {
	static char buff[80];
	rt11_file_t *f = _this->file[fileidx];
	sprintf(buff, "%6s.%-3s%6d%c %s", f->filnam, f->ext, f->block_count,
			f->readonly ? 'P' : ' ', rt11_date_text(f->date));
	return buff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq 0x90(%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
addq $0x52, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x7c(%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movl 0xd0(%rax), %edx
movl $0x20, %eax
movl $0x50, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rcx
addq $0x98, %rcx
movq 0x30(%rcx), %rdx
movq %rsp, %rax
movq %rdx, 0x30(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x17070
movq -0x30(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x20(%rbp), %r8d
movl -0x1c(%rbp), %r9d
leaq 0x3b635(%rip), %rdi     # 0x51bd0
leaq 0x79b5(%rip), %rsi      # 0x1df57
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3520
leaq 0x3b61c(%rip), %rax     # 0x51bd0
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_filename_to_host
char *rt11_filename_to_host(char *filnam, char *ext, char *streamname) {
	static char result[80];
	char _filnam[80], _ext[80];
	// remove surrounding spaces.
	// all XXDP filename chars are valid host chars (" ", "$", "%")
	// return concat "filnam.ext"
	strcpy(_filnam, strtrim(filnam));
	strcpy(_ext, strtrim(ext));
	if (!strlen(_filnam))
		strcpy(_filnam, "_");
	strcpy(result, _filnam);
	if (strlen(_ext)) {
		strcat(result, ".");
		strcat(result, _ext);
	}
	if (streamname && strlen(streamname)) {
		strcat(result, ".");
		strcat(result, streamname);
	}

	return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd610
movq -0xd0(%rbp), %rdi
movq %rax, %rsi
callq 0x30c0
leaq -0xc0(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rdi
callq 0xd610
movq -0xc8(%rbp), %rdi
movq %rax, %rsi
callq 0x30c0
leaq -0x70(%rbp), %rdi
callq 0x3190
cmpq $0x0, %rax
jne 0x1666f
leaq -0x70(%rbp), %rdi
leaq 0x5d5b(%rip), %rsi      # 0x1c3c5
callq 0x30c0
leaq -0x70(%rbp), %rsi
leaq 0x26bc6(%rip), %rdi     # 0x3d240
callq 0x30c0
leaq -0xc0(%rbp), %rdi
callq 0x3190
cmpq $0x0, %rax
je 0x166b7
leaq 0x26ba8(%rip), %rdi     # 0x3d240
leaq 0x4943(%rip), %rsi      # 0x1afe2
callq 0x3500
leaq -0xc0(%rbp), %rsi
leaq 0x26b8e(%rip), %rdi     # 0x3d240
callq 0x3500
cmpq $0x0, -0x18(%rbp)
je 0x166f0
movq -0x18(%rbp), %rdi
callq 0x3190
cmpq $0x0, %rax
je 0x166f0
leaq 0x26b6c(%rip), %rdi     # 0x3d240
leaq 0x4907(%rip), %rsi      # 0x1afe2
callq 0x3500
movq -0x18(%rbp), %rsi
leaq 0x26b55(%rip), %rdi     # 0x3d240
callq 0x3500
leaq 0x26b49(%rip), %rax     # 0x3d240
addq $0xd0, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: stream_destroy
static void stream_destroy(rt11_stream_t *stream) {
	if (stream) {
		if (stream->data)
			free(stream->data);
		free(stream);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x16734
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x1672b
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3040
movq -0x8(%rbp), %rdi
callq 0x3040
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_filesystem_mark_filestream_as_changed
static void rt11_filesystem_mark_filestream_as_changed(rt11_filesystem_t *_this,
		rt11_stream_t *stream) {
	rt11_blocknr_t blknr, blkend;
	if (!stream)
		return;
	stream->changed = 0;
	if (_this->image_changed_blocks) {
		blkend = stream->blocknr + NEEDED_BLOCKS(RT11_BLOCKSIZE, stream->data_size);
		for (blknr = stream->blocknr; !stream->changed && blknr < blkend; blknr++)
			stream->changed |= BOOLARRAY_BIT_GET(_this->image_changed_blocks, blknr);
//		stream->changed |= boolarray_bit_get(_this->image_changed_blocks, blknr);
		// possible optimization: boolarray is tested sequentially
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x167d8
jmp 0x168b7
movq -0x10(%rbp), %rax
movb $0x0, 0x64(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x168b7
movq -0x10(%rbp), %rax
movzwl (%rax), %eax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
addl $0x200, %ecx            # imm = 0x200
subl $0x1, %ecx
shrl $0x9, %ecx
addl %ecx, %eax
movw %ax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x12(%rbp)
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpb $0x0, 0x64(%rcx)
movb %al, -0x15(%rbp)
jne 0x16839
movzwl -0x12(%rbp), %eax
movzwl -0x14(%rbp), %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0x15(%rbp)
movb -0x15(%rbp), %al
testb $0x1, %al
jne 0x16842
jmp 0x168b5
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movzwl -0x12(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x1c(%rbp)
movzwl -0x12(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
movl -0x1c(%rbp), %eax
movl %edx, %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %edx
movq -0x10(%rbp), %rax
movzbl 0x64(%rax), %ecx
orl %edx, %ecx
movb %cl, 0x64(%rax)
movw -0x12(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x12(%rbp)
jmp 0x1681a
jmp 0x168b7
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_image_set_word_at
static void rt11_image_set_word_at(rt11_filesystem_t *_this, rt11_blocknr_t blocknr,
		uint32_t byte_offset, uint16_t val) {
	uint32_t idx = RT11_BLOCKSIZE * blocknr + byte_offset;
	assert((idx + 1) < _this->image_size);

	_this->image_data[idx] = val & 0xff;
	_this->image_data[idx + 1] = (val >> 8) & 0xff;
	//fprintf(ferr, "set 0x%x to 0x%x\n", idx, val) ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %cx, %ax
movw %si, %cx
movq %rdi, -0x8(%rbp)
movw %cx, -0xa(%rbp)
movl %edx, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movzwl -0xa(%rbp), %eax
shll $0x9, %eax
addl -0x10(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jae 0x168fb
jmp 0x1691a
leaq 0x68fb(%rip), %rdi      # 0x1d1fd
leaq 0x6d2f(%rip), %rsi      # 0x1d638
movl $0x79, %edx
leaq 0x71b1(%rip), %rcx      # 0x1dac6
callq 0x3200
movzwl -0x12(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x18(%rbp), %ecx
movb %dl, (%rax,%rcx)
movzwl -0x12(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_dir_entries_per_segment
static int rt11_dir_entries_per_segment(rt11_filesystem_t *_this) {
	// without extra bytes: 72 [VFFM91] 1-15
	int result = (2 * RT11_BLOCKSIZE - 2 * 5) / (2 * 7 + _this->dir_entry_extra_bytes);
	// in a segment 3 entries spare, including end-of-segment
	result -= 3;
	return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movzwl 0x68(%rax), %ecx
addl $0xe, %ecx
movl $0x3f6, %eax            # imm = 0x3F6
cltd
idivl %ecx
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
subl $0x3, %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_filesystem_file_by_name
static rt11_file_t *rt11_filesystem_file_by_name(rt11_filesystem_t *_this, char *filnam,
		char *ext) {
	rt11_file_t *f;
	int i;
	for (i = 0; i < _this->file_count; i++) {
		f = _this->file[i];
		if (!strcasecmp(filnam, f->filnam) && !strcasecmp(ext, f->ext))
			return f;
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8c(%rcx), %eax
jge 0x16fe1
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x90(%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x2, %rsi
callq 0x3050
cmpl $0x0, %eax
jne 0x16fd4
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x52, %rsi
callq 0x3050
cmpl $0x0, %eax
jne 0x16fd4
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x16fe9
jmp 0x16fd6
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x16f7b
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_dir_needed_segments
static int rt11_dir_needed_segments(rt11_filesystem_t *_this, int file_count) {
	// without extra bytes: 72 [VFFM91] 1-15
	int entries_per_seg = rt11_dir_entries_per_segment(_this);
	file_count++; // one more for the mandatory "empty space" file entry
	// round up to whole segments
	return (file_count + entries_per_seg - 1) / entries_per_seg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
callq 0x16960
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
addl -0x10(%rbp), %eax
subl $0x1, %eax
cltd
idivl -0x10(%rbp)
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_date_text
static char *rt11_date_text(struct tm t) {
	char *mon[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
			"Dec" };
	static char buff[80];
	sprintf(buff, "%02d-%3s-%02d", t.tm_mday, mon[t.tm_mon], t.tm_year);
	return buff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq 0xbcf5(%rip), %rsi      # 0x22d80
movl $0x60, %edx
callq 0x3330
movq -0x68(%rbp), %rax
movl 0xc(%rax), %edx
movslq 0x10(%rax), %rcx
movq -0x60(%rbp,%rcx,8), %rcx
movl 0x14(%rax), %r8d
leaq 0x3ab70(%rip), %rdi     # 0x51c20
leaq 0x6527(%rip), %rsi      # 0x1d5de
movb $0x0, %al
callq 0x3520
leaq 0x3ab5b(%rip), %rax     # 0x51c20
addq $0x70, %rsp
popq %rbp
retq
nop
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/monitor.c
// Function: monitor_getc
int monitor_getc(monitor_t *_this, int timeout_us) {
	char tmpbuff[2];
	int n;
	int timeout ;
	timeout_set(timeout_us);
	// "Busy waiting" loop, as delay() routines are unreliable under CygWin.
	do {
		// Fix for slow single thread CPUs (BBB):
		// test timeout BEFORE read()
		timeout = timeout_reached() ;
		fcntl(_this->serial->fd, F_SETFL, FNDELAY);
		tmpbuff[0] = 0; // clear
		n = read(_this->serial->fd, tmpbuff, 1);
//		if (n < 0)
//			return error_set(ERROR_MONITOR, "monitor_getc() failed with errno=%u", errno);
		if (n > 0) {
			// monitor_trace(tmpbuff, n, TRACE_IN, "monitor_getc") ;
			return tmpbuff[0];
		}
	} while (n <= 0 && !timeout);
	return EOF;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %edi
callq 0xd330
callq 0xd360
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
movb $0x0, %al
callq 0x3120
movb $0x0, -0x16(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %edi
leaq -0x16(%rbp), %rsi
movl $0x1, %edx
callq 0x32a0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jle 0x172a8
movsbl -0x16(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x172cf
jmp 0x172aa
xorl %eax, %eax
cmpl $0x0, -0x1c(%rbp)
movb %al, -0x21(%rbp)
jg 0x172c1
cmpl $0x0, -0x20(%rbp)
setne %al
xorb $-0x1, %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x17257
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/monitor.c
// Function: monitor_assert_prompt
int monitor_assert_prompt(monitor_t *_this) {
	int res ;
	monitor_puts(_this, CR); // hit "ENTER"
	if (monitor_wait_prompt(_this, NULL) == ERROR_OK)
		return ERROR_OK; // first CR successful

	// no prompt. try 2nd CR (M9312)
	monitor_puts(_this, CR); // hit "ENTER"
	res = monitor_wait_prompt(_this, NULL) ;

	if (res == ERROR_OK)
		return ERROR_OK; // 2nd CR successful
	else if (res > 0) {  // no prompt: return status
		monitor_trace_dump(ferr);
		return res ;
	} else { // error
		monitor_trace_dump(ferr);
		return error_set(res, "monitor_assert_prompt(): no %s-prompt on tty %u",
				_this->prompt, _this->serial->fd);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x6cf2(%rip), %rsi      # 0x1dfe9
callq 0x173b0
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x17440
cmpl $0x0, %eax
jne 0x1731a
movl $0x0, -0x4(%rbp)
jmp 0x1739b
movq -0x10(%rbp), %rdi
leaq 0x6cc4(%rip), %rsi      # 0x1dfe9
callq 0x173b0
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x17440
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x17349
movl $0x0, -0x4(%rbp)
jmp 0x1739b
cmpl $0x0, -0x14(%rbp)
jle 0x17366
leaq 0xe1da(%rip), %rax      # 0x25530
movq (%rax), %rdi
callq 0x17230
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1739b
leaq 0xe1c3(%rip), %rax      # 0x25530
movq (%rax), %rdi
callq 0x17230
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %ecx
leaq 0x6c5a(%rip), %rsi      # 0x1dfeb
movb $0x0, %al
callq 0xcd70
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/monitor.c
// Function: monitor_puts
int monitor_puts(monitor_t *_this, char *s) {
	int n;
	n = strlen(s);
	n = write(_this->serial->fd, s, n);
	if (n < 0) {
		monitor_trace_dump(ferr);
		return error_set(ERROR_MONITOR, "serial_puts() failed");
	}
	monitor_trace(s, n, TRACE_OUT, "monitor_puts");
	return ERROR_OK;
	// do not echo output, PDP-11 should do this
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3190
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %edi
movq -0x18(%rbp), %rsi
movslq -0x1c(%rbp), %rdx
callq 0x3140
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x17413
leaq 0xe13d(%rip), %rax      # 0x25530
movq (%rax), %rdi
callq 0x17230
movl $0xfffffff6, %edi       # imm = 0xFFFFFFF6
leaq 0x6c41(%rip), %rsi      # 0x1e048
movb $0x0, %al
callq 0xcd70
movl %eax, -0x4(%rbp)
jmp 0x17431
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
xorl %edx, %edx
leaq 0x6c3a(%rip), %rcx      # 0x1e05d
movb $0x0, %al
callq 0x17690
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/monitor.c
// Function: monitor_wait_prompt
static int monitor_wait_prompt(monitor_t *_this, char *last_answer) {
	char buff[256];
	int rounds = 5;
	char *s;

	buff[0] = 0;
	if (last_answer)
		strcat(buff, last_answer);
monitor_trace(NULL, 0, TRACE_STATUS, "monitor_wait_prompt():responsetime_us=%u", _this->responsetime_us) ;
	do {
		s = monitor_gets(_this, _this->responsetime_us);
		if (s) {
			// append to buffer, clip off first chars
			int n = strlen(s);
			if (n + strlen(buff) + 1 >= sizeof(buff))
				memmove(buff, buff + n, sizeof(buff) - n);
			strcat(buff, s);
		}
		// find prompt in string
		if (strstr(buff, _this->prompt) != NULL)
			return ERROR_OK; // found
	} while (--rounds);

	monitor_trace_dump(ferr);
	return STATUS_MONITOR_NOPROMPT; // not found after timeout
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x5, -0x124(%rbp)
movb $0x0, -0x120(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1747b
leaq -0x120(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3500
movq -0x10(%rbp), %rax
movl 0x18(%rax), %r8d
xorl %eax, %eax
movl %eax, %edi
xorl %esi, %esi
movl $0x2, %edx
leaq 0x6cee(%rip), %rcx      # 0x1e183
movb $0x0, %al
callq 0x17690
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %esi
callq 0x175b0
movq %rax, -0x130(%rbp)
cmpq $0x0, -0x130(%rbp)
je 0x17545
movq -0x130(%rbp), %rdi
callq 0x3190
movl %eax, -0x134(%rbp)
movslq -0x134(%rbp), %rax
movq %rax, -0x140(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x3190
movq %rax, %rcx
movq -0x140(%rbp), %rax
addq %rcx, %rax
addq $0x1, %rax
cmpq $0x100, %rax            # imm = 0x100
jb 0x17532
leaq -0x120(%rbp), %rdi
leaq -0x120(%rbp), %rsi
movslq -0x134(%rbp), %rax
addq %rax, %rsi
movslq -0x134(%rbp), %rax
movl $0x100, %edx            # imm = 0x100
subq %rax, %rdx
callq 0x3450
leaq -0x120(%rbp), %rdi
movq -0x130(%rbp), %rsi
callq 0x3500
leaq -0x120(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x35a0
cmpq $0x0, %rax
je 0x17568
movl $0x0, -0x4(%rbp)
jmp 0x17598
jmp 0x1756a
movl -0x124(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x124(%rbp)
cmpl $0x0, %eax
jne 0x1749c
leaq 0xdfa7(%rip), %rax      # 0x25530
movq (%rax), %rdi
callq 0x17230
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/monitor.c
// Function: monitor_gets
char *monitor_gets(monitor_t *_this, int timeout_us) {
	static char buffer[10240];
	unsigned charcount;
	int c;

	charcount = 0;
	buffer[0] = 0; // clear
	// "Busy waiting" loop, as delay() routines are unreliable under CygWin.
	do {
		c = monitor_getc(_this, timeout_us);
		if (c != EOF) {
			// append char to string, new timeout
			buffer[charcount++] = (char) c;
			buffer[charcount] = 0;
			if (charcount + 1 >= sizeof(buffer))
				fatal("monitor_gets(): buffer overflow");
			if (_this->fecho)
				fputc(c, _this->fecho);
			timeout_us = 3 * _this->chartime_us; // next chars full RS232 speed
		}
	} while (c != EOF);
	monitor_trace(buffer, charcount, TRACE_IN, "monitor_gets");

	return buffer;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movb $0x0, 0x3a6a3(%rip)     # 0x51c70
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x17240
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
je 0x17654
movl -0x14(%rbp), %eax
movb %al, %dl
movl -0x10(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x10(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0x3a673(%rip), %rax     # 0x51c70
movb %dl, (%rax,%rcx)
movl -0x10(%rbp), %eax
movl %eax, %ecx
leaq 0x3a664(%rip), %rax     # 0x51c70
movb $0x0, (%rax,%rcx)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
cmpq $0x2800, %rax           # imm = 0x2800
jb 0x1762e
leaq 0x69f4(%rip), %rdi      # 0x1e01b
movb $0x0, %al
callq 0xd140
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x17649
movl -0x14(%rbp), %edi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x3290
movq -0x8(%rbp), %rax
imull $0x3, 0x1c(%rax), %eax
movl %eax, -0xc(%rbp)
jmp 0x17656
cmpl $-0x1, -0x14(%rbp)
jne 0x175cd
movl -0x10(%rbp), %esi
leaq 0x3a606(%rip), %rdi     # 0x51c70
movl $0x1, %edx
leaq 0x69c5(%rip), %rcx      # 0x1e03b
movb $0x0, %al
callq 0x17690
leaq 0x3a5ec(%rip), %rax     # 0x51c70
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)