LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/giometti[P]mastering_UNIX_programming/chapter_03/flockr.c
// Function: main
int main(void)
{
	int fd;
	char buf[32];
	struct flock fl;
	int ret;

	/* Open the file */
	fd = open("file.locked", O_RDONLY);
	if (fd < 0) {
		perror("open");
		return -1;
	}
	printf("file opened\n");

	/* Establish a read lock */
	fl.l_type   = F_RDLCK;
	fl.l_whence = SEEK_SET;
	fl.l_start  = 0;        /* Offset from l_whence */
	fl.l_len    = 0;        /* length, 0 = to EOF   */
	fl.l_pid    = getpid(); /* our PID              */
	ret = fcntl(fd, F_SETLKW, &fl);
	if (ret < 0) {
		perror("fcntl(F_SETLKW)");
		return -1;
	}
	printf("read lock get\n");

	/* Do the read */
	ret = read(fd, buf, 32);
	if (ret < 0) {
		perror("read");
		return -1;
	}
	printf("read done\n");

	printf("sleeping 10s...\n");
	sleep(10);

	/* Unlock the region */
	fl.l_type   = F_UNLCK;
	fl.l_whence = SEEK_SET;
	fl.l_start  = 0;        /* Offset from l_whence */
	fl.l_len    = 0;        /* length, 0 = to EOF   */
	fl.l_pid    = getpid(); /* our PID              */
	ret = fcntl(fd, F_UNLCK, &fl);
	if (ret < 0) {
		perror("fcntl(F_SETLKW)");
		return -1;
	}
	printf("unlock done\n");

	close(fd);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
leaq 0xe49(%rip), %rdi       # 0x2004
xorl %esi, %esi
xorl %eax, %eax
callq 0x1080
testl %eax, %eax
js 0x12a3
movl %eax, %ebx
leaq 0xe55(%rip), %rdi       # 0x202a
callq 0x1030
movq %rsp, %r14
movl $0x0, (%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r14)
callq 0x1050
movl %eax, 0x18(%r14)
movl %ebx, %edi
movl $0x7, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1040
testl %eax, %eax
js 0x129a
leaq 0xe21(%rip), %rdi       # 0x2036
callq 0x1030
leaq 0x20(%rsp), %rsi
movl $0x20, %edx
movl %ebx, %edi
callq 0x1070
testl %eax, %eax
js 0x12ac
leaq 0x8(%rsp), %r14
leaq 0xe09(%rip), %rdi       # 0x2044
callq 0x1030
leaq 0xe07(%rip), %rdi       # 0x204e
callq 0x1030
movl $0xa, %edi
callq 0x10a0
movl $0x2, -0x8(%r14)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
callq 0x1050
movl %eax, 0x10(%r14)
xorl %ebp, %ebp
movq %rsp, %rdx
movl %ebx, %edi
movl $0x2, %esi
xorl %eax, %eax
callq 0x1040
testl %eax, %eax
js 0x129a
leaq 0xdd2(%rip), %rdi       # 0x205e
callq 0x1030
movl %ebx, %edi
callq 0x1060
jmp 0x12bd
leaq 0xd74(%rip), %rdi       # 0x2015
jmp 0x12b3
leaq 0xd66(%rip), %rdi       # 0x2010
jmp 0x12b3
leaq 0xd72(%rip), %rdi       # 0x2025
callq 0x1090
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Joy-Division[P]tools-mgs/gcx-decompile.c
// Function: gcx_param
uint16_t gcx_param(unsigned char *data, FILE *out) {
	unsigned int i;
	uint16_t size = 0;
	gcxdef blank;
	blank.name = 0;
	blank.off = 0;
	printf("gcx_param == type %04x == size ????\n", data[0]);
	switch(data[0]) {
		case 0x30: {
			size = data[1];
			fprintf(out, "STACKOP!\n");
			break;
		}
		case 0x40: {
			gcx_proc(blank, data, out);
			break;
		}
		case 0x50: {
			// size of params plus param letter
			size = data[2] + 1;
			switch(data[1]) {
				case 'm': {
					fprintf(out, "-m [%02x]:%04x\n", data[3], bswap_16(*(uint16_t *)(data+4)));
					break;
				}
				case 's': {
					fprintf(out, "-s [%02x]:%02x\n", data[3], data[4]);
					break;
				}
				default: {
					fprintf(out, "-%c ", *(char *)(data+1));
					for(i = 0; i < (size-1); size++) fprintf(out, "%02x", data[3+i]);
					fprintf(out, "\n");
					break;
				}
			}
			break;
		}
		default: {
			printf("unknown param %02x size %04x\n", data[0], size);
			break;
		}
	}
	return size+1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movzbl (%rdi), %esi
leaq 0xdb8(%rip), %rdi       # 0x2004
xorl %eax, %eax
callq 0x1090
movzbl (%r14), %esi
cmpl $0x50, %esi
je 0x129d
cmpl $0x40, %esi
je 0x1289
cmpl $0x30, %esi
jne 0x12d0
movzbl 0x1(%r14), %ebp
leaq 0xdb7(%rip), %rdi       # 0x2029
movl $0x9, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1100
jmp 0x134a
xorl %ebp, %ebp
xorl %edi, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1358
jmp 0x134a
movzbl 0x2(%r14), %r12d
leal 0x1(%r12), %ebp
movzbl 0x1(%r14), %eax
cmpl $0x73, %eax
je 0x12e4
cmpl $0x6d, %eax
jne 0x1301
movzbl 0x3(%r14), %edx
movzwl 0x4(%r14), %eax
rolw $0x8, %ax
movzwl %ax, %ecx
leaq 0xd65(%rip), %rsi       # 0x2033
jmp 0x12f5
leaq 0xd86(%rip), %rdi       # 0x205d
xorl %ebp, %ebp
xorl %edx, %edx
xorl %eax, %eax
callq 0x1090
jmp 0x134a
movzbl 0x3(%r14), %edx
movzbl 0x4(%r14), %ecx
leaq 0xd4e(%rip), %rsi       # 0x2043
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10b0
jmp 0x134a
movsbl %al, %edx
leaq 0xd48(%rip), %rsi       # 0x2053
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10b0
testb %r12b, %r12b
je 0x133d
leaq 0xd37(%rip), %r15       # 0x2058
movzbl 0x3(%r14), %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x10b0
incw %r12w
jne 0x1321
movw $0x1, %bp
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10a0
movzwl %bp, %eax
incl %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Joy-Division[P]tools-mgs/gcx-decompile.c
// Function: gcx_proc
uint16_t gcx_proc(gcxdef def, unsigned char *data, FILE *out) {
	uint16_t size = bswap_16(*(uint16_t *)(data + 1)), cur = 0;
	printf("gcx_proc == type %02x == size %04x\n", data[0], size);
	switch(data[0]) {
		case 0x40: {
			fprintf(out, "proc %04x {\n", def.name);
			cur = 3;
			while(data[cur]) cur += gcx_proc(def, data+cur, out);
			fprintf(out, "}\n");
			break;
		}
		case 0x60: {
			fprintf(out, "begin {\n");
			cur = 3;
			while(gcx_iscommand(data+cur) > -1) cur += gcx_cmd(data+cur, out);
			fprintf(out, "}\n");
			break;
		}
		case 0x70: {
			size >>= 8;
			fprintf(out, "call %04x\n", bswap_16(*(uint16_t *)(data+2)));
			break;
		}
		default: {
			printf("unknown type %02x size %04x\n", data[0], size);
			break;
		}
	}
	return (size+1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
movzwl 0x1(%rsi), %ebx
rolw $0x8, %bx
movzbl (%rsi), %esi
movzwl %bx, %r12d
leaq 0xd4d(%rip), %rdi       # 0x20ce
movl %r12d, %edx
xorl %eax, %eax
callq 0x1090
movzbl (%r15), %esi
cmpl $0x70, %esi
je 0x1469
cmpl $0x60, %esi
je 0x1404
cmpl $0x40, %esi
jne 0x148f
movzwl %bp, %edx
leaq 0xd42(%rip), %rsi       # 0x20f2
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
cmpb $0x0, 0x3(%r15)
je 0x13e6
leaq 0x3(%r15), %rsi
movw $0x3, %r12w
movl %ebp, %edi
movq %r14, %rdx
callq 0x1358
addl %eax, %r12d
movzwl %r12w, %eax
leaq (%r15,%rax), %rsi
cmpb $0x0, (%r15,%rax)
jne 0x13ca
leaq 0xd12(%rip), %rdi       # 0x20ff
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x1100
jmp 0x14a0
leaq 0xcf7(%rip), %rdi       # 0x2102
movl $0x8, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x1100
movl $0x3, %r12d
leaq 0x2c76(%rip), %r13      # 0x40a0
movzwl %r12w, %r12d
leaq (%r15,%r12), %rdi
movzwl (%r15,%r12), %eax
rolw $0x8, %ax
xorl %ecx, %ecx
movzwl (%rcx,%r13), %edx
cmpw %ax, %dx
je 0x1459
addq $0x22, %rcx
cmpq $0x1ba, %rcx            # imm = 0x1BA
jne 0x143d
cmpw %ax, %dx
jne 0x13e6
movq %r14, %rsi
callq 0x14b3
movzwl %ax, %eax
addl %eax, %r12d
jmp 0x142a
shrl $0x8, %r12d
movzwl 0x2(%r15), %eax
rolw $0x8, %ax
movzwl %ax, %edx
leaq 0xc8b(%rip), %rsi       # 0x210b
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
movl %r12d, %ebx
jmp 0x14a0
leaq 0xc80(%rip), %rdi       # 0x2116
movl %r12d, %edx
xorl %eax, %eax
callq 0x1090
incl %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Joy-Division[P]tools-mgs/gcx-decompile.c
// Function: gcx_cmd
uint16_t gcx_cmd(unsigned char *data, FILE *out) {
	int cmd = gcx_iscommand(data);
	uint16_t size = bswap_16(*(uint16_t *)(data+2)) >> 8, cur = 0;
	printf("gcx_cmd == cmd %s (%d) == size %04x\n", gcxcommands[cmd].name, cmd, size);
	fprintf(out, "%s(", gcxcommands[cmd].name);
	cur = 3;
	switch(cmd) {
		case 0: // eval
		case 3:
		case 1: { // if
			while(data[cur]) cur += gcx_param(data+cur, out);
			break;
		}
		case 2: { // load
			fprintf(out, "%02x \"%s\"\n", data[cur], (char *)(data+cur+2));
			cur += data[cur];
			while(data[cur]) cur += gcx_param(data+cur, out);
			break;
		}
		default: {
			printf("unknown cmd %02x size %04x\n", cmd, size);
			break;
		}
	}
	fprintf(out, ")\n");
	return size+2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movzwl (%rdi), %eax
rolw $0x8, %ax
leaq 0x2bce(%rip), %rcx      # 0x40a0
xorl %r15d, %r15d
cmpw %ax, (%rcx)
je 0x14ed
incq %r15
addq $0x22, %rcx
cmpq $0xd, %r15
jne 0x14d5
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movzbl 0x2(%r14), %ebp
movslq %r15d, %r12
movq %r12, %rax
shlq $0x5, %rax
leaq (%rax,%r12,2), %rax
leaq 0x2b99(%rip), %rcx      # 0x40a0
leaq (%rcx,%rax), %r13
addq $0x2, %r13
leaq 0xb65(%rip), %rdi       # 0x207b
movq %r13, %rsi
movl %r12d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x1090
leaq 0xb74(%rip), %rsi       # 0x20a0
movq %rbx, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x10b0
cmpl $0x2, %r12d
jb 0x1547
je 0x1577
cmpl $0x3, %r15d
jne 0x15c6
cmpb $0x0, 0x3(%r14)
je 0x15d9
leaq 0x3(%r14), %rdi
movw $0x3, %r15w
movq %rbx, %rsi
callq 0x1234
addl %eax, %r15d
movzwl %r15w, %eax
leaq (%r14,%rax), %rdi
cmpb $0x0, (%r14,%rax)
jne 0x155b
jmp 0x15d9
movzbl 0x3(%r14), %edx
leaq 0x5(%r14), %rcx
leaq 0xb1d(%rip), %rsi       # 0x20a4
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10b0
movzbl 0x3(%r14), %r15d
cmpb $0x0, 0x3(%r14,%r15)
je 0x15d9
leaq (%r14,%r15), %rdi
addq $0x3, %rdi
addq $0x3, %r15
movq %rbx, %rsi
callq 0x1234
addl %eax, %r15d
movzwl %r15w, %eax
leaq (%r14,%rax), %rdi
cmpb $0x0, (%r14,%rax)
jne 0x15aa
jmp 0x15d9
leaq 0xae2(%rip), %rdi       # 0x20af
movl %r15d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x1090
leaq 0xaeb(%rip), %rdi       # 0x20cb
movl $0x2, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1100
movzwl %bp, %eax
addl $0x2, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/tests/nc-server/main.c
// Function: main
int
main(int argc, char ** argv)
{
	struct nc_cookie cookie;
	struct nc_cookie * C = &cookie;
	const char * sockname;
	const char * filename;

	WARNP_INIT;

	/* Parse command-line arguments. */
	if (argc < 3) {
		fprintf(stderr, "usage: %s ADDRESS FILENAME [ECHO_BPS]\n",
		    argv[0]);
		goto err0;
	}
	sockname = argv[1];
	filename = argv[2];
	if (argc > 3) {
		/* Allow up to 1 MB per second of echoing. */
		if (PARSENUM(&C->bps, argv[3], 0, 1000000)) {
			warnp("parsenum");
			goto err0;
		}
		if ((C->bps % 100) != 0) {
			warn0("BPS must be a multiple of 100");
			goto err0;
		}
	} else
		C->bps = 0;

	/* Open the output file; can be /dev/null. */
	if ((C->out = fopen(filename, "wb")) == NULL) {
		warnp("fopen");
		goto err0;
	}

	/* Run the server. */
	if (simple_server(sockname, MAX_CONNECTIONS, SHUTDOWN_AFTER,
	    &callback_snc_response, C)) {
		warn0("simple_server failed");
		goto err1;
	}

	/* Write the output file. */
	if (fclose(C->out) != 0) {
		warnp("fclose");
		goto err0;
	}

	/* Success! */
	exit(0);

err1:
	if (fclose(C->out))
		warnp("fclose");
err0:
	/* Failure! */
	exit(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r12
movl %edi, %ebp
movq (%rsi), %rdi
testq %rdi, %rdi
je 0x257a
callq 0x5c58
cmpl $0x2, %ebp
jg 0x25a5
movq 0x8a72(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq (%r12), %rdx
leaq 0x4aac(%rip), %rsi      # 0x7040
xorl %eax, %eax
callq 0x21c0
movl $0x1, %edi
callq 0x22c0
movq 0x8(%r12), %rbx
movq 0x10(%r12), %r15
cmpl $0x3, %ebp
jne 0x25ef
movq $0x0, 0x8(%rsp)
leaq 0x4aca(%rip), %rsi      # 0x708e
movq %r15, %rdi
callq 0x2270
movq %rax, (%rsp)
testq %rax, %rax
jne 0x264c
callq 0x2090
cmpl $0x0, (%rax)
jne 0x269a
leaq 0x4aa7(%rip), %rdi      # 0x7091
jmp 0x26eb
callq 0x2090
movq %rax, %r14
movl $0x0, (%rax)
movq $-0x1, 0x8(%rsp)
movq 0x18(%r12), %rdi
callq 0x2713
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r14)
jne 0x2680
movabsq $-0x70a3d70a3d70a3d7, %rcx # imm = 0x8F5C28F5C28F5C29
imulq %rcx, %rax
rorq $0x2, %rax
movabsq $0x28f5c28f5c28f5d, %rcx # imm = 0x28F5C28F5C28F5D
cmpq %rcx, %rax
jb 0x25bd
leaq 0x4a2d(%rip), %rdi      # 0x7070
xorl %eax, %eax
callq 0x5df7
jmp 0x268e
leaq 0x133(%rip), %rcx       # 0x2786
movq %rsp, %r8
movl $0x2, %esi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x293c
testl %eax, %eax
jne 0x26a6
movq (%rsp), %rdi
callq 0x2100
testl %eax, %eax
jne 0x26da
xorl %edi, %edi
callq 0x22c0
leaq 0x49e0(%rip), %rdi      # 0x7067
xorl %eax, %eax
callq 0x5cd8
movl $0x0, (%r14)
jmp 0x259b
movq %rax, %rbx
leaq 0x49ed(%rip), %rdi      # 0x7091
jmp 0x2701
leaq 0x49ea(%rip), %rdi      # 0x7097
xorl %eax, %eax
callq 0x5df7
callq 0x2090
movq %rax, %rbx
movl $0x0, (%rax)
movq (%rsp), %rdi
callq 0x2100
testl %eax, %eax
je 0x259b
cmpl $0x0, (%rbx)
je 0x26e4
jmp 0x26fa
callq 0x2090
cmpl $0x0, (%rax)
jne 0x26f7
leaq 0x49c1(%rip), %rdi      # 0x70ac
xorl %eax, %eax
callq 0x5df7
jmp 0x259b
movq %rax, %rbx
leaq 0x49ab(%rip), %rdi      # 0x70ac
xorl %eax, %eax
callq 0x5cd8
movl $0x0, (%rbx)
jmp 0x259b
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/tests/nc-server/main.c
// Function: callback_snc_response
static int
callback_snc_response(void * cookie, uint8_t * buf, size_t buflen, int sock)
{
	struct nc_cookie * C = cookie;

	/* Write buffer to the previously-opened file. */
	if (fwrite(buf, sizeof(uint8_t), buflen, C->out) != buflen) {
		warnp("fwrite");
		goto err0;
	}

	/* Echo to the client (if applicable). */
	if ((C->bps > 0) && (write_bps(sock, buf, buflen, C->bps)))
		goto err0;

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movq (%rdi), %rcx
movl $0x1, %esi
movq %r15, %rdi
callq 0x22e0
cmpq %r14, %rax
jne 0x27eb
movq 0x8(%r12), %r12
testq %r12, %r12
je 0x2906
leaq 0x10(%rsp), %rdi
callq 0x49f4
testl %eax, %eax
je 0x2826
leaq 0x4964(%rip), %rdi      # 0x713b
xorl %eax, %eax
callq 0x5df7
callq 0x2090
movl $0x0, (%rax)
jmp 0x281c
callq 0x2090
cmpl $0x0, (%rax)
je 0x280e
movq %rax, %rbx
leaq 0x4935(%rip), %rdi      # 0x7134
xorl %eax, %eax
callq 0x5cd8
movl $0x0, (%rbx)
jmp 0x281c
leaq 0x491f(%rip), %rdi      # 0x7134
xorl %eax, %eax
callq 0x5df7
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x2908
movq %r12, %xmm0
punpckldq 0x47dd(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x47e5(%rip), %xmm0     # 0x7020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x30(%rsp)
xorl %r12d, %r12d
movq %rsp, %r13
movq $0x0, 0x20(%rsp)
movq $0x989680, 0x28(%rsp)   # imm = 0x989680
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
callq 0x2130
movq %r13, %rdi
callq 0x49f4
testl %eax, %eax
jne 0x27d0
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq 0x10(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
subq 0x18(%rsp), %rcx
xorps %xmm1, %xmm1
cvtsi2sd %rcx, %xmm1
mulsd 0x4784(%rip), %xmm1     # 0x7030
addsd %xmm0, %xmm1
mulsd 0x30(%rsp), %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rcx
subsd 0x4772(%rip), %xmm1     # 0x7038
cvttsd2si %xmm1, %rbp
sarq $0x3f, %rcx
andq %rcx, %rbp
orq %rax, %rbp
subq %r12, %rbp
jbe 0x28fd
cmpq %r14, %rbp
cmovaeq %r14, %rbp
movl %ebx, %edi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x20f0
cmpq $-0x1, %rax
je 0x2917
subq %rbp, %r14
addq %rbp, %r15
addq %rbp, %r12
testq %r14, %r14
jne 0x2853
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2090
cmpl $0x0, (%rax)
je 0x2930
movq %rax, %rbx
leaq 0x480a(%rip), %rdi      # 0x7135
jmp 0x27ff
leaq 0x47fe(%rip), %rdi      # 0x7135
jmp 0x2815
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/tests/nc-server/simple_server.c
// Function: doaccept
static int
doaccept(struct accept_state * A)
{
	int rc = 0;

	/* If we can, accept a new connection. */
	if ((A->nconn < A->nconn_max) && (A->accept_cookie == NULL) &&
	    !A->shutdown_requested) {
		if ((A->accept_cookie =
		    network_accept(A->s, callback_gotconn, A)) == NULL) {
			warnp("network_accept");
			rc = -1;
		}
	}

	/* Return success/fail status. */
	return (rc);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x20(%rdi), %rax
xorl %ebx, %ebx
cmpq 0x28(%rdi), %rax
jae 0x2c4b
movq %rdi, %r14
cmpq $0x0, 0x30(%rdi)
jne 0x2c4b
cmpl $0x0, 0x8(%r14)
jne 0x2c4b
movl (%r14), %edi
leaq 0x51(%rip), %rsi        # 0x2c55
movq %r14, %rdx
callq 0x4410
movq %rax, 0x30(%r14)
testq %rax, %rax
jne 0x2c4b
callq 0x2090
cmpl $0x0, (%rax)
je 0x2c38
movq %rax, %rbx
leaq 0x456f(%rip), %rdi      # 0x7198
xorl %eax, %eax
callq 0x5cd8
movl $0x0, (%rbx)
jmp 0x2c46
leaq 0x4559(%rip), %rdi      # 0x7198
xorl %eax, %eax
callq 0x5df7
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/tests/nc-server/simple_server.c
// Function: callback_read
static int
callback_read(void * cookie, ssize_t lenread)
{
	struct conn_list_node * R = cookie;
	struct accept_state * A = R->A;
	int sock = R->sock_read;

	/* Cookie is no longer valid. */
	R->network_read_cookie = NULL;

	/* If we have a message. */
	if (lenread > 0) {
		/* Handle it with the parent code. */
		if (A->callback_nc_message(A->caller_cookie, R->buf,
		    (size_t)lenread, sock))
			goto err0;

		/* Try to read some more data. */
		if ((R->network_read_cookie = network_read(R->sock_read,
		    R->buf, BUFLEN, 1, callback_read, R)) == NULL) {
			warnp("network_read");
			goto err0;
		}
	} else if (lenread == 0) {
		if (drop(R)) {
			warn0("drop");
			goto err0;
		}
	} else {
		warn0("Failed to read from network");
		A->conndone = 1;
		goto err0;
	}

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
movq 0x10(%rdi), %rbx
movl 0x18(%rdi), %ecx
movq $0x0, 0x2020(%rdi)
testq %rsi, %rsi
jle 0x2e7d
movq %rsi, %rdx
movq 0x40(%rbx), %rdi
leaq 0x1c(%r14), %r15
movq %r15, %rsi
callq *0x48(%rbx)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x2ecf
movl 0x18(%r14), %edi
leaq -0x48(%rip), %r8        # 0x2df0
movl $0x2000, %edx           # imm = 0x2000
movl $0x1, %ecx
movq %r15, %rsi
movq %r14, %r9
callq 0x44e8
movq %rax, 0x2020(%r14)
testq %rax, %rax
jne 0x2ecd
callq 0x2090
cmpl $0x0, (%rax)
je 0x2ed7
movq %rax, %r14
leaq 0x433a(%rip), %rdi      # 0x71a7
xorl %eax, %eax
callq 0x5cd8
movl $0x0, (%r14)
jmp 0x2ecf
je 0x2ea1
leaq 0x4333(%rip), %rdi      # 0x71b9
xorl %eax, %eax
callq 0x5df7
callq 0x2090
movl $0x0, (%rax)
movl $0x1, 0x4(%rbx)
jmp 0x2ec6
movq %r14, %rdi
callq 0x2ee7
testl %eax, %eax
je 0x2ecd
leaq 0x4300(%rip), %rdi      # 0x71b4
xorl %eax, %eax
callq 0x5df7
callq 0x2090
movl $0x0, (%rax)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x2ecf
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x42c9(%rip), %rdi      # 0x71a7
xorl %eax, %eax
callq 0x5df7
jmp 0x2ecf
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/tests/nc-server/simple_server.c
// Function: drop
static int
drop(struct conn_list_node * node_ptr)
{

	/* If we still have an active read cookie, cancel it. */
	if (node_ptr->network_read_cookie != NULL)
		network_read_cancel(node_ptr->network_read_cookie);

	/* Close the incoming connection. */
	if (close(node_ptr->sock_read) == -1) {
		warnp("close");
		goto err0;
	}

	/* Clean up the node. */
	conndied(node_ptr);

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x2020(%rdi), %rdi
testq %rdi, %rdi
je 0x2eff
callq 0x4793
movl 0x18(%rbx), %edi
callq 0x2180
cmpl $-0x1, %eax
je 0x2f81
movq 0x10(%rbx), %r14
cmpq $0x0, 0x38(%r14)
je 0x2fbf
decq 0x20(%r14)
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x2f40
movq 0x18(%r14), %rcx
incq %rcx
movq %rcx, 0x18(%r14)
cmpq %rax, %rcx
jb 0x2f40
movl $0x1, 0x8(%r14)
movq (%rbx), %rax
testq %rax, %rax
je 0x2f50
movq 0x8(%rbx), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rbx), %rcx
movq %rax, (%rcx)
movq %rbx, %rdi
callq 0x2040
cmpl $0x0, 0x8(%r14)
je 0x2f75
cmpq $0x0, 0x20(%r14)
jne 0x2f75
movl $0x1, 0x4(%r14)
movq %r14, %rdi
callq 0x2bd9
xorl %eax, %eax
jmp 0x2fb7
callq 0x2090
cmpl $0x0, (%rax)
je 0x2fa4
movq %rax, %rbx
leaq 0x4118(%rip), %rdi      # 0x70ad
xorl %eax, %eax
callq 0x5cd8
movl $0x0, (%rbx)
jmp 0x2fb2
leaq 0x4102(%rip), %rdi      # 0x70ad
xorl %eax, %eax
callq 0x5df7
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x420f(%rip), %rdi      # 0x71d5
leaq 0x4226(%rip), %rsi      # 0x71f3
leaq 0x422f(%rip), %rcx      # 0x7203
movl $0x4c, %edx
callq 0x2160
nop
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/test/hfile.c
// Function: fail
void HTS_FORMAT(HTS_PRINTF_FMT, 1, 2) HTS_NORETURN
fail(const char *format, ...)
{
    int err = errno;
    va_list args;
    va_start(args, format);
    vfprintf(stderr, format, args);
    va_end(args);
    if (err != 0) fprintf(stderr, ": %s", strerror(err));
    fprintf(stderr, "\n");
    exit(EXIT_FAILURE);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %r14
leaq 0x20(%rsp), %r15
movq %rsi, 0x8(%r15)
movq %rdx, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq %r8, 0x20(%r15)
movq %r9, 0x28(%r15)
testb %al, %al
je 0x5e1f
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)
callq 0x4050
movl (%rax), %ebx
movq %rsp, %rdx
movq %r15, 0x10(%rdx)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq 0xad193(%rip), %r15     # 0xb2fe0
movq (%r15), %rdi
movq %r14, %rsi
callq 0x4680
testl %ebx, %ebx
je 0x5e7a
movq (%r15), %r14
movl %ebx, %edi
callq 0x4140
leaq 0x90bd7(%rip), %rsi     # 0x96a44
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x46f0
movq (%r15), %rsi
movl $0xa, %edi
callq 0x4620
movl $0x1, %edi
callq 0x45d0
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/test/hfile.c
// Function: check_offset
void check_offset(hFILE *f, off_t off, const char *message)
{
    off_t ret = htell(f);
    if (ret < 0) fail("htell(%s)", message);
    if (ret == off) return;

    fprintf(stderr, "%s offset incorrect: expected %ld but got %ld\n",
            message, (long)off, (long)ret);
    exit(EXIT_FAILURE);
}

// Assembly:
pushq %rax
movq 0x28(%rdi), %r8
addq 0x8(%rdi), %r8
subq (%rdi), %r8
js 0x5ea9
movq %rsi, %rcx
cmpq %rsi, %r8
jne 0x5eba
popq %rax
retq
leaq 0x8c180(%rip), %rdi     # 0x92030
movq %rdx, %rsi
xorl %eax, %eax
callq 0x5dbc
movq 0xad11f(%rip), %rax     # 0xb2fe0
movq (%rax), %rdi
leaq 0x8c16f(%rip), %rsi     # 0x9203a
xorl %eax, %eax
callq 0x46f0
movl $0x1, %edi
callq 0x45d0
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/test/hfile.c
// Function: slurp
char *slurp(const char *filename)
{
    char *text;
    struct stat sbuf;
    size_t filesize;
    FILE *f = fopen(filename, "rb");
    if (f == NULL) fail("fopen(\"%s\", \"rb\")", filename);
    if (fstat(fileno(f), &sbuf) != 0) fail("fstat(\"%s\")", filename);
    filesize = sbuf.st_size;

    text = (char *) malloc(filesize + 1);
    if (text == NULL) fail("malloc(text)");

    if (fread(text, 1, filesize, f) != filesize) fail("fread");
    fclose(f);

    text[filesize] = '\0';
    return text;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rdi, %r14
leaq 0x8c177(%rip), %rsi     # 0x92069
callq 0x45a0
testq %rax, %rax
je 0x5f60
movq %rax, %rbx
movq %rax, %rdi
callq 0x44e0
movq %rsp, %rsi
movl %eax, %edi
callq 0x4870
testl %eax, %eax
jne 0x5f69
movq 0x30(%rsp), %r14
leaq 0x1(%r14), %rdi
callq 0x4670
testq %rax, %rax
je 0x5f7a
movq %rax, %r15
movl $0x1, %esi
movq %rax, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x4780
cmpq %r14, %rax
jne 0x5f83
movq %rbx, %rdi
callq 0x44a0
movb $0x0, (%r15,%r14)
movq %r15, %rax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x8c105(%rip), %rdi     # 0x9206c
jmp 0x5f70
leaq 0x8c10e(%rip), %rdi     # 0x9207e
movq %r14, %rsi
xorl %eax, %eax
callq 0x5dbc
leaq 0x8c109(%rip), %rdi     # 0x9208a
jmp 0x5f8a
leaq 0x8c10d(%rip), %rdi     # 0x92097
xorl %eax, %eax
callq 0x5dbc
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/test/hfile.c
// Function: reopen
void reopen(const char *infname, const char *outfname)
{
    if (fin) { if (hclose(fin) != 0) fail("hclose(input)"); }
    if (fout) { if (hclose(fout) != 0) fail("hclose(output)"); }

    fin = hopen(infname, "r");
    if (fin == NULL) fail("hopen(\"%s\")", infname);

    fout = hopen(outfname, "w");
    if (fout == NULL) fail("hopen(\"%s\")", outfname);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0xad566(%rip), %rdi     # 0xb3508
testq %rdi, %rdi
je 0x5fb0
callq 0x7f94
testl %eax, %eax
jne 0x6024
movq 0xad559(%rip), %rdi     # 0xb3510
testq %rdi, %rdi
je 0x5fc5
callq 0x7f94
testl %eax, %eax
jne 0x602d
leaq 0x8fcb9(%rip), %rsi     # 0x95c85
movq %r14, %rdi
xorl %eax, %eax
callq 0x88d8
movq %rax, 0xad52b(%rip)     # 0xb3508
testq %rax, %rax
je 0x6007
leaq 0x8eeb8(%rip), %rsi     # 0x94ea1
movq %rbx, %rdi
xorl %eax, %eax
callq 0x88d8
movq %rax, 0xad516(%rip)     # 0xb3510
testq %rax, %rax
je 0x6013
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x8c0ac(%rip), %rdi     # 0x920ba
movq %r14, %rsi
jmp 0x601d
leaq 0x8c0a0(%rip), %rdi     # 0x920ba
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5dbc
leaq 0x8c072(%rip), %rdi     # 0x9209d
jmp 0x6034
leaq 0x8c077(%rip), %rdi     # 0x920ab
xorl %eax, %eax
callq 0x5dbc
// File: /workspace/github_c_makefile_star2_O1/morozov312[P]documentary/./src/main.c
// Function: main
int main(int argc, char** argv)
{
    char *start_dir, *dest_dir;
    int argc_flag = Check_argc(argc, argv);
    if (!argc_flag) {
        return 0;
    }
    int argv_flag = Check_argv(argc, argv, &start_dir, &dest_dir);
    if (!argv_flag) {
        return 0;
    }
    if (strcmp(start_dir, "") == 0) {
        printf("\x1b[31m Error! \x1b[0m\n");
        Print_help();
        return 0;
    }
    char** paths_array = (char**)calloc(MAX_COUNT_OF_FILES, sizeof(char*));
    for (int i = 0; i < MAX_COUNT_OF_FILES; i++) {
        paths_array[i] = (char*)calloc(MAX_PATH_LEN, sizeof(char));
    }
    int recursive_exit_flag = 0;
    int recursive_res = Search_files_recursive(
            start_dir, paths_array, &recursive_exit_flag);
    if (recursive_res == -1) {
        printf("%s\n",
               "\x1b[36mWarning!\x1b[0m limit of files for this "
               "folder "
               "overpassed!");
    }
    for (int i = 0; i < MAX_COUNT_OF_FILES; i++) {
        size_t len = strlen(paths_array[i]);
        if (len > 0) {
            Create_document(paths_array[i], dest_dir);
        }
    }
    for (int i = 0; i < MAX_COUNT_OF_FILES; i++) {
        free(paths_array[i]);
    }
    free(paths_array);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movl %edi, %r14d
callq 0x1742
testl %eax, %eax
je 0x136c
leaq -0x28(%rbp), %rdx
leaq -0x20(%rbp), %rcx
movl %r14d, %edi
movq %rbx, %rsi
callq 0x17e0
testl %eax, %eax
je 0x136c
movq -0x28(%rbp), %r14
cmpb $0x0, (%r14)
je 0x1359
movl $0x1e, %edi
movl $0x8, %esi
callq 0x1110
movq %rax, %rbx
xorl %r15d, %r15d
movl $0xff, %edi
movl $0x1, %esi
callq 0x1110
movq %rax, (%rbx,%r15,8)
incq %r15
cmpq $0x1e, %r15
jne 0x12da
leaq -0x2c(%rbp), %rdx
movl $0x0, (%rdx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1483
cmpl $-0x1, %eax
jne 0x131c
leaq 0x1ced(%rip), %rdi      # 0x3004
callq 0x1060
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rdi
cmpb $0x0, (%rdi)
je 0x1331
movq -0x20(%rbp), %rsi
callq 0x210f
incq %r14
cmpq $0x1e, %r14
jne 0x131f
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rdi
callq 0x1030
incq %r14
cmpq $0x1e, %r14
jne 0x133d
movq %rbx, %rdi
callq 0x1030
jmp 0x136c
leaq 0x1ce1(%rip), %rdi      # 0x3041
callq 0x1060
xorl %eax, %eax
callq 0x16c3
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/group-function/request.c
// Function: usage
void usage(char **argv, char **av)
{
  if (av)
  {
    fprintf(stderr, "Unknown or invalid argument %s\n", av[0]);
  }
  fprintf(stderr, "Usage: %s <dest> <prio> <pgn> <interval> <field>=<value> ...\n\n", argv[0]);
  fprintf(stderr, "       <field> is a decimal value\n");
  fprintf(stderr, "       <value> is a hexadecimal value; the length of the value defines how many bytes are encoded\n");
  fprintf(stderr, "       Maximum # of fields: %d\n\n", MAX_FIELDS);
  fprintf(stderr, "This program uses PGN 126208 to request a device to start reporting a PGN at the given interval.\n");
  fprintf(stderr, "The use of this is thus completely dependent on what the device allows.\n\n" COPYRIGHT);
  exit(1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rsi, %rsi
je 0x13b3
movq 0x4c59(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
movq (%rsi), %rdx
leaq 0x1c58(%rip), %rsi      # 0x3004
xorl %eax, %eax
callq 0x1130
movq 0x4c3e(%rip), %r14      # 0x5ff8
movq (%r14), %rdi
movq (%rbx), %rdx
leaq 0x1c5d(%rip), %rsi      # 0x3024
xorl %eax, %eax
callq 0x1130
movq (%r14), %rcx
leaq 0x1c8b(%rip), %rdi      # 0x3063
movl $0x22, %esi
movl $0x1, %edx
callq 0x1210
movq (%r14), %rcx
leaq 0x1c95(%rip), %rdi      # 0x3086
movl $0x62, %esi
movl $0x1, %edx
callq 0x1210
movq (%r14), %rdi
leaq 0x1cdf(%rip), %rsi      # 0x30e9
movl $0x14, %edx
xorl %eax, %eax
callq 0x1130
movq (%r14), %rcx
leaq 0x1cea(%rip), %rdi      # 0x310a
movl $0x61, %esi
movl $0x1, %edx
callq 0x1210
movq (%r14), %rcx
leaq 0x1d33(%rip), %rdi      # 0x316c
movl $0x304, %esi            # imm = 0x304
movl $0x1, %edx
callq 0x1210
movl $0x1, %edi
callq 0x11f0
// File: /workspace/github_c_makefile_star2_O1/hamsternz[P]emulate-risc-v/main.c
// Function: main
int main(int argc, char *argv[]) {
  int run = 1, quit = 0, trace = 1, reset = 0;

  if(!display_start()) {
    fprintf(stderr,"Unable to initialise display\n");
    return 0;
  }

  if(!memory_initialise()) {
    return 0;
  }
  display_log("Memory inisitalised");

  if(!riscv_initialise()) {
    return 0;
  }
  display_log("RISC-V initalised");
  riscv_reset();
  display_log("Press SPACE to run a sigle instruction, or 'r' to run. 'q' to quit");

  while(!quit) {
    if(run) {
       if(!memory_run())
         run = 0;
    }
    if(run) {
       if(!riscv_run() ||run == 1)
         run = 0;
    }
    display_update();
    display_process_input(&run, &quit, &trace, &reset);
    if(reset) {
      riscv_reset();
      reset = 0;
    }
  }
  riscv_dump();
  riscv_finish();
  display_log("RISC-V shutdown");
  memory_finish();
  display_log("Memory shutdown");
  display_update();
  display_end();
  
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl $0x1, %eax
movl %eax, 0x8(%rsp)
xorl %ecx, %ecx
movl %ecx, 0x10(%rsp)
movl %eax, 0x14(%rsp)
movl %ecx, 0xc(%rsp)
callq 0x48ac
testl %eax, %eax
je 0x2570
callq 0x604a
testl %eax, %eax
je 0x2562
leaq 0x4ba3(%rip), %rdi      # 0x7022
callq 0x4d86
callq 0x2ef1
testl %eax, %eax
je 0x2562
leaq 0x4b9e(%rip), %rdi      # 0x7036
callq 0x4d86
callq 0x2e86
leaq 0x4b9f(%rip), %rdi      # 0x7048
callq 0x4d86
cmpl $0x0, 0x10(%rsp)
jne 0x2531
leaq 0x8(%rsp), %rbx
leaq 0x10(%rsp), %r14
leaq 0x14(%rsp), %r15
leaq 0xc(%rsp), %r12
cmpl $0x0, 0x8(%rsp)
je 0x24e1
callq 0x621d
testl %eax, %eax
jne 0x24e1
movl $0x0, 0x8(%rsp)
cmpl $0x0, 0x8(%rsp)
je 0x2500
callq 0x2fa1
testl %eax, %eax
je 0x24f8
cmpl $0x1, 0x8(%rsp)
jne 0x2500
movl $0x0, 0x8(%rsp)
callq 0x4a83
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x4f02
cmpl $0x0, 0xc(%rsp)
je 0x252a
callq 0x2e86
movl $0x0, 0xc(%rsp)
cmpl $0x0, 0x10(%rsp)
je 0x24c9
callq 0x31ff
callq 0x3200
leaq 0x4b49(%rip), %rdi      # 0x708b
callq 0x4d86
callq 0x6380
leaq 0x4b48(%rip), %rdi      # 0x709b
callq 0x4d86
callq 0x4a83
callq 0x5054
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x2240
jmp 0x2562
nop
// File: /workspace/github_c_makefile_star2_O1/hamsternz[P]emulate-risc-v/riscv.c
// Function: riscv_reset
void riscv_reset(void) {
  memory_reset();
  memset(regs,0xFF,sizeof(regs));
  regs[0] = 0;
  pc = 0x20400000;
  display_log("RISC-V reset");
}

// Assembly:
pushq %rax
callq 0x6008
pcmpeqd %xmm0, %xmm0
movdqa %xmm0, 0xdb98(%rip)     # 0x10a30
movdqa %xmm0, 0xdc00(%rip)     # 0x10aa0
movdqa %xmm0, 0xdbe8(%rip)     # 0x10a90
movdqa %xmm0, 0xdbd0(%rip)     # 0x10a80
movdqa %xmm0, 0xdbb8(%rip)     # 0x10a70
movdqa %xmm0, 0xdba0(%rip)     # 0x10a60
movdqa %xmm0, 0xdb88(%rip)     # 0x10a50
movdqa %xmm0, 0xdb70(%rip)     # 0x10a40
movl $0x0, 0xdb56(%rip)      # 0x10a30
movl $0x20400000, 0x9b2c(%rip) # imm = 0x20400000
leaq 0x49b9(%rip), %rdi      # 0x78a4
popq %rax
jmp 0x4d86
// File: /workspace/github_c_makefile_star2_O1/hamsternz[P]emulate-risc-v/riscv.c
// Function: riscv_initialise
int riscv_initialise(void) {
  int i;
  for(i = 0; i < sizeof(opcodes)/sizeof(struct opcode_entry); i++) {
     int j;
     if(strlen(opcodes[i].spec) != 32) {
       return 0;
     }
     opcodes[i].mask = 0;
     opcodes[i].value = 0;
     for(j = 0; j < 32; j++) {
       opcodes[i].value <<= 1;
       opcodes[i].mask  <<= 1;

       /* Change the string specifiers into masks */
       switch(opcodes[i].spec[j]) {
          case '0':
             opcodes[i].mask  |= 1;
             break;
          case '1':
             opcodes[i].mask  |= 1;
             opcodes[i].value |= 1;
             break;
          case '-':
             break;
          default:
	     display_log("Unknown character in opcode");
	     return 0;
        }
     }
  }
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
xorl %ebx, %ebx
leaq 0x923d(%rip), %r15      # 0xc140
xorl %r12d, %r12d
leaq (%r12,%r12,4), %r13
movq (%r15,%r13,8), %r14
movq %r14, %rdi
callq 0x20a0
cmpq $0x20, %rax
jne 0x2f87
leaq (%r15,%r13,8), %rax
movq $0x0, 0x20(%rax)
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
addl %edx, %edx
movl %edx, 0x20(%rax)
addl %esi, %esi
movl %esi, 0x24(%rax)
movzbl (%r14,%rcx), %edi
cmpl $0x2d, %edi
je 0x2f60
cmpl $0x31, %edi
je 0x2f54
cmpl $0x30, %edi
jne 0x2f79
orl $0x1, %esi
movl %esi, 0x24(%rax)
jmp 0x2f60
orl $0x1, %esi
movl %esi, 0x24(%rax)
orl $0x1, %edx
movl %edx, 0x20(%rax)
incq %rcx
cmpq $0x20, %rcx
jne 0x2f2e
incq %r12
cmpq $0x38, %r12
jne 0x2f06
movl $0x1, %ebx
jmp 0x2f87
leaq 0x4931(%rip), %rdi      # 0x78b1
callq 0x4d86
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/hamsternz[P]emulate-risc-v/riscv.c
// Function: trace
static void trace(char *fmt, uint32_t a, uint32_t b, uint32_t c) {
  char buffer[128];
  if(!trace_active)
    return;
  sprintf(buffer,"%08X:%c",pc, stalled ? '*' : ' ');
  sprintf(buffer+10, fmt, a, b, c);
  display_trace(buffer);
}

// Assembly:
cmpl $0x0, 0x8f28(%rip)      # 0xc130
je 0x327f
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x80, %rsp
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
movl 0x97e7(%rip), %edx      # 0xca10
cmpb $0x0, 0xd898(%rip)      # 0x10ac8
movl $0x2a, %eax
movl $0x20, %ecx
cmovnel %eax, %ecx
leaq 0x46ae(%rip), %rsi      # 0x78f2
movq %rsp, %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x2200
leaq 0xa(%rsp), %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x2200
movq %r12, %rdi
callq 0x4e53
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hamsternz[P]emulate-risc-v/memorymap.c
// Function: memorymap_aligned_read
int memorymap_aligned_read(uint32_t address, uint32_t *value) {
   struct region *r = first_region;

   /* Find the region */
   while(r != NULL) {
     if(address >= r->base && address < r->base+r->size)
       break;
     r = r->next;
   }

   /* If no region found then exit */
   if(r == NULL) {
     char buffer[128];
     sprintf(buffer, "Read of invalid address %08X",address);
     display_log(buffer);
     return 0;
   }

   /* Trap a currently unhandled error */
   if(address+4 > r->base + r->size) {
     display_log("Need to split the read of address as it crosses boundary");
     return 0;
   }
   return r->get(r, address-r->base, value);
}

// Assembly:
pushq %rbx
subq $0x80, %rsp
movl %edi, %edx
movq 0xd39f(%rip), %rdi      # 0x10af8
testq %rdi, %rdi
je 0x3779
movq %rsi, %rax
movl 0x8(%rdi), %ecx
movl %edx, %esi
subl %ecx, %esi
jb 0x3771
addl 0xc(%rdi), %ecx
cmpl %edx, %ecx
ja 0x37a0
movq (%rdi), %rdi
testq %rdi, %rdi
jne 0x3761
leaq 0x4698(%rip), %rsi      # 0x7e18
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2200
movq %rbx, %rdi
callq 0x4d86
xorl %eax, %eax
addq $0x80, %rsp
popq %rbx
retq
addl $0x4, %edx
cmpl %ecx, %edx
jbe 0x37b0
leaq 0x4687(%rip), %rdi      # 0x7e35
jmp 0x3790
movq 0x20(%rdi), %rcx
movq %rax, %rdx
addq $0x80, %rsp
popq %rbx
jmpq *%rcx
// File: /workspace/github_c_makefile_star2_O1/hamsternz[P]emulate-risc-v/memorymap.c
// Function: memorymap_aligned_write
int memorymap_aligned_write(uint32_t address, uint8_t mask, uint32_t value) {
   struct region *r = first_region;

   /* Find the region */
   while(r != NULL) {
     if(address >= r->base && address < r->base+r->size)
       break;
     r = r->next;
   }

   /* If no region found then exit */
   if(r == NULL) {
     char buffer[128];
     sprintf(buffer, "Write of invalid address %08X",address);
     display_log(buffer);
     return 0;
   }

   /* Trap a currently unhandled error */
   if(address+4 > r->base + r->size) {
     display_log("Write to split the read of address as it crosses boundary");
     return 0;
   }
   return r->set(r, address-r->base, mask, value);
}

// Assembly:
pushq %rbx
subq $0x80, %rsp
movl %edx, %ecx
movl %edi, %edx
movq 0xd324(%rip), %rdi      # 0x10af8
testq %rdi, %rdi
je 0x37f2
movl 0x8(%rdi), %r8d
movl %edx, %eax
subl %r8d, %eax
jb 0x37ed
addl 0xc(%rdi), %r8d
cmpl %edx, %r8d
ja 0x3819
movq (%rdi), %rdi
jmp 0x37d4
leaq 0x4675(%rip), %rsi      # 0x7e6e
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2200
movq %rbx, %rdi
callq 0x4d86
xorl %eax, %eax
addq $0x80, %rsp
popq %rbx
retq
addl $0x4, %edx
cmpl %r8d, %edx
jbe 0x382a
leaq 0x4664(%rip), %rdi      # 0x7e8c
jmp 0x3809
movq 0x18(%rdi), %r8
movzbl %sil, %edx
movl %eax, %esi
addq $0x80, %rsp
popq %rbx
jmpq *%r8
// File: /workspace/github_c_makefile_star2_O1/hamsternz[P]emulate-risc-v/memorymap.c
// Function: add_region
static int add_region(uint32_t base, uint32_t size, 
  int  (*init)(struct region *r),
  int (*get)(struct region *r, uint32_t address, uint32_t *value),
  int (*set)(struct region *r, uint32_t address, uint8_t mask, uint32_t value),
  void (*free)(struct region *r),
  void (*dump)(struct region *r)) {
  struct region *r = NULL;

  /* Allocate space */
  r = malloc(sizeof(struct region));
  if(r == NULL) {
    return 0;
  }

  /* Initialise it */
  memset(r,0,sizeof(struct region));
  r->base = base;
  r->size = size;
  r->init = init;
  r->get  = get;
  r->set  = set;
  r->free = free;
  r->dump = dump;

  /* Add to list */
  if(first_region == NULL) {
    first_region = r;
    r->next = NULL;
  } else {
    struct region *c = first_region;
    while(c->next != NULL)
      c = c->next;
    c->next = r;
    r->next = NULL;
  }
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %ebp
movl %edi, %r13d
movl $0x40, %edi
callq 0x2190
testq %rax, %rax
je 0x3ae5
movq 0x40(%rsp), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movl %r13d, 0x8(%rax)
movl %ebp, 0xc(%rax)
movq %r12, 0x10(%rax)
movq %r15, 0x20(%rax)
movq %r14, 0x18(%rax)
movq %rbx, 0x28(%rax)
movq %rcx, 0x30(%rax)
movq 0xd025(%rip), %rcx      # 0x10af8
testq %rcx, %rcx
je 0x3ae9
movq %rcx, %rdx
movq (%rcx), %rcx
testq %rcx, %rcx
jne 0x3ad8
jmp 0x3af0
xorl %eax, %eax
jmp 0x3aff
leaq 0xd008(%rip), %rdx      # 0x10af8
movq %rax, (%rdx)
movq $0x0, (%rax)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hamsternz[P]emulate-risc-v/memorymap.c
// Function: memorymap_read
int memorymap_read(uint32_t address, uint8_t width, uint32_t *value) {
   uint32_t v, v1, mask;

   /* Mask out data we don't want */
   switch(width) {
     case 1:
       mask = 0xFF;
       break; 
     case 2:
       mask = 0xFFFF;
       break; 
     case 4:
       mask = 0xFFFFFFFF;
       break; 
     default:
       display_log("Invalid read width at address 0x%08x");
       return 0;
   }

   /* Read the memory region */
   switch(address & 3) {
     case 0:
       if(!memorymap_aligned_read(address+0, &v))  return 0;
       break;
     case 1:
       if(!memorymap_aligned_read(address-1, &v))  return 0;
       if(!memorymap_aligned_read(address+3, &v1)) return 0;
       v = (v>>8) | (v1 <<24);
       break;
     case 2:
       if(!memorymap_aligned_read(address-2, &v))  return 0;
       if(!memorymap_aligned_read(address+2, &v1)) return 0;
       v = (v>>16) | (v1 <<16);
       break;
     default:
       if(!memorymap_aligned_read(address-3, &v))  return 0;
       if(!memorymap_aligned_read(address+1, &v1)) return 0;
       v = (v>>24) | (v1 <<8);
       break;
   }
   /* Set the return value */
   *value = v & mask;
   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %edi, %r14d
cmpl $0x1, %esi
je 0x3b62
cmpl $0x4, %esi
je 0x3b46
cmpl $0x2, %esi
jne 0x3b93
movl $0xffff, %r15d          # imm = 0xFFFF
movl %r14d, %eax
andl $0x3, %eax
leaq 0x425b(%rip), %rcx      # 0x7d98
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r14d, %eax
andl $0x3, %eax
leaq 0x423f(%rip), %rcx      # 0x7d98
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0xff, %r15d
movl %r14d, %eax
andl $0x3, %eax
leaq 0x4223(%rip), %rcx      # 0x7d98
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rsp, %rsi
movl %r14d, %edi
callq 0x3748
testl %eax, %eax
jne 0x3c4a
jmp 0x3b9f
leaq 0x437d(%rip), %rdi      # 0x7f17
callq 0x4d86
xorl %ebp, %ebp
jmp 0x3c56
leal -0x2(%r14), %edi
movq %rsp, %rsi
callq 0x3748
xorl %ebp, %ebp
testl %eax, %eax
je 0x3c56
addl $0x2, %r14d
leaq 0x4(%rsp), %rsi
movl %r14d, %edi
callq 0x3748
testl %eax, %eax
je 0x3c56
movl (%rsp), %eax
movl 0x4(%rsp), %ecx
shldl $0x10, %eax, %ecx
jmp 0x3c47
leal -0x3(%r14), %edi
movq %rsp, %rsi
callq 0x3748
xorl %ebp, %ebp
testl %eax, %eax
je 0x3c56
incl %r14d
leaq 0x4(%rsp), %rsi
movl %r14d, %edi
callq 0x3748
testl %eax, %eax
je 0x3c56
movl (%rsp), %eax
movl 0x4(%rsp), %ecx
shldl $0x8, %eax, %ecx
jmp 0x3c47
leal -0x1(%r14), %edi
movq %rsp, %rsi
callq 0x3748
xorl %ebp, %ebp
testl %eax, %eax
je 0x3c56
addl $0x3, %r14d
leaq 0x4(%rsp), %rsi
movl %r14d, %edi
callq 0x3748
testl %eax, %eax
je 0x3c56
movl (%rsp), %eax
movl 0x4(%rsp), %ecx
shldl $0x18, %eax, %ecx
movl %ecx, (%rsp)
andl (%rsp), %r15d
movl %r15d, (%rbx)
movl $0x1, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hamsternz[P]emulate-risc-v/memorymap.c
// Function: memorymap_finish
void memorymap_finish(void) {
   while(first_region != NULL) {
      struct region *r = first_region;
      first_region = first_region->next;
      r->free(r);
      free(r);
   }
}

// Assembly:
pushq %rbx
movq 0xcc28(%rip), %rbx      # 0x10af8
testq %rbx, %rbx
je 0x3eef
movq (%rbx), %rax
movq %rax, 0xcc19(%rip)      # 0x10af8
movq %rbx, %rdi
callq *0x28(%rbx)
movq %rbx, %rdi
callq 0x2040
jmp 0x3ec9
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/hamsternz[P]emulate-risc-v/ram.c
// Function: RAM_init
int RAM_init(struct region *r) {
  uint32_t *data;

  if(r->data != NULL) {
    display_log("RAM already initialized");
    return 0;
  }
 
  data = malloc(r->size);
  if(data == NULL){
    return 0;
  }
  r->data = (void *)data;
  memset(r->data, 0, r->size);
  attempt_to_read(r);
  display_log("Set up memory region");
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x0, 0x38(%rdi)
je 0x3f14
xorl %ebx, %ebx
leaq 0x4063(%rip), %rdi      # 0x7f72
jmp 0x40d7
movq %rdi, %rbx
movl 0xc(%rdi), %r15d
movq %r15, %rdi
callq 0x2190
testq %rax, %rax
je 0x40a3
movq %rax, %r14
movq %rax, 0x38(%rbx)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20f0
movl 0x8(%rbx), %edx
leaq 0x40fa(%rip), %rsi      # 0x8044
movq %rsp, %rdi
xorl %eax, %eax
callq 0x21a0
testl %eax, %eax
jle 0x40a7
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x40bf
leaq 0x4135(%rip), %rsi      # 0x80a5
callq 0x21c0
testq %rax, %rax
je 0x40ed
movq %rax, %r15
movq (%rsp), %rdi
callq 0x2040
xorl %r13d, %r13d
movq %r15, %rdi
callq 0x2110
cmpl $0xa, %eax
je 0x3f8d
cmpl $0xd, %eax
je 0x3f8d
cmpl $-0x1, %eax
jne 0x3fbf
leaq 0x4114(%rip), %rdi      # 0x80bf
movl %r13d, %esi
xorl %eax, %eax
callq 0x20c0
movl $0x3, %eax
jmp 0x4052
leal -0x30(%rax), %ebp
cmpl $0x9, %ebp
jbe 0x3fee
leal -0x41(%rax), %ecx
cmpl $0x5, %ecx
ja 0x3fd4
addl $-0x37, %eax
jmp 0x3fdf
leal -0x61(%rax), %ecx
cmpl $0x5, %ecx
ja 0x3fe3
addl $-0x57, %eax
movl %eax, %ebp
jmp 0x3fee
xorl %ebp, %ebp
cmpl $0x20, %eax
jne 0x409c
movl $0x7, %r12d
movq %r15, %rdi
callq 0x2110
leal -0x30(%rax), %ecx
cmpl $0x9, %ecx
ja 0x400b
shll $0x4, %ebp
orl %ecx, %ebp
jmp 0x402d
leal -0x41(%rax), %ecx
cmpl $0x5, %ecx
ja 0x401d
shll $0x4, %ebp
addl %eax, %ebp
addl $-0x37, %ebp
jmp 0x402d
leal -0x61(%rax), %ecx
cmpl $0x5, %ecx
ja 0x405c
shll $0x4, %ebp
addl %eax, %ebp
addl $-0x57, %ebp
decl %r12d
jne 0x3ff4
movslq %r13d, %rcx
movl %ebp, (%r14,%rcx,4)
incl %r13d
cmpl $-0x1, %eax
je 0x4050
cmpl $0xa, %eax
je 0x4050
movq %r15, %rdi
callq 0x2110
jmp 0x403c
xorl %eax, %eax
testl %eax, %eax
je 0x3f8d
jmp 0x40b0
cmpl $0x20, %eax
ja 0x4089
movl %eax, %ecx
movabsq $0x100000600, %rdx      # imm = 0x100000600
btq %rcx, %rdx
jae 0x4089
leal 0x3(,%r13,4), %ecx
cmpl 0xc(%rbx), %ecx
jb 0x4032
leaq 0x4072(%rip), %rdi      # 0x80f9
jmp 0x4090
leaq 0x4089(%rip), %rdi      # 0x8119
callq 0x4d86
movl $0x1, %eax
jmp 0x4052
callq 0x227a
jmp 0x4095
xorl %ebx, %ebx
jmp 0x40dc
leaq 0x3fa3(%rip), %rdi      # 0x8051
jmp 0x40c6
cmpl $0x3, %eax
jne 0x40cb
movq %r15, %rdi
callq 0x2090
jmp 0x40cb
leaq 0x3fb6(%rip), %rdi      # 0x807c
callq 0x4d86
movl $0x1, %ebx
leaq 0x3eb3(%rip), %rdi      # 0x7f8a
callq 0x4d86
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsp, %rdi
callq 0x229c
jmp 0x40cb