LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/j-hoppe[P]tu58fs/xxdp.c
// Function: xxdp_filename_from_host
char *xxdp_filename_from_host(char *hostfname, char *filnam, char *ext) {
	static char result[80];
	char pathbuff[4096];
	char _filnam[7], _ext[4];
	char *s, *t;

	strcpy(pathbuff, hostfname);

	// upcase and replace forbidden characters
	for (s = pathbuff; *s; s++)
		if (*s == '_')
			*s = ' ';
		else {
			*s = toupper(*s);
			if (!strchr(" ABCDEFGHIJKLMNOPQRSTUVWXYZ$.%0123456789", *s))
				*s = '%';
		}

	// search last "."
	s = extract_extension(pathbuff, /*truncate*/1);
	t = _ext; // extract 3 char ext
	while (s && *s && (t - _ext) < 3)
		*t++ = *s++;
	*t = 0;

	// extract 6 char filnam
	s = pathbuff; // only filename
	t = _filnam;
	while (*s && (t - _filnam) < 6)
		*t++ = *s++;
	*t = 0;

	if (filnam) // length MUST be >= 7
		strcpy(filnam, strtrim(_filnam));
	if (ext) // length MUST be >= 4
		strcpy(ext, strtrim(_ext));

	strcpy(result, strtrim(_filnam));
	if (strlen(_ext)) {
		strcat(result, ".");
		strcat(result, strtrim(_ext));
	}

	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %rsi
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x30c0
leaq 0x8694(%rip), %r12      # 0x15e1e
movzbl (%r15), %eax
movb $0x20, %cl
cmpl $0x5f, %eax
je 0xd7c6
testl %eax, %eax
je 0xd7ce
movsbq %al, %r13
callq 0x3030
movq (%rax), %rax
movl (%rax,%r13,4), %ebp
movsbl %bpl, %esi
movl $0x29, %edx
movq %r12, %rdi
callq 0x32a0
movl $0x25, %ecx
testq %rax, %rax
je 0xd7c6
movl %ebp, %ecx
movb %cl, (%r15)
incq %r15
jmp 0xd78a
leaq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0xab1f
leaq 0x5(%rsp), %rcx
testq %rax, %rax
je 0xd80b
movb (%rax), %dl
testb %dl, %dl
je 0xd80b
movl $0x1, %esi
movb %dl, (%rcx)
incq %rcx
movb (%rax,%rsi), %dl
testb %dl, %dl
je 0xd80b
leaq 0x1(%rsi), %rdi
cmpq $0x3, %rsi
movq %rdi, %rsi
jl 0xd7f2
movb $0x0, (%rcx)
movb 0x10(%rsp), %al
testb %al, %al
je 0xd837
xorl %ecx, %ecx
movb %al, 0x9(%rsp,%rcx)
movb 0x11(%rsp,%rcx), %al
incq %rcx
testb %al, %al
je 0xd82d
cmpq $0x6, %rcx
jl 0xd818
leaq (%rsp,%rcx), %rax
addq $0x9, %rax
jmp 0xd83c
leaq 0x9(%rsp), %rax
movb $0x0, (%rax)
testq %r14, %r14
je 0xd859
leaq 0x9(%rsp), %rdi
callq 0xa691
movq %r14, %rdi
movq %rax, %rsi
callq 0x30c0
testq %rbx, %rbx
je 0xd873
leaq 0x5(%rsp), %rdi
callq 0xa691
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30c0
leaq 0x9(%rsp), %rdi
callq 0xa691
leaq 0x13abc(%rip), %rbx     # 0x21340
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30c0
cmpb $0x0, 0x5(%rsp)
je 0xd8b9
movq %rbx, %rdi
callq 0x3190
movw $0x2e, (%rax,%rbx)
leaq 0x5(%rsp), %rdi
callq 0xa691
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3510
leaq 0x13a80(%rip), %rax     # 0x21340
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/j-hoppe[P]tu58fs/xxdp.c
// Function: xxdp_filesystem_print_dir
void xxdp_filesystem_print_dir(xxdp_filesystem_t *_this, FILE *stream) {
	int file_idx;
	// header
	fprintf(stream, "%s\n", xxdp_dir_line(_this, -1));
	fprintf(stream, "\n");
	for (file_idx = 0; file_idx < _this->file_count; file_idx++)
		fprintf(stream, "%s\n", xxdp_dir_line(_this, file_idx));

	fprintf(stream, "\n");
	fprintf(stream, "FREE BLOCKS: %d\n", _this->blockcount - xxdp_bitmap_count(_this));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
leaq 0x7fd7(%rip), %rsi      # 0x15dde
leaq 0x885b(%rip), %rdx      # 0x16669
movq %r15, %rdi
xorl %eax, %eax
callq 0x3310
movl $0xa, %edi
movq %r15, %rsi
callq 0x3290
cmpl $0x0, 0xa8(%r14)
jle 0xdef1
xorl %ebp, %ebp
movq %r15, %r13
movq 0xb0(%r14,%rbp,8), %r15
incq %rbp
leaq 0x808(%r15), %r12
leaq 0x858(%r15), %rax
movq %rax, (%rsp)
movslq 0x8a0(%r15), %rax
movl 0x89c(%r15), %edx
movl 0x8a4(%r15), %r8d
leaq 0x8893(%rip), %rsi      # 0x16704
movslq (%rsi,%rax,4), %rcx
addq %rsi, %rcx
movq %r14, %rbx
leaq 0x27dde(%rip), %r14     # 0x35c60
movq %r14, %rdi
leaq 0x886a(%rip), %rsi      # 0x166f6
xorl %eax, %eax
callq 0x3530
movl (%r15), %r10d
movzwl 0x4(%r15), %r11d
movq %r13, %r15
leaq 0x27d6b(%rip), %r13     # 0x35c10
movq %r13, %rdi
leaq 0x87f9(%rip), %rsi      # 0x166a8
movl %ebp, %edx
movq %r12, %rcx
movq (%rsp), %r8
movq %r14, %r9
movq %rbx, %r14
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x3530
addq $0x10, %rsp
movq %r15, %rdi
leaq 0x7f07(%rip), %rsi      # 0x15dde
movq %r13, %rdx
xorl %eax, %eax
callq 0x3310
movslq 0xa8(%rbx), %rax
cmpq %rax, %rbp
jl 0xde35
movl $0xa, %edi
movq %r15, %rsi
callq 0x3290
movl 0x4c(%r14), %ebx
movq %r14, %rdi
callq 0xdf2d
subl %eax, %ebx
leaq 0x7de7(%rip), %rsi      # 0x15cfa
movq %r15, %rdi
movl %ebx, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3310
// File: /workspace/github_c_makefile_star2_O3/j-hoppe[P]tu58fs/xxdp.c
// Function: xxdp_bitmap_count
static int xxdp_bitmap_count(xxdp_filesystem_t *_this) {
	int result = 0;
	unsigned i, j, k;
	for (i = 0; i < _this->bitmap->blocklist.count; i++) {
		xxdp_blocknr_t map_blknr = _this->bitmap->blocklist.blocknr[i];
		unsigned map_wordcount;
		map_wordcount = xxdp_image_get_word(_this, map_blknr, 2);
		for (j = 0; j < map_wordcount; j++) {
			uint16_t map_flags = xxdp_image_get_word(_this, map_blknr, j + 4);
			// 16 flags per word. count "1" bits
			if (map_flags == 0xffff)
				result += 16; // most of time
			else
				for (k = 0; k < 16; k++)
					if (map_flags & (1 << k))
						result++;
		}
	}
	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x90(%rdi), %rax
cmpl $0x0, (%rax)
je 0xe055
movq %rdi, %rbx
xorl %r15d, %r15d
xorl %r14d, %r14d
movzwl 0x4(%rax,%r15,2), %ebp
movq %rbx, %rdi
movl %ebp, %esi
movl $0x2, %edx
callq 0xe4d2
testw %ax, %ax
je 0xe03e
movzwl %ax, %r12d
xorl %r13d, %r13d
leal 0x4(%r13), %eax
movzbl %al, %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0xe4d2
cmpw $-0x1, %ax
je 0xe02e
movzwl %ax, %eax
movd %r14d, %xmm0
movd %eax, %xmm1
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movl $0x10, %eax
movdqa 0x7b51(%rip), %xmm2     # 0x15b00
movaps 0x7b5a(%rip), %xmm7     # 0x15b10
movdqa 0x7b61(%rip), %xmm8     # 0x15b20
pshuflw $0xfe, %xmm2, %xmm3     # xmm3 = xmm2[2,3,3,3,4,5,6,7]
movdqa %xmm1, %xmm4
psrld %xmm3, %xmm4
pshuflw $0x54, %xmm2, %xmm3     # xmm3 = xmm2[0,1,1,1,4,5,6,7]
movdqa %xmm1, %xmm5
psrld %xmm3, %xmm5
punpcklqdq %xmm4, %xmm5    # xmm5 = xmm5[0],xmm4[0]
pshufd $0xee, %xmm2, %xmm3     # xmm3 = xmm2[2,3,2,3]
pshuflw $0xfe, %xmm3, %xmm4     # xmm4 = xmm3[2,3,3,3,4,5,6,7]
movdqa %xmm1, %xmm6
psrld %xmm4, %xmm6
pshuflw $0x54, %xmm3, %xmm3     # xmm3 = xmm3[0,1,1,1,4,5,6,7]
movdqa %xmm1, %xmm4
psrld %xmm3, %xmm4
punpckhqdq %xmm6, %xmm4    # xmm4 = xmm4[1],xmm6[1]
shufps $0xcc, %xmm4, %xmm5     # xmm5 = xmm5[0,3],xmm4[0,3]
andps %xmm7, %xmm5
paddd %xmm5, %xmm0
paddd %xmm8, %xmm2
addl $-0x4, %eax
jne 0xdfbf
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
paddd %xmm0, %xmm1
pshufd $0x55, %xmm1, %xmm0     # xmm0 = xmm1[1,1,1,1]
paddd %xmm1, %xmm0
movd %xmm0, %r14d
jmp 0xe032
addl $0x10, %r14d
incl %r13d
cmpl %r12d, %r13d
jne 0xdf76
incq %r15
movq 0x90(%rbx), %rax
movl (%rax), %ecx
cmpq %rcx, %r15
jb 0xdf51
jmp 0xe058
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/j-hoppe[P]tu58fs/xxdp.c
// Function: xxdp_filename_to_host
char *xxdp_filename_to_host(char *filnam, char *ext) {
	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);
	}
	return result;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %rbx
callq 0xa691
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x30c0
movq %rbx, %rdi
callq 0xa691
movq %rsp, %rdi
movq %rax, %rsi
callq 0x30c0
cmpb $0x0, (%r14)
jne 0xe421
movw $0x5f, 0x50(%rsp)
leaq 0x12ec8(%rip), %rbx     # 0x212f0
leaq 0x50(%rsp), %rsi
movq %rbx, %rdi
callq 0x30c0
cmpb $0x0, (%rsp)
je 0xe454
movq %rbx, %rdi
callq 0x3190
movw $0x2e, (%rax,%rbx)
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x3510
leaq 0x12e95(%rip), %rax     # 0x212f0
addq $0xa8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %eax
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
movq %r15, %r12
incq %r15
movw %ax, 0x4(%rbx,%r12,2)
movzwl %ax, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0xe4d2
cmpq $0x3fe, %r12            # imm = 0x3FE
ja 0xe4a0
testw %ax, %ax
jne 0xe479
movl %r15d, (%rbx)
testw %ax, %ax
je 0xe4c6
leaq 0x7bcb(%rip), %rsi      # 0x1607a
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x9f73
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x1, (%rsi)
jne 0xe526
xorl %eax, %eax
jmp 0xe54e
xorl %r15d, %r15d
movzwl 0x4(%r14,%r15,2), %esi
movzwl 0x6(%r14,%r15,2), %ecx
incq %r15
movq %rbx, %rdi
xorl %edx, %edx
callq 0xe562
movl (%r14), %eax
decl %eax
cmpq %rax, %r15
jb 0xe529
movl %eax, %eax
movzwl 0x4(%r14,%rax,2), %esi
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
popq %rbx
popq %r14
popq %r15
jmp 0xe562
// File: /workspace/github_c_makefile_star2_O3/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:
shll $0x9, %esi
leal (%rsi,%rdx,2), %edx
leaq 0x1(%rdx), %rax
cmpl 0x8(%rdi), %eax
jae 0xe57e
movq (%rdi), %rsi
movb %cl, (%rsi,%rdx)
movq (%rdi), %rdx
movb %ch, (%rdx,%rax)
retq
pushq %rax
leaq 0x7d8f(%rip), %rdi      # 0x16315
leaq 0x75fc(%rip), %rsi      # 0x15b89
leaq 0x7d9f(%rip), %rcx      # 0x16333
movl $0x74, %edx
callq 0x3200
nop
// File: /workspace/github_c_makefile_star2_O3/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 %rax
movl $0xd8, %edi
callq 0x33b0
xorl %ecx, %ecx
movb %cl, 0x2(%rax)
movb %cl, 0x52(%rax)
movw $0x0, 0x7c(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x80(%rax)
movups %xmm0, 0x90(%rax)
movups %xmm0, 0xa0(%rax)
movups %xmm0, 0xb0(%rax)
movups %xmm0, 0xc0(%rax)
movq $0x0, 0xd0(%rax)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_filesystem_create
rt11_filesystem_t *rt11_filesystem_create(device_type_t dec_device, uint8_t *image_data,
		uint32_t image_size, boolarray_t *changedblocks) {
	int i;
	rt11_filesystem_t *_this;

	_this = malloc(sizeof(rt11_filesystem_t));
	_this->dec_device = dec_device;
	_this->device_info = (device_info_t*) search_tagged_array(device_info_table,
			sizeof(device_info_t), _this->dec_device);
	assert(_this->device_info);

	// Search Random Access Device Information
	_this->radi = (rt11_radi_t*) search_tagged_array(rt11_radi, sizeof(rt11_radi_t),
			_this->dec_device);
	assert(_this->radi);

	// save pointer to variables defining image buffer data
	_this->image_data = image_data;
	_this->image_size = image_size;
	_this->image_changed_blocks = changedblocks;

	// these are always there, static allocated
#ifdef DEFAULTBOOTLOADER
	_this->nobootblock = malloc(sizeof(rt11_stream_t)); // fix bootblock for no bootable volumes
	stream_init(_this->nobootblock);
#endif
	_this->bootblock = malloc(sizeof(rt11_stream_t));
	stream_init(_this->bootblock);
	_this->monitor = malloc(sizeof(rt11_stream_t));
	stream_init(_this->monitor);

	// files vary: dynamic allocate
	_this->file_count = 0;
	for (i = 0; i < RT11_MAX_FILES_PER_IMAGE; i++)
		_this->file[i] = NULL;
	rt11_filesystem_init(_this);
	return _this;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
movl %edi, %r12d
movl $0x1fd8, %edi           # imm = 0x1FD8
callq 0x33b0
movq %rax, %rbx
movl %r12d, 0x18(%rax)
leaq 0xde99(%rip), %rdi      # 0x1c4b0
movl $0x20, %esi
movl %r12d, %edx
callq 0xb0ca
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0xe6c3
leaq 0xe288(%rip), %rdi      # 0x1c8c0
movl $0xc, %esi
movl %r12d, %edx
callq 0xb0ca
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0xe6e2
movq %r15, (%rbx)
movl %ebp, 0x8(%rbx)
movq %r14, 0x10(%rbx)
movl $0x68, %edi
callq 0x33b0
movq %rax, 0x78(%rbx)
xorl %ebp, %ebp
movw %bp, (%rax)
movb %bpl, 0x14(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rax)
movl $0x68, %edi
callq 0x33b0
movq %rax, 0x80(%rbx)
movw %bp, (%rax)
movb %bpl, 0x14(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rax)
movq %rbx, %rdi
addq $0x8c, %rdi
movl $0x1f44, %edx           # imm = 0x1F44
xorl %esi, %esi
callq 0x3220
movq %rbx, %rdi
callq 0xe701
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x66c9(%rip), %rdi      # 0x14d93
leaq 0x80af(%rip), %rsi      # 0x16780
leaq 0x80af(%rip), %rcx      # 0x16787
movl $0x108, %edx            # imm = 0x108
callq 0x3200
leaq 0x80fb(%rip), %rdi      # 0x167e4
leaq 0x8090(%rip), %rsi      # 0x16780
leaq 0x8090(%rip), %rcx      # 0x16787
movl $0x10d, %edx            # imm = 0x10D
callq 0x3200
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
movq %rdi, %rbx
callq 0xe701
movq 0x78(%rbx), %rdi
callq 0x3050
movq 0x80(%rbx), %rdi
callq 0x3050
movq %rbx, %rdi
popq %rbx
jmp 0x3050
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, 0x4(%rsp)
movslq 0x8c(%rdi), %r13
testq %r13, %r13
jle 0xf728
movq %rsi, %r15
movq %rdi, %r14
xorl %ebp, %ebp
leaq 0x7044(%rip), %r12      # 0x1673c
movq 0x90(%r14,%rbp,8), %rbx
leaq 0x2(%rbx), %rsi
movq %r15, %rdi
callq 0x3060
testl %eax, %eax
jne 0xf720
leaq 0x52(%rbx), %rsi
movq %r12, %rdi
callq 0x3060
testl %eax, %eax
je 0xf737
incq %rbp
cmpq %rbp, %r13
jne 0xf6f8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %rbx, %rbx
je 0xf728
cmpw $0x3, 0x7c(%rbx)
ja 0xf764
leaq 0x7556(%rip), %rsi      # 0x16ca0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9f73
movzwl 0x7a(%rbx), %esi
movzwl 0x4(%rsp), %ecx
movq %r14, %rdi
movl $0x2c, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x107cc
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, (%rsp)
movl 0x8c(%rdi), %edx
testl %edx, %edx
jle 0x10580
leaq 0x3a3e7(%rip), %r15     # 0x4a8d0
movq %rsp, %r12
leaq 0x58eb(%rip), %r13      # 0x15dde
xorl %ebp, %ebp
testb $0x1, %bpl
jne 0x10512
movq %r14, %rdi
movl %ebp, %esi
callq 0x105c1
movq %r12, %rdi
movq %r15, %rsi
callq 0x30c0
jmp 0x10552
movq %r12, %rdi
callq 0x3190
movl $0x20202020, (%rsp,%rax) # imm = 0x20202020
movl $0x202020, 0x3(%rsp,%rax) # imm = 0x202020
movq %r14, %rdi
movl %ebp, %esi
callq 0x105c1
movq %r12, %rdi
movq %r15, %rsi
callq 0x3510
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3310
movb $0x0, (%rsp)
incl %ebp
movl 0x8c(%r14), %edx
cmpl %edx, %ebp
jl 0x104f5
cmpb $0x0, (%rsp)
je 0x10580
leaq 0x5872(%rip), %rsi      # 0x15dde
movq %rsp, %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3310
movl 0x8c(%r14), %edx
movzwl 0x1fd0(%r14), %ecx
leaq 0x636c(%rip), %rsi      # 0x168fb
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3310
movzwl 0x1fd2(%r14), %edx
leaq 0x6369(%rip), %rsi      # 0x16911
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3310
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movslq %esi, %rax
movq 0x90(%rdi,%rax,8), %rax
leaq 0x2(%rax), %rbx
leaq 0x52(%rax), %r14
movzwl 0x7c(%rax), %ebp
cmpl $0x0, 0xd0(%rax)
movl $0x20, %ecx
movl $0x50, %r15d
cmovel %ecx, %r15d
movslq 0xa8(%rax), %rcx
movl 0xa4(%rax), %edx
movl 0xac(%rax), %r8d
leaq 0x6a7f(%rip), %rax      # 0x17094
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
leaq 0x3a2fd(%rip), %r12     # 0x4a920
leaq 0x60cc(%rip), %rsi      # 0x166f6
movq %r12, %rdi
xorl %eax, %eax
callq 0x3530
movq %r12, (%rsp)
leaq 0x3a291(%rip), %rdi     # 0x4a8d0
leaq 0x6a0d(%rip), %rsi      # 0x17053
movq %rbx, %rdx
movq %r14, %rcx
movl %ebp, %r8d
movl %r15d, %r9d
xorl %eax, %eax
callq 0x3530
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movq %rdx, %rbx
movq %rsi, %r14
callq 0xa691
leaq 0x50(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x30c0
movq %r14, %rdi
callq 0xa691
movq %rsp, %rdi
movq %rax, %rsi
callq 0x30c0
cmpb $0x0, (%r15)
jne 0x106b2
movw $0x5f, 0x50(%rsp)
leaq 0x25887(%rip), %r14     # 0x35f40
leaq 0x50(%rsp), %rsi
movq %r14, %rdi
callq 0x30c0
cmpb $0x0, (%rsp)
je 0x106e6
movq %r14, %rdi
callq 0x3190
movw $0x2e, (%rax,%r14)
movq %rsp, %rsi
movq %r14, %rdi
callq 0x3510
testq %rbx, %rbx
je 0x1070a
cmpb $0x0, (%rbx)
je 0x1070a
movq %r14, %rdi
callq 0x3190
movw $0x2e, (%rax,%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3510
leaq 0x2582f(%rip), %rax     # 0x35f40
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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:
testq %rdi, %rdi
je 0x1073e
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x10735
callq 0x3050
movq %rbx, %rdi
popq %rbx
jmp 0x3050
retq
// File: /workspace/github_c_makefile_star2_O3/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:
testq %rsi, %rsi
je 0x107cb
movb $0x0, 0x64(%rsi)
movq 0x10(%rdi), %rcx
testq %rcx, %rcx
je 0x107cb
movl $0x1ff, %edx            # imm = 0x1FF
addl 0x10(%rsi), %edx
movzwl (%rsi), %eax
shrl $0x9, %edx
addl %eax, %edx
cmpw %dx, %ax
jae 0x107cb
movq (%rcx), %rcx
movzwl %dx, %edx
movl %eax, %edi
shrl $0x5, %edi
movl (%rcx,%rdi,4), %edi
btl %eax, %edi
setb %dil
jb 0x107c7
incl %eax
cmpl %edx, %eax
jb 0x107b0
movb %dil, 0x64(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/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:
shll $0x9, %esi
movl %edx, %eax
addq %rsi, %rax
leal 0x1(%rax), %edx
cmpl 0x8(%rdi), %edx
jae 0x107ea
movq (%rdi), %rdx
movb %cl, (%rdx,%rax)
movq (%rdi), %rdx
movb %ch, 0x1(%rdx,%rax)
retq
pushq %rax
leaq 0x5b23(%rip), %rdi      # 0x16315
leaq 0x5f87(%rip), %rsi      # 0x16780
leaq 0x63c2(%rip), %rcx      # 0x16bc2
movl $0x79, %edx
callq 0x3200
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl %esi, %edi
callq 0xa460
leaq 0xe(%rsp), %r14
callq 0xa498
movl %eax, %ebp
movq 0x10(%rbx), %rax
movl (%rax), %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
xorl %eax, %eax
callq 0x3120
movb $0x0, 0xe(%rsp)
movq 0x10(%rbx), %rax
movl (%rax), %edi
movl $0x1, %edx
movq %r14, %rsi
callq 0x32b0
testl %eax, %eax
jg 0x10b71
testl %ebp, %ebp
je 0x10b2c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x10b76
movsbl 0xe(%rsp), %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x3190
movq 0x10(%r14), %rcx
movl (%rcx), %edi
movslq %eax, %rdx
movq %rbx, %rsi
callq 0x3140
testl %eax, %eax
js 0x10be9
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x653b(%rip), %rsi      # 0x1712b
movl $0xfffffff6, %edi       # imm = 0xFFFFFFF6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x9f73
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rdi, %rbx
movb $0x0, (%rsp)
testq %rsi, %rsi
je 0x10c26
movq %rsp, %rdi
callq 0x3510
movl $0xfffffffb, %ebp       # imm = 0xFFFFFFFB
leaq 0x39d3e(%rip), %r14     # 0x4a970
movq %rsp, %r15
movl 0x18(%rbx), %esi
movq %rbx, %rdi
callq 0x10cb1
movq %r14, %rdi
callq 0x3190
movslq %eax, %r12
movq %r15, %rdi
callq 0x3190
addq %r12, %rax
addq $-0xff, %rax
cmpq $-0x101, %rax           # imm = 0xFEFF
ja 0x10c78
leaq (%rsp,%r12), %rsi
movl $0x100, %edx            # imm = 0x100
subq %r12, %rdx
movq %r15, %rdi
callq 0x3460
movq %r15, %rdi
movq %r14, %rsi
callq 0x3510
movq 0x8(%rbx), %rsi
movq %r15, %rdi
callq 0x35b0
testq %rax, %rax
jne 0x10c9f
incl %ebp
jne 0x10c35
movl $0x1, %eax
jmp 0x10ca1
xorl %eax, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movb $0x0, 0x39cad(%rip)     # 0x4a970
callq 0x10b15
cmpl $-0x1, %eax
je 0x10d33
movl %eax, %ebp
movl $0x1, %r15d
leaq 0x39c94(%rip), %r12     # 0x4a970
leaq 0x6428(%rip), %r14      # 0x1710b
leal -0x1(%r15), %eax
movb %bpl, (%rax,%r12)
movl %r15d, %eax
movb $0x0, (%rax,%r12)
leal -0x27ff(%r15), %eax
cmpl $0xffffd7ff, %eax       # imm = 0xFFFFD7FF
ja 0x10d0b
movq %r14, %rdi
xorl %eax, %eax
callq 0xa2d7
movq 0x20(%rbx), %rsi
testq %rsi, %rsi
je 0x10d1b
movl %ebp, %edi
callq 0x3290
movl 0x1c(%rbx), %eax
leal (%rax,%rax,2), %esi
movq %rbx, %rdi
callq 0x10b15
movl %eax, %ebp
incl %r15d
cmpl $-0x1, %eax
jne 0x10ce3
leaq 0x39c36(%rip), %rax     # 0x4a970
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/j-hoppe[P]tu58fs/monitor.c
// Function: monitor_go
int monitor_go(monitor_t *_this, unsigned address, int no_go) {
	switch (_this->monitor_type) {
	case monitor_odt:
		return monitor_odt_go(_this, address, no_go);
	case monitor_m9312:
	case monitor_m9301: // only difference is the prompt
		return monitor_m9312_go(_this, address, no_go);
        case monitor_1144:
            return monitor_1144_go(_this, address, no_go);
	default:
		return error_set(ERROR_MONITOR, "monitor_go(): Illegal boot monitor %u selected",
				_this->monitor_type);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movl %edx, %r14d
movl %esi, %eax
movq %rdi, %rbx
movl (%rdi), %edx
leal -0x3(%rdx), %ecx
cmpl $0x2, %ecx
jb 0x11151
cmpl $0x5, %edx
je 0x111a4
cmpl $0x2, %edx
jne 0x111d9
testl %r14d, %r14d
je 0x111f9
leaq 0x6131(%rip), %rsi      # 0x17260
movq %rsp, %r14
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x3530
movl 0x18(%rbx), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10d43
jmp 0x11231
movq %rbx, %rdi
movl %eax, %esi
callq 0x1126d
testl %eax, %eax
jne 0x111ce
movl 0x18(%rbx), %edx
leaq 0x4677(%rip), %rsi      # 0x157e0
movq %rbx, %rdi
callq 0x10d43
xorl %ebp, %ebp
testl %r14d, %r14d
jne 0x11233
leaq 0x5f86(%rip), %rsi      # 0x17109
movq %rbx, %rdi
callq 0x10bb8
movl 0x18(%rbx), %esi
movq %rbx, %rdi
callq 0x10cb1
cmpb $0x0, 0x397d3(%rip)     # 0x4a970
jne 0x1118b
jmp 0x11233
leaq 0x6147(%rip), %rsi      # 0x172f2
xorl %ebp, %ebp
movq %rsp, %r15
movq %r15, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x3530
movl 0x18(%rbx), %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x10d43
testl %eax, %eax
je 0x11243
leaq 0xd063(%rip), %rax      # 0x1e238
movl (%rax), %ebp
jmp 0x11233
leaq 0x6014(%rip), %rsi      # 0x171f4
movl $0xfffffff6, %edi       # imm = 0xFFFFFFF6
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x9f73
leaq 0x60ee(%rip), %rsi      # 0x172ee
movq %rsp, %r14
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x3530
movl 0x18(%rbx), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10d43
movl 0x18(%rbx), %esi
movq %rbx, %rdi
callq 0x10cb1
cmpb $0x0, 0x39741(%rip)     # 0x4a970
jne 0x1121d
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
testl %r14d, %r14d
jne 0x11233
leaq 0x5eba(%rip), %rsi      # 0x17109
movq %rbx, %rdi
callq 0x10bb8
movl 0x18(%rbx), %esi
movq %rbx, %rdi
callq 0x10cb1
cmpb $0x0, 0x39707(%rip)     # 0x4a970
jne 0x11257
jmp 0x11233
// File: /workspace/github_c_makefile_star2_O3/j-hoppe[P]tu58fs/monitor.c
// Function: monitor_m9312_load_addr
static int monitor_m9312_load_addr(monitor_t *_this, unsigned address) {
	char buffer[256];
	char *answer;
	_this->last_address = 0xffffffff; // invalidate
	sprintf(buffer, "L %o", address);
	if (monitor_puts_echocheck(_this, buffer, _this->responsetime_us)) // verify address
		return error_code;
	monitor_puts(_this, CR);
	answer = monitor_gets(_this, _this->responsetime_us); // read prompt
	if (monitor_wait_prompt(_this, answer))
		return error_set(ERROR_MONITOR, "M9312/M9301 address load: %s-prompt not found",
				_this->prompt);
	_this->last_address = address;
	return ERROR_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movl %esi, %ebp
movq %rdi, %rbx
movl $0xffffffff, 0x28(%rdi) # imm = 0xFFFFFFFF
leaq 0x6001(%rip), %rsi      # 0x1728c
movq %rsp, %r14
movq %r14, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x3530
movl 0x18(%rbx), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10d43
testl %eax, %eax
je 0x112b7
leaq 0xcf85(%rip), %rax      # 0x1e238
movl (%rax), %eax
jmp 0x11302
leaq 0x5e4b(%rip), %rsi      # 0x17109
movq %rbx, %rdi
callq 0x10bb8
movl 0x18(%rbx), %esi
movq %rbx, %rdi
callq 0x10cb1
leaq 0x39698(%rip), %rsi     # 0x4a970
movq %rbx, %rdi
callq 0x10c03
testl %eax, %eax
je 0x112fd
movq 0x8(%rbx), %rdx
leaq 0x5fa2(%rip), %rsi      # 0x17291
movl $0xfffffff6, %edi       # imm = 0xFFFFFFF6
xorl %eax, %eax
callq 0x9f73
jmp 0x11302
movl %ebp, 0x28(%rbx)
xorl %eax, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/j-hoppe[P]tu58fs/bootloader.c
// Function: bootloader_show_code
void bootloader_show_code(FILE *fout, int opt_boot_address) {
	unsigned i;
	fprintf(fout, "# TU58 boot loader octal address/value dump\n");
	// dump out address/value pairs
	for (i = 0; i < obj_code_word_count; i++) {
		unsigned addr = opt_boot_address + 2 * i;
		unsigned value = obj_code[i];
		fprintf(fout, "%06o %06o\n", addr, value);
	}
	fprintf(fout, "\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x5fe1(%rip), %rdi      # 0x17308
movl $0x2c, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3550
movl %ebp, %r15d
leaq 0x61cd(%rip), %r12      # 0x17510
leaq 0x5feb(%rip), %r14      # 0x17335
xorl %r13d, %r13d
leal (%r15,%r13), %edx
movzwl (%r13,%r12), %ecx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3310
addq $0x2, %r13
cmpq $0x56, %r13
jne 0x1134d
movl $0xa, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3290
// File: /workspace/github_c_makefile_star2_O3/j-hoppe[P]tu58fs/bootloader.c
// Function: bootloader_download
int bootloader_download(serial_device_t *serialdevice, monitor_type_t monitor_type,
		int opt_boot_address) {
	monitor_t monitor;
	unsigned i;

	if (monitor_init(&monitor, serialdevice, monitor_type, stdout, opt_usbdelay))
		return error_set(ERROR_MONITOR, "monitor_init in bootloader_download");
	if (monitor_assert_prompt(&monitor))
		return error_set(ERROR_MONITOR,
				"Boot loader download: PDP-11 console prompt not found.");

	// dump out address/value pairs
	for (i = 0; i < obj_code_word_count; i++) {
		unsigned addr = opt_boot_address + 2 * i;
		unsigned value = obj_code[i];
		if (monitor_deposit(&monitor, addr, value))
			return error_set(ERROR_MONITOR, "bootloader_download");
	}
//monitor_trace_dump(stderr) ; //debug
	monitor_close(&monitor);
	return ERROR_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebx
movl %esi, %edx
movq %rdi, %rsi
movq 0xac2e(%rip), %rax      # 0x1bfd0
movq (%rax), %rcx
leaq 0xb6d8(%rip), %rax      # 0x1ca84
movl (%rax), %r8d
leaq 0x8(%rsp), %rdi
callq 0x10aac
testl %eax, %eax
je 0x113c6
leaq 0x5f7c(%rip), %rsi      # 0x17340
jmp 0x11423
leaq 0x8(%rsp), %rdi
callq 0x10b7f
testl %eax, %eax
je 0x113dd
leaq 0x5f89(%rip), %rsi      # 0x17364
jmp 0x11423
movl %ebx, %r14d
xorl %r15d, %r15d
leaq 0x6126(%rip), %r12      # 0x17510
leaq 0x8(%rsp), %rbx
leal (%r14,%r15), %esi
movzwl (%r15,%r12), %edx
movq %rbx, %rdi
callq 0x10e9a
testl %eax, %eax
jne 0x1141c
addq $0x2, %r15
cmpq $0x56, %r15
jne 0x113ef
leaq 0x8(%rsp), %rdi
callq 0x10b12
xorl %eax, %eax
jmp 0x1142f
leaq 0x5f2d(%rip), %rsi      # 0x17350
movl $0xfffffff6, %edi       # imm = 0xFFFFFFF6
xorl %eax, %eax
callq 0x9f73
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/j-hoppe[P]tu58fs/bootloader.c
// Function: bootloader_go
int bootloader_go(serial_device_t *serialdevice, monitor_type_t monitor_type, int boot_address) {
	monitor_t monitor;
	if (monitor_init(&monitor, serialdevice, monitor_type, stdout, opt_usbdelay))
		return error_set(ERROR_MONITOR, "monitor_init in bootloader_go");
	if (monitor_assert_prompt(&monitor))
		return error_set(ERROR_MONITOR, "monitor_assert_prompt in bootloader_go");
	if (monitor_go(&monitor, boot_address, 0))
		return error_set(ERROR_MONITOR, "monitor_go in bootloader_go");
	return ERROR_OK;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebx
movl %esi, %edx
movq %rdi, %rsi
movq 0xab81(%rip), %rax      # 0x1bfd0
movq (%rax), %rcx
leaq 0xb62b(%rip), %rax      # 0x1ca84
movl (%rax), %r8d
leaq 0x8(%rsp), %rdi
callq 0x10aac
testl %eax, %eax
je 0x11473
leaq 0x5f2a(%rip), %rsi      # 0x1739b
jmp 0x114a5
leaq 0x8(%rsp), %rdi
callq 0x10b7f
testl %eax, %eax
je 0x1148a
leaq 0x5f31(%rip), %rsi      # 0x173b9
jmp 0x114a5
leaq 0x8(%rsp), %rdi
xorl %ebp, %ebp
movl %ebx, %esi
xorl %edx, %edx
callq 0x110ee
testl %eax, %eax
je 0x114b3
leaq 0x5f3b(%rip), %rsi      # 0x173e0
movl $0xfffffff6, %edi       # imm = 0xFFFFFFF6
xorl %eax, %eax
callq 0x9f73
movl %eax, %ebp
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/meaning-matters[P]Except/thread.c
// Function: main
int main(void)
{
    pthread_t   launchers[NUM_LAUNCHERS];

    int i;

    try
    {
        for (i = 0; i < NUM_LAUNCHERS; i++)
        {
            pthread_create(&launchers[i], NULL, launch, (void *)0);
        }
    
        for (i = 0; i < NUM_LAUNCHERS; i++)
        {
            pthread_join(launchers[i], NULL);
        }
    }
    catch(Throwable, e)
    {
        e->printTryTrace(0);
    }
    finally;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
leaq 0x5f1f(%rip), %r15      # 0x7230
movq (%r15), %rdi
leaq 0x2ce9(%rip), %rsi      # 0x4004
movl $0x14, %edx
callq 0x1958
leaq 0x5ef8(%rip), %r14      # 0x7224
xorl %r13d, %r13d
movl %r13d, %eax
movq %rax, 0x8(%rsp)
leaq 0x1b8(%rip), %r12       # 0x14f6
movq (%r15), %rdi
callq 0x1710
movq %rax, %rbp
movq %rax, %rdi
movq %r14, %rsi
leaq 0x2cae(%rip), %rdx      # 0x4004
movl $0x14, %ecx
callq 0x1f8c
testl %eax, %eax
je 0x1383
movq (%rbp), %rdi
cmpl $0x0, 0x1b4(%rdi)
je 0x1383
addq $0x8, %rdi
movl $0x1, %esi
callq 0x1130
testl %eax, %eax
je 0x13f7
movq %rbp, %rdi
movq %r14, %rsi
leaq 0x5d30(%rip), %rdx      # 0x70c0
leaq 0x2c6d(%rip), %rcx      # 0x4004
movl $0x20, %r8d
callq 0x2025
testl %eax, %eax
je 0x144d
movq (%rbp), %rax
cmpl $0x0, 0x1b4(%rax)
je 0x144d
movq %rbp, %rdi
leaq 0x5cfb(%rip), %rsi      # 0x70c0
callq 0x1ce0
testl %eax, %eax
je 0x144d
movq 0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x2379
movq (%rbp), %rcx
movl $0x2, 0x1b8(%rcx)
movq 0x8(%rsp), %rdi
callq *0x1f0(%rax)
jmp 0x144d
movq (%rbp), %rax
movl $0x1, 0x1b8(%rax)
movl %r13d, %eax
movq %rax, %rbx
leaq (%rsp,%rax), %rdi
addq $0x10, %rdi
movl %r13d, %ecx
movq %rcx, %rsi
movq %r12, %rdx
callq 0x10e0
addq $0x8, %rbx
movq %rbx, %rax
cmpq $0x50, %rbx
jne 0x1408
movl %r13d, %eax
movq %rax, %rbx
movq 0x10(%rsp,%rax,8), %rdi
movl %r13d, %esi
callq 0x1120
incq %rbx
movq %rbx, %rax
cmpq $0xa, %rbx
jne 0x1431
cmpl $0x0, 0x5dd0(%rip)      # 0x7224
je 0x133e
movq (%rbp), %rdi
cmpl $0x0, 0x1b4(%rdi)
jne 0x148f
addq $0xd0, %rdi
movl $0x1, %esi
callq 0x1130
testl %eax, %eax
jne 0x148f
movq (%rbp), %rax
movl $0x1, 0x1b4(%rax)
jmp 0x133e
movq (%r15), %rdi
callq 0x1710
movq (%rax), %rax
movl $0x3, 0x1b8(%rax)
movq (%r15), %rdi
callq 0x1710
movq (%rax), %rax
cmpl $0x0, 0x1b4(%rax)
jg 0x14c4
movq (%r15), %rdi
callq 0x1d36
testl %eax, %eax
je 0x14e5
movq (%r15), %rdi
callq 0x1710
movq (%rax), %rax
movl 0x1b4(%rax), %ecx
movl %ecx, %edx
decl %edx
movl %edx, 0x1b4(%rax)
testl %ecx, %ecx
jg 0x14c4
jmp 0x14a4
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/meaning-matters[P]Except/thread.c
// Function: launch
void *launch(void *arg)
{
    pthread_t   threads[NUM_THREADS];
    int         i;

    for (i = 0; i < NUM_THREADS; i++)
    {
        pthread_create(&threads[i], NULL, thread, (void *)0);
    }

    for (i = 0; i < NUM_THREADS; i++)
    {
        pthread_join(threads[i], NULL);
    }   
    printf("launch: reporting that all %d threads have terminated\n", i);

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
xorl %r14d, %r14d
leaq 0x4d(%rip), %rbx        # 0x1554
leaq (%rsp,%r14), %rdi
xorl %esi, %esi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x10e0
addq $0x8, %r14
cmpq $0x50, %r14
jne 0x1507
xorl %ebx, %ebx
movq (%rsp,%rbx,8), %rdi
xorl %esi, %esi
callq 0x1120
incq %rbx
cmpq $0xa, %rbx
jne 0x1523
leaq 0x2acf(%rip), %rdi      # 0x400d
movl $0xa, %esi
xorl %eax, %eax
callq 0x1060
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/meaning-matters[P]Except/Except.c
// Function: ExceptGetScope
Scope ExceptGetScope(
    Context *   pC)             /* pointer to thread exception context */
{
    Scope       scope;

    if (pC == NULL)
        pC = ExceptGetContext(NULL);

    ExceptPrintDebug(pC, "ExceptGetScope");

    if (pC == NULL || pC->pEx == NULL)
        scope = OUTSIDE;
    else
        scope = ((Except *)LifoPeek(pC->exStack, 1))->scope;

    return scope;
}

// Assembly:
pushq %rax
testq %rdi, %rdi
jne 0x16ed
xorl %edi, %edi
callq 0x1710
movq %rax, %rdi
testq %rax, %rax
je 0x1709
cmpq $0x0, (%rdi)
je 0x1709
movq 0x8(%rdi), %rdi
movl $0x1, %esi
callq 0x2379
movl 0x1b8(%rax), %eax
jmp 0x170e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/meaning-matters[P]Except/Except.c
// Function: ExceptGetContext
Context * ExceptGetContext(
    Context *   pC)             /* pointer to thread exception context */
{
#if     MULTI_THREADING
    EXCEPT_THREAD_MUTEX_FUNC(1);
    if (pC == NULL && pContextHash != NULL)
        pC = HashLookup(pContextHash, EXCEPT_THREAD_ID_FUNC());
    EXCEPT_THREAD_MUTEX_FUNC(0);
    
    return pC;
#else
    return &defaultContext;
#endif
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %edi
callq 0x175f
testq %rbx, %rbx
sete %al
movq 0x5b0a(%rip), %r14      # 0x7238
testq %r14, %r14
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x174d
callq 0x10f0
movq %r14, %rdi
movl %eax, %esi
callq 0x2757
movq %rax, %rbx
xorl %edi, %edi
callq 0x175f
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/meaning-matters[P]Except/Except.c
// Function: ExceptMutex
static void ExceptMutex(
    int         mode)           /* 1: lock, 0 unlock */
{
    static volatile pthread_mutex_t mutex;
    static volatile sig_atomic_t    initialized;
    static volatile sig_atomic_t    ready;
    static volatile int             count;
    static volatile pthread_t       tid;

    if (!initialized && !initialized++)
    {
        pthread_mutex_init(&mutex, NULL);
        ready = 1;
    }
    else
    {
        while (!ready)
            ;
    }
    
    if (mode == 1)
    {
        if (tid == pthread_self())
        {
            count++;
        }
        else
        {
            pthread_mutex_lock(&mutex);
            tid = pthread_self();
            count = 1;
        }
    }
    else if (mode == 0)
    {
        if (tid == pthread_self())
        {
            if (--count == 0)
            {
                tid = 0;
                pthread_mutex_unlock(&mutex);
            }
        }
        else if (tid != 0 && tid != pthread_self())
        {
            fprintf(stderr, "Except internal error: thread attempts to unlock"
                            " without holding lock\n");
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edi, %ebx
cmpl $0x0, 0x5afb(%rip)      # 0x7268
jne 0x1786
movl 0x5af3(%rip), %eax      # 0x7268
leal 0x1(%rax), %ecx
movl %ecx, 0x5aea(%rip)      # 0x7268
testl %eax, %eax
je 0x1814
cmpl $0x0, 0x5adf(%rip)      # 0x726c
je 0x1786
movq 0x5ae2(%rip), %r15      # 0x7278
callq 0x10f0
movq %rax, %r14
cmpl $0x1, %ebx
jne 0x17b0
cmpq %r14, %r15
jne 0x17d9
incl 0x5ac2(%rip)            # 0x7270
jmp 0x180e
cmpq %r14, %r15
jne 0x17f8
decl 0x5ab5(%rip)            # 0x7270
jne 0x180e
movq $0x0, 0x5ab0(%rip) # 0x7278
leaq 0x5a71(%rip), %rdi      # 0x7240
popq %rbx
popq %r14
popq %r15
jmp 0x10b0
leaq 0x5a60(%rip), %rdi      # 0x7240
callq 0x1150
movq %r14, 0x5a8c(%rip)      # 0x7278
movl $0x1, 0x5a7a(%rip)      # 0x7270
jmp 0x180e
cmpq $0x0, 0x5a78(%rip)      # 0x7278
je 0x180e
movq 0x5a6f(%rip), %rax      # 0x7278
cmpq %r14, %rax
jne 0x1831
popq %rbx
popq %r14
popq %r15
retq
leaq 0x5a25(%rip), %rdi      # 0x7240
xorl %esi, %esi
callq 0x1140
movl $0x1, 0x5a40(%rip)      # 0x726c
jmp 0x178f
callq 0x1170
jmp 0x180e
// File: /workspace/github_c_makefile_star2_O3/meaning-matters[P]Except/Except.c
// Function: ExceptThreadCleanup
void ExceptThreadCleanup(
    int         threadId)       /* ID of ceased thread or -1 for self */
{
#if     MULTI_THREADING
    validate(threadId != EXCEPT_THREAD_ID_FUNC(), NOTHING);
    if (threadId == -1)
        threadId = EXCEPT_THREAD_ID_FUNC();

    EXCEPT_THREAD_MUTEX_FUNC(1);
    if (pContextHash != NULL)
    {
        Context * pC;
        
        pC = HashLookup(pContextHash, threadId);
        if (pC != NULL)
        {
            ExceptRestoreHandlers(pC);
            LifoDestroyData(pC->exStack);
            if (pC->pEx->checkList != NULL)
                ListDestroyData(pC->pEx->checkList);
            free(HashRemove(pContextHash, threadId));
        }
    }    
    EXCEPT_THREAD_MUTEX_FUNC(0);
#endif
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edi, %ebp
callq 0x10f0
movq %rax, %rbx
cmpl %ebp, %ebx
jne 0x1870
movq 0x59df(%rip), %rdi      # 0x7230
leaq 0x287e(%rip), %rdx      # 0x40d6
leaq 0x2897(%rip), %rcx      # 0x40f6
xorl %esi, %esi
movl $0x2c6, %r8d            # imm = 0x2C6
popq %rbx
popq %r14
popq %rbp
jmp 0x24a8
cmpl $-0x1, %ebp
cmovnel %ebp, %ebx
movl $0x1, %edi
callq 0x175f
movq 0x59b1(%rip), %rdi      # 0x7238
testq %rdi, %rdi
je 0x18d3
movl %ebx, %esi
callq 0x2757
testq %rax, %rax
je 0x18d3
movq %rax, %r14
callq 0x18de
movq 0x8(%r14), %rdi
callq 0x21cf
movq (%r14), %rax
movq 0x1c0(%rax), %rdi
testq %rdi, %rdi
je 0x18bd
callq 0x29c4
movq 0x5974(%rip), %rdi      # 0x7238
movl %ebx, %esi
callq 0x2870
movq %rax, %rdi
callq 0x1040
xorl %edi, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x175f