LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/express.c
// Function: do_oper
void do_oper() { /* perform binary operations */

	long l = stack[vsp++];
	char c = opstk[osp++];
	if (vsp > MAXESTK) {
		vsp = MAXESTK;
		display_error(error = 'C');
	}
	if (osp > MAXESTK) {
		osp = MAXESTK;
		display_error(error = 'C');
	}
	lastval = TRUE;
	switch (c) {
		case '+':
			stack[vsp] += l;
			break;
		case '-':
			stack[vsp] -= l;
			break;
		case '*':
			stack[vsp] *= l;
			break;
		case '^':
			stack[vsp] ^= l;
			break;
		case '&':
			stack[vsp] &= l;
			break;
		case '|':
			stack[vsp] |= l;
			break;
		case '/':
			if (l)
				stack[vsp] /= l; /* divide by 0? */
			else
				display_error(error = 'E');
			break;
		default:
			display_error(error = 'C');
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movslq 0x9c1d(%rip), %rcx      # 0xe470
leal 0x1(%rcx), %edx
movslq 0x9c17(%rip), %rsi      # 0xe474
leal 0x1(%rsi), %eax
movl %edx, 0x9c0a(%rip)      # 0xe470
leaq 0x9a73(%rip), %rbx      # 0xe2e0
leaq 0x9c0c(%rip), %rdx      # 0xe480
movzbl (%rsi,%rdx), %r15d
movq (%rbx,%rcx,8), %r14
movl %eax, 0x9bf1(%rip)      # 0xe474
cmpq $0x32, %rcx
jl 0x48ad
movl $0x32, 0x9bdd(%rip)     # 0xe470
leaq 0x9556(%rip), %rax      # 0xddf0
movb $0x43, (%rax)
movl $0x43, %edi
callq 0x1ec8
movl 0x9bc7(%rip), %eax      # 0xe474
cmpl $0x33, %eax
jl 0x48d0
movl $0x32, 0x9bb8(%rip)     # 0xe474
leaq 0x952d(%rip), %rax      # 0xddf0
movb $0x43, (%rax)
movl $0x43, %edi
callq 0x1ec8
movl $0x1, 0x9b9e(%rip)      # 0xe478
leal -0x26(%r15), %eax
cmpl $0x9, %eax
ja 0x4900
leaq 0x5c02(%rip), %rcx      # 0xa4ec
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movslq 0x9b76(%rip), %rax      # 0xe470
andq %r14, (%rbx,%rax,8)
jmp 0x497c
cmpl $0x5e, %r15d
je 0x4971
cmpl $0x7c, %r15d
jne 0x4919
movslq 0x9b5d(%rip), %rax      # 0xe470
orq %r14, (%rbx,%rax,8)
jmp 0x497c
leaq 0x94d0(%rip), %rax      # 0xddf0
movb $0x43, (%rax)
movl $0x43, %edi
jmp 0x4991
movslq 0x9b3f(%rip), %rax      # 0xe470
imulq (%rbx,%rax,8), %r14
movq %r14, (%rbx,%rax,8)
jmp 0x497c
movslq 0x9b2d(%rip), %rax      # 0xe470
addq %r14, (%rbx,%rax,8)
jmp 0x497c
movslq 0x9b20(%rip), %rax      # 0xe470
subq %r14, (%rbx,%rax,8)
jmp 0x497c
testq %r14, %r14
je 0x4982
movslq 0x9b0e(%rip), %rcx      # 0xe470
movq (%rbx,%rcx,8), %rax
cqto
idivq %r14
movq %rax, (%rbx,%rcx,8)
jmp 0x497c
movslq 0x9af8(%rip), %rax      # 0xe470
xorq %r14, (%rbx,%rax,8)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x9467(%rip), %rax      # 0xddf0
movb $0x45, (%rax)
movl $0x45, %edi
popq %rbx
popq %r14
popq %r15
jmp 0x1ec8
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/express.c
// Function: eval
void eval(char op) {
	int more = TRUE;
	if (op == '_' || op == '<' || op == '>' || op == '~' ||
	    op == '(') { /* unary operators */
		opstk[--osp] = op;
		more = lastval = FALSE;
	}
	while (more)
		if (priority(opstk[osp]) < priority(op)) {
			opstk[--osp] = op;
			more = lastval = FALSE;
		} else
			do_oper();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
leal -0x28(%rbx), %eax
cmpl $0x37, %eax
ja 0x49bc
movabsq $0x80000000500001, %rcx # imm = 0x80000000500001
btq %rax, %rcx
jb 0x49c1
cmpl $0x7e, %ebx
jne 0x49f2
movslq 0x9aac(%rip), %rax      # 0xe474
leaq -0x1(%rax), %rcx
movl %ecx, 0x9aa2(%rip)      # 0xe474
leaq 0x9aa7(%rip), %rcx      # 0xe480
movb %bl, -0x1(%rax,%rcx)
movl $0x0, 0x9a91(%rip)      # 0xe478
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movslq 0x9a7b(%rip), %rax      # 0xe474
leaq 0x9a80(%rip), %r15      # 0xe480
movsbl (%rax,%r15), %edi
callq 0x472c
movl %eax, %r14d
movsbl %bl, %ebp
movl %ebp, %edi
callq 0x472c
cmpl %eax, %r14d
jb 0x49c1
callq 0x4847
movslq 0x9a4c(%rip), %rax      # 0xe474
movsbl (%rax,%r15), %edi
callq 0x472c
movl %eax, %r14d
jmp 0x4a10
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/help.c
// Function: help
void help() {
	printf("\nthe assembler command line consists of the file names and "
	       "switches\n");
	printf("\nC65> "
	       "[object],[listing]=source[,source]...[,source][/switch]...[/"
	       "switch]\n");
	printf("\nItems enclosed in brackets [...] are optional.\n");
	printf("\nThe default file extentions are .obj , .lst and .src\n");
	printf("\nSwitches  (either upper or lower case)\n");
	printf("/A absolute assembly (default)\n");
	printf("/Cn cpu instruction set /C0 for NMOS 6502   /C1 for CMOS "
	       "6502\n");
	printf("     /C2 for CMOS 6502 w/bit instructions   /C3 for Commodore "
	       "4502 (default)\n");
	printf("/Dpath specify path for intermediate file ( usually RAM disk "
	       "on PCs).\n");
	printf("/H help - prints this message\n");
	printf("/L assume long branches on pass1. (default= assume short "
	       "branches)\n");
	printf("/Mnnn maximum macro nesting depth (default=50, "
	       "limits=2-999).\n");
	printf("/Pnn maximum number of passes to try (default=15, "
	       "limits=2-99).\n");
	printf("/N don't print errors to console during assembly\n");
	printf("/R relocatable assembly - illegal since this is an absolute "
	       "assembler only\n");
	printf("/S narrow list format\n");
	printf("/T don't print symbol table\n");
	printf("/V don't print cross reference\n");
	printf("/X print cross reference (default)\n");
}

// Assembly:
pushq %rax
leaq 0x572b(%rip), %rdi      # 0xa587
callq 0x1090
leaq 0x5763(%rip), %rdi      # 0xa5cb
callq 0x1090
leaq 0x57a1(%rip), %rdi      # 0xa615
callq 0x1090
leaq 0x57c5(%rip), %rdi      # 0xa645
callq 0x1090
leaq 0x57ef(%rip), %rdi      # 0xa67b
callq 0x1090
leaq 0x580b(%rip), %rdi      # 0xa6a3
callq 0x1090
leaq 0x581e(%rip), %rdi      # 0xa6c2
callq 0x1090
leaq 0x5850(%rip), %rdi      # 0xa700
callq 0x1090
leaq 0x5891(%rip), %rdi      # 0xa74d
callq 0x1090
leaq 0x58cb(%rip), %rdi      # 0xa793
callq 0x1090
leaq 0x58dd(%rip), %rdi      # 0xa7b1
callq 0x1090
leaq 0x5914(%rip), %rdi      # 0xa7f4
callq 0x1090
leaq 0x5946(%rip), %rdi      # 0xa832
callq 0x1090
leaq 0x597a(%rip), %rdi      # 0xa872
callq 0x1090
leaq 0x599f(%rip), %rdi      # 0xa8a3
callq 0x1090
leaq 0x59de(%rip), %rdi      # 0xa8ee
callq 0x1090
leaq 0x59e8(%rip), %rdi      # 0xa904
callq 0x1090
leaq 0x59f8(%rip), %rdi      # 0xa920
callq 0x1090
leaq 0x5a0b(%rip), %rdi      # 0xa93f
popq %rax
jmp 0x1090
nop
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/macrodef.c
// Function: macro_tab
void macro_tab() {
	long s = 0;
	int i = 0;
	char *p;
	if ((tmpmac = macro_head))
		fprintf(file_lst,
		        "\n\n size  name                            "
		        "parameters\n");
	while (tmpmac) {
		i++;
		s += tmpmac->size;
		fprintf(file_lst, "%5u. %-31s", tmpmac->size, tmpmac->name);
		p = tmpmac->name;
		while (*p++)
			;
		while (*p) {
			fprintf(file_lst, " %s", p);
			while (*p++)
				;
		}
		fprintf(file_lst, "\n");
		tmpmac = tmpmac->nextmac;
	}
	if (macro_head)
		fprintf(file_lst,
		        "\nMemory used to store %d macro definitions: %ld. "
		        "bytes.\n",
		        i, s);
	else
		fprintf(file_lst, "\n\nNo macros defined.\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x7f0a(%rip), %rax      # 0xdaa8
movq (%rax), %rax
leaq 0x80d0(%rip), %r13      # 0xdc78
movq %rax, (%r13)
testq %rax, %rax
je 0x5ca0
leaq 0x7ed4(%rip), %r14      # 0xda90
movq (%r14), %rcx
leaq 0x4e64(%rip), %rdi      # 0xaa2a
movl $0x34, %esi
movl $0x1, %edx
callq 0x1210
movq (%r13), %rcx
testq %rcx, %rcx
je 0x5c6b
leaq 0x4e81(%rip), %r15      # 0xaa6a
xorl %ebp, %ebp
xorl %ebx, %ebx
movl 0x8(%rcx), %r12d
movq (%r14), %rdi
addq $0xc, %rcx
leaq 0x4e60(%rip), %rsi      # 0xaa5f
movl %r12d, %edx
xorl %eax, %eax
callq 0x1140
movq (%r13), %r13
addq $0xc, %r13
cmpb $0x0, (%r13)
leaq 0x1(%r13), %r13
jne 0x5c11
jmp 0x5c39
movq (%r14), %rdi
movq %r15, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x1140
cmpb $0x0, (%r13)
leaq 0x1(%r13), %r13
jne 0x5c2e
cmpb $0x0, (%r13)
jne 0x5c1e
incl %ebp
addq %r12, %rbx
movq (%r14), %rsi
movl $0xa, %edi
callq 0x1110
leaq 0x801f(%rip), %r13      # 0xdc78
movq (%r13), %rax
movq (%rax), %rcx
movq %rcx, (%r13)
testq %rcx, %rcx
jne 0x5bed
jmp 0x5c6f
xorl %ebx, %ebx
xorl %ebp, %ebp
leaq 0x7e32(%rip), %rax      # 0xdaa8
cmpq $0x0, (%rax)
je 0x5ca0
movq (%r14), %rdi
leaq 0x4de8(%rip), %rsi      # 0xaa6e
movl %ebp, %edx
movq %rbx, %rcx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1140
leaq 0x7de9(%rip), %rax      # 0xda90
movq (%rax), %rcx
leaq 0x4df6(%rip), %rdi      # 0xaaa7
movl $0x15, %esi
movl $0x1, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1210
nop
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/opcode.c
// Function: opcode
void opcode() {
	int i;
	for (wrt = i = 0; nmi[i]; i += 2)
		wrt |= s2[0] == nmi[i] &&
		       s2[1] == nmi[i + 1] && /* is a write and */
		       ((s3[0] != 'a' && s3[0] != 'A') ||
		        s3[1]); /* not accumulator */
	addr = print = data = known = 1;
	i = d[0] = parseopr();
	if (data) {
		loc_cntr += data; /* increment the current location counter */
		if (mpulevel[i & 255] > cputype) display_error(error = 'I');
	}
}

// Assembly:
pushq %rbx
leaq 0x8104(%rip), %rax      # 0xdddc
movl $0x0, (%rax)
movb 0x799b(%rip), %r8b      # 0xd680
testb %r8b, %r8b
je 0x5d4e
leaq 0x83a7(%rip), %rcx      # 0xe098
movq (%rcx), %rcx
leaq 0x83a5(%rip), %rdx      # 0xe0a0
movq (%rdx), %rdx
xorl %esi, %esi
leaq 0x797b(%rip), %rdi      # 0xd682
movl $0x0, %r9d
cmpb %r8b, (%rcx)
jne 0x5d3d
movb 0x1(%rcx), %r8b
cmpb -0x1(%rdi), %r8b
jne 0x5d3d
movzbl (%rdx), %r8d
orl $0x20, %r8d
cmpl $0x61, %r8d
jne 0x5d37
xorl %r9d, %r9d
cmpb $0x0, 0x1(%rdx)
setne %r9b
jmp 0x5d3d
movl $0x1, %r9d
orl %r9d, %esi
movl %esi, (%rax)
movb (%rdi), %r8b
addq $0x2, %rdi
testb %r8b, %r8b
jne 0x5d07
leaq 0x856e(%rip), %rax      # 0xe2c3
movb $0x1, %cl
movb %cl, (%rax)
leaq 0x8561(%rip), %rbx      # 0xe2c1
movb %cl, (%rbx)
leaq 0x8083(%rip), %rax      # 0xddec
movl $0x1, (%rax)
leaq 0x854a(%rip), %rax      # 0xe2c0
movb %cl, (%rax)
callq 0x5e1f
leaq 0x843c(%rip), %rcx      # 0xe1c0
movb %al, (%rcx)
movsbq (%rbx), %rcx
testq %rcx, %rcx
je 0x5dc7
leaq 0x7a7a(%rip), %rdx      # 0xd810
addq %rcx, (%rdx)
movzbl %al, %eax
leaq 0x739d(%rip), %rcx      # 0xd140
movsbl (%rax,%rcx), %eax
leaq 0x7b0a(%rip), %rcx      # 0xd8b8
cmpl %eax, (%rcx)
jge 0x5dc7
leaq 0x8037(%rip), %rax      # 0xddf0
movb $0x49, (%rax)
movl $0x49, %edi
popq %rbx
jmp 0x1ec8
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/opcode.c
// Function: searchstr
int searchstr(char *str, char *key, int size) {
	int i, j, k;
	for (i = j = 0; str[i]; i += size, j++) {
		for (k = 0; k < size && str[i + k] == key[k]; k++)
			;
		if (k == size) return (j);
	}
	return (-1);
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpb $0x0, (%rdi)
je 0x5e1e
pushq %rbp
pushq %rbx
movslq %edx, %rcx
movl %ecx, %r8d
xorl %r9d, %r9d
movq %rdi, %r11
xorl %r10d, %r10d
movl $0x0, %ebx
testl %edx, %edx
jle 0x5e03
xorl %ebx, %ebx
movb (%r11,%rbx), %bpl
cmpb (%rsi,%rbx), %bpl
jne 0x5e03
incq %rbx
cmpq %rbx, %r8
jne 0x5def
jmp 0x5e19
cmpl %edx, %ebx
je 0x5e19
addq %rcx, %r9
incl %r10d
addq %rcx, %r11
cmpb $0x0, (%rdi,%r9)
jne 0x5de4
jmp 0x5e1c
movl %r10d, %eax
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/outline.c
// Function: outhex
void outhex(unsigned int addr, char data) {
	if (!binptr) {
		sprintf(binbuf, ";00%04X", binadr = addr);
		chksum = addr >> 8 & 255;
		chksum += addr & 255;
		binptr = 5;
	}
	if (addr == binadr && binptr < 37) {
		sprintf(&binbuf[binptr += 2], "%02X", data & 255);
		chksum += data & 255;
		binadr++;
	} else {
		int i = (binptr - 5) / 2;
		chksum += i;
		if (i > 15) {
			binbuf[1] = '1';
			i &= 15;
		}
		binbuf[2] = i + (i > 9 ? '7' : '0');
		sprintf(&binbuf[binptr += 2], "%04X\0", chksum);
		fprintf(file_obj, "%s\n", binbuf);
		binlin++;
		binptr = 0;
		outhex(addr, data);
	}
	binadr = addr + 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movl %edi, %ebx
leaq 0x5d4f(%rip), %r15      # 0xd800
movl (%r15), %eax
testl %eax, %eax
jne 0x7af6
leaq 0x5d45(%rip), %rax      # 0xd804
movl %ebx, (%rax)
leaq 0x61c8(%rip), %rdi      # 0xdc90
leaq 0x3127(%rip), %rsi      # 0xabf6
movl %ebx, %edx
xorl %eax, %eax
callq 0x11f0
movl %ebx, %eax
shrl $0x8, %eax
movl $0xff, %ecx
andl %ecx, %eax
andl %ebx, %ecx
addl %eax, %ecx
leaq 0x5d0d(%rip), %rax      # 0xd7fc
movl %ecx, (%rax)
movl $0x5, %eax
leaq 0x5d07(%rip), %r12      # 0xd804
cmpl $0x24, %eax
jg 0x7b41
cmpl %ebx, (%r12)
jne 0x7b41
leal 0x2(%rax), %ecx
movl %ecx, (%r15)
cltq
leaq 0x6179(%rip), %rcx      # 0xdc90
leaq (%rax,%rcx), %rdi
addq $0x2, %rdi
movzbl %bpl, %ebp
leaq 0x306e(%rip), %rsi      # 0xab98
movl %ebp, %edx
xorl %eax, %eax
callq 0x11f0
leaq 0x5cc2(%rip), %rax      # 0xd7fc
addl %ebp, (%rax)
jmp 0x7bd9
leal -0x5(%rax), %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
addl $-0x5, %ecx
sarl %ecx
leaq 0x5ca7(%rip), %rsi      # 0xd7fc
movl (%rsi), %edx
addl %ecx, %edx
movl %edx, (%rsi)
cmpl $0x25, %eax
jl 0x7b6e
leaq 0x6129(%rip), %rsi      # 0xdc90
movb $0x31, 0x1(%rsi)
andl $0xf, %ecx
leal 0x30(%rcx), %esi
leal 0x37(%rcx), %edi
cmpl $0xa, %ecx
cmovll %esi, %edi
leaq 0x610f(%rip), %r14      # 0xdc90
movb %dil, 0x2(%r14)
leal 0x2(%rax), %ecx
movl %ecx, (%r15)
cltq
leaq (%r14,%rax), %rdi
addq $0x2, %rdi
leaq 0x3062(%rip), %rsi      # 0xabfe
xorl %eax, %eax
callq 0x11f0
leaq 0x5c7e(%rip), %rax      # 0xd828
movq (%rax), %rdi
leaq 0x28fd(%rip), %rsi      # 0xa4b1
movq %r14, %rdx
xorl %eax, %eax
callq 0x1140
leaq 0x5c43(%rip), %rax      # 0xd808
incl (%rax)
movl $0x0, (%r15)
movsbl %bpl, %esi
movl %ebx, %edi
callq 0x7a9e
incl %ebx
movl %ebx, (%r12)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/outline.c
// Function: outline
void outline(char addr, char data, char *d, char equ, char known) {
	int i;
	linenum++;
	outline1(file_tmp, addr, data, d, equ, known);
	if (prnerrcon && *error_field != ' ' && pass == 2) {
		outline1(stdout, addr, data, d, equ, known);
		errcount--;
	}
	print = error = 0;
	dbyt = byte = word = FALSE;
	spechar = ' ';
	if (!equ) codebytes += data;
	if (emitobj && pass == 2 && !equ)
		for (i = 0; i < data; i++)
			outhex((unsigned int)(old_loc + i), d[i]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r15d
movl %ecx, %r14d
movq %rdx, %rbx
leaq 0x5f75(%rip), %rax      # 0xdb78
incl (%rax)
movl %esi, %ebp
movl %edi, %r12d
leaq 0x5b37(%rip), %rax      # 0xd748
movq (%rax), %rdi
movl %r12d, %esi
movl %ebp, %edx
movq %rbx, %rcx
movl %r14d, %r8d
movl %r15d, %r9d
callq 0x766b
leaq 0x5bca(%rip), %rax      # 0xd7f8
cmpl $0x0, (%rax)
leaq 0x5bbc(%rip), %r13      # 0xd7f4
je 0x7c78
leaq 0x602f(%rip), %rax      # 0xdc70
cmpb $0x20, (%rax)
je 0x7c78
cmpl $0x2, (%r13)
jne 0x7c78
movq 0x537c(%rip), %rax      # 0xcfd0
movq (%rax), %rdi
movsbl %r12b, %esi
movsbl %bpl, %edx
movsbl %r14b, %r8d
movsbl %r15b, %r9d
movq %rbx, %rcx
callq 0x766b
leaq 0x5ba2(%rip), %rax      # 0xd818
decl (%rax)
leaq 0x6171(%rip), %rax      # 0xddf0
movb $0x0, (%rax)
leaq 0x6163(%rip), %rax      # 0xddec
xorl %ecx, %ecx
movl %ecx, (%rax)
leaq 0x5e08(%rip), %rax      # 0xda9c
movl %ecx, (%rax)
leaq 0x5dfb(%rip), %rax      # 0xda98
movl %ecx, (%rax)
leaq 0x5dfa(%rip), %rax      # 0xdaa0
movl %ecx, (%rax)
leaq 0x5f67(%rip), %rax      # 0xdc16
movb $0x20, (%rax)
testb %r14b, %r14b
jne 0x7d0d
movsbq %bpl, %rax
leaq 0x5b26(%rip), %rcx      # 0xd7e8
addq %rax, (%rcx)
leaq 0x5b54(%rip), %rax      # 0xd820
cmpl $0x0, (%rax)
sete %al
cmpl $0x2, (%r13)
setne %cl
orb %al, %cl
testb %bpl, %bpl
setle %al
orb %cl, %al
jne 0x7d0d
movzbl %bpl, %r14d
xorl %r15d, %r15d
leaq 0x60dc(%rip), %r12      # 0xddd0
movl (%r12), %edi
addl %r15d, %edi
movsbl (%rbx,%r15), %esi
callq 0x7a9e
incq %r15
cmpq %r15, %r14
jne 0x7cf4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/pass1.c
// Function: good_symbol
int good_symbol(char *p) {
	int i = 1;
	if (isalpha(*p) || *p == '.' || *p == '_') /* global symbol */
		for (; i < 32 && p[i]; i++)
			if (!isalpha(p[i]) && !isdigit(p[i]) && p[i] != '.' &&
			    p[i] != '_' & p[i] != '$') {
				display_error(error = 'C');
				return (0);
			}
	return (1);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x1230
movq (%rax), %rcx
movsbq (%rbx), %rax
movzwl (%rcx,%rax,2), %edx
btl $0xa, %edx
jb 0x7d48
movzbl %al, %edx
cmpl $0x5f, %edx
je 0x7d48
movl $0x1, %eax
cmpl $0x2e, %edx
jne 0x7d9e
movl $0x1, %edx
movl $0x1, %eax
movsbq (%rbx,%rdx), %rsi
testq %rsi, %rsi
je 0x7d9e
cmpb $0x2e, %sil
je 0x7d7d
movzwl (%rcx,%rsi,2), %edi
andl $0xc00, %edi            # imm = 0xC00
jne 0x7d7d
cmpb $0x24, %sil
je 0x7d7d
movzbl %sil, %esi
cmpl $0x5f, %esi
jne 0x7d88
incq %rdx
cmpq $0x20, %rdx
jne 0x7d52
jmp 0x7d9e
leaq 0x6061(%rip), %rax      # 0xddf0
movb $0x43, (%rax)
movl $0x43, %edi
callq 0x1ec8
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/pass1.c
// Function: good_label
int good_label(char *p) {
	int i;

	if (!*p) return (1); /* empty labels are okay */
	if (isdigit(*p)) {   /* must be a local symbol */
		for (i = error = 0; isdigit(*p) && *p; p++)
			i = i * 10 + *p - '0';
		if (*p++ != '$') display_error(error = 'F');
		if (*p) display_error(error = 'F');
		if (i > 255 || i < 1) display_error(error = 'F');
		return (!error);
	}
	return (good_symbol(p));
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movsbq (%rdi), %r14
testq %r14, %r14
je 0x7dcc
movq %rdi, %rbx
callq 0x1230
movq (%rax), %rcx
testb $0x8, 0x1(%rcx,%r14,2)
jne 0x7dd6
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x7d1c
movl $0x1, %eax
jmp 0x7e76
leaq 0x6013(%rip), %r14      # 0xddf0
movb $0x0, (%r14)
movsbq (%rbx), %rcx
movb $0x1, %bpl
testq %rcx, %rcx
je 0x7e33
movq (%rax), %rax
movzwl (%rax,%rcx,2), %edx
andl $0x800, %edx            # imm = 0x800
je 0x7e33
xorl %edx, %edx
movsbl %cl, %ecx
leal (%rdx,%rdx,4), %edx
leal (%rcx,%rdx,2), %edx
addl $-0x30, %edx
movsbq 0x1(%rbx), %rcx
incq %rbx
testq %rcx, %rcx
je 0x7e23
movzwl (%rax,%rcx,2), %esi
andl $0x800, %esi            # imm = 0x800
jne 0x7dfe
addl $0xffffff00, %edx       # imm = 0xFFFFFF00
cmpl $0xffffff01, %edx       # imm = 0xFFFFFF01
setb %bpl
cmpb $0x24, %cl
je 0x7e46
movb $0x46, (%r14)
movl $0x46, %edi
callq 0x1ec8
cmpb $0x0, 0x1(%rbx)
je 0x7e5a
movb $0x46, (%r14)
movl $0x46, %edi
callq 0x1ec8
testb %bpl, %bpl
je 0x7e6d
movb $0x46, (%r14)
movl $0x46, %edi
callq 0x1ec8
xorl %eax, %eax
cmpb $0x0, (%r14)
sete %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/pass1.c
// Function: get_label
void get_label(char *p, int endlocal) {
	if (!*p || isspace(*p)) return; /* no label */
	addr = TRUE;
	if (isdigit(*p)) { /* must be a local symbol */
		int i;
		char s[32];
		for (i = 0; isdigit(*p) && *p; p++) i = i * 10 + *p - '0';
		makelocal(i, s);
		insert_symbol(s, loc_cntr, 1, 1, 1);
	} else {
		insert_symbol(p, loc_cntr, 1, 1, 0);
		if (endlocal) clear_local();
	}
	ptr->label = TRUE;
	if (ptr->multiple) display_error(error = 'M');
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movsbq (%rdi), %r14
testq %r14, %r14
je 0x7f81
movl %esi, %ebp
movq %rdi, %rbx
callq 0x1230
movq (%rax), %rcx
testb $0x20, 0x1(%rcx,%r14,2)
jne 0x7f81
leaq 0x6410(%rip), %rcx      # 0xe2c0
movb $0x1, (%rcx)
movq (%rax), %rax
movsbq (%rbx), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x7eed
leaq 0x5948(%rip), %rax      # 0xd810
movq (%rax), %rsi
movq %rbx, %rdi
movl $0x1, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x8b70
testl %ebp, %ebp
je 0x7f4e
xorl %eax, %eax
callq 0x915a
jmp 0x7f4e
testb %cl, %cl
je 0x7f1f
incq %rbx
xorl %edi, %edi
movsbl %cl, %ecx
leal (%rdi,%rdi,4), %edx
leal (%rcx,%rdx,2), %edi
addl $-0x30, %edi
movsbq (%rbx), %rcx
testq %rcx, %rcx
je 0x7f21
movzwl (%rax,%rcx,2), %edx
andl $0x800, %edx            # imm = 0x800
incq %rbx
testw %dx, %dx
jne 0x7ef6
jmp 0x7f21
xorl %edi, %edi
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x8b21
leaq 0x58dd(%rip), %rax      # 0xd810
movq (%rax), %rsi
movq %rbx, %rdi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x8b70
leaq 0x5ceb(%rip), %rax      # 0xdc40
movq (%rax), %rax
movzwl 0x20(%rax), %ecx
movl %ecx, %edx
orl $0x200, %edx            # imm = 0x200
movw %dx, 0x20(%rax)
testb $0x8, %cl
je 0x7f81
leaq 0x5e7c(%rip), %rax      # 0xddf0
movb $0x4d, (%rax)
movl $0x4d, %edi
callq 0x1ec8
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/symbol.c
// Function: allocsym
char *allocsym(int symlen) {
	/* returns a pointer for use as a symbol table entry */

	int symptr = symbol_ptr;
	symbol_ptr += sizeof(struct smbl) - 31 + symlen;
	if (symbol_ptr >= SYMBLKSZ) {
		symbol_buf = (char *)calloc(SYMBLKSZ, 1);
		if (!symbol_buf)
			error_msg("Available memory exceeded storing symbol",
			          "", 4);
		symptr = 0;
		symbol_ptr = sizeof(struct smbl) - 31 + symlen;
		symblk++;
	}
	return (symbol_buf + symptr);
}

// Assembly:
pushq %rbx
movl %edi, %ebx
movl 0x4f2b(%rip), %eax      # 0xd69c
leal (%rax,%rbx), %ecx
addl $0x29, %ecx
movl %ecx, 0x4f1f(%rip)      # 0xd69c
cmpl $0x1000, %ecx           # imm = 0x1000
jl 0x87c9
addl $0x29, %ebx
movl $0x1000, %edi           # imm = 0x1000
movl $0x1, %esi
callq 0x1120
movq %rax, 0x5d2a(%rip)      # 0xe4c8
testq %rax, %rax
jne 0x87bb
leaq 0x24c6(%rip), %rdi      # 0xac70
leaq 0x2386(%rip), %rsi      # 0xab37
movl $0x4, %edx
callq 0x1e8b
movl %ebx, 0x4edb(%rip)      # 0xd69c
incl 0x4ed1(%rip)            # 0xd698
xorl %eax, %eax
cltq
addq 0x5cf6(%rip), %rax      # 0xe4c8
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/symbol.c
// Function: addref
void addref(struct xrfr **xref, int def) {
	struct xrfr *new;
	if (pass > 1) return;
	if (--xrefcnt <= 0) {
		xrefcnt = XREFALLOC;
		if (!(xrefheap = (struct xrfr *)calloc(XREFALLOC,
		                                       sizeof(struct xrfr))))
			error_msg("Available memory exceeded adding reference",
			          "", 4);
	}
	new = xrefheap++;        /* pointer to memory to be used for xref */
	new->linenumb = linenum; /* line number of reference */
	new->def = def;          /* is symbol defined on this line? */
	new->wrt = wrt;          /* is it a write operation to this symbol? */
	new->known = ptr->known; /* is symbol defined at this point? */
	new->next = *xref;       /* pointer to next reference */
	*xref = new;             /* add the reference to the list */
}

// Assembly:
leaq 0x4d9f(%rip), %rax      # 0xd7f4
cmpl $0x1, (%rax)
jg 0x8b20
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movl 0x5a54(%rip), %eax      # 0xe4c0
leal -0x1(%rax), %ecx
movl %ecx, 0x5a4b(%rip)      # 0xe4c0
cmpl $0x1, %eax
jg 0x8ab7
movl $0x200, 0x5a3c(%rip)    # imm = 0x200
movl $0x200, %edi            # imm = 0x200
movl $0x10, %esi
callq 0x1120
movq %rax, 0x5bae(%rip)      # 0xe648
testq %rax, %rax
jne 0x8ab7
leaq 0x21f3(%rip), %rdi      # 0xac99
leaq 0x208a(%rip), %rsi      # 0xab37
movl $0x4, %edx
callq 0x1e8b
movq 0x5b8a(%rip), %rax      # 0xe648
leaq 0x10(%rax), %rcx
movq %rcx, 0x5b7f(%rip)      # 0xe648
leaq 0x50a8(%rip), %rcx      # 0xdb78
movl (%rcx), %ecx
movl %ecx, 0xc(%rax)
movb 0x8(%rax), %cl
andb $0x1, %bpl
andb $-0x4, %cl
orb %bpl, %cl
leaq 0x52f3(%rip), %rdx      # 0xdddc
movb (%rdx), %dl
addb %dl, %dl
andb $0x2, %dl
orb %cl, %dl
movb %dl, 0x8(%rax)
leaq 0x5144(%rip), %rcx      # 0xdc40
movq (%rcx), %rcx
movzwl 0x20(%rcx), %ecx
shrl $0x6, %ecx
andb $0x4, %cl
andb $-0x5, %dl
orb %cl, %dl
movb %dl, 0x8(%rax)
movq (%rbx), %rcx
movq %rcx, (%rax)
movq %rax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/symbol.c
// Function: find_symbol
struct smbl *find_symbol(char *sym) { /* find the address of a symbol's entry */
	struct smbl *pntr;
	int i;
	pntr = root_symtab;
	while (pntr)                             /* while not a terminal node */
		if ((i = strcmp(pntr->name, sym))) /* if symbol name not equal */
			pntr = pntr->link[i <
			                  0]; /* try the appropriate sub-node */
		else
			return (pntr); /* found the symbol in table */
	return (NULL);                 /* symbol not found */
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x4c74(%rip), %rax      # 0xdab0
movq (%rax), %rbx
testq %rbx, %rbx
je 0x8e63
movq %rdi, %r14
leaq 0x22(%rbx), %rdi
movq %r14, %rsi
callq 0x1130
testl %eax, %eax
je 0x8e65
shrl $0x1f, %eax
movq (%rbx,%rax,8), %rbx
testq %rbx, %rbx
jne 0x8e47
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/symbol.c
// Function: output_symbol
void output_symbol(struct smbl *pntr) {
	char c;
	symknt++;
	if (pntr->link[0]) output_symbol(pntr->link[0]);
	if (pntr->name[0] == '-')
		locknt++;
	else {
		c = ' ';
		if (pntr->equate) c = '=';   /* equated symbol */
		if (pntr->multiple) c = 'M'; /* multiply defined symbol */
		if (!pntr->defined) c = '?'; /* undefined symbol */
		if (pntr->section) c = 'S';  /* program section name */
		fprintf(file_lst, "\n%c %04lX %-31s ", c, pntr->value & 0xffffL,
		        pntr->name);
		if (prnxref) prnref(pntr->xref);
	}
	if (pntr->link[1]) output_symbol(pntr->link[1]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x1dc7(%rip), %xmm0     # 0xac50
punpcklwd %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3]
movdqa %xmm0, (%rsp)
movl $0x3f, %r15d
leaq 0x4bf1(%rip), %r12      # 0xda90
movl $0x53, %r13d
leaq 0x1e18(%rip), %r14      # 0xacc4
leaq 0x4aa9(%rip), %rbp      # 0xd95c
incl 0x5797(%rip)            # 0xe650
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x8ec6
callq 0x8e70
cmpb $0x2d, 0x22(%rbx)
jne 0x8ed4
incl 0x5782(%rip)            # 0xe654
jmp 0x8f3b
movd 0x20(%rbx), %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
punpcklwd %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3]
pand (%rsp), %xmm0
pcmpeqw 0x1d71(%rip), %xmm0     # 0xac60
movmskps %xmm0, %eax
movl $0x20, %edx
testb $0x8, %al
jne 0x8f00
movl $0x3d, %edx
leaq 0x22(%rbx), %r8
testb $0x4, %al
movl $0x4d, %ecx
cmovel %ecx, %edx
testb $0x2, %al
cmovnel %r15d, %edx
movq (%r12), %rdi
testb $0x1, %al
cmovel %r13d, %edx
movzwl 0x18(%rbx), %ecx
movq %r14, %rsi
xorl %eax, %eax
callq 0x1140
cmpl $0x0, (%rbp)
je 0x8f3b
movq 0x10(%rbx), %rdi
callq 0x8f57
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0x8eb3
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/symbol.c
// Function: prnref
void prnref(struct xrfr *tmp) {
	int i = 0;
	char c;
	while (tmp) {
		c = ' '; /* nothing interesting about this reference */
		if (tmp->def)
			c = '#'; /* symbol defined on this line */
		else if (tmp->wrt)
			c = '$'; /* symbol is operand of write instruction */
		else if (!tmp->known)
			c = '?'; /* symbol is undefined here */
		fprintf(file_lst, "%6d%c", tmp->linenumb, c);
		tmp = tmp->next;
		refknt++;
		i++;
		if (i > (wide ? 12 : 4)) {
			i = 0;
			fprintf(file_lst, "\n       %31s ", " ");
		}
	}
}

// Assembly:
testq %rdi, %rdi
je 0x9010
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x4b1b(%rip), %r13      # 0xda90
leaq 0x1e43(%rip), %r14      # 0xadbf
leaq 0x49e1(%rip), %rbp      # 0xd964
leaq 0x1100(%rip), %r12      # 0xa08a
xorl %r15d, %r15d
movb 0x8(%rbx), %al
movl $0x23, %ecx
testb $0x1, %al
jne 0x8fb1
movl $0x24, %ecx
testb $0x2, %al
jne 0x8fb1
testb $0x4, %al
movl $0x20, %ecx
movl $0x3f, %eax
cmovel %eax, %ecx
movq (%r13), %rdi
movl 0xc(%rbx), %edx
movq %r14, %rsi
xorl %eax, %eax
callq 0x1140
movq (%rbx), %rbx
incl 0x568d(%rip)            # 0xe658
xorl %eax, %eax
cmpl $0x0, (%rbp)
setne %al
leal 0x4(,%rax,8), %eax
cmpl %eax, %r15d
jge 0x8fe5
incl %r15d
jmp 0x8ffd
movq (%r13), %rdi
xorl %r15d, %r15d
leaq 0x1dd2(%rip), %rsi      # 0xadc5
movq %r12, %rdx
xorl %eax, %eax
callq 0x1140
testq %rbx, %rbx
jne 0x8f8d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/symbol.c
// Function: list_sym
void list_sym() {
	refknt = locknt = symknt = 0;
	fprintf(file_lst, "\nErrors detected in %d line", errcount);
	if (errcount != 1) fprintf(file_lst, "s");
	fprintf(file_lst, ".\n\f\n");
	fprintf(file_lst, " value name                            ");
	if (prnxref) fprintf(file_lst, "cross reference");
	fprintf(file_lst, "\n");
	if (root_symtab) output_symbol(root_symtab);
	fprintf(file_lst,
	        "\n\nMemory used to store %d local symbols: %d. bytes.", locknt,
	        26 * locknt);
	fprintf(file_lst,
	        "\n\nMemory used to store %d permanent symbols: %d. bytes.",
	        symknt - locknt, SYMBLKSZ * symblk + symbol_ptr - locknt * 26);
	if (!prnxref) return;
	fprintf(file_lst,
	        "\n\nMemory used for cross reference table: %ld. bytes.",
	        (long)refknt * (long)sizeof(struct xrfr));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
xorl %eax, %eax
movl %eax, 0x5633(%rip)      # 0xe650
movl %eax, 0x5631(%rip)      # 0xe654
movl %eax, 0x562f(%rip)      # 0xe658
leaq 0x4a60(%rip), %rbx      # 0xda90
movq (%rbx), %rdi
leaq 0x47de(%rip), %r14      # 0xd818
movl (%r14), %edx
leaq 0x1c91(%rip), %rsi      # 0xacd5
xorl %eax, %eax
callq 0x1140
cmpl $0x1, (%r14)
je 0x905e
movq (%rbx), %rsi
movl $0x73, %edi
callq 0x1110
movq (%rbx), %rcx
leaq 0x1c89(%rip), %rdi      # 0xacf1
movl $0x4, %esi
movl $0x1, %edx
callq 0x1210
movq (%rbx), %rcx
leaq 0x1c75(%rip), %rdi      # 0xacf6
movl $0x27, %esi
movl $0x1, %edx
callq 0x1210
leaq 0x48c5(%rip), %r14      # 0xd95c
cmpl $0x0, (%r14)
je 0x90b6
movq (%rbx), %rcx
leaq 0x1888(%rip), %rdi      # 0xa92f
movl $0xf, %esi
movl $0x1, %edx
callq 0x1210
movq (%rbx), %rsi
movl $0xa, %edi
callq 0x1110
leaq 0x49e6(%rip), %rax      # 0xdab0
movq (%rax), %rdi
testq %rdi, %rdi
je 0x90d7
callq 0x8e70
movq (%rbx), %rdi
movl 0x5574(%rip), %edx      # 0xe654
leal (%rdx,%rdx,4), %eax
leal (%rax,%rax,4), %ecx
addl %edx, %ecx
leaq 0x1c2f(%rip), %rsi      # 0xad1e
xorl %eax, %eax
callq 0x1140
movq (%rbx), %rdi
movl 0x5551(%rip), %edx      # 0xe650
movl 0x554f(%rip), %eax      # 0xe654
subl %eax, %edx
movl 0x458b(%rip), %esi      # 0xd698
shll $0xc, %esi
imull $-0x1a, %eax, %ecx
addl 0x4583(%rip), %ecx      # 0xd69c
addl %esi, %ecx
leaq 0x1c30(%rip), %rsi      # 0xad52
xorl %eax, %eax
callq 0x1140
cmpl $0x0, (%r14)
je 0x9152
movq (%rbx), %rdi
movslq 0x551f(%rip), %rdx      # 0xe658
shlq $0x4, %rdx
leaq 0x1c46(%rip), %rsi      # 0xad8a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1140
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/symbol.c
// Function: clear_local
void clear_local() { /* increment the local symbol block number */
	int i;
	for (i = 0; i < 4; i++) {
		if (++lbn[i] <= 'Z') return;
		lbn[i] = 'A';
	}
}

// Assembly:
xorl %eax, %eax
leaq 0x46b9(%rip), %rcx      # 0xd81c
movb (%rcx,%rax), %dl
incb %dl
movb %dl, (%rcx,%rax)
cmpb $0x5b, %dl
jl 0x917d
movb $0x41, (%rcx,%rax)
incq %rax
cmpq $0x4, %rax
jne 0x9163
retq
// File: /workspace/github_c_makefile_star2_O3/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_2/exercise_2_05/any.c
// Function: main
int main(void)
{
  char str1[MAXSTR] = "xxxabcabc";
  char str2[MAXSTR] = "cbaa";

  printf("%d", any(str1, str2));

  return 0;
}

// Assembly:
pushq %rbx
subq $0x3f0, %rsp            # imm = 0x3F0
movq %rsp, %rdi
xorl %ebx, %ebx
movl $0x3e8, %edx            # imm = 0x3E8
xorl %esi, %esi
callq 0x1040
leaq 0x1(%rsp), %rax
movw $0x6162, (%rax)         # imm = 0x6162
movb $0x61, 0x2(%rax)
movb $0x78, %cl
leaq 0xe94(%rip), %rdx       # 0x2010
movb $0x63, %dil
movq %rax, %rsi
cmpb %dil, %cl
je 0x11a4
movb (%rsi), %dil
incq %rsi
testb %dil, %dil
jne 0x1182
movb 0x1(%rbx,%rdx), %cl
incq %rbx
cmpq $0x9, %rbx
jne 0x117c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
leaq 0x124d(%rip), %rdi      # 0x23f8
movl %ebx, %esi
xorl %eax, %eax
callq 0x1030
xorl %eax, %eax
addq $0x3f0, %rsp            # imm = 0x3F0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_2/exercise_2_05/any.c
// Function: any
int any(char str1[], char str2[])
{
  int i, j;
  for (i = 0; str1[i] != '\0'; ++i)
  {
    for (j = 0; str2[j] != '\0'; ++j)
    {
      if (str1[i] == str2[j])
      {
        return i;
      }
    }
  }

  return -1;
}

// Assembly:
movb (%rdi), %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb %cl, %cl
je 0x11f8
movb (%rsi), %dl
incq %rsi
xorl %r8d, %r8d
movq %rsi, %r9
movl %edx, %r10d
testb %dl, %dl
je 0x11ec
cmpb %r10b, %cl
je 0x11f9
movb (%r9), %r10b
incq %r9
testb %r10b, %r10b
jne 0x11dc
movb 0x1(%rdi,%r8), %cl
incq %r8
testb %cl, %cl
jne 0x11d2
retq
movl %r8d, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/xtanitfy[P]Murphy/test/test_log.c
// Function: main
int main(int argc,char **argv)
{
	if (argc != 3) {
		help();
		return -1;
	}
	LOG_compBinFile(argv[1],argv[2],28*28*500*sizeof(float));
	
	
	return 0;
}

// Assembly:
pushq %rax
cmpl $0x3, %edi
jne 0x1222
movq 0x8(%rsi), %rdi
movq 0x10(%rsi), %rsi
movl $0x17ed00, %edx         # imm = 0x17ED00
callq 0x1766
xorl %eax, %eax
jmp 0x123f
leaq 0x1ddb(%rip), %rdi      # 0x3004
callq 0x10d0
leaq 0x1ddd(%rip), %rdi      # 0x3012
callq 0x10d0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rcx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/xtanitfy[P]Murphy/src/log.c
// Function: LOG_writeBlobToBinFile
int LOG_writeBlobToBinFile(char *binFile,BLOB_s *pBlob)
{
	int fd = open(binFile,O_RDWR | O_CREAT,0666);
	CHECK_EXPR_RET(fd < 0,-1);

	BLOB_DATA_TYPE *pData = BLOB_data(pBlob);

	int writeSize = sizeof(BLOB_DATA_TYPE)*pBlob->count;
	int nwrite = write(fd,&pData[0],writeSize);
	CHECK_EXPR_RET(nwrite != writeSize,-1);

	close(fd);

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movl $0x42, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x1080
testl %eax, %eax
js 0x171c
movl %eax, %ebx
movq %r14, %rdi
callq 0x1fb4
movl 0x30(%r14), %ecx
shll $0x3, %ecx
movslq %ecx, %r14
movl %ebx, %edi
movq %rax, %rsi
movq %r14, %rdx
callq 0x1050
cmpl %eax, %r14d
jne 0x1738
movl %ebx, %edi
callq 0x10e0
xorl %eax, %eax
jmp 0x175e
leaq 0x191d(%rip), %rdi      # 0x3040
leaq 0x192c(%rip), %rsi      # 0x3056
leaq 0x195b(%rip), %rdx      # 0x308c
movl $0x57, %ecx
jmp 0x1752
leaq 0x1901(%rip), %rdi      # 0x3040
leaq 0x1910(%rip), %rsi      # 0x3056
leaq 0x193f(%rip), %rdx      # 0x308c
movl $0x5d, %ecx
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/xtanitfy[P]Murphy/src/blob.c
// Function: BLOB_create
int BLOB_create(BLOB_s **pBlob,
						unsigned long numSize,
						unsigned long channelSize, 
						unsigned long heightSize,
						unsigned long widthSize,
						BOOL bShape)
{
	unsigned long counts = 0;
	CHECK_EXPR_RET(numSize <= 0,-1);
	CHECK_EXPR_RET(channelSize <= 0,-1);
	CHECK_EXPR_RET(heightSize <= 0,-1);
	CHECK_EXPR_RET(widthSize <= 0,-1);

	CHECK_EXPR_RET(pBlob == NULL,-1);

	*pBlob = (BLOB_s *)malloc(sizeof(BLOB_s));
	CHECK_EXPR_RET(*pBlob == NULL,-1);

	(*pBlob)->numSize = numSize;
	(*pBlob)->widthSize = widthSize;
	(*pBlob)->heightSize = heightSize;
	(*pBlob)->channelSize = channelSize;
	
	counts = (*pBlob)->numSize * (*pBlob)->channelSize *\
				(*pBlob)->heightSize * (*pBlob)->widthSize;
	
	(*pBlob)->pady = 0;
	(*pBlob)->padx = 0;
	(*pBlob)->count = counts;
	if (bShape == TRUE) {
		BLOB_shape(*pBlob);
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x19f9
movq %rdx, %r15
testq %rdx, %rdx
je 0x1a18
movq %rcx, %r14
testq %rcx, %rcx
je 0x1a34
movq %r8, %r12
testq %r8, %r8
je 0x1a50
movq %rdi, %rbp
testq %rdi, %rdi
je 0x1a6c
movl %r9d, %ebx
movq %rsi, %r13
movl $0x40, %edi
callq 0x10a0
movq %rax, (%rbp)
testq %rax, %rax
je 0x1a88
movq %r13, 0x10(%rax)
movq %r12, 0x28(%rax)
movq %r14, 0x20(%rax)
movq %r15, 0x18(%rax)
imulq %r13, %r15
imulq %r12, %r14
imulq %r15, %r14
movq $0x0, 0x38(%rax)
movq %r14, 0x30(%rax)
xorl %ebp, %ebp
cmpb $0x1, %bl
jne 0x1aae
movq %rax, %rdi
callq 0x1abf
jmp 0x1aae
leaq 0x1640(%rip), %rdi      # 0x3040
leaq 0x16f6(%rip), %rsi      # 0x30fd
leaq 0x16f6(%rip), %rdx      # 0x3104
movl $0xc, %ecx
jmp 0x1aa2
leaq 0x1621(%rip), %rdi      # 0x3040
leaq 0x16d7(%rip), %rsi      # 0x30fd
leaq 0x16d7(%rip), %rdx      # 0x3104
movl $0xd, %ecx
jmp 0x1aa2
leaq 0x1605(%rip), %rdi      # 0x3040
leaq 0x16bb(%rip), %rsi      # 0x30fd
leaq 0x16bb(%rip), %rdx      # 0x3104
movl $0xe, %ecx
jmp 0x1aa2
leaq 0x15e9(%rip), %rdi      # 0x3040
leaq 0x169f(%rip), %rsi      # 0x30fd
leaq 0x169f(%rip), %rdx      # 0x3104
movl $0xf, %ecx
jmp 0x1aa2
leaq 0x15cd(%rip), %rdi      # 0x3040
leaq 0x1683(%rip), %rsi      # 0x30fd
leaq 0x1683(%rip), %rdx      # 0x3104
movl $0x11, %ecx
jmp 0x1aa2
leaq 0x15b1(%rip), %rdi      # 0x3040
leaq 0x1667(%rip), %rsi      # 0x30fd
leaq 0x1667(%rip), %rdx      # 0x3104
movl $0x14, %ecx
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xtanitfy[P]Murphy/src/blob.c
// Function: BLOB_createAddPad
int BLOB_createAddPad(BLOB_s **pBlob,
						unsigned long numSize,
						unsigned long channelSize, 
						unsigned long heightSize,
						unsigned long widthSize,
						BOOL bShape,int pady,int padx)
{
	int ret = BLOB_create(pBlob,numSize,channelSize,heightSize+pady*2,widthSize+padx*2,bShape);
	CHECK_EXPR_RET(ret != 0,-1);

	BLOB_s *blob = *pBlob;
	blob->pady = pady;
	blob->padx = padx;

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl 0x28(%rsp), %r14d
movl 0x20(%rsp), %r15d
leal (%r15,%r15), %eax
cltq
addq %rax, %rcx
leal (%r14,%r14), %eax
cltq
addq %rax, %r8
callq 0x1958
testl %eax, %eax
je 0x1b5f
leaq 0x1502(%rip), %rdi      # 0x3040
leaq 0x15b8(%rip), %rsi      # 0x30fd
leaq 0x15c4(%rip), %rdx      # 0x3110
movl $0x30, %ecx
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1b6c
movq (%rbx), %rax
movl %r15d, 0x38(%rax)
movl %r14d, 0x3c(%rax)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/xtanitfy[P]Murphy/src/blob.c
// Function: BLOB_shapeAddPad
int BLOB_shapeAddPad(BLOB_s *pDataSrc,BLOB_s *pData,int pady,int padx)
{
	CHECK_EXPR_RET(pDataSrc == NULL,-1);
	CHECK_EXPR_RET(pData == NULL,-1);
	CHECK_EXPR_RET(pady > pDataSrc->heightSize,-1);
	CHECK_EXPR_RET(padx > pDataSrc->widthSize,-1);
	
	BLOB_DATA_PTR(pDataSrc,ptrDataSrc);
	BLOB_DATA_PTR(pData,ptrData);
	for (int i_num = 0;i_num < pData->numSize;i_num++) {	
		for (int i_channel = 0;i_channel  < pData->channelSize;i_channel++) {
			for (int i_height = 0;i_height < pData->heightSize - pady;i_height++) {	
				for (int i_width = 0;i_width < pData->widthSize - padx;i_width++) {	
					ptrData[i_num][i_channel][i_height + pady][i_width + padx] = 
						ptrDataSrc[i_num][i_channel][i_height][i_width];	
				
				}
			}
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
testq %rdi, %rdi
je 0x1cfc
testq %rsi, %rsi
je 0x1d03
movl %ecx, %eax
movq %rdi, %r10
movslq %edx, %rdx
movq 0x20(%rdi), %r8
movl $0x3d, %ecx
movq %rdx, 0x10(%rsp)
cmpq %rdx, %r8
jb 0x1d08
cltq
movq 0x28(%r10), %r9
movl $0x3e, %ecx
cmpq %rax, %r9
jb 0x1d08
movq 0x10(%rsi), %rcx
movq %rcx, 0x28(%rsp)
testq %rcx, %rcx
je 0x1cf8
movq %r8, %rdi
movq 0x8(%r10), %rcx
movq %rcx, 0x8(%rsp)
movq 0x18(%rsi), %r8
movq 0x28(%rsi), %rbx
movq 0x20(%rsi), %r11
movq %r11, %r15
movq 0x10(%rsp), %rdx
subq %rdx, %r15
movq %rbx, %r12
subq %rax, %r12
movq %rbx, %rcx
imulq %rdx, %rcx
leaq (,%rax,8), %rdx
leaq (%rdx,%rcx,8), %rcx
addq 0x8(%rsi), %rcx
movq %rcx, (%rsp)
movq %rbx, %rcx
movq %r11, 0x40(%rsp)
imulq %r11, %rcx
movq %rcx, %rdx
movq %r8, %rsi
imulq %r8, %rdx
shlq $0x3, %rdx
movq %rdx, 0x20(%rsp)
shlq $0x3, %rcx
movq %rcx, 0x38(%rsp)
leaq (,%rbx,8), %rcx
movq %rdi, %r11
imulq %r9, %r11
movq 0x18(%r10), %rdx
imulq %r11, %rdx
shlq $0x3, %rdx
movq %rdx, 0x18(%rsp)
shlq $0x3, %r11
shlq $0x3, %r9
xorl %edi, %edi
movq %rdi, 0x30(%rsp)
testq %rsi, %rsi
je 0x1cd2
movq 0x8(%rsp), %rbp
movq (%rsp), %rdx
xorl %edi, %edi
movq 0x40(%rsp), %r8
cmpq 0x10(%rsp), %r8
je 0x1cc2
movq %rbp, %r10
movq %rdx, %r13
xorl %r8d, %r8d
cmpq %rax, %rbx
je 0x1cb4
xorl %r14d, %r14d
movsd (%r10,%r14,8), %xmm0
movsd %xmm0, (%r13,%r14,8)
incq %r14
cmpq %r14, %r12
jne 0x1c9f
incq %r8
addq %rcx, %r13
addq %r9, %r10
cmpq %r15, %r8
jne 0x1c97
incq %rdi
addq 0x38(%rsp), %rdx
addq %r11, %rbp
cmpq %rsi, %rdi
jne 0x1c82
movq 0x30(%rsp), %rdi
incq %rdi
movq 0x20(%rsp), %rdx
addq %rdx, (%rsp)
movq 0x18(%rsp), %rdx
addq %rdx, 0x8(%rsp)
cmpq 0x28(%rsp), %rdi
jne 0x1c6d
xorl %eax, %eax
jmp 0x1d29
movl $0x3b, %ecx
jmp 0x1d08
movl $0x3c, %ecx
leaq 0x1331(%rip), %rdi      # 0x3040
leaq 0x13e7(%rip), %rsi      # 0x30fd
leaq 0x1405(%rip), %rdx      # 0x3122
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xtanitfy[P]Murphy/src/blob.c
// Function: BLOB_shapeLike
int BLOB_shapeLike(BLOB_s *pDataSrc,BLOB_s **pData)
{
	CHECK_EXPR_RET(pDataSrc == NULL,-1);
	CHECK_EXPR_RET(pData == NULL,-1);

	*pData = (BLOB_s *)malloc(sizeof(BLOB_s));
	CHECK_EXPR_RET(*pData == NULL,-1);

	memcpy(*pData,pDataSrc,sizeof(BLOB_s));
	
	BLOB_shape(*pData);
	
	return 0;	
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x1d88
movq %rsi, %r14
testq %rsi, %rsi
je 0x1da4
movq %rdi, %rbx
movl $0x40, %edi
callq 0x10a0
movq %rax, (%r14)
testq %rax, %rax
je 0x1dc0
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups 0x30(%rbx), %xmm3
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq %rax, %rdi
callq 0x1abf
xorl %eax, %eax
jmp 0x1de6
leaq 0x12b1(%rip), %rdi      # 0x3040
leaq 0x1367(%rip), %rsi      # 0x30fd
leaq 0x1396(%rip), %rdx      # 0x3133
movl $0x55, %ecx
jmp 0x1dda
leaq 0x1295(%rip), %rdi      # 0x3040
leaq 0x134b(%rip), %rsi      # 0x30fd
leaq 0x137a(%rip), %rdx      # 0x3133
movl $0x56, %ecx
jmp 0x1dda
leaq 0x1279(%rip), %rdi      # 0x3040
leaq 0x132f(%rip), %rsi      # 0x30fd
leaq 0x135e(%rip), %rdx      # 0x3133
movl $0x59, %ecx
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/xtanitfy[P]Murphy/src/blob.c
// Function: BLOB_shapeByPtr
int BLOB_shapeByPtr(BLOB_s *pBlob,BLOB_DATA_TYPE *pData,int len)
{
	CHECK_EXPR_RET(pData == NULL,-1);
	CHECK_EXPR_RET(pBlob == NULL,-1);
	CHECK_EXPR_RET(len != pBlob->count,-1);
	
	BLOB_shape(pBlob);
	BLOB_DATA_PTR(pBlob,ptr);
	int k = 0;
	for (int i_num = 0;i_num < pBlob->numSize;i_num++) {	
		for (int i_channel = 0;i_channel  < pBlob->channelSize;i_channel++) {
			for (int i_height = 0;i_height < pBlob->heightSize;i_height++) {	
				for (int i_width = 0;i_width < pBlob->widthSize;i_width++) {	
					ptr[i_num][i_channel][i_height][i_width] = pData[k++];	
				}
			}
		}
	}
	
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rsi, %rsi
je 0x1ee1
movq %rdi, %r14
testq %rdi, %rdi
je 0x1ee8
movq %rsi, %rbx
movslq %edx, %rsi
movl $0x6f, %ecx
cmpq %rsi, 0x30(%r14)
jne 0x1eed
shlq $0x3, %rsi
movl $0x1, %edi
callq 0x1070
movq %rax, 0x8(%r14)
movq 0x10(%r14), %rcx
movq %rcx, 0x10(%rsp)
testq %rcx, %rcx
je 0x1edd
movq 0x18(%r14), %rdx
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdi
movq %rdi, %r8
imulq %rsi, %r8
movq %r8, %rcx
imulq %rdx, %rcx
shlq $0x3, %rcx
movq %rcx, 0x8(%rsp)
shlq $0x3, %r8
leaq (,%rdi,8), %r10
xorl %r11d, %r11d
xorl %ebp, %ebp
testq %rdx, %rdx
je 0x1ece
movq %rax, %r14
xorl %r15d, %r15d
testq %rsi, %rsi
je 0x1ec3
movq %r14, %r12
xorl %r13d, %r13d
testq %rdi, %rdi
je 0x1eb8
movslq %ebp, %rcx
leaq (%rbx,%rcx,8), %r9
xorl %ecx, %ecx
movsd (%r9,%rcx,8), %xmm0
movsd %xmm0, (%r12,%rcx,8)
incq %rcx
cmpq %rcx, %rdi
jne 0x1ea2
addl %ecx, %ebp
incq %r13
addq %r10, %r12
cmpq %rsi, %r13
jne 0x1e94
incq %r15
addq %r8, %r14
cmpq %rdx, %r15
jne 0x1e89
incq %r11
addq 0x8(%rsp), %rax
cmpq 0x10(%rsp), %r11
jne 0x1e7e
xorl %eax, %eax
jmp 0x1f0e
movl $0x6d, %ecx
jmp 0x1eed
movl $0x6e, %ecx
leaq 0x114c(%rip), %rdi      # 0x3040
leaq 0x1202(%rip), %rsi      # 0x30fd
leaq 0x124b(%rip), %rdx      # 0x314d
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xtanitfy[P]Murphy/src/blob.c
// Function: BLOB_printPara
void BLOB_printPara(BLOB_s *pBolb)
{	
	printf("num:     %ld\n",pBolb->numSize);
	printf("channel: %ld\n",pBolb->channelSize);
	printf("height:  %ld\n",pBolb->heightSize);
	printf("width:   %ld\n",pBolb->widthSize);
	printf("size:    %ld\n",pBolb->count);
	printf("bytes:   %ld\n",pBolb->count*sizeof(BLOB_DATA_TYPE));
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rsi
leaq 0x120f(%rip), %rdi      # 0x315d
xorl %eax, %eax
callq 0x1030
movq 0x18(%rbx), %rsi
leaq 0x120b(%rip), %rdi      # 0x316b
xorl %eax, %eax
callq 0x1030
movq 0x20(%rbx), %rsi
leaq 0x1207(%rip), %rdi      # 0x3179
xorl %eax, %eax
callq 0x1030
movq 0x28(%rbx), %rsi
leaq 0x1203(%rip), %rdi      # 0x3187
xorl %eax, %eax
callq 0x1030
movq 0x30(%rbx), %rsi
leaq 0x11ff(%rip), %rdi      # 0x3195
xorl %eax, %eax
callq 0x1030
movq 0x30(%rbx), %rsi
shlq $0x3, %rsi
leaq 0x11f7(%rip), %rdi      # 0x31a3
xorl %eax, %eax
popq %rbx
jmp 0x1030