LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/image.c
// Function: image_save
int image_save(image_t *_this) {
	if (!_this->open)
		return error_set(ERROR_IMAGE_MODE, "image_save(): closed unit %d", _this->unit);

	if (_this->readonly)
		return error_set(ERROR_IMAGE_MODE, "image_save(): unit %d read only", _this->unit);
	if (opt_verbose)
		info("unit %d: saving %s image to %s\"%s\"'", _this->unit,
				_this->changed ? "changed" : "unchanged", _this->shared ? "shared " : "",
				_this->host_fpath);

	image_lock(_this);
	if (_this->shared) {
		if (hostdir_save(_this->hostdir))
			error_set(error_code, "hostdir_save failed");
	} else {
		if (image_hostfile_save(_this))
			error_set(error_code, "image_hostfile_save failed");
	}
	if (!error_code) {
		_this->changed = 0;
		boolarray_clear(_this->changedblocks);
	}
	image_unlock(_this);
	return error_code;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x0, 0xf4(%rdi)
je 0x8224
cmpl $0x0, 0x3c(%rbx)
je 0x8243
movl (%rbx), %edx
leaq 0xcd66(%rip), %rsi      # 0x14f88
jmp 0x822d
movl (%rbx), %edx
leaq 0xcd3e(%rip), %rsi      # 0x14f6b
movl $0xfffffff8, %edi       # imm = 0xFFFFFFF8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x9f8f
leaq 0x1482a(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x8292
cmpb $0x0, 0xf5(%rbx)
leaq 0xcd6f(%rip), %rax      # 0x14fcc
leaq 0xcd6a(%rip), %rdx      # 0x14fce
cmoveq %rax, %rdx
movl (%rbx), %esi
cmpl $0x0, 0x38(%rbx)
leaq 0xd52a(%rip), %rax      # 0x1579f
leaq 0xcd5a(%rip), %rcx      # 0x14fd6
cmoveq %rax, %rcx
movq 0x30(%rbx), %r8
leaq 0xcd1d(%rip), %rdi      # 0x14fa8
xorl %eax, %eax
callq 0xa127
leaq 0x8(%rbx), %r14
movq %r14, %rdi
callq 0x35d0
cmpl $0x0, 0x38(%rbx)
je 0x82d4
movq 0xd8(%rbx), %rdi
callq 0x958b
testl %eax, %eax
je 0x83a2
leaq 0x15f89(%rip), %rax     # 0x1e248
movl (%rax), %edi
leaq 0xcd16(%rip), %rsi      # 0x14fde
xorl %eax, %eax
callq 0x9f8f
jmp 0x83a2
movq 0x30(%rbx), %rdi
movl $0x2, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x34b0
testl %eax, %eax
js 0x8355
movl %eax, %ebp
movl 0x10c(%rbx), %edi
testl %edi, %edi
je 0x8387
movl 0x3c(%rbx), %edx
movl 0x108(%rbx), %esi
movq 0x118(%rbx), %rcx
movl 0x110(%rbx), %r8d
xorl %r9d, %r9d
callq 0xb6e7
movq %rax, %r15
movq %rax, %rdi
callq 0xb829
movq %r15, %rdi
callq 0xbc20
movq 0x118(%rbx), %rsi
movl 0x110(%rbx), %edx
movl %ebp, %edi
callq 0x3150
movq %r15, %rdi
callq 0xbbf5
movq %r15, %rdi
callq 0xb79c
jmp 0x839b
movl (%rbx), %edx
movq 0x30(%rbx), %rcx
leaq 0xcdf2(%rip), %rsi      # 0x15154
movl $0xfffffffa, %edi       # imm = 0xFFFFFFFA
xorl %eax, %eax
callq 0x9f8f
testl %eax, %eax
je 0x83a2
leaq 0x15ecf(%rip), %rax     # 0x1e248
movl (%rax), %edi
leaq 0xcc70(%rip), %rsi      # 0x14ff2
jmp 0x82c8
movq 0x118(%rbx), %rsi
movl 0x110(%rbx), %edx
movl %ebp, %edi
callq 0x3150
movl %ebp, %edi
callq 0x3270
leaq 0x15e9f(%rip), %r15     # 0x1e248
cmpl $0x0, (%r15)
jne 0x83c2
movb $0x0, 0xf5(%rbx)
movq 0xf8(%rbx), %rdi
callq 0xb19e
movq %r14, %rdi
callq 0x33b0
movl (%r15), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/image.c
// Function: image_sync
int image_sync(image_t *_this) {
	int result = ERROR_OK;
	if (_this->open) {
		if (_this->shared) {
			// merge files in the image and the shared directory
			image_lock(_this);
			hostdir_sync(_this->hostdir);
			image_unlock(_this);
		} else {
			// just save the image file
			if (_this->changed)
				result = image_save(_this);
		}
	}
	boolarray_clear(_this->changedblocks);
	return result;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %ebp, %ebp
cmpb $0x0, 0xf4(%rdi)
je 0x8425
cmpl $0x0, 0x38(%rbx)
je 0x8412
leaq 0x8(%rbx), %r14
movq %r14, %rdi
callq 0x35d0
movq 0xd8(%rbx), %rdi
callq 0x962d
movq %r14, %rdi
callq 0x33b0
jmp 0x8425
cmpb $0x0, 0xf5(%rbx)
je 0x8425
movq %rbx, %rdi
callq 0x8200
movl %eax, %ebp
movq 0xf8(%rbx), %rdi
callq 0xb19e
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/image.c
// Function: image_destroy
void image_destroy(image_t *_this) {
	_this->open = 0;
	if (_this->host_fpath)
		free(_this->host_fpath);
	_this->host_fpath = NULL;
	if (_this->data)
		free(_this->data);
	_this->data = NULL;
	_this->data_size = 0;
	if (_this->shared) {
		if (_this->hostdir)
			hostdir_destroy(_this->hostdir);
		if (_this->pdp_filesystem)
			filesystem_destroy(_this->pdp_filesystem);
	}
	free(_this);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movb $0x0, 0xf4(%rdi)
movq 0x30(%rdi), %rdi
testq %rdi, %rdi
je 0x8451
callq 0x3050
movq $0x0, 0x30(%rbx)
movq 0x118(%rbx), %rdi
testq %rdi, %rdi
je 0x846a
callq 0x3050
movq $0x0, 0x118(%rbx)
movl $0x0, 0x110(%rbx)
cmpl $0x0, 0x38(%rbx)
je 0x84a7
movq 0xd8(%rbx), %rdi
testq %rdi, %rdi
je 0x8496
callq 0x94a8
movq 0xe0(%rbx), %rdi
testq %rdi, %rdi
je 0x84a7
callq 0xb79c
movq %rbx, %rdi
popq %rbx
jmp 0x3050
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/serial.c
// Function: serial_devtxinit
void serial_devtxinit(serial_device_t *serial) {
	// flush all output
	tcflush(serial->fd, TCOFLUSH);

	// reset send buffer
	serial->wcnt = 0;
	serial->wptr = serial->wbuf;

	return;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
movl $0x1, %esi
callq 0x31c0
movl $0x0, 0x128(%rbx)
leaq 0x20(%rbx), %rax
movq %rax, 0x120(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/serial.c
// Function: serial_devrxinit
void serial_devrxinit(serial_device_t *serial) {
	// flush all input
	tcflush(serial->fd, TCIFLUSH);

	// reset receive buffer
	serial->rcnt = 0;
	serial->rptr = serial->rbuf;

	return;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
xorl %esi, %esi
callq 0x31c0
movl $0x0, 0x238(%rbx)
leaq 0x12c(%rbx), %rax
movq %rax, 0x230(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/serial.c
// Function: serial_devrxavail
int32_t serial_devrxavail(serial_device_t *serial) {
	// get more characters if none available
	if (serial->rcnt <= 0) {
		serial->rcnt = read(serial->fd, serial->rbuf, sizeof(serial->rbuf));
		serial->rptr = serial->rbuf;
	}
	if (serial->rcnt < 0)
		serial->rcnt = 0;

	// return characters available
	return serial->rcnt;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x238(%rdi)
jg 0x8555
movl (%rbx), %edi
leaq 0x12c(%rbx), %r14
movl $0x100, %edx            # imm = 0x100
movq %r14, %rsi
callq 0x32c0
movl %eax, 0x238(%rbx)
movq %r14, 0x230(%rbx)
cmpl $0x0, 0x238(%rbx)
jns 0x8568
movl $0x0, 0x238(%rbx)
movl 0x238(%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/serial.c
// Function: serial_devtxwrite
int32_t serial_devtxwrite(serial_device_t *serial, uint8_t *buf, int32_t cnt) {
	// write characters if asked, return number written
	int32_t result = 0;
	if (cnt > 0) {
		// write is monolitic and may take long
		// make sure serial_tx_lasttime_ms doe not time out
		serial->tx_lasttime_ms = now_ms() + 60000; // signal busy: 1 minute in the future
		result = write(serial->fd, buf, cnt);
		serial->tx_lasttime_ms = now_ms(); // now up to date
	}
	return result;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testl %edx, %edx
jle 0x85b3
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
xorl %eax, %eax
callq 0xa41c
addq $0xea60, %rax           # imm = 0xEA60
movq %rax, 0x18(%rbx)
movl (%rbx), %edi
movl %ebp, %edx
movq %r14, %rsi
callq 0x3150
movq %rax, %r14
xorl %eax, %eax
callq 0xa41c
movq %rax, 0x18(%rbx)
jmp 0x85b6
xorl %r14d, %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/serial.c
// Function: serial_devtxflush
void serial_devtxflush(serial_device_t *serial) {
	int32_t acnt;

	// write any characters we have
	if (serial->wcnt > 0) {
		if ((acnt = serial_devtxwrite(serial, serial->wbuf, serial->wcnt)) != serial->wcnt)
			error("devtxflush(): write error, expected=%d, actual=%d", serial->wcnt, acnt);
	}

	// buffer is now empty
	serial->wcnt = 0;
	serial->wptr = serial->wbuf;

	// wait until all characters are transmitted
	tcdrain(serial->fd);

	return;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x128(%rdi), %edx
testl %edx, %edx
jle 0x85f2
leaq 0x20(%rbx), %rsi
movq %rbx, %rdi
callq 0x8576
movl 0x128(%rbx), %esi
cmpl %esi, %eax
je 0x85f2
leaq 0xcb90(%rip), %rdi      # 0x15179
movl %eax, %edx
xorl %eax, %eax
callq 0xa054
movl $0x0, 0x128(%rbx)
leaq 0x20(%rbx), %rax
movq %rax, 0x120(%rbx)
movl (%rbx), %edi
popq %rbx
jmp 0x3120
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/serial.c
// Function: serial_devrxget
uint8_t serial_devrxget(serial_device_t *serial) {
	// get more characters if none available
	while (serial_devrxavail(serial) <= 0)
		/*spin*/;

	serial->rx_lasttime_ms = now_ms(); // signal activity

	// count, return next character
	serial->rcnt--;
	return *(serial->rptr)++;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq %rbx, %rdi
callq 0x8522
testl %eax, %eax
jle 0x8613
xorl %eax, %eax
callq 0xa41c
movq %rax, 0x10(%rbx)
decl 0x238(%rbx)
movq 0x230(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x230(%rbx)
movb (%rax), %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/serial.c
// Function: serial_devtxput
void serial_devtxput(serial_device_t *serial, uint8_t c) {

	// must flush if hit the end of the buffer
	if (serial->wcnt >= (int)sizeof(serial->wbuf))
		serial_devtxflush(serial);

	// count, add one character to buffer
	serial->wcnt++;
	*(serial->wptr)++ = c;

	serial->tx_lasttime_ms = now_ms(); // signal activity

	return;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
cmpl $0x100, 0x128(%rdi)     # imm = 0x100
jl 0x8662
movq %rbx, %rdi
callq 0x85be
incl 0x128(%rbx)
movq 0x120(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x120(%rbx)
movb %bpl, (%rax)
xorl %eax, %eax
callq 0xa41c
movq %rax, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/serial.c
// Function: serial_decode_format
int serial_decode_format(char *formatstr, int *result_bitcount, char *result_parity,
		int *result_stopbits) {
	if (!formatstr || strlen(formatstr) != 3)
		return 1;
	switch (formatstr[0]) {
	case '5':
		*result_bitcount = 5 ;
		break ;
	case '6':
		*result_bitcount = 6 ;
		break ;
	case '7':
		*result_bitcount = 7 ;
		break ;
	case '8':
		*result_bitcount = 8 ;
		break ;
	default: return 1;
	}

	switch (toupper(formatstr[1])) {
	case 'O':
	case 'E':
	case 'N':
		*result_parity = toupper(formatstr[1]) ;
		break ;
	default: return 1;
	}

	switch (formatstr[2]) {
	case '1':
		*result_stopbits = 1 ;
		break ;
	case '2':
		*result_stopbits = 2 ;
		break ;
	default: return 1;
	}
	return 0 ; // all OK
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl $0x1, %ebx
testq %rdi, %rdi
je 0x8713
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r12
callq 0x31a0
cmpq $0x3, %rax
jne 0x8713
movb (%r12), %al
leal -0x35(%rax), %ecx
cmpb $0x3, %cl
ja 0x8713
addb $-0x30, %al
movzbl %al, %eax
movl %eax, (%r13)
callq 0x3030
movq (%rax), %rax
movsbq 0x1(%r12), %rcx
movl (%rax,%rcx,4), %eax
leal -0x45(%rax), %ecx
cmpl $0xa, %ecx
ja 0x8713
movl $0x601, %edx            # imm = 0x601
btl %ecx, %edx
jae 0x8713
movb %al, (%r15)
movzbl 0x2(%r12), %eax
movl $0x1, %ebx
cmpl $0x31, %eax
je 0x870e
cmpl $0x32, %eax
jne 0x8713
movl $0x2, %ebx
movl %ebx, (%r14)
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/serial.c
// Function: serial_devrestore
void serial_devrestore(serial_device_t *serial) {
	tcsetattr(serial->fd, TCSANOW, &serial->lineSave);
	close(serial->fd);
	serial->fd = -1;
	return;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
leaq 0x23c(%rbx), %rdx
xorl %esi, %esi
callq 0x34a0
movl (%rbx), %edi
callq 0x3270
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/serial.c
// Function: coninit
void coninit(int rawmode) {
	struct termios cons;

	// background mode, don't do anything
	if (opt_background)
		return;

	// get current console parameters
	if (tcgetattr(fileno(stdin), &consSave))
		fatal("stdin not a serial device");

	// copy modes
	cons = consSave;

	// set new modes
	if (rawmode) {
		cfmakeraw(&cons);
	} else {
		cons.c_lflag &= ~( ICANON | ECHO);
	}

	// now set param
	tcflush(fileno(stdin), TCIFLUSH);
	tcsetattr(fileno(stdin), TCSANOW, &cons);

	// set non-blocking reads
	if (fcntl(fileno(stdin), F_SETFL, FNDELAY) == -1)
		error("stdin failed to set non-blocking read");

	return;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
leaq 0x1404f(%rip), %rax     # 0x1ca8c
cmpl $0x0, (%rax)
jne 0x8b0c
movl %edi, %ebx
movq 0x13589(%rip), %r14     # 0x1bfd8
movq (%r14), %rdi
callq 0x3380
leaq 0x156f2(%rip), %rsi     # 0x1e150
movl %eax, %edi
callq 0x3490
testl %eax, %eax
je 0x8a77
leaq 0xc797(%rip), %rdi      # 0x15207
xorl %eax, %eax
callq 0xa2ef
movups 0x156fe(%rip), %xmm0    # 0x1e17c
movups %xmm0, 0x2c(%rsp)
movups 0x156e6(%rip), %xmm0    # 0x1e170
movaps %xmm0, 0x20(%rsp)
movups 0x156ca(%rip), %xmm0    # 0x1e160
movaps %xmm0, 0x10(%rsp)
movups 0x156ae(%rip), %xmm0    # 0x1e150
movaps %xmm0, (%rsp)
testl %ebx, %ebx
je 0x8ab4
movq %rsp, %rdi
callq 0x3440
jmp 0x8ab9
andb $-0xb, 0xc(%rsp)
movq (%r14), %rdi
callq 0x3380
movl %eax, %edi
xorl %esi, %esi
callq 0x31c0
movq (%r14), %rdi
callq 0x3380
movq %rsp, %rdx
movl %eax, %edi
xorl %esi, %esi
callq 0x34a0
movq (%r14), %rdi
callq 0x3380
movl %eax, %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
xorl %eax, %eax
callq 0x3130
cmpl $-0x1, %eax
jne 0x8b0c
leaq 0xc71c(%rip), %rdi      # 0x15221
xorl %eax, %eax
callq 0xa054
addq $0x48, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/serial.c
// Function: conget
int32_t conget(void) {
	char buf[1];
	int32_t s;

	// background mode, don't return anything
	if (opt_background)
		return -1;

	// try to read at most one char (may be none)
	s = read(fileno(stdin), buf, sizeof(buf));

	// if got a char return it, else return -1
	return s == 1 ? *buf : -1;
}

// Assembly:
leaq 0x13f43(%rip), %rcx     # 0x1ca8c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x0, (%rcx)
je 0x8b54
retq
pushq %rbx
subq $0x10, %rsp
movq 0x13478(%rip), %rax     # 0x1bfd8
movq (%rax), %rdi
callq 0x3380
leaq 0xf(%rsp), %rbx
movl $0x1, %edx
movl %eax, %edi
movq %rbx, %rsi
callq 0x32c0
cmpl $0x1, %eax
movsbl (%rbx), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel %ecx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/hostdir.c
// Function: snapshot_file_find
hostdir_file_t *snapshot_file_find(hostdir_snapshot_t *_this, char *pdp_filename_ext) {
	int i;
	hostdir_file_t *result = NULL;
	for (i = 0; !result && i < _this->file_count; i++) {
		if (!strcasecmp(_this->file[i].pdp_filnam_ext_stream, pdp_filename_ext))
			result = &_this->file[i]; // found
	}
	return result;
}

// Assembly:
movl 0x8(%rdi), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
jle 0x8c03
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %r15
imulq $0x150, %rax, %r12      # imm = 0x150
addq $-0x150, %r12           # imm = 0xFEB0
xorl %r13d, %r13d
movq %r15, %rdi
movq %r14, %rsi
callq 0x3060
leaq -0x150(%r13), %rcx
testl %eax, %eax
je 0x8be8
addq %r12, %r13
addq $0x150, %r15            # imm = 0x150
testq %r13, %r13
movq %rcx, %r13
jne 0x8bc0
subq %rcx, %rbx
addq $-0x140, %rbx           # imm = 0xFEC0
xorl %ecx, %ecx
testl %eax, %eax
cmoveq %rbx, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
movq %rcx, %rax
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/hostdir.c
// Function: snapshot_file_register
hostdir_file_t *snapshot_file_register(hostdir_snapshot_t *_this, char *pdp_filename_ext,
		hostdir_side_t side) {
	hostdir_file_t *result;
	result = snapshot_file_find(_this, pdp_filename_ext);
	if (result && result->state[OTHER_SIDE(side)] == fs_created) {
		// Special logic: if a file is create on both sides simultanuously
		// it is found by the 2nd side, because 1st side allocated it.
		// so do not create a 2nd time but mark as "created"
		// It ois NOT possible that the 1st side "created" and the 2nd side had the file before:
		// the snapshot shows only a synchronized state with same files on both sides.
		result->state[side] = fs_created;
	}
	if (!result) {
		assert(_this->file_count < HOSTDIR_MAX_FILES);
		result = &_this->file[_this->file_count++];
		memset(result, 0, sizeof(hostdir_file_t));
		strcpy(result->pdp_filnam_ext_stream, pdp_filename_ext);
		result->state[side] = fs_created;
		result->state[OTHER_SIDE(side)] = fs_missing;
	}
	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r12
movl 0x8(%rdi), %ecx
leaq 0x10(%rdi), %r14
xorl %eax, %eax
testl %ecx, %ecx
cmovlel %eax, %ecx
jle 0x8c84
movl %ebx, 0x4(%rsp)
imulq $0x150, %rcx, %rbp      # imm = 0x150
addq $-0x150, %rbp           # imm = 0xFEB0
xorl %ebx, %ebx
movq %r14, %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x3060
movl %eax, %ecx
leaq -0x150(%rbx), %rax
testl %ecx, %ecx
je 0x8c6b
addq %rbp, %rbx
addq $0x150, %r13            # imm = 0x150
testq %rbx, %rbx
movq %rax, %rbx
jne 0x8c41
movq %r12, %rdx
subq %rax, %rdx
addq $-0x140, %rdx           # imm = 0xFEC0
xorl %eax, %eax
testl %ecx, %ecx
cmoveq %rdx, %rax
movl 0x4(%rsp), %ebx
testq %rax, %rax
je 0x8ca9
xorl %ecx, %ecx
testl %ebx, %ebx
sete %cl
cmpl $0x3, 0x128(%rax,%rcx,4)
jne 0x8d06
movl %ebx, %ecx
movl $0x3, 0x128(%rax,%rcx,4)
jmp 0x8d06
movslq 0x8(%r12), %rax
cmpq $0x3e8, %rax            # imm = 0x3E8
jge 0x8d15
leal 0x1(%rax), %ecx
movl %ecx, 0x8(%r12)
imulq $0x150, %rax, %rax      # imm = 0x150
addq %rax, %r14
movl $0x150, %edx            # imm = 0x150
movq %r14, %rdi
xorl %esi, %esi
callq 0x3230
movq %r14, %rdi
movq %r15, %rsi
callq 0x30d0
movl %ebx, %eax
movl $0x3, 0x128(%r14,%rax,4)
xorl %eax, %eax
testl %ebx, %ebx
sete %al
movl $0x1, 0x128(%r14,%rax,4)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc5e4(%rip), %rdi      # 0x15300
leaq 0xc603(%rip), %rsi      # 0x15326
leaq 0xc606(%rip), %rcx      # 0x15330
movl $0x78, %edx
callq 0x3210
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/hostdir.c
// Function: state_text
char *state_text(hostdir_side_t side, hostdir_file_state_t state) {
	static char buff[2][80];
	char *statetxt[] = { "unchanged", "missing", "changed", "created" };
	char *sidetxt[] = { "PDP", "host" };
	char *result = buff[side]; // static buffer for each side
	sprintf(result, "%s on %s", statetxt[state], sidetxt[side]);
	return result;
}

// Assembly:
pushq %rbx
movl %edi, %eax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
leaq 0x1545a(%rip), %rbx     # 0x1e1a0
addq %rcx, %rbx
movl %esi, %ecx
leaq 0x1306e(%rip), %rdx     # 0x1bdc0
movq (%rdx,%rcx,8), %rdx
leaq 0xc9db(%rip), %rsi      # 0x15738
movslq (%rsi,%rax,4), %rcx
addq %rsi, %rcx
leaq 0xc62b(%rip), %rsi      # 0x15396
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3540
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/hostdir.c
// Function: hostdir_from_pdp_fs
int hostdir_from_pdp_fs(hostdir_t *_this) {
	char pathbuff[4096];
	int fileidx;
	struct utimbuf ut;
	// known filesystems have max 3 special files (RT11)
	for (fileidx = -FILESYSTEM_MAX_SPECIALFILE_COUNT; fileidx < *_this->pdp_fs->file_count;
			fileidx++) {
		int i;
		file_t *f = filesystem_file_get(_this->pdp_fs, fileidx);
		if (f)
			for (i = 0; i < FILESYSTEM_MAX_DATASTREAM_COUNT; i++)
				if (f->stream[i].valid) {
					file_stream_t *stream = &f->stream[i];
					sprintf(pathbuff, "%s/%s", _this->path,
							filesystem_filename_to_host(_this->pdp_fs, f->filnam, f->ext,
									stream->name));
					file_write(pathbuff, stream->data, stream->data_size);
					if (fileidx >= 0) {
						// regular file, not bootblock or monitor: set original file date
						ut.modtime = mktime(&f->date);
						ut.actime = mktime(&f->date);
						utime(pathbuff, &ut);
					}
				}
	}
	return ERROR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1038, %rsp           # imm = 0x1038
movq %rdi, 0x8(%rsp)
movq 0x1008(%rdi), %rdi
movq 0x18(%rdi), %rax
cmpl $-0x8, (%rax)
jl 0x91bc
movq 0x8(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x10(%rsp)
movl $0xfffffff7, %ebp       # imm = 0xFFFFFFF7
movl %ebp, %esi
callq 0xb94b
testq %rax, %rax
je 0x91a2
movq %rax, %rbx
addq $0x50, %rax
movq %rax, 0x18(%rsp)
leaq 0x1b0(%rbx), %r14
movq %rbx, %r13
addq $0x88, %r13
movl $0x3, %r12d
cmpl $0x0, -0x10(%r13)
je 0x9195
movq 0x8(%rsp), %rax
movq 0x1008(%rax), %rdi
movq %rbx, %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rcx
callq 0xbc89
leaq 0x30(%rsp), %r15
movq %r15, %rdi
leaq 0xc2fe(%rip), %rsi      # 0x15447
movq 0x10(%rsp), %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x3540
movq -0x8(%r13), %rsi
movl -0xc(%r13), %edx
movq %r15, %rdi
callq 0xa5d8
testl %ebp, %ebp
js 0x9195
movq %r14, %rdi
callq 0x3400
movq %rax, 0x28(%rsp)
movq %r14, %rdi
callq 0x3400
movq %rax, 0x20(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x3040
addq $0x68, %r13
decq %r12
jne 0x9117
incl %ebp
movq 0x8(%rsp), %rax
movq 0x1008(%rax), %rdi
movq 0x18(%rdi), %rax
cmpl (%rax), %ebp
jl 0x90e4
xorl %eax, %eax
addq $0x1038, %rsp           # imm = 0x1038
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/hostdir.c
// Function: hostdir_create
hostdir_t *hostdir_create(int unit, char *path, filesystem_t *pdp_fs) {
	hostdir_t *_this;
	_this = malloc(sizeof(hostdir_t));
	_this->unit = unit ;
	strcpy(_this->path, path);
	_this->pdp_fs = pdp_fs;

	_this->snapshot.hostdir = _this ;
	_this->snapshot.file_count = 0;
	return _this;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movl $0x530a8, %edi          # imm = 0x530A8
callq 0x33c0
movq %rax, %r15
movl %ebp, (%rax)
leaq 0x4(%rax), %rdi
movq %r14, %rsi
callq 0x30d0
movq %rbx, 0x1008(%r15)
movq %r15, 0x1010(%r15)
movl $0x0, 0x1018(%r15)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/hostdir.c
// Function: hostdir_load
int hostdir_load(hostdir_t *_this, int allowcreate, int *created) {

	if (hostdir_prepare(_this, /*wipe*/0, allowcreate, created)) {
		error("Unit %d: hostdir_prepare() failed", _this->unit);
		return -1;
	}
	if (opt_verbose && *created)
		info("Unit %d: Host directory \"%s\" created", _this->unit, _this->path);

	return hostdir_image_reload(_this);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %edx
movq %rdi, %rbx
xorl %esi, %esi
movq %r14, %rcx
callq 0x8d7a
testl %eax, %eax
je 0x94de
movl (%rbx), %esi
leaq 0xc01a(%rip), %rdi      # 0x154ea
xorl %eax, %eax
callq 0xa054
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x950e
leaq 0x1358f(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x9504
cmpl $0x0, (%r14)
je 0x9504
movl (%rbx), %esi
leaq 0x4(%rbx), %rdx
leaq 0xc00f(%rip), %rdi      # 0x1550c
xorl %eax, %eax
callq 0xa127
movq %rbx, %rdi
callq 0x9516
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/hostdir.c
// Function: hostdir_image_reload
static int hostdir_image_reload(hostdir_t *_this) {
	filesystem_init(_this->pdp_fs);
	hostdir_to_pdp_fs(_this); //  dir => filesystem
	filesystem_render(_this->pdp_fs); // filesystem => image
	if (opt_debug)
		filesystem_print_dir(_this->pdp_fs, ferr);
	if (opt_debug)
		filesystem_print_diag(_this->pdp_fs, ferr);

	snapshot_init(_this);
	return ERROR_OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x1008(%rdi), %rdi
callq 0xb7eb
movq %rbx, %rdi
callq 0x91d0
movq 0x1008(%rbx), %rdi
callq 0xbbc4
leaq 0x13540(%rip), %r14     # 0x1ca84
cmpl $0x0, (%r14)
je 0x9560
movq 0x1008(%rbx), %rdi
leaq 0x14ce8(%rip), %rax     # 0x1e240
movq (%rax), %rsi
callq 0xbc4b
cmpl $0x0, (%r14)
je 0x957c
movq 0x1008(%rbx), %rdi
leaq 0x14ccc(%rip), %rax     # 0x1e240
movq (%rax), %rsi
callq 0xbc6a
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x9f37
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/hostdir.c
// Function: hostdir_save
int hostdir_save(hostdir_t *_this) {
	if (hostdir_prepare(_this, /*wipe*/1, 0, NULL))
		return error_set(error_code, "Unit %d: Saving host dir", _this->unit);
	filesystem_init(_this->pdp_fs);
	filesystem_parse(_this->pdp_fs); // image => filesystem
	hostdir_from_pdp_fs(_this); // filesystem => dir
	if (opt_debug)
		filesystem_print_dir(_this->pdp_fs, ferr);
	if (opt_debug)
		filesystem_print_diag(_this->pdp_fs, ferr);
	return ERROR_OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x8d7a
testl %eax, %eax
je 0x95c4
leaq 0x14c9d(%rip), %rax     # 0x1e248
movl (%rax), %edi
movl (%rbx), %edx
leaq 0xbf7b(%rip), %rsi      # 0x15531
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x9f8f
movq 0x1008(%rbx), %rdi
callq 0xb7eb
movq 0x1008(%rbx), %rdi
callq 0xb829
movq %rbx, %rdi
callq 0x90a7
leaq 0x13499(%rip), %r14     # 0x1ca84
cmpl $0x0, (%r14)
je 0x9607
movq 0x1008(%rbx), %rdi
leaq 0x14c41(%rip), %rax     # 0x1e240
movq (%rax), %rsi
callq 0xbc4b
cmpl $0x0, (%r14)
je 0x9623
movq 0x1008(%rbx), %rdi
leaq 0x14c25(%rip), %rax     # 0x1e240
movq (%rax), %rsi
callq 0xbc6a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/hostdir.c
// Function: snapshot_scan_pdpimage
static int snapshot_scan_pdpimage(hostdir_t *_this) {
	int i, j;
	hostdir_file_t *f;

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

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

	filesystem_init(_this->pdp_fs);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq 0x1018(%rdi), %rax
testq %rax, %rax
jle 0x9c42
imulq $0x150, %rax, %rax      # imm = 0x150
xorl %ecx, %ecx
movl $0x1, 0x1148(%rbx,%rcx)
addq $0x150, %rcx            # imm = 0x150
cmpq %rcx, %rax
jne 0x9c2b
movq 0x1008(%rbx), %rdi
callq 0xb7eb
movq 0x1008(%rbx), %rdi
callq 0xb829
testl %eax, %eax
je 0x9c85
leaq 0x145e3(%rip), %rax     # 0x1e248
movl (%rax), %edi
movl (%rbx), %edx
leaq 0xba2f(%rip), %rsi      # 0x1569f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9f8f
movq 0x1008(%rbx), %rdi
movq 0x18(%rdi), %rax
cmpl $-0x8, (%rax)
jl 0x9d45
leaq 0x1010(%rbx), %rax
movq %rax, (%rsp)
movl $0xfffffff7, %ebp       # imm = 0xFFFFFFF7
movl %ebp, %esi
callq 0xb94b
movq %rax, %r15
leaq 0x78(%rax), %r13
leaq 0x50(%rax), %r12
xorl %r14d, %r14d
testq %r15, %r15
je 0x9d23
cmpl $0x0, (%r13)
je 0x9d23
movq 0x1008(%rbx), %rdi
leaq 0x10(%r13), %rcx
movq %r15, %rsi
movq %r12, %rdx
callq 0xbc89
movq (%rsp), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x8c07
movl %ebp, 0x140(%rax)
movl 0x1e8(%r15), %ecx
movl %ecx, 0x148(%rax)
movl %r14d, 0x144(%rax)
cmpl $0x3, 0x128(%rax)
je 0x9d23
xorl %ecx, %ecx
cmpb $0x0, 0x60(%r13)
setne %cl
addl %ecx, %ecx
movl %ecx, 0x128(%rax)
incq %r14
addq $0x68, %r13
cmpq $0x3, %r14
jne 0x9cbe
incl %ebp
movq 0x1008(%rbx), %rdi
movq 0x18(%rdi), %rax
cmpl (%rax), %ebp
jl 0x9ca9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/hostdir.c
// Function: snapshot_print
static void snapshot_print(hostdir_snapshot_t *_this, FILE *stream, int all) {
	int i;
	UNUSED(stream) ;
	for (i = 0; i < _this->file_count; i++) {
		hostdir_file_t *f;
		f = &_this->file[i];
		if (all || f->state[side_pdp] != fs_unchanged || f->state[side_host] != fs_unchanged) {
			info("Unit %d, file %3d: %10s %s, %s.", _this->hostdir->unit,
				i, f->pdp_filnam_ext_stream,
					state_text(side_pdp, f->state[side_pdp]),
					state_text(side_host, f->state[side_host]));
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, 0xc(%rsp)
cmpl $0x0, 0x8(%rdi)
jle 0x9e3e
leaq 0x13c(%rdi), %r12
xorl %r13d, %r13d
cmpl $0x0, 0xc(%rsp)
jne 0x9d94
cmpl $0x0, -0x4(%r12)
jne 0x9d94
cmpl $0x0, (%r12)
je 0x9e27
leaq -0x12c(%r12), %rax
movq %rax, 0x10(%rsp)
movq (%rdi), %rax
movl (%rax), %r15d
movl -0x4(%r12), %eax
leaq 0x1200d(%rip), %rbp     # 0x1bdc0
movq (%rbp,%rax,8), %rdx
leaq 0x143e1(%rip), %rax     # 0x1e1a0
movq %rdi, %r14
movq %rax, %rdi
leaq 0xb5ca(%rip), %rbx      # 0x15396
movq %rbx, %rsi
leaq 0xb5b7(%rip), %rcx      # 0x1538d
xorl %eax, %eax
callq 0x3540
movl (%r12), %eax
movq (%rbp,%rax,8), %rdx
leaq 0x14403(%rip), %rbp     # 0x1e1f0
movq %rbp, %rdi
movq %rbx, %rsi
leaq 0xb597(%rip), %rcx      # 0x15391
xorl %eax, %eax
callq 0x3540
leaq 0xb8b3(%rip), %rdi      # 0x156bb
movl %r15d, %esi
movl %r13d, %edx
movq 0x10(%rsp), %rcx
leaq 0x14386(%rip), %r8      # 0x1e1a0
movq %rbp, %r9
xorl %eax, %eax
callq 0xa127
movq %r14, %rdi
incq %r13
movslq 0x8(%rdi), %rax
addq $0x150, %r12            # imm = 0x150
cmpq %rax, %r13
jl 0x9d7a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/hostdir.c
// Function: hostdir_file_copy_from_pdp
static void hostdir_file_copy_from_pdp(hostdir_t *_this, hostdir_file_t *f) {
	char pathbuff[4096];
	file_t *fpdp;
	file_stream_t *stream;
	sprintf(pathbuff, "%s/%s", _this->path, f->pdp_filnam_ext_stream);

	fpdp = filesystem_file_get(_this->pdp_fs, f->pdp_fileidx); // also boot and monitor
	stream = &fpdp->stream[f->pdp_streamidx];
	if (!dbg_simulate)
		file_write(pathbuff, stream->data, stream->data_size);
	if (opt_verbose)
		info("Unit %d: Copied file \"%s\" from PDP to shared dir.", _this->unit, pathbuff);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4(%rdi), %rdx
leaq 0xb5df(%rip), %rsi      # 0x15447
movq %rsp, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x3540
movq 0x1008(%rbx), %rdi
movl 0x140(%r14), %esi
callq 0xb94b
cmpl $0x0, 0x14301(%rip)     # 0x1e190
jne 0x9eb0
movslq 0x144(%r14), %rcx
imulq $0x68, %rcx, %rcx
movq 0x80(%rax,%rcx), %rsi
movl 0x7c(%rax,%rcx), %edx
movq %rsp, %rdi
callq 0xa5d8
leaq 0x12bbd(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x9ecf
movl (%rbx), %esi
leaq 0xb816(%rip), %rdi      # 0x156db
movq %rsp, %rdx
xorl %eax, %eax
callq 0xa127
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/hostdir.c
// Function: hostdir_file_delete
static void hostdir_file_delete(hostdir_t *_this, hostdir_file_t *f) {
	char pathbuff[4096];
	sprintf(pathbuff, "%s/%s", _this->path, f->hostfilename);
	if (!dbg_simulate)
		remove(pathbuff);
	if (opt_verbose)
		info("Unit %d: Deleted file \"%s\" on shared dir.", _this->unit, pathbuff);
}

// Assembly:
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq %rdi, %rbx
leaq 0x4(%rdi), %rdx
leaq 0x28(%rsi), %rcx
leaq 0xb553(%rip), %rsi      # 0x15447
movq %rsp, %rdi
xorl %eax, %eax
callq 0x3540
cmpl $0x0, 0x1428b(%rip)     # 0x1e190
jne 0x9f0f
movq %rsp, %rdi
callq 0x30b0
leaq 0x12b5e(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x9f2e
movl (%rbx), %esi
leaq 0xb7e9(%rip), %rdi      # 0x1570d
movq %rsp, %rdx
xorl %eax, %eax
callq 0xa127
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/hostdir.c
// Function: snapshot_init
static void snapshot_init(hostdir_t *_this) {
	_this->snapshot.file_count = 0;
	snapshot_scan_hostdir(_this);
	snapshot_scan_pdpimage(_this);
	snapshot_clear_states(_this);
	// now both sides "unchanged"
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x0, 0x1018(%rdi)
callq 0x99e7
movq %rbx, %rdi
callq 0x9c08
movslq 0x1018(%rbx), %rax
testq %rax, %rax
jle 0x9f7f
imulq $0x150, %rax, %rax      # imm = 0x150
xorl %ecx, %ecx
movq $0x0, 0x1148(%rbx,%rcx)
addq $0x150, %rcx            # imm = 0x150
cmpq %rcx, %rax
jne 0x9f67
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/error.c
// Function: error_set
int error_set(int code, char *fmt, ...) {
	char buffer[1024];
	va_list args;
//	assert(error_trace_level < ERROR_MAX_TRACE_LEVEL) ;
	error_code = code;
	if (code == ERROR_OK)
		error_clear();
	else if (fmt && strlen(fmt)) {
		va_start(args, fmt);
		vsprintf(buffer, fmt, args);
		va_end(args);
		// strcpy(error_message[error_trace_level++], buffer);
		error(buffer);
	}
	return error_code;
}

// Assembly:
pushq %rbx
subq $0x4d0, %rsp            # imm = 0x4D0
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x9fe6
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movl %edi, 0x1425c(%rip)     # 0x1e248
testl %edi, %edi
je 0xa03b
testq %rsi, %rsi
je 0xa045
cmpb $0x0, (%rsi)
je 0xa045
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0x4e0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
leaq 0xd0(%rsp), %rbx
movq %rbx, %rdi
callq 0x3480
movq %rbx, %rdi
xorl %eax, %eax
callq 0xa054
jmp 0xa045
movl $0x0, 0x14203(%rip)     # 0x1e248
movl 0x141fd(%rip), %eax     # 0x1e248
addq $0x4d0, %rsp            # imm = 0x4D0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/error.c
// Function: error
void error(char *fmt, ...) {
	va_list args;
	va_start(args, fmt);
	fprintf(ferr, "[%s ERROR]  ", cur_time_text());
	vfprintf(ferr, fmt, args);
	fprintf(ferr, "\n");
	va_end(args);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %rbx
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0xa0b7
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %r14
movq %rdi, 0x10(%r14)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%r14)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%r14)
movq 0x14162(%rip), %r15     # 0x1e240
callq 0xa4e4
leaq 0xb671(%rip), %rsi      # 0x1575b
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3320
movq 0x14142(%rip), %rdi     # 0x1e240
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3500
movq 0x14130(%rip), %rsi     # 0x1e240
movl $0xa, %edi
callq 0x32a0
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/error.c
// Function: info
void info(char *fmt, ...) {
	va_list args;
	if (!opt_background) {
		va_start(args, fmt);
		fprintf(ferr, "[%s info]  ", cur_time_text());
		vfprintf(ferr, fmt, args);
		fprintf(ferr, "\n");
		va_end(args);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0xa187
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
leaq 0x128fe(%rip), %rax     # 0x1ca8c
cmpl $0x0, (%rax)
jne 0xa1fe
movq %rdi, %rbx
leaq 0x20(%rsp), %rax
movq %rsp, %r14
movq %rax, 0x10(%r14)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%r14)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%r14)
movq 0x1407e(%rip), %r15     # 0x1e240
callq 0xa4e4
leaq 0xb572(%rip), %rsi      # 0x15740
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3320
movq 0x1405e(%rip), %rdi     # 0x1e240
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3500
movq 0x1404c(%rip), %rsi     # 0x1e240
movl $0xa, %edi
callq 0x32a0
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/error.c
// Function: warning
void warning(char *fmt, ...) {
	va_list args;
	if (!opt_background) {
		va_start(args, fmt);
		fprintf(ferr, "[%s Warning]  ", cur_time_text());
		vfprintf(ferr, fmt, args);
		fprintf(ferr, "\n");
		va_end(args);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0xa26b
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
leaq 0x1281a(%rip), %rax     # 0x1ca8c
cmpl $0x0, (%rax)
jne 0xa2e2
movq %rdi, %rbx
leaq 0x20(%rsp), %rax
movq %rsp, %r14
movq %rax, 0x10(%r14)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%r14)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%r14)
movq 0x13f9a(%rip), %r15     # 0x1e240
callq 0xa4e4
leaq 0xb49a(%rip), %rsi      # 0x1574c
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3320
movq 0x13f7a(%rip), %rdi     # 0x1e240
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3500
movq 0x13f68(%rip), %rsi     # 0x1e240
movl $0xa, %edi
callq 0x32a0
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/error.c
// Function: fatal
void fatal(char *fmt, ...) {
	va_list args;
	va_start(args, fmt);
	fprintf(ferr, "[%s FATAL]  ", cur_time_text());
	vfprintf(ferr, fmt, args);
	fprintf(ferr, "\n");
	va_end(args);
	exit(EXIT_FAILURE);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %rbx
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0xa352
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %r14
movq %rdi, 0x10(%r14)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%r14)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%r14)
movq 0x13ec7(%rip), %r15     # 0x1e240
callq 0xa4e4
leaq 0xb3e3(%rip), %rsi      # 0x15768
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3320
movq 0x13ea7(%rip), %rdi     # 0x1e240
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3500
movq 0x13e95(%rip), %rsi     # 0x1e240
movl $0xa, %edi
callq 0x32a0
movl $0x1, %edi
callq 0x3550
nop
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/utils.c
// Function: delay_us
void delay_us(int32_t us) {
	struct timespec rqtp;
	int32_t sts;

	// check if any delay required
	if (us <= 0)
		return;

	// nanosleep() preferred over usleep(),
	// compute integer seconds and fraction (in nanoseconds)
	rqtp.tv_sec = us / 1000000L;
	rqtp.tv_nsec = (us % 1000000L) * 1000L;

	// if nanosleep() fails then just plain sleep()
	if ((sts = nanosleep(&rqtp, NULL)) == -1)
		sleep(rqtp.tv_sec);
}

// Assembly:
testl %edi, %edi
jle 0xa410
subq $0x18, %rsp
movl %edi, %ecx
movabsq $0x10c6f7a0b5ee, %rdx   # imm = 0x10C6F7A0B5EE
movq %rcx, %rax
mulq %rdx
leaq 0x8(%rsp), %rdi
movq %rdx, (%rdi)
imulq $0xf4240, %rdx, %rax    # imm = 0xF4240
subq %rax, %rcx
imulq $0x3e8, %rcx, %rax      # imm = 0x3E8
movq %rax, 0x8(%rdi)
xorl %esi, %esi
callq 0x31f0
cmpl $-0x1, %eax
jne 0xa40c
movl 0x8(%rsp), %edi
callq 0x35a0
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/utils.c
// Function: cur_time_text
char *cur_time_text() {
	static char result[40] ;
	time_t timer;
	struct tm* tm_info;
	time(&timer);
	tm_info = localtime(&timer);
	strftime(result, 26, "%H:%M:%S", tm_info);
	return result;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x3370
movq %rbx, %rdi
callq 0x3070
leaq 0x13d5b(%rip), %rbx     # 0x1e260
leaq 0xb269(%rip), %rdx      # 0x15775
movl $0x1a, %esi
movq %rbx, %rdi
movq %rax, %rcx
callq 0x3460
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/utils.c
// Function: is_memset
int is_memset(void *ptr, uint8_t val, uint32_t size) {
	for (; size; ptr++, size--)
		if (*(uint8_t *) ptr != val)
			return 0;
	return 1;
}

// Assembly:
movl $0x1, %eax
testl %edx, %edx
je 0xa53f
movl %edx, %ecx
xorl %edx, %edx
cmpb %sil, (%rdi,%rdx)
jne 0xa540
incq %rdx
cmpl %edx, %ecx
jne 0xa532
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/utils.c
// Function: is_fileset
int is_fileset(char *fpath, uint8_t val, uint32_t offset) {
	int result;
	FILE *f;
	uint8_t b;
	f = fopen(fpath, "r");
	fseek(f, offset, SEEK_SET);
	result = 1;
	// inefficient byte loop
	while (result && fread(&b, sizeof(b), 1, f) == 1)
		if (b != val)
			result = 0;

	fclose(f);
	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %ebp
leaq 0xca80(%rip), %rsi      # 0x16fd6
callq 0x34c0
movq %rax, %rbx
movl %r14d, %esi
movq %rax, %rdi
xorl %edx, %edx
callq 0x3410
leaq 0x7(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3110
movl $0x1, %r14d
cmpq $0x1, %rax
jne 0xa5c2
leaq 0x7(%rsp), %r14
movb 0x7(%rsp), %r15b
cmpb %bpl, %r15b
jne 0xa5b8
movl $0x1, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x3110
cmpq $0x1, %rax
je 0xa593
xorl %r14d, %r14d
cmpb %bpl, %r15b
sete %r14b
movq %rbx, %rdi
callq 0x3160
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/utils.c
// Function: file_write
int file_write(char *fpath, uint8_t *data, unsigned size) {
	int fd;
	// O_TRUNC: set to length 0
	fd = open(fpath, O_CREAT | O_TRUNC | O_RDWR, 0666);
	// or f = fopen(fpath, "w") ;
	if (fd < 0)
		return error_set(ERROR_HOSTFILE, "File write: can not open \"%s\"", fpath);
	write(fd, data, size);
	close(fd);
	return ERROR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl $0x242, %esi            # imm = 0x242
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x34b0
testl %eax, %eax
js 0xa620
movl %eax, %r15d
movl %ebp, %edx
movl %eax, %edi
movq %rbx, %rsi
callq 0x3150
movl %r15d, %edi
callq 0x3270
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb157(%rip), %rsi      # 0x1577e
movl $0xfffffffa, %edi       # imm = 0xFFFFFFFA
movq %r14, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x9f8f
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/utils.c
// Function: inputline
int inputline(char **tokenlist, int tokenlist_size) {
	static char buffer[1024];
	int n;
	char *t;

	n = 0;
	if (fgets(buffer, sizeof(buffer), stdin)) {
		t = strtok(buffer, " \t\n");
		while (t && n < tokenlist_size - 1) {
			tokenlist[n++] = t;
			t = strtok(NULL, " \t\n");
		}
	}
	tokenlist[n] = NULL; // terminate list
	return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq 0x11984(%rip), %rax     # 0x1bfd8
movq (%rax), %rdx
leaq 0x13c32(%rip), %rdi     # 0x1e290
movl $0x400, %esi            # imm = 0x400
callq 0x32d0
xorl %r14d, %r14d
testq %rax, %rax
je 0xa6bd
leaq 0x13c19(%rip), %rdi     # 0x1e290
leaq 0xb11e(%rip), %rsi      # 0x1579c
callq 0x34e0
testq %rax, %rax
sete %cl
cmpl $0x2, %ebp
setl %dl
orb %cl, %dl
jne 0xa6bd
decl %ebp
movslq %ebp, %r12
xorl %r14d, %r14d
leaq 0xb0fa(%rip), %r15      # 0x1579c
movq %rax, (%rbx,%r14,8)
incq %r14
xorl %edi, %edi
movq %r15, %rsi
callq 0x34e0
testq %rax, %rax
je 0xa6bd
cmpq %r12, %r14
jl 0xa6a2
movl %r14d, %eax
movq $0x0, (%rbx,%rax,8)
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/utils.c
// Function: strtrim
char *strtrim(char *txt) {
	static char buff[1024];
	char *s = txt; // start

	assert(strlen(txt) < sizeof(buff));

	// skip leading space
	while (*s && isspace(*s))
		s++;
	strcpy(buff, s); // buff now without leading space
	// s = last last non-white char
	s = buff + strlen(buff) - 1;
	while (s > buff && isspace(*s))
		s--;
	*(s + 1) = 0; // clip off
	return buff;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x31a0
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0xa75e
movb (%rbx), %bpl
testb %bpl, %bpl
je 0xa70f
callq 0x35e0
movq (%rax), %rax
movsbq %bpl, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0xa70f
movb 0x1(%rbx), %bpl
incq %rbx
testb %bpl, %bpl
jne 0xa6f8
leaq 0x13f7a(%rip), %r14     # 0x1e690
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30d0
movq %r14, %rdi
callq 0x31a0
addq %r14, %rax
decq %rax
movq %rax, %rbx
cmpq %r14, %rax
jbe 0xa74e
callq 0x35e0
movq (%rax), %rcx
movsbq (%rbx), %rdx
leaq -0x1(%rbx), %rax
testb $0x20, 0x1(%rcx,%rdx,2)
jne 0xa72f
movb $0x0, 0x1(%rbx)
leaq 0x13f37(%rip), %rax     # 0x1e690
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xb03b(%rip), %rdi      # 0x157a0
leaq 0xb04f(%rip), %rsi      # 0x157bb
leaq 0xb050(%rip), %rcx      # 0x157c3
movl $0xbe, %edx
callq 0x3210
// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/utils.c
// Function: strrpad
char *strrpad(char *txt, int len, char c) {
	static char buff[1024];
	memset(buff, c, len); // init buffer with base pattern
	strncpy(buff, txt, strlen(txt));
	buff[len] = 0;
	return buff;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movslq %esi, %r14
leaq 0x14301(%rip), %r15     # 0x1ea90
movq %r15, %rdi
movl %edx, %esi
movq %r14, %rdx
callq 0x3230
movq %rbx, %rdi
callq 0x31a0
movq %r15, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x30a0
movb $0x0, (%r14,%r15)
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq