LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/netutils.cpp
// Function: SerialBuffer::read_str(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
void SerialBuffer::read_str(string &target)
{
	// If we trusted the other end blindly, we could just do:
#if 0
	target.assign(pos);
	pos += target.size()+1;
#endif
	/* But alas, there are mean people out there who would abuse such a hole.
	 * Hence we enforce a maximum length of a string and read carefully
	 * one byte at a time (there might not be any '\0' in the buffer to end the
	 * string!) */
	target.clear();
	// Read (A) at most the maximum string length, (B) at most as much as there
	// is buffer left!
	short bs_read = 0;
	while(bs_read < MAXIMUM_STR_LEN && pos != arr+BUFFER_SIZE)
	{
		if(*pos == '\0')
		{
			++pos;
			break;
		}
		target += *pos;
		++pos;
		++bs_read;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq $0x0, 0x8(%rsi)
movq (%rsi), %rax
movb $0x0, (%rax)
leaq 0x80a(%rdi), %r15
movq (%rdi), %rax
movw $0x15e, %r12w           # imm = 0x15E
cmpq %r15, %rax
je 0xf3b1
movb (%rax), %cl
testb %cl, %cl
je 0xf3ab
movsbl %cl, %esi
movq %r14, %rdi
callq 0x4300
movq (%rbx), %rax
incq %rax
movq %rax, (%rbx)
decw %r12w
jne 0xf384
jmp 0xf3b1
incq %rax
movq %rax, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/netutils.cpp
// Function: SerialBuffer::read_compressed(char*)
bool SerialBuffer::read_compressed(char *buffer)
{
	// read the size of the block:
	unsigned short sh = read_sh();
	uLongf res_size = BUFFER_SIZE;
	int r = uncompress((Bytef*)buffer, &res_size, (Bytef*)pos, sh);
	if(r == Z_BUF_ERROR || r == Z_DATA_ERROR)
		return true;
	// Z_MEM_ERROR (insufficient memory) is highly unlikely and would cause more
	// general problems.
	pos += res_size;
	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %rbx
movq (%rdi), %rdx
movzwl (%rdx), %ecx
addq $0x2, %rdx
rolw $0x8, %cx
movq %rdx, (%rdi)
leaq -0x10(%rbp), %rsi
movq $0x800, (%rsi)          # imm = 0x800
movzwl %cx, %ecx
movq %rax, %rdi
callq 0x4160
cmpl $-0x5, %eax
je 0xf3fe
cmpl $-0x3, %eax
je 0xf3fe
movq -0x10(%rbp), %rcx
addq %rcx, (%rbx)
addl $0x5, %eax
testl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
sete %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/utfstr.cpp
// Function: del(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, int)
void del(string &s, const int n)
{
	string::iterator i = s.begin();
	advance(i, s, n);
	for(char c = seq_len(*i); c > 0; --c)
	{
		if((i = s.erase(i)) == s.end())
			break; /* If this happens, string is not proper UTF-8!
		            * We can't really do anything with such a string;
					* this is just to avoid nasty segfaults. */
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
leaq -0x20(%rbp), %r14
movq %rax, (%r14)
movswl %si, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xf4aa
movq (%r14), %r14
movsbl (%r14), %edi
callq 0xf55b
movl %eax, %r15d
movq (%rbx), %rax
subq %rax, %r14
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4440
cmpq 0x8(%rbx), %r14
je 0xf49f
movq (%rbx), %rax
addq %rax, %r14
leal -0x1(%r15), %ecx
cmpb $0x1, %r15b
movl %ecx, %r15d
jg 0xf473
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/utfstr.cpp
// Function: (anonymous namespace)::advance(__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, short)
void advance(string::iterator &i, string &s, short num)
{
	char l;
	for(; num > 0; --num)
	{
		l = seq_len(*i);
		do { ++i; --l; }
		while(l > 0 // sequence is ready,
			&& i != s.end() // premature end of string,
			&& !invalid_cont_byte(*i)); // non-first byte invalid for continuation

#ifdef DEBUG
		if(l > 0) // if was broken for some other reason than this, something is wrong
		{
			cerr << inv_utf8_warning << endl;
			return;
		}
#endif
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
testw %r15w, %r15w
jle 0xf502
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rcx
movsbl (%rcx), %edi
callq 0xf55b
movq (%r14), %rcx
movq (%rbx), %rdx
addq 0x8(%rbx), %rdx
incq %rcx
movq %rcx, (%r14)
cmpb $0x2, %al
jl 0xf4f4
cmpq %rdx, %rcx
je 0xf50d
decb %al
cmpb $-0x40, (%rcx)
leaq 0x1(%rcx), %rcx
jl 0xf4db
jmp 0xf50d
leal -0x1(%r15), %eax
cmpw $0x1, %r15w
movl %eax, %r15d
jg 0xf4c6
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0xb1bc(%rip), %rsi      # 0x1a6d0
movq 0xb1bd(%rip), %rdx      # 0x1a6d8
movq 0x7ace(%rip), %rdi      # 0x16ff0
callq 0x4410
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4250
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/utfstr.cpp
// Function: (anonymous namespace)::seq_len(char)
char seq_len(char leadch) // determine the length of the sequence starting with leadch
{
	unsigned char lead = static_cast<unsigned char>(leadch);
	if(lead < 0x80)
		return 1;
	if(lead >= 0xC2 && lead <= 0xDF)
		return 2;
	if(lead >= 0xE0 && lead <= 0xEF)
		return 3;
	if(lead >= 0xF0 && lead <= 0xF4)
		return 4;
#ifdef DEBUG
	cerr << inv_utf8_warning << endl;
#endif
	return 1; // invalid lead!
}

// Assembly:
movb $0x1, %al
testb %dil, %dil
js 0xf563
retq
leal 0x3e(%rdi), %ecx
movb $0x2, %al
cmpb $0x1e, %cl
jb 0xf562
movl %edi, %ecx
andb $-0x10, %cl
movb $0x3, %al
cmpb $-0x20, %cl
je 0xf562
addb $0x10, %dil
movb $0x4, %al
cmpb $0x5, %dil
jb 0xf562
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0xb13e(%rip), %rsi      # 0x1a6d0
movq 0xb13f(%rip), %rdx      # 0x1a6d8
movq 0x7a50(%rip), %rdi      # 0x16ff0
callq 0x4410
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/utfstr.cpp
// Function: ins(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, unsigned int, int)
void ins(string &s, const unsigned int c, const int n)
{
	// First interpret "n symbols" in terms of a string iterator:
	string::iterator i = s.begin();
	advance(i, s, n);
	if(c < 0x80) // single byte
		s.insert(i, static_cast<unsigned char>(c));
	else if(c < 0x800) // 2 bytes
	{
		i = s.insert(i, static_cast<unsigned char>((c >> 6) | 0xc0));
		s.insert(++i, static_cast<unsigned char>((c & 0x3f) | 0x80));
	}
	else if(c < 0x10000) // 3
	{
		i = s.insert(i, static_cast<unsigned char>((c >> 12) | 0xe0));
		i = s.insert(++i, static_cast<unsigned char>(((c >> 6) & 0x3f) | 0x80));
		s.insert(++i, static_cast<unsigned char>((c & 0x3f) | 0x80));
	}
	else // 4
	{
		i = s.insert(i, static_cast<unsigned char>((c >> 18) | 0xf0));
		i = s.insert(++i, static_cast<unsigned char>(((c >> 12) & 0x3f) | 0x80));
		i = s.insert(++i, static_cast<unsigned char>(((c >> 6) & 0x3f) | 0x80));
		s.insert(++i, static_cast<unsigned char>((c & 0x3f) | 0x80));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movq (%rdi), %rax
leaq -0x20(%rbp), %rdi
movq %rax, (%rdi)
movswl %dx, %edx
movq %rbx, %rsi
callq 0xf4aa
cmpl $0x7f, %r14d
ja 0xf60f
movq -0x20(%rbp), %rsi
movq (%rbx), %rax
jmp 0xf718
cmpl $0x7ff, %r14d           # imm = 0x7FF
ja 0xf64c
movq -0x20(%rbp), %r15
movl %r14d, %eax
shrl $0x6, %eax
orb $-0x40, %al
subq (%rbx), %r15
movsbl %al, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x46d0
movq (%rbx), %rax
leaq (%rax,%r15), %rsi
incq %rsi
jmp 0xf710
movq -0x20(%rbp), %r15
subq (%rbx), %r15
movl %r14d, %eax
cmpl $0xffff, %r14d          # imm = 0xFFFF
ja 0xf6a8
shrl $0xc, %eax
orb $-0x20, %al
movsbl %al, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x46d0
movl %r14d, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
leaq 0x1(%r15), %rsi
movsbl %al, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x46d0
movq (%rbx), %rax
leaq (%rax,%r15), %rsi
addq $0x2, %rsi
jmp 0xf710
shrl $0x12, %eax
orb $-0x10, %al
movsbl %al, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x46d0
movl %r14d, %eax
shrl $0xc, %eax
andb $0x3f, %al
orb $-0x80, %al
leaq 0x1(%r15), %rsi
movsbl %al, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x46d0
movl %r14d, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
leaq 0x2(%r15), %rsi
movsbl %al, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x46d0
movq (%rbx), %rax
leaq (%rax,%r15), %rsi
addq $0x3, %rsi
andb $0x3f, %r14b
orb $-0x80, %r14b
subq %rax, %rsi
movsbl %r14b, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x46d0
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/utfstr.cpp
// Function: num_syms(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
short num_syms(const string &s)
{
	// we assume the string is valid UTF-8, and can hence simply count the non-continuation bytes
	int n = 0;
	for(string::const_iterator i = s.begin(); i != s.end(); ++i)
	{
		if(static_cast<unsigned char>(*i) < 0x80 || static_cast<unsigned char>(*i) > 0xBF)
			++n;
	}
	return n;
}

// Assembly:
movq 0x8(%rdi), %rcx
testq %rcx, %rcx
je 0xf762
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rdx
xorl %esi, %esi
xorl %eax, %eax
xorl %edi, %edi
cmpb $-0x40, (%rdx,%rsi)
setge %dil
addl %edi, %eax
incq %rsi
cmpq %rsi, %rcx
jne 0xf74c
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/utfstr.cpp
// Function: ind_of_sym(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int)
short ind_of_sym(const string &s, int n)
{
	short b = 0;
	for(; n > 0; --n)
		b += seq_len(s[b]);
	return b;
}

// Assembly:
testl %esi, %esi
jle 0xf81b
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
incl %ebx
xorl %r15d, %r15d
movswq %r15w, %rax
movq (%r14), %rcx
movsbl (%rcx,%rax), %edi
callq 0xf55b
movzbl %al, %eax
addl %r15d, %eax
decl %ebx
movl %eax, %r15d
cmpl $0x1, %ebx
ja 0xf7f0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/utfstr.cpp
// Function: mb_substr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, short, short)
std::string mb_substr(const string &s, const short beg, short len)
{
	short b = ind_of_sym(s, beg);
	short e = 0;
	for(; len > 0; --len)
		e += seq_len(s[b+e]);
	return s.substr(b, e);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
testw %dx, %dx
jle 0xf8aa
movzwl %dx, %r12d
incl %r12d
xorl %r13d, %r13d
movswq %r13w, %rax
movq (%r14), %rcx
movsbl (%rcx,%rax), %edi
callq 0xf55b
movzbl %al, %eax
addl %r13d, %eax
movl %eax, %r13d
decl %r12d
cmpl $0x1, %r12d
ja 0xf882
movswq %r13w, %r12
jmp 0xf8ad
xorl %r12d, %r12d
testw %r15w, %r15w
jle 0xf8e5
incl %r15d
xorl %r13d, %r13d
movswq %r13w, %rax
movq (%r14), %rcx
addq %r12, %rcx
movsbl (%rax,%rcx), %edi
callq 0xf55b
movzbl %al, %eax
addl %r13d, %eax
movl %eax, %r13d
decl %r15d
cmpw $0x1, %r15w
ja 0xf8b9
movswq %r13w, %rcx
jmp 0xf8e7
xorl %ecx, %ecx
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x43b0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/utfstr.cpp
// Function: low_bound(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, short)
short low_bound(const std::string &s, const short n)
{
	short a = n;
	while(!invalid_cont_byte(s[a]))
		--a;
	if(a + seq_len(s[a]) > n)
		return a;
	return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq (%rdi), %rcx
movl %ebx, %r14d
movswq %r14w, %rax
movb (%rcx,%rax), %al
decl %r14d
cmpb $-0x40, %al
jl 0xf919
incl %r14d
movswl %r14w, %r15d
movsbl %al, %edi
callq 0xf55b
movzbl %al, %ecx
addl %r15d, %ecx
movswl %bx, %eax
cmpl %eax, %ecx
cmovgl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/confdir.cpp
// Function: get_conf_dir[abi:cxx11]()
std::string get_conf_dir()
{
	std::string s;
	char *tmp = getenv("HOME");
	if(tmp && tmp[0])
		s = std::string(tmp);
	else
	{
		std::cerr << "HOME not defined!" << std::endl;
		exit(1);
	}
	s += "/.config/yuxtapa/";
	return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x10(%rdi), %r15
movq %r15, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
leaq 0x3775(%rip), %rdi      # 0x130f1
callq 0x4470
testq %rax, %rax
je 0xf9f3
movq %rax, %r14
cmpb $0x0, (%rax)
je 0xf9f3
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
movq %r14, %rdi
callq 0x41b0
movq %r14, %rdx
addq %rax, %rdx
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x891a
leaq -0x40(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4480
movq (%r14), %rdi
cmpq %r12, %rdi
je 0xf9d4
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x4390
leaq 0x372d(%rip), %rsi      # 0x13108
movq %rbx, %rdi
callq 0x46e0
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x75f6(%rip), %rdi      # 0x16ff0
leaq 0x36f5(%rip), %rsi      # 0x130f6
movl $0x11, %edx
callq 0x4410
movq 0x75de(%rip), %rdi      # 0x16ff0
callq 0x41d0
movl $0x1, %edi
callq 0x4460
jmp 0xfa23
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0xfa39
movq (%r15), %rsi
incq %rsi
callq 0x4390
movq %r14, %rdi
callq 0x4660
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/coords.cpp
// Function: Coords::in(e_Dir) const
Coords Coords::in(const e_Dir d) const
{
	Coords c(x,y);
	switch(d)
	{
		case D_N: c.y--; break;
		case D_NE: c.x++; c.y--; break;
		case D_E: c.x++; break;
		case D_SE: c.x++; c.y++; break;
		case D_S: c.y++; break;
		case D_SW: c.x--; c.y++; break;
		case D_W: c.x--; break;
		case D_NW: c.x--; c.y--; break;
		default: /*assert(0)*/;
	}
	return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, %rax
movzwl (%rsi), %edi
movzwl 0x2(%rsi), %ecx
movw %di, (%rax)
movw %cx, 0x2(%rax)
cmpl $0x7, %edx
ja 0xfb63
movl %edx, %edx
leaq 0x35e9(%rip), %rsi      # 0x1311c
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
incl %edi
jmp 0xfb4a
incl %edi
jmp 0xfb53
incl %edi
jmp 0xfb60
decl %edi
movw %di, (%rax)
decl %ecx
jmp 0xfb58
decl %edi
movw %di, (%rax)
incl %ecx
movw %cx, 0x2(%rax)
jmp 0xfb63
decl %edi
movw %di, (%rax)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/coords.cpp
// Function: Coords::unitise()
void Coords::unitise()
{
	short len = short(dist_eucl(Coords(0,0)));
	if(len)
	{
		x /= len;
		y /= len;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movswl (%rdi), %eax
cvtsi2sd %eax, %xmm0
mulsd %xmm0, %xmm0
movswl 0x2(%rdi), %ecx
cvtsi2sd %ecx, %xmm1
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
cvttss2si %xmm0, %edx
testw %dx, %dx
je 0xfbab
movswl %dx, %esi
cltd
idivl %esi
movw %ax, (%rdi)
movl %ecx, %eax
cltd
idivl %esi
movw %ax, 0x2(%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/common/coords.cpp
// Function: Coords::dir_of(Coords) const
e_Dir Coords::dir_of(Coords ref) const
{
	// Basically, we construct the vector from *this to ref and
	// shrink it (in a Euclidian fashion) to a unit vector, which
	// we then interpret as a direction:
	ref.x -= x;
	ref.y -= y;
	ref.unitise();
	switch(ref.x + ref.y)
	{
	case 2: return D_SE;
	case -2: return D_NW;
	case 1: if(ref.x) return D_E;
		return D_S;
	case -1: if(ref.x) return D_W;
		return D_N;
	case 0: if(ref.x == 1) return D_NE;
		return D_SW;
	}
	return D_N; // reaching this line is an error!
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movzwl (%rdi), %eax
subw %ax, (%rsi)
movzwl 0x2(%rdi), %eax
subw %ax, 0x2(%rsi)
movq %rsi, %rdi
callq 0xfb66
movswl (%rbx), %eax
movswl 0x2(%rbx), %ecx
addl %eax, %ecx
addl $0x2, %ecx
cmpl $0x4, %ecx
ja 0xfc2e
leaq 0x3557(%rip), %rdx      # 0x1313c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl $0x7, %eax
jmp 0xfc30
movl $0x3, %eax
jmp 0xfc30
xorl %ecx, %ecx
cmpw $0x1, %ax
setne %cl
leal 0x1(,%rcx,4), %eax
jmp 0xfc30
xorl %ecx, %ecx
testw %ax, %ax
sete %cl
leal 0x2(,%rcx,2), %eax
jmp 0xfc30
xorl %ecx, %ecx
testw %ax, %ax
movl $0x6, %eax
cmovel %ecx, %eax
jmp 0xfc30
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/error.cpp
// Function: printCachedErrors()
bool printCachedErrors()
{
    if (cached_errors.size() != 0) {
        std::cout << "compile terminated with error(s):" << std::endl;
        int count = 0;
        for (std::string msg : cached_errors) {
            if (count == 6) {
                std::cout << "Ommited " << (cached_errors.size() - 0) 
                    << "+ more errors" << std::endl;
                break;
            }
            std::cout << msg;
            count++;
        }
        return true;
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq 0x16a24(%rip), %rax     # 0x24118
movq 0x16a15(%rip), %rcx     # 0x24110
movq %rax, -0x38(%rbp)
movq %rcx, -0x30(%rbp)
cmpq %rcx, %rax
je 0xd842
movq 0x158bd(%rip), %rbx     # 0x22fd0
leaq 0xea9b(%rip), %rsi      # 0x1c1b5
movl $0x21, %edx
movq %rbx, %rdi
callq 0x3340
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31d0
movq 0x169bb(%rip), %r15     # 0x24110
movq 0x169bc(%rip), %r12     # 0x24118
cmpq %r12, %r15
je 0xd842
xorl %r14d, %r14d
leaq -0x48(%rbp), %rbx
movq %rbx, -0x58(%rbp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x58(%rbp), %rdi
callq 0xe4fc
cmpl $0x6, %r14d
jne 0xd806
movl $0x8, %edx
movq 0x1583b(%rip), %rdi     # 0x22fd0
leaq 0xea3b(%rip), %rsi      # 0x1c1d7
callq 0x3340
movq 0x16970(%rip), %rsi     # 0x24118
subq 0x16961(%rip), %rsi     # 0x24110
sarq $0x5, %rsi
movq 0x15816(%rip), %rdi     # 0x22fd0
callq 0x31c0
movq %rax, %r13
movl $0xd, %edx
movq %rax, %rdi
leaq 0xea0f(%rip), %rsi      # 0x1c1e0
callq 0x3340
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movl $0x6, %r13d
movq %rax, %rdi
callq 0x31d0
jmp 0xd81e
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq 0x157bb(%rip), %rdi     # 0x22fd0
callq 0x3340
leal 0x1(%r14), %r13d
movq -0x58(%rbp), %rdi
cmpq %rbx, %rdi
je 0xd82c
callq 0x32a0
cmpl $0x6, %r14d
je 0xd842
addq $0x20, %r15
movl %r13d, %r14d
cmpq %r12, %r15
jne 0xd76c
movq -0x30(%rbp), %rax
cmpq %rax, -0x38(%rbp)
setne %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x58(%rbp), %rdi
cmpq %rbx, %rdi
je 0xd86d
callq 0x32a0
movq %r14, %rdi
callq 0x3480
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/error.cpp
// Function: skip(Symset)
void skip(Symset fsys)
{
    //bool skipped = false;
    while (!fsys.contains(g_sym)) {
        //skipped = true;
        // TODO: underline for skipped words
        readSymbol();
    }
    //if (skipped) std::cout << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x1bdad(%rip), %r14     # 0x29630
movl (%r14), %eax
btq %rax, %rdi
jb 0xd89d
movq %rdi, %rbx
callq 0x19d18
movl (%r14), %eax
btq %rax, %rbx
jae 0xd88f
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/error.cpp
// Function: test(Symset, Symset)
void test(Symset s1, Symset s2)
{
    if (!s1.contains(g_sym)) {
        std::vector<int> syms = s1.toVector();
        std::stringstream buffer;
        buffer << "error: expected ";
        for (unsigned int i = 0; i < syms.size(); i++) {
            if (i != 0) buffer << "|";
            buffer << sym2str[syms[i]];
        }
        buffer << " before " << sym2str[g_sym];
        printError(buffer.str());
        skip(s1 + s2);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdi, -0x30(%rbp)
leaq 0x1bd6f(%rip), %rax     # 0x29630
movl (%rax), %eax
btq %rax, %rdi
jb 0xda15
movq %rsi, %rbx
leaq -0x48(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xe046
leaq -0x1f0(%rbp), %rdi
callq 0x31f0
leaq -0x1e0(%rbp), %r14
leaq 0xe8f7(%rip), %rsi      # 0x1c1ee
movl $0x10, %edx
movq %r14, %rdi
callq 0x3340
movq -0x48(%rbp), %rax
cmpq %rax, -0x40(%rbp)
je 0xd96f
movl $0x1, %r13d
xorl %r15d, %r15d
leaq 0x15e72(%rip), %r12     # 0x23790
cmpl $0x1, %r13d
je 0xd93c
movl $0x1, %edx
movq %r14, %rdi
leaq 0xe8cc(%rip), %rsi      # 0x1c1ff
callq 0x3340
movq -0x48(%rbp), %rax
movslq (%rax,%r15,4), %rax
shlq $0x5, %rax
movq (%rax,%r12), %rsi
movq 0x8(%rax,%r12), %rdx
movq %r14, %rdi
callq 0x3340
movl %r13d, %r15d
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
incl %r13d
cmpq %r15, %rcx
ja 0xd91e
leaq 0xe88b(%rip), %rsi      # 0x1c201
movl $0x8, %edx
movq %r14, %rdi
callq 0x3340
leaq 0x1bca6(%rip), %r15     # 0x29630
movl (%r15), %eax
shlq $0x5, %rax
leaq 0x15df8(%rip), %rcx     # 0x23790
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq %r14, %rdi
callq 0x3340
leaq -0x1d8(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x3420
leaq -0x68(%rbp), %rdi
callq 0xda7f
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd9d4
callq 0x32a0
orq -0x30(%rbp), %rbx
movl (%r15), %eax
btq %rax, %rbx
jb 0xd9e8
callq 0x19d18
jmp 0xd9d8
movq 0x155b1(%rip), %rsi     # 0x22fa0
leaq -0x1f0(%rbp), %rdi
callq 0x3210
leaq -0x170(%rbp), %rdi
callq 0x30e0
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0xda15
callq 0x32a0
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xda4a
callq 0x32a0
jmp 0xda4a
movq %rax, %rbx
jmp 0xda69
jmp 0xda47
jmp 0xda47
movq %rax, %rbx
movq 0x1554f(%rip), %rsi     # 0x22fa0
leaq -0x1f0(%rbp), %rdi
callq 0x3210
leaq -0x170(%rbp), %rdi
callq 0x30e0
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0xda77
callq 0x32a0
movq %rbx, %rdi
callq 0x3480
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/error.cpp
// Function: expect(Symbol)
void expect(Symbol sym)
{
    if (g_sym != sym) {
        std::cout << "Error: expect " << sym2str[sym]
            << " but got " << sym2str[g_sym];
        if (g_sym == IDENTSY)
            std::cout << "<" << g_id << ">";
        std::cout << std::endl;
        std::exit(1);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x1b8f6(%rip), %r15     # 0x29630
cmpl %edi, (%r15)
jne 0xdd48
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %edi, %ebx
movq 0x1527f(%rip), %r14     # 0x22fd0
leaq 0xe4ba(%rip), %rsi      # 0x1c212
movl $0xe, %edx
movq %r14, %rdi
callq 0x3340
movl %ebx, %eax
shlq $0x5, %rax
leaq 0x15a1e(%rip), %r12     # 0x23790
movq (%rax,%r12), %rsi
movq 0x8(%rax,%r12), %rdx
movq %r14, %rdi
callq 0x3340
movq %rax, %rbx
leaq 0xe499(%rip), %rsi      # 0x1c226
movl $0x9, %edx
movq %rax, %rdi
callq 0x3340
movl (%r15), %eax
shlq $0x5, %rax
movq (%rax,%r12), %rsi
movq 0x8(%rax,%r12), %rdx
movq %rbx, %rdi
callq 0x3340
cmpl $0x0, (%r15)
jne 0xddfd
movq 0x15211(%rip), %rbx     # 0x22fd0
leaq 0xe45b(%rip), %rsi      # 0x1c221
movl $0x1, %edx
movq %rbx, %rdi
callq 0x3340
leaq 0x1b85e(%rip), %rax     # 0x29638
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x3340
leaq 0xe433(%rip), %rsi      # 0x1c223
movl $0x1, %edx
movq %rax, %rdi
callq 0x3340
movq 0x151cc(%rip), %rdi     # 0x22fd0
callq 0x3130
movl $0x1, %edi
callq 0x3360
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/error.cpp
// Function: expectMul(int, ...)
void expectMul(int num, ...) 
{
    va_list valist;
    va_start(valist, num);
    for (int i = 0; i < num; i++) {
        Symbol sym = (Symbol)va_arg(valist, int);
        if (g_sym == sym) {
            va_end(valist);
            return;
        }
    }
    va_end(valist);
    std::cout << "Error: expect ";
    va_start(valist, num);
    for (int i = 0; i < num; i++) {
        if (i != 0)
            std::cout << "|";
        std::cout << sym2str[va_arg(valist, int)];
    }
    va_end(valist);
    std::cout << ", but got " << sym2str[g_sym] << std::endl;
    std::exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
leaq -0xf0(%rbp), %r14
movq %rsi, 0x8(%r14)
movq %rdx, 0x10(%r14)
movq %rcx, 0x18(%r14)
movq %r8, 0x20(%r14)
movq %r9, 0x28(%r14)
testb %al, %al
je 0xde72
movaps %xmm0, -0xc0(%rbp)
movaps %xmm1, -0xb0(%rbp)
movaps %xmm2, -0xa0(%rbp)
movaps %xmm3, -0x90(%rbp)
movaps %xmm4, -0x80(%rbp)
movaps %xmm5, -0x70(%rbp)
movaps %xmm6, -0x60(%rbp)
movaps %xmm7, -0x50(%rbp)
movq %r14, -0x30(%rbp)
leaq 0x10(%rbp), %r15
movq %r15, -0x38(%rbp)
movabsq $0x3000000008, %r12     # imm = 0x3000000008
movq %r12, -0x40(%rbp)
testl %edi, %edi
jle 0xdfc7
movl %edi, %ebx
movl -0x40(%rbp), %eax
movq -0x30(%rbp), %rcx
leaq 0x1b78c(%rip), %rdx     # 0x29630
movl (%rdx), %edx
movq -0x38(%rbp), %rdi
movl %ebx, %esi
cmpl $0x28, %eax
ja 0xdec1
movq %rdi, %r8
movl %eax, %edi
addq %rcx, %rdi
addl $0x8, %eax
movl %eax, -0x40(%rbp)
jmp 0xdec9
leaq 0x8(%rdi), %r8
movq %r8, -0x38(%rbp)
cmpl (%rdi), %edx
je 0xdfb5
movq %r8, %rdi
decl %esi
jne 0xdeac
movq 0x150f1(%rip), %rdi     # 0x22fd0
leaq 0xe32c(%rip), %rsi      # 0x1c212
movl $0xe, %edx
callq 0x3340
movq %r12, -0x40(%rbp)
movq %r15, -0x38(%rbp)
movq %r14, -0x30(%rbp)
testl %ebx, %ebx
jle 0xdf71
xorl %r12d, %r12d
leaq 0x15886(%rip), %r13     # 0x23790
movq 0x150bf(%rip), %r14     # 0x22fd0
leaq 0xe2e7(%rip), %r15      # 0x1c1ff
testl %r12d, %r12d
je 0xdf2d
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3340
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0xdf45
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0xdf51
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movslq (%rax), %rax
shlq $0x5, %rax
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %r14, %rdi
callq 0x3340
incl %r12d
cmpl %r12d, %ebx
jne 0xdf18
movq 0x15058(%rip), %rdi     # 0x22fd0
leaq 0xe2a6(%rip), %rsi      # 0x1c225
callq 0x32c0
leaq 0x1b6a5(%rip), %rcx     # 0x29630
movl (%rcx), %ecx
shlq $0x5, %rcx
leaq 0x157f8(%rip), %rsi     # 0x23790
addq %rcx, %rsi
movq %rax, %rdi
callq 0x3280
movq %rax, %rdi
callq 0x3130
movl $0x1, %edi
callq 0x3360
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x15002(%rip), %rdi     # 0x22fd0
leaq 0xe23d(%rip), %rsi      # 0x1c212
movl $0xe, %edx
callq 0x3340
movq %r12, -0x40(%rbp)
movq %r15, -0x38(%rbp)
movq %r14, -0x30(%rbp)
jmp 0xdf71
nop
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/symbol.h
// Function: Symset::toVector()
std::vector<int> toVector() {
        std::vector<int> res;
        for (int i = 0; i < 64; i++) {
            if (contains(i))
                res.push_back(i);
        }
        return res;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq -0x1c(%rbp), %r15
movl $0x0, (%r15)
xorl %eax, %eax
movq (%r14), %rcx
btq %rax, %rcx
jae 0xe09b
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xe090
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xe09b
movq %rbx, %rdi
movq %r15, %rdx
callq 0xe15a
movl -0x1c(%rbp), %ecx
leal 0x1(%rcx), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x3f, %ecx
jl 0xe071
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0xe0c7
callq 0x32a0
movq %r14, %rdi
callq 0x3480
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/grammar.cpp
// Function: pSignedInteger()
static void pSignedInteger() 
{
    int negtive = 1;
    if (g_sym == PLUS || g_sym == MINUS) {
        negtive = g_sym == MINUS ? -1 : 1;
        readSymbol();
    }
    test3(Symset({INTVALUE}));
    g_num *= negtive;
    readSymbol();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq 0x1660a(%rip), %rax     # 0x29630
movl (%rax), %eax
leal -0x13(%rax), %ecx
movl $0x1, %r13d
cmpl $0x1, %ecx
ja 0x1304b
xorl %ecx, %ecx
cmpl $0x14, %eax
setne %cl
leal -0x1(,%rcx,2), %r13d
callq 0x19d18
movl $0x11, %r12d
leaq -0x2c(%rbp), %rbx
movl %r12d, (%rbx)
leaq -0x48(%rbp), %r14
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x13dee
movabsq $0x2600000022, %rax     # imm = 0x2600000022
leaq -0x38(%rbp), %rsi
movq %rax, (%rsi)
leaq -0x40(%rbp), %r15
movl $0x2, %edx
movq %r15, %rdi
callq 0x13dee
movq (%r14), %rdi
movq (%r15), %rsi
callq 0xd8a2
movl %r12d, (%rbx)
leaq -0x38(%rbp), %rbx
leaq -0x2c(%rbp), %rsi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x13dee
movq (%rbx), %rax
leaq 0x16575(%rip), %rcx     # 0x29630
movl (%rcx), %ecx
btq %rcx, %rax
jae 0x130d1
leaq 0x16592(%rip), %rax     # 0x2965c
imull (%rax), %r13d
movl %r13d, (%rax)
callq 0x19d18
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/symbol.h
// Function: Symset::Symset(std::initializer_list<int>)
Symset(std::initializer_list<int> il) {
        bitmap = 0LL;
        for (auto itm : il) {
            if (itm < 0 || itm >= 64) {
                std::cout << "values of symset must between 1 and 64"
                    << std::endl;
                exit(1);
            }
            // (long long) is important
            bitmap |= (long long)1 << itm;
        }
    }

// Assembly:
movq $0x0, (%rdi)
testq %rdx, %rdx
je 0x13e1c
shlq $0x2, %rdx
xorl %eax, %eax
xorl %ecx, %ecx
movl (%rsi,%rax), %r8d
cmpq $0x40, %r8
jae 0x13e1d
btsq %r8, %rcx
movq %rcx, (%rdi)
addq $0x4, %rax
cmpq %rax, %rdx
jne 0x13e02
retq
pushq %rbp
movq %rsp, %rbp
movq 0xf1a8(%rip), %rdi      # 0x22fd0
leaq 0x8522(%rip), %rsi      # 0x1c351
callq 0x32c0
movq %rax, %rdi
callq 0x3130
movl $0x1, %edi
callq 0x3360
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/midcode.cpp
// Function: flushCachedMidCode()
void flushCachedMidCode()
{
    int t = cachedMidCode.size();
    assert(t > 0); // t must > 0
    std::vector<FourTuple> &cached = cachedMidCode[t - 1];
    for (const auto &item : cached) {
        genMidCode(item.op, item.a, item.b, item.res);
    }
    cachedMidCode.pop_back();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x11b2f(%rip), %rdi     # 0x27670
movq 0x11b20(%rip), %rax     # 0x27668
movq %rdi, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
testl %ecx, %ecx
jle 0x15bb0
decl %ecx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rbx
movq 0x8(%rax,%rcx,8), %r14
cmpq %r14, %rbx
je 0x15b9c
leaq 0x8(%rbx), %rsi
leaq 0x28(%rbx), %rdx
leaq 0x48(%rbx), %rcx
movq %rbx, %rdi
callq 0x150ec
addq $0x68, %rbx
cmpq %r14, %rbx
jne 0x15b78
movq 0x11ad4(%rip), %rdi     # 0x27670
addq $-0x18, %rdi
movq %rdi, 0x11ac9(%rip)     # 0x27670
popq %rbx
popq %r14
popq %rbp
jmp 0x13f9e
leaq 0x6cfb(%rip), %rdi      # 0x1c8b2
leaq 0x7013(%rip), %rsi      # 0x1cbd1
leaq 0x7037(%rip), %rcx      # 0x1cbfc
movl $0x48, %edx
callq 0x31b0
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/midcode.cpp
// Function: isConstValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int&)
bool isConstValue(const std::string &t, int &val)
{
    if (t[0] == '\'') {
        assert(t[2] == '\'');
        val = t[1];
        return true;
    } else if (std::isdigit(t[0]) || t[0] == '-') {
        val = std::stoi(t);
        return true;
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq (%rdi), %r15
movsbl (%r15), %eax
cmpl $0x27, %eax
jne 0x163d9
cmpb $0x27, 0x2(%r15)
jne 0x16446
movsbl 0x1(%r15), %eax
jmp 0x1642f
movl %eax, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
setae %cl
cmpb $0x2d, %al
setne %al
testb %cl, %al
jne 0x16435
callq 0x3050
movq %rax, %r14
movl (%rax), %r13d
movl $0x0, (%rax)
leaq -0x30(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x33a0
cmpq %r15, (%r12)
je 0x16465
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x16471
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x16471
testl %ecx, %ecx
jne 0x1642f
movl %r13d, (%r14)
movl %eax, (%rbx)
movb $0x1, %al
jmp 0x16437
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x67e6(%rip), %rdi      # 0x1cc33
leaq 0x677d(%rip), %rsi      # 0x1cbd1
leaq 0x67e5(%rip), %rcx      # 0x1cc40
movl $0xb3, %edx
callq 0x31b0
leaq 0x6877(%rip), %rdi      # 0x1cce3
callq 0x3180
leaq 0x686b(%rip), %rdi      # 0x1cce3
callq 0x33b0
cmpl $0x0, (%r14)
jne 0x16486
movl %r13d, (%r14)
movq %rax, %rdi
callq 0x3480
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/mips.cpp
// Function: gen_END()
static void gen_END()
{
    // loads $ra from memory
    MIPS(T << "lw" << HT << "$ra, " << cur_func_size - 4 << "($sp)");
    // restore $sp 
    MIPS(T << "addiu" << HT << "$sp, $sp, " << cur_func_size);
    MIPS(T << "jr" << HT << "$ra");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0xeec5(%rip), %rbx      # 0x285c0
leaq 0x3695(%rip), %rsi      # 0x1cd97
movl $0x2, %edx
movq %rbx, %rdi
callq 0x3340
leaq 0x36c3(%rip), %r14      # 0x1cdd9
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3340
leaq 0x36f7(%rip), %rsi      # 0x1ce24
movl $0x5, %edx
movq %rbx, %rdi
callq 0x3340
movl 0xf074(%rip), %esi      # 0x287b4
addl $-0x4, %esi
movq %rbx, %rdi
callq 0x3470
movq %rax, %r15
leaq 0x36d5(%rip), %rsi      # 0x1ce2a
movl $0x5, %edx
movq %rax, %rdi
callq 0x3340
movq %r15, %rdi
callq 0x16ea7
leaq 0x36a2(%rip), %rsi      # 0x1ce13
movl $0x5, %edx
movq %rbx, %rdi
callq 0x3340
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3340
leaq 0x3684(%rip), %rsi      # 0x1ce19
movl $0xa, %edx
movq %rbx, %rdi
callq 0x3340
movl 0xf00c(%rip), %esi      # 0x287b4
movq %rbx, %rdi
callq 0x3470
movq %rax, %rdi
callq 0x16ea7
leaq 0x3a41(%rip), %rsi      # 0x1d200
movl $0x2, %edx
movq %rbx, %rdi
callq 0x3340
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3340
leaq 0x3a20(%rip), %rsi      # 0x1d203
movl $0x3, %edx
movq %rbx, %rdi
callq 0x3340
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x16ea7
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/mips.cpp
// Function: loadToReg(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
static void loadToReg(const std::string &reg, const std::string &t)
{
    TabEntry entry;
    int val;

    if (isConstValue(t, val)) {
        MIPS(T << "li" << HT << reg << ", " << val);
        return;
    }
    bool flag = tabFind(t, entry);
    assert(flag == true);
    if (entry.scope == GLOBAL) {
        MIPS(T << "lw" << HT << reg << ", " << t);
    } else {
        MIPS(T << "lw" << HT << reg << ", " << entry.addr << "($sp)");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x24(%rbp), %rsi
movq %rbx, %rdi
callq 0x163ae
testb %al, %al
je 0x1988c
leaq 0xed92(%rip), %rbx      # 0x285c0
leaq 0x35bd(%rip), %rsi      # 0x1cdf2
movl $0x2, %edx
movq %rbx, %rdi
callq 0x3340
leaq 0x3590(%rip), %rsi      # 0x1cdd9
movl $0x1, %edx
movq %rbx, %rdi
callq 0x3340
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x3340
movq %rax, %rbx
leaq 0x37e4(%rip), %rsi      # 0x1d053
movl $0x2, %edx
movq %rax, %rdi
callq 0x3340
movl -0x24(%rbp), %esi
movq %rbx, %rdi
callq 0x3470
jmp 0x19931
leaq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x1a77d
testb %al, %al
je 0x19949
movl -0x38(%rbp), %r12d
leaq 0xed15(%rip), %r15      # 0x285c0
leaq 0x34e5(%rip), %rsi      # 0x1cd97
movl $0x2, %edx
movq %r15, %rdi
callq 0x3340
leaq 0x3513(%rip), %rsi      # 0x1cdd9
movl $0x1, %edx
movq %r15, %rdi
callq 0x3340
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x3340
movq %rax, %r14
leaq 0x3767(%rip), %rsi      # 0x1d053
movl $0x2, %edx
movq %rax, %rdi
callq 0x3340
testl %r12d, %r12d
je 0x19922
movl -0x28(%rbp), %esi
movq %r14, %rdi
callq 0x3470
movq %rax, %rbx
leaq 0x3517(%rip), %rsi      # 0x1ce2a
movl $0x5, %edx
movq %rax, %rdi
callq 0x3340
jmp 0x19934
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x3340
movq %rax, %rbx
movq %rbx, %rdi
callq 0x16ea7
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3587(%rip), %rdi      # 0x1ced7
leaq 0x341e(%rip), %rsi      # 0x1cd75
leaq 0x3586(%rip), %rcx      # 0x1cee4
movl $0x1d4, %edx            # imm = 0x1D4
callq 0x31b0
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/mips.cpp
// Function: getVariableAddr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
static std::string getVariableAddr(const std::string &t)
{
    TabEntry entry;
    bool flag = tabFind(t, entry);
    if (!flag) {
        std::cout << "Did you forget the TEMP mid-code for temp var?"
                  << std::endl;
    }
    assert(flag == true);
    if (entry.scope == GLOBAL) {
        return t;
    } else {
        return std::to_string(entry.addr) + "($sp)";
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x5c(%rbp), %rsi
movq %r14, %rdi
callq 0x1a77d
testb %al, %al
je 0x19abf
cmpl $0x0, -0x5c(%rbp)
je 0x199f4
movl -0x4c(%rbp), %r13d
movl %r13d, %r14d
negl %r14d
cmovsl %r13d, %r14d
movl $0x1, %r15d
cmpl $0xa, %r14d
jb 0x19a1b
movl $0x4, %r15d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r14d, %ecx
cmpl $0x63, %ecx
jbe 0x19a12
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x19a18
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x19a1b
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r15d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x199c1
addl $-0x3, %r15d
jmp 0x19a1b
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0xe4fc
jmp 0x19ab0
addl $-0x2, %r15d
jmp 0x19a1b
decl %r15d
shrl $0x1f, %r13d
movl %r13d, %esi
addl %r15d, %esi
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x48(%rbp), %r12
movq %r12, %rdi
movl $0x2d, %edx
callq 0x3350
movq (%r12), %rdi
addq %r13, %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x13e46
leaq 0x33d3(%rip), %rsi      # 0x1ce2a
movq %r12, %rdi
callq 0x34c0
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x19a81
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x19a87
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x19ab0
callq 0x32a0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x950a(%rip), %rdi      # 0x22fd0
leaq 0x3450(%rip), %rsi      # 0x1cf1d
callq 0x32c0
movq %rax, %rdi
callq 0x3130
leaq 0x33f6(%rip), %rdi      # 0x1ced7
leaq 0x328d(%rip), %rsi      # 0x1cd75
leaq 0x345d(%rip), %rcx      # 0x1cf4c
movl $0x1e9, %edx            # imm = 0x1E9
callq 0x31b0
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x19b0e
callq 0x32a0
movq %rbx, %rdi
callq 0x3480
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/symbol.cpp
// Function: extraCodeChecking()
void extraCodeChecking()
{
    check_remaining_flag = true;
    while (nextch()) {
        if (!isBlankCharacter(ch)) {
            error(ERR_REDUNDENT_CODE);
            printCachedErrors();
            std::exit(1);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movb $0x1, 0xf1e5(%rip)      # 0x296ac
callq 0x1a293
testb %al, %al
je 0x1a526
movzbl 0x8da9(%rip), %eax      # 0x23280
leal -0x9(%rax), %ecx
cmpl $0x2, %ecx
jb 0x1a4c7
cmpl $0x20, %eax
je 0x1a4c7
leaq -0x20(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x2d54(%rip), %rsi      # 0x1d247
leaq 0x2d6b(%rip), %rdx      # 0x1d265
leaq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x14396
movq %rbx, %rdi
callq 0xdccb
leaq -0x30(%rbp), %rdi
callq 0x34d8
callq 0xd6dc
movl $0x1, %edi
callq 0x3360
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq -0x30(%rbp), %rdi
cmpq %r14, %rdi
je 0x1a540
callq 0x32a0
movq %rbx, %rdi
callq 0x3480
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/table.cpp
// Function: tabInsertParam(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, DataType&)
void tabInsertParam(const std::string &id, DataType &dtype)
{
    std::unordered_map<std::string, std::vector
        <DataType>>::iterator it;
    if ((it = funcParams.find(id)) == funcParams.end()) {
        std::vector<DataType> params;
        params.push_back(dtype);
        funcParams[id] = params;
    } 
    else {
        std::vector<DataType> &params = (*it).second;
        params.push_back(dtype);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xfbb8(%rip), %rdi      # 0x2a250
movq %r14, %rsi
callq 0x1af58
testq %rax, %rax
je 0x1a6bd
movq 0x30(%rax), %rsi
cmpq 0x38(%rax), %rsi
je 0x1a70b
movl (%rbx), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x30(%rax)
jmp 0x1a702
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
xorl %esi, %esi
movq %rbx, %rdx
callq 0x1b064
leaq 0xfb70(%rip), %rdi      # 0x2a250
movq %r14, %rsi
callq 0x1b19c
leaq -0x30(%rbp), %rsi
movq %rax, %rdi
callq 0x1abac
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x1a702
callq 0x32a0
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
addq $0x28, %rax
movq %rax, %rdi
movq %rbx, %rdx
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x1b064
movq %rax, %rbx
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x1a733
callq 0x32a0
movq %rbx, %rdi
callq 0x3480
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/table.cpp
// Function: tabGetParams(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
const std::vector<DataType> & tabGetParams(const std::string &id) 
{
    const static std::vector<DataType> EMPTY_PARAMS;
    std::unordered_map<std::string, std::vector
        <DataType>>::iterator it;
    if ((it = funcParams.find(id)) != funcParams.end()) {
        return (*it).second;
    }
    else return EMPTY_PARAMS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb 0xfb56(%rip), %al       # 0x2a2a0
testb %al, %al
je 0x1a776
leaq 0xfafb(%rip), %rdi      # 0x2a250
movq %rbx, %rsi
callq 0x1af58
leaq 0x28(%rax), %rcx
testq %rax, %rax
leaq 0xfb1d(%rip), %rax      # 0x2a288
cmovneq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
callq 0x359b
jmp 0x1a74e
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/table.cpp
// Function: tabFind(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, _TabEntry&)
bool tabFind(const std::string &id, TabEntry &entry)
{
    std::unordered_map<std::string, TabEntry>::iterator it;
    // find in local
    if ((it = symbolTableL.find(id)) != symbolTableL.end()) {
        entry = (*it).second;
        return true;
    }
    // find in global
    if ((it = symbolTableG.find(id)) != symbolTableG.end()) {
        entry = (*it).second;
        return true;
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xfa87(%rip), %rdi      # 0x2a218
movq %r14, %rsi
callq 0x1b4f0
testq %rax, %rax
jne 0x1a7b2
leaq 0xfa3b(%rip), %rdi      # 0x2a1e0
movq %r14, %rsi
callq 0x1b4f0
testq %rax, %rax
je 0x1a7c6
movl 0x38(%rax), %ecx
movl %ecx, 0x10(%rbx)
movups 0x28(%rax), %xmm0
movups %xmm0, (%rbx)
movb $0x1, %al
popq %rbx
popq %r14
popq %rbp
retq
xorl %eax, %eax
jmp 0x1a7c1
// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/table.cpp
// Function: printSymbolTable(IdentScope)
void printSymbolTable(IdentScope scope)
{
    std::cout << (scope == GLOBAL ? 
        "##############Global table##############\n":
        "##############Local table###############\n");
    const std::unordered_map<std::string, TabEntry> &symbolTable =
        (scope == GLOBAL) ? symbolTableG : symbolTableL;
    int count = 0;
    for (auto const& item : symbolTable) {
        count++;
        std::cout << count << ":";
        printTabEntry(item.first, item.second);
    }
    std::cout << "################Table End###########\n";
    count = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %edi, %edi
leaq 0x2b14(%rip), %rax      # 0x1d2f5
leaq 0x2b37(%rip), %rsi      # 0x1d31f
cmoveq %rax, %rsi
leaq 0xf9fd(%rip), %rax      # 0x2a1f0
leaq 0xfa2e(%rip), %r14      # 0x2a228
cmoveq %rax, %r14
movq 0x87cb(%rip), %rbx      # 0x22fd0
movl $0x29, %edx
movq %rbx, %rdi
callq 0x3340
movq (%r14), %r15
testq %r15, %r15
je 0x1a95b
movl $0x1, %r14d
leaq 0x2828(%rip), %r12      # 0x1d053
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3470
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1990(%rip), %rsi      # 0x1c1d5
callq 0x3340
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
movq %rbx, %rdi
callq 0x3340
movq %rax, %r13
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x3340
movl 0x2c(%r15), %eax
shlq $0x5, %rax
leaq 0xf804(%rip), %rcx      # 0x2a080
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq %r13, %rdi
callq 0x3340
movq %rax, %r13
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x3340
movl 0x30(%r15), %eax
shlq $0x5, %rax
leaq 0xf831(%rip), %rcx      # 0x2a0e0
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq %r13, %rdi
callq 0x3340
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x3340
cmpl $0x0, 0x2c(%r15)
je 0x1a8dd
movl 0x34(%r15), %esi
jmp 0x1a8e8
movl 0x34(%r15), %esi
cmpl $0x1, 0x30(%r15)
jne 0x1a944
movq %rbx, %rdi
callq 0x3470
movl $0x2, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3340
movl 0x38(%r15), %esi
movq %rbx, %rdi
callq 0x3470
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31d0
movq (%r15), %r15
incl %r14d
testq %r15, %r15
jne 0x1a82b
jmp 0x1a95b
movb %sil, -0x29(%rbp)
movl $0x1, %edx
movq %rbx, %rdi
leaq -0x29(%rbp), %rsi
callq 0x3340
jmp 0x1a8f0
movq 0x866e(%rip), %rdi      # 0x22fd0
leaq 0x29e0(%rip), %rsi      # 0x1d349
movl $0x25, %edx
callq 0x3340
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq