LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/matteorr[P]EarleyParser/EarleyParser.cpp
// Function: EarleyParser::splitToVector(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
void EarleyParser::splitToVector
	(
		const std::string& inputString,
        std::vector<std::string>* outputVector,
        const std::string& separatorString,
        bool skipNullStrings
    )
{
    unsigned int pos = 0;
    outputVector->clear();

    while( pos < inputString.length() )
    {
        std::string next = inputString.substr( pos );
        unsigned int next_pos = next.find( separatorString );

        if( next_pos == static_cast<unsigned int> (std::string::npos) )
            next_pos = next.length();

        if( !skipNullStrings || next_pos > 0 )
        {
            std::string to_insert = next.substr( 0, next_pos );
            outputVector->push_back( to_insert );
        }

        pos += next_pos + separatorString.size();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r8d, -0x2c(%rbp)
movq %rcx, %r14
movq %rdx, %rdi
movq %rsi, %rbx
movq %rdx, -0x38(%rbp)
callq 0x638c
cmpq $0x0, 0x8(%rbx)
je 0x336a
xorl %r13d, %r13d
leaq -0x80(%rbp), %r12
movq %rbx, -0x40(%rbp)
leaq -0x60(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq $-0x1, %rcx
callq 0x2200
movq (%r14), %rsi
movq 0x8(%r14), %rcx
movq %r15, %rdi
xorl %edx, %edx
callq 0x22e0
cmpl $-0x1, %eax
jne 0x32fd
movl -0x58(%rbp), %eax
testl %eax, %eax
sete %cl
movl $0x0, %ebx
testb %cl, -0x2c(%rbp)
jne 0x3340
movl %eax, %ebx
movq %r12, %r15
movq %r12, %rdi
leaq -0x60(%rbp), %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x2200
movq -0x38(%rbp), %rdi
movq %r15, %rsi
callq 0x63d2
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x3340
callq 0x21a0
addq %rbx, %r13
addq 0x8(%r14), %r13
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x3359
callq 0x21a0
movl %r13d, %r13d
movq -0x40(%rbp), %rbx
cmpq 0x8(%rbx), %r13
jb 0x32cb
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3393
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x3393
callq 0x21a0
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x33a5
callq 0x21a0
movq %rbx, %rdi
callq 0x22f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/matteorr[P]EarleyParser/Node.cpp
// Function: Node::Node(Node*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, Production*, float)
Node::Node( Node* father, string grammarElement, vector<string> nodeProduction, Production* productionPointer, float productionProbability )
{
	this->father = father;

	this->grammarElement = grammarElement;
	this->production = nodeProduction;
	this->productionProbability = productionProbability;

	this->productionPointer = productionPointer;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movss %xmm0, -0x2c(%rbp)
movq %r8, %r14
movq %rcx, %r13
movq %rdi, %r12
leaq 0x646a(%rip), %rax      # 0xdd38
movq %rax, (%rdi)
leaq 0x8(%rdi), %rbx
leaq 0x18(%rdi), %rax
movq %rax, -0x40(%rbp)
movq %rax, 0x8(%rdi)
xorl %eax, %eax
movq %rax, 0x10(%rdi)
movb $0x0, 0x18(%rdi)
leaq 0x28(%rdi), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rdi)
movq %rax, 0x38(%rdi)
leaq 0x48(%rdi), %rcx
movq %rcx, -0x38(%rbp)
movups %xmm0, 0x48(%rdi)
movq %rax, 0x58(%rdi)
movq %rsi, 0x40(%rdi)
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x2110
movq %r15, %rdi
movq %r13, %rsi
callq 0x8f18
movss -0x2c(%rbp), %xmm0
movss %xmm0, 0x60(%r12)
movq %r14, 0x68(%r12)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x38(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x7958
callq 0x21a0
movq %r15, %rdi
callq 0x60b2
movq (%rbx), %rdi
cmpq -0x40(%rbp), %rdi
je 0x796e
callq 0x21a0
movq %r14, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O3/matteorr[P]EarleyParser/Node.cpp
// Function: Node::print(bool)
float Node::print( bool printProbabilities )
{
	float prob = -1;

	cout << "Node [" << this->grammarElement << "]{";

	if( printProbabilities == true ){

		if( this->children.size() == 0 )
		{
			/*
			 * we are in a leaf node
			 */
			prob = this->productionProbability;

		}else{

			prob = this->productionProbability;
			for( vector<Node*>::iterator it = this->children.begin(); it != this->children.end(); it++ )
			{
				prob = prob * (*it)->print( printProbabilities );
			}
		}
	}else{

		for( vector<Node*>::iterator it = this->children.begin(); it != this->children.end(); it++ )
		{
			prob = (*it)->print( printProbabilities );
		}
	}
	cout << "prob [" << prob << "]}";

	return prob;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movq 0x51b5(%rip), %r15      # 0xdfd8
leaq 0x198b(%rip), %rsi      # 0xa7b5
movl $0x6, %edx
movq %r15, %rdi
callq 0x2220
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
movq %r15, %rdi
callq 0x2220
leaq 0x196e(%rip), %rsi      # 0xa7bc
movl $0x2, %edx
movq %rax, %rdi
callq 0x2220
testl %r14d, %r14d
je 0x8e9b
movq 0x48(%rbx), %r14
movss 0x60(%rbx), %xmm0
cmpq %r14, 0x50(%rbx)
movss %xmm0, -0x1c(%rbp)
je 0x8ec8
movq (%r14), %rdi
movl $0x1, %esi
callq 0x8e0c
movss -0x1c(%rbp), %xmm1
mulss %xmm0, %xmm1
movss %xmm1, -0x1c(%rbp)
addq $0x8, %r14
cmpq 0x50(%rbx), %r14
jne 0x8e74
jmp 0x8ec8
movq 0x48(%rbx), %r14
cmpq 0x50(%rbx), %r14
je 0x8ebb
movq (%r14), %rdi
xorl %esi, %esi
callq 0x8e0c
addq $0x8, %r14
cmpq 0x50(%rbx), %r14
jne 0x8ea5
jmp 0x8ec3
movss 0x1145(%rip), %xmm0     # 0xa008
movss %xmm0, -0x1c(%rbp)
movq 0x5109(%rip), %rbx      # 0xdfd8
leaq 0x18e9(%rip), %rsi      # 0xa7bf
movl $0x6, %edx
movq %rbx, %rdi
callq 0x2220
xorps %xmm0, %xmm0
cvtss2sd -0x1c(%rbp), %xmm0
movq %rbx, %rdi
callq 0x22a0
leaq 0x18cc(%rip), %rsi      # 0xa7c6
movl $0x2, %edx
movq %rax, %rdi
callq 0x2220
movss -0x1c(%rbp), %xmm0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/matteorr[P]EarleyParser/State.cpp
// Function: State::State(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, Production*, State*, int, int)
State::State( string nonTerminal, Production* productionPointer, State* backtraceState, int inputStringProgress, int productionProgress )
: productionProgress(0), printed(false)
{

	//cout << endl << endl << "!!!!!!!!!!!![DEBUG]: OTHER CONSTRUCTOR CALLED!!!!!!!!!!!!!" << endl << endl << endl;

	this->nonTerminal = nonTerminal;
	this->productionPointer = productionPointer;

	this->backtraceStateVector.push_back( backtraceState );

	this->inputStringProgress = inputStringProgress;
	this->productionProgress = productionProgress;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, -0x2c(%rbp)
movl %r8d, %r15d
movq %rcx, %r13
movq %rdx, %rbx
movq %rdi, %r12
movq %rcx, -0x48(%rbp)
leaq 0x4a64(%rip), %rax      # 0xdd98
movq %rax, (%rdi)
leaq 0x8(%rdi), %r14
leaq 0x18(%rdi), %rax
movq %rax, -0x40(%rbp)
movq %rax, 0x8(%rdi)
movq $0x0, 0x10(%rdi)
xorl %eax, %eax
movb %al, 0x18(%rdi)
leaq 0x30(%rdi), %rcx
movq %rcx, -0x38(%rbp)
movb %al, 0x50(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x3c(%rdi)
movq %r14, %rdi
callq 0x2110
movq %rbx, 0x28(%r12)
movq 0x38(%r12), %rsi
cmpq 0x40(%r12), %rsi
je 0x938e
movq %r13, (%rsi)
addq $0x8, 0x38(%r12)
jmp 0x939b
leaq -0x48(%rbp), %rdx
movq -0x38(%rbp), %rdi
callq 0x7442
movl %r15d, 0x4c(%r12)
movl -0x2c(%rbp), %eax
movl %eax, 0x48(%r12)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x38(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x93cb
callq 0x21a0
movq (%r14), %rdi
cmpq -0x40(%rbp), %rdi
je 0x93d9
callq 0x21a0
movq %rbx, %rdi
callq 0x22f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/matteorr[P]EarleyParser/State.cpp
// Function: State::getProductionPointer() const
Production* State::getProductionPointer() const
{
	if( this->productionPointer == NULL ){
		cout << "[ERROR]: production pointer is null" << endl;
		exit(1);
	}

	return this->productionPointer;
}

// Assembly:
movq 0x28(%rdi), %rax
testq %rax, %rax
je 0x9486
retq
pushq %rbp
movq %rsp, %rbp
movq 0x4b47(%rip), %rdi      # 0xdfd8
leaq 0x1344(%rip), %rsi      # 0xa7dc
callq 0x21d0
movq %rax, %rdi
callq 0x20f0
movl $0x1, %edi
callq 0x2230
nop
// File: /workspace/github_cpp_makefile_star2_O3/matteorr[P]EarleyParser/State.cpp
// Function: State::isComplete()
bool State::isComplete()
{
	if( this->getProductionProgress() == this->getProductionPointer()->getProductionContent().size() )
		return true;
	else
		return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movslq 0x48(%rdi), %r14
callq 0x947c
leaq -0x28(%rbp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x92d6
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x5, %rax
cmpq %r14, %rax
sete %r14b
movq %rbx, %rdi
callq 0x60b2
movl %r14d, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/ronakshah725[P]SLR1Parser_C/parser1.cpp
// Function: start_parser()
void start_parser(void)
{
    int ntoken;
    
    ntoken = yylex();
    
    while(ntoken!=DOLLAR) {
        
        
        //printTokens(ntoken);
        printf("%d ",ntoken);
        ntoken = yylex();
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
callq 0x37c8
cmpl $0x9, %eax
je 0x2d34
leaq 0x2340(%rip), %rbx      # 0x505e
movq %rbx, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x2040
callq 0x37c8
cmpl $0x9, %eax
jne 0x2d1e
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/ronakshah725[P]SLR1Parser_C/parser1.cpp
// Function: main
int main(int argc, char *argv[] )
{
    if ( argc != 2 ) /* argc should be 2 for correct execution */
    {
        
        printf( "usage: %s filename", argv[0] );
    }
    else
    {
        char x[row][col];
        FILE *file = fopen( argv[1], "r" );
        MAX_STATES = states(argv[1]);
        MAX_STATES -= 2;

        if ( file == 0 )
        {
            printf( "Could not open file\n" );
        }
        else
        {
            //start_parser();
            run(x, file);
        }
    }
 return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x1f70, %rsp           # imm = 0x1F70
movq %rsi, %r14
cmpl $0x2, %edi
jne 0x2ea1
movq 0x8(%r14), %rdi
leaq 0x2239(%rip), %rsi      # 0x5079
callq 0x21a0
movq %rax, %rbx
movq 0x8(%r14), %rsi
leaq -0x38(%rbp), %r14
leaq -0x11(%rbp), %rdx
movq %r14, %rdi
callq 0x20b0
movq %r14, %rdi
callq 0x2c33
movl %eax, 0x53ca(%rip)      # 0x8234
leaq -0x28(%rbp), %rcx
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x2e82
callq 0x2150
movl 0x53b2(%rip), %eax      # 0x8234
addl $-0x2, %eax
movl %eax, 0x53a9(%rip)      # 0x8234
testq %rbx, %rbx
je 0x2eb4
leaq -0x1f80(%rbp), %rdi
movq %rbx, %rsi
callq 0x2de9
jmp 0x2ec0
movq (%r14), %rsi
leaq 0x21bb(%rip), %rdi      # 0x5066
xorl %eax, %eax
callq 0x2040
jmp 0x2ec0
leaq 0x2262(%rip), %rdi      # 0x511d
callq 0x2250
xorl %eax, %eax
addq $0x1f70, %rsp           # imm = 0x1F70
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ee3
callq 0x2150
movq %rbx, %rdi
callq 0x22f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/cachesim.cpp
// Function: cache_update(unsigned int, unsigned int)
void cache_update(uint32_t addr, uint32_t data) {
	uint32_t idx = cache_calc_idx(addr);
	uint32_t tag = cache_calc_tag(addr);
	uint32_t wid = cache_calc_word_idx(addr);
	int way = cache_peek(addr,4);
	if ( way < 0 ) {
		for ( int i = 0; i < CACHE_WAYS; i++ ) {
			if ( !is_flag_valid(g_flags[idx][i]) ) {
				way = i;
				break;
			}
		}
	}

	g_cache[idx][way][wid] = data;
	g_tags[idx][way] = tag;
	g_flags[idx][way] = set_flag_valid(g_flags[idx][way]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movl %edi, %ebx
movl %edi, %eax
shrl $0x2, %eax
movzbl %al, %r15d
movl $0x4, %esi
callq 0x25a7
leaq 0xc2c8(%rip), %rcx      # 0xea00
testl %eax, %eax
jns 0x2746
xorl %edx, %edx
testb $0x1, (%r15,%rcx)
cmovel %edx, %eax
shrl $0xa, %ebx
cltq
leal (,%r15,4), %edx
leaq 0xbaa6(%rip), %rsi      # 0xe200
addq %rdx, %rsi
movl %r14d, (%rsi,%rax,4)
leaq 0xbe98(%rip), %rsi      # 0xe600
addq %rdx, %rsi
movl %ebx, (%rsi,%rax,4)
addq %r15, %rcx
orb $0x1, (%rax,%rcx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/cachesim.cpp
// Function: cache_flush(unsigned int, unsigned char*)
void cache_flush(uint32_t addr, uint8_t* mem) {
	uint32_t idx = cache_calc_idx(addr);
	//uint32_t wid = cache_calc_word_idx(addr);

	//choose way
	//int way = rand()%CACHE_WAYS;
	int way = 0;

	if (!is_flag_valid(g_flags[idx][way])) return;
	uint32_t tag = g_tags[idx][way];

	//write to mem
	//set flag to empty
	for ( int i = 0; i < CACHE_LINE_WORD; i++ ) {
		uint32_t data = g_cache[idx][way][i];
		uint32_t maddr = cache_reassemble_addr(idx, tag) + (i*4);
		*(uint32_t*)(mem+maddr) = data;
		g_flags[idx][way] = set_flag_invalid(g_flags[idx][way]);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
shrl $0x2, %edi
movzbl %dil, %eax
leaq 0xc26e(%rip), %rcx      # 0xea00
testb $0x1, (%rax,%rcx)
je 0x27c1
leal (,%rax,4), %edx
leaq 0xbe5a(%rip), %rdi      # 0xe600
movl (%rdx,%rdi), %edi
leaq 0xba50(%rip), %r8       # 0xe200
movl (%rdx,%r8), %edx
shll $0xa, %edi
leal (%rdi,%rax,4), %edi
movl %edx, (%rsi,%rdi)
andb $-0x2, (%rax,%rcx)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/emulator.cpp
// Function: parse_imm(char*, int, int, bool)
uint32_t parse_imm(char* tok, int bits, int line, bool strict = true) {
	if ( !(tok[0]>='0'&&tok[0]<='9') && tok[0] != '-' && strict) {
		print_syntax_error(line, "Malformed immediate value" );
	}
	long int imml = strtol(tok, NULL, 0);


	if (imml > ((1<<bits)-1) || imml < -(1<<(bits-1)) ) {
		printf( "Syntax error at token %s\n", tok);
		exit(1);
	}
	uint64_t uv = *(uint64_t*)&imml;
	uint32_t hv = (uv&UINT32_MAX);

	return hv;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
xorb $0x1, %cl
movb (%rdi), %al
leal -0x3a(%rax), %esi
cmpb $-0xa, %sil
setae %sil
cmpb $0x2d, %al
sete %al
orb %cl, %al
orb %sil, %al
je 0x320b
movq %rdi, %rbx
xorl %esi, %esi
xorl %edx, %edx
callq 0x2290
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl %r14d, %ecx
shll %cl, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
notl %esi
cmpq %rsi, %rax
jg 0x31f8
decb %r14b
movl %r14d, %ecx
shll %cl, %edx
movslq %edx, %rcx
cmpq %rcx, %rax
jl 0x31f8
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x842c(%rip), %rdi      # 0xb62b
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2040
jmp 0x3225
leaq 0x832e(%rip), %rdi      # 0xb540
leaq 0x83f8(%rip), %rax      # 0xb611
movl %edx, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2040
movl $0x1, %edi
callq 0x2210
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/emulator.cpp
// Function: parse_mem(char*, int*, unsigned int*, int, int)
void parse_mem(char* tok, int* reg, uint32_t* imm, int bits, int line) {
	char* imms = strtok(tok, "(");
	char* regs = strtok(NULL, ")");
	*imm = parse_imm(imms, bits, line);
	*reg = parse_reg(regs, line);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r14d
movl %ecx, %r15d
movq %rdx, %r12
movq %rsi, -0x30(%rbp)
leaq 0x83f4(%rip), %rsi      # 0xb645
callq 0x2320
movq %rax, %r13
leaq 0x83e7(%rip), %rsi      # 0xb647
xorl %edi, %edi
callq 0x2320
movq %rax, %rbx
movq %r13, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl $0x1, %ecx
callq 0x319b
movl %eax, (%r12)
movq %rbx, %rdi
movl %r14d, %esi
movl $0x1, %edx
callq 0x2d50
movq -0x30(%rbp), %rcx
movl %eax, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/emulator.cpp
// Function: mem_write(unsigned char*, unsigned int, unsigned int, instr_type)
void mem_write(uint8_t* mem, uint32_t addr, uint32_t data, instr_type op) {
	//printf( "Storing %x to %d\n", data, addr );
	int bytes = 0;
	switch (op ) {
		case SB: bytes = 1; break;
		case SH: bytes = 2; break;
		case SW: bytes = 4; break;
	}
	if ( addr < MEM_BYTES && addr + bytes <= MEM_BYTES ) {
		mem_write_reqs ++;
		int way = cache_peek(addr,bytes);
		if ( way < 0 ) {
			cache_flush(addr, mem);
			uint32_t waddr = addr-(addr&((1<<(2+CACHE_LINE_WORD_SZ))-1));
			for ( int i = 0; i < CACHE_LINE_WORD; i++ ) {
				cache_update(waddr+(i*4), *(uint32_t*)&(mem[waddr+(i*4)]));
			}
			mem_flush_words += CACHE_LINE_WORD;
		} else {
			cache_write_hits ++;
		}
		cache_write(addr,data,bytes);
	} else if ( addr == MEM_BYTES ) {
		printf( "[System output]: 0x%x\n", data );
	} else {
		printf( "0x%x -- 0x%x\n", addr, data);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r12
cmpl $0x23, %ecx
je 0x32db
cmpl $0x17, %ecx
je 0x32d3
xorl %r15d, %r15d
cmpl $0x16, %ecx
jne 0x32e1
movl $0x1, %r15d
jmp 0x32e1
movl $0x2, %r15d
jmp 0x32e1
movl $0x4, %r15d
cmpl $0x10000, %r14d         # imm = 0x10000
setb %al
leal (%r15,%r14), %ecx
cmpl $0x10001, %ecx          # imm = 0x10001
setb %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x331d
incl 0xb83f(%rip)            # 0xeb44
movl %r14d, %edi
movl %r15d, %esi
callq 0x25a7
testl %eax, %eax
js 0x3359
leaq 0xb82d(%rip), %rax      # 0xeb48
jmp 0x337d
cmpl $0x10000, %r14d         # imm = 0x10000
jne 0x333e
leaq 0x831c(%rip), %rdi      # 0xb649
movl %ebx, %esi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2040
leaq 0x831b(%rip), %rdi      # 0xb660
movl %r14d, %esi
movl %ebx, %edx
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2040
movl %r14d, %edi
movq %r12, %rsi
callq 0x2780
movl %r14d, %edi
andl $0xfffc, %edi           # imm = 0xFFFC
movl (%r12,%rdi), %esi
callq 0x270f
leaq 0xb7c3(%rip), %rax      # 0xeb40
incl (%rax)
movl %r14d, %edi
movl %ebx, %esi
movl %r15d, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2601
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/emulator.cpp
// Function: mem_read(unsigned char*, unsigned int, instr_type)
uint32_t mem_read(uint8_t* mem, uint32_t addr, instr_type op) {
	uint32_t ret = 0;
	int bytes = 0;

	switch(op) {
		case LB: 
		case LBU: bytes = 1; break;
		case LH:
		case LHU: bytes = 2; break;
		case LW:  bytes = 4; break;
	}
	if ( addr + bytes <= MEM_BYTES ) {
		mem_read_reqs ++;
		int way = cache_peek(addr,bytes);
		if ( way < 0 ) {
			cache_flush(addr, mem);
			mem_flush_words += CACHE_LINE_WORD;
			uint32_t waddr = addr-(addr&((1<<(2+CACHE_LINE_WORD_SZ))-1));
			for ( int i = 0; i < CACHE_LINE_WORD; i++ ) {
				cache_update(waddr+(i*4), *(uint32_t*)&(mem[waddr+(i*4)]));
			}
		} else {
			cache_read_hits++;
			//printf( "%x %d--\n", addr,way);
		}
		uint32_t cr = cache_read(addr,bytes);
		switch(op) {
			case LB: ret = signextend(cr, 8); break;
			case LBU: ret = (cr&0xff); break;
			case LH: ret = signextend(cr,16); break;
			case LHU: ret = (cr&0xffff); break;
			case LW: ret = cr; break;
		}
	}
	//printf( "Reading %x from %d\n", ret, addr );

	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %r13
addl $-0xe, %r14d
xorl %ebx, %ebx
movl $0x0, %r12d
cmpl $0x5, %r14d
ja 0x33cb
movl %r14d, %eax
leaq 0x80b9(%rip), %rcx      # 0xb480
movl (%rcx,%rax,4), %r12d
leal (%r12,%r15), %eax
cmpl $0x10000, %eax          # imm = 0x10000
ja 0x345d
incl 0xb76c(%rip)            # 0xeb4c
movl %r15d, %edi
movl %r12d, %esi
callq 0x25a7
testl %eax, %eax
js 0x33f7
incl 0xb75b(%rip)            # 0xeb50
jmp 0x3418
movl %r15d, %edi
movq %r13, %rsi
callq 0x2780
incl 0xb738(%rip)            # 0xeb40
movl %r15d, %edi
andl $-0x4, %edi
movl (%r13,%rdi), %esi
callq 0x270f
movl %r15d, %edi
movl %r12d, %esi
callq 0x268d
cmpl $0x5, %r14d
ja 0x345d
leaq 0x4c00(%rip), %rcx      # 0x8030
movslq (%rcx,%r14,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movsbl %al, %ebx
andl $0xffffff00, %ebx       # imm = 0xFFFFFF00
jmp 0x344d
movswl %ax, %ebx
andl $0xffff0000, %ebx       # imm = 0xFFFF0000
orl %eax, %ebx
jmp 0x345d
movzbl %al, %ebx
jmp 0x345d
movzwl %ax, %ebx
jmp 0x345d
movl %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/emulator.cpp
// Function: append_source(char const*, char const*, char const*, char const*, source*, instr*)
void append_source(const char* op, const char* a1, const char* a2, const char* a3, source* src, instr* i) {
	char tbuf[128]; // not safe... static size... but should be okay since label length enforced
	if ( op && a1 && !a2 && !a3 ) {
		sprintf(tbuf, "%s %s", op, a1);
	} else if ( op && a1 && a2 && !a3 ) {
		sprintf(tbuf, "%s %s, %s", op, a1, a2);
	} else if ( op && a1 && a2 && a3 ) {
		sprintf(tbuf, "%s %s, %s, %s", op, a1, a2, a3);
	} else {
		return;
	}
	int slen = strlen(tbuf);
	if ( slen + src->offset < MAX_SRC_LEN ) {
		strncpy(src->src+src->offset, tbuf, strlen(tbuf));

		i->psrc = src->src+src->offset;
		src->offset += slen+1;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %r9, %r14
movq %r8, %rbx
movq %rcx, %r9
movq %rdx, %r8
movq %rsi, %rcx
movq %rdi, %rdx
testq %rdi, %rdi
setne %sil
testq %rcx, %rcx
setne %al
andb %sil, %al
movl %eax, %esi
xorb $0x1, %sil
testq %r8, %r8
setne %dil
testq %r9, %r9
setne %r10b
orb %dil, %r10b
orb %sil, %r10b
je 0x34fb
testq %r9, %r9
setne %sil
testq %r8, %r8
setne %dil
andb %dil, %al
xorb $0x1, %al
orb %al, %sil
je 0x3512
testq %r9, %r9
sete %sil
orb %sil, %al
jne 0x356c
leaq 0x8193(%rip), %rsi      # 0xb67e
leaq -0xa0(%rbp), %rdi
xorl %eax, %eax
callq 0x2060
jmp 0x3527
leaq 0x816c(%rip), %rsi      # 0xb66e
leaq -0xa0(%rbp), %rdi
xorl %eax, %eax
callq 0x2060
jmp 0x3527
leaq 0x815b(%rip), %rsi      # 0xb674
leaq -0xa0(%rbp), %rdi
xorl %eax, %eax
callq 0x2060
leaq -0xa0(%rbp), %rdi
callq 0x20f0
movq %rax, %r15
movslq 0x8(%rbx), %rdi
addl %edi, %eax
cmpl $0xfffff, %eax          # imm = 0xFFFFF
jg 0x356c
addq (%rbx), %rdi
leaq -0xa0(%rbp), %rsi
movq %r15, %rdx
callq 0x2100
movslq 0x8(%rbx), %rax
leal (%r15,%rax), %ecx
incl %ecx
addq (%rbx), %rax
movq %rax, 0x88(%r14)
movl %ecx, 0x8(%rbx)
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/emulator.cpp
// Function: parse_data_element(int, int, unsigned char*, int)
int parse_data_element(int line, int size, uint8_t* mem, int offset) {
	while (char* t = strtok(NULL, " \t\r\n") ) {
		errno = 0;
		int64_t v = strtol(t, NULL, 0);
		int64_t vs = (v>>(size*8));
		if ( errno == ERANGE || (vs > 0 && vs != -1 ) ) {
			printf( "Value out of bounds at line %d : %s\n", line, t);
			exit(2);
		}
		//printf ( "parse_data_element %d: %d %ld %d %d\n", line, size, v, errno, sizeof(long int));
		memcpy(&mem[offset], &v, size);
		offset += size;
		//strtok(NULL, ",");
	}
	return offset;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
movq %rdx, %r15
movl %esi, %r14d
movl %edi, %r13d
leaq 0x80b2(%rip), %rsi      # 0xb69c
xorl %edi, %edi
callq 0x2320
testq %rax, %rax
je 0x3670
movq %rax, %r12
movl %r13d, -0x2c(%rbp)
callq 0x2030
movq %rax, %r13
leal (,%r14,8), %eax
movq %rax, -0x38(%rbp)
movslq %r14d, %r14
movslq %ebx, %rax
addq %rax, %r15
movl $0x0, (%r13)
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2290
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rcx
sarq %cl, %rax
cmpl $0x22, (%r13)
je 0x3681
testq %rax, %rax
jg 0x3681
movq %r15, %rdi
leaq -0x40(%rbp), %rsi
movq %r14, %rdx
callq 0x2150
xorl %edi, %edi
leaq 0x803f(%rip), %rsi      # 0xb69c
callq 0x2320
movq %rax, %r12
addq %r14, %r15
addl %r14d, %ebx
testq %rax, %rax
jne 0x361a
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8019(%rip), %rdi      # 0xb6a1
movl -0x2c(%rbp), %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2040
movl $0x2, %edi
callq 0x2210
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/emulator.cpp
// Function: parse_data_zero(int, unsigned char*, int)
int parse_data_zero(int line, uint8_t* mem, int offset) {
	char* t = strtok(NULL, " \t\r\n");
	int bytes = atoi(t);
	memset(&mem[offset], 0, bytes);

	return offset + bytes;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
leaq 0x7fe7(%rip), %rsi      # 0xb69c
xorl %edi, %edi
callq 0x2320
movq %rax, %rdi
callq 0x2310
movslq %ebx, %r15
addq %r15, %r14
movslq %eax, %rbx
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x2120
addl %r15d, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/emulator.cpp
// Function: parse_assembler_directive(int, char*, unsigned char*, int)
int parse_assembler_directive(int line, char* ftok, uint8_t* mem, int memoff) {
	//printf( "assembler directive %s\n", ftok );
	if ( 0 == memcmp(ftok, ".text", strlen(ftok) ) ) {
		if (strtok(NULL, " \t\r\n") ) {
			print_syntax_error(line, "Tokens after assembler directive");
		}
		//cur_section = SECTION_TEXT;
		memoff = TEXT_OFFSET;
		//printf( "starting text section\n" );
	} else if ( 0 == memcmp(ftok, ".data", strlen(ftok) ) ) {
		//cur_section = SECTION_TEXT;
		memoff = DATA_OFFSET;
		//printf( "starting data section\n" );
	} else if ( 0 == memcmp(ftok, ".byte", strlen(ftok)) ) memoff = parse_data_element(line, 1, mem, memoff);
	else if ( 0 == memcmp(ftok, ".half", strlen(ftok)) ) memoff = parse_data_element(line, 2, mem, memoff);
	else if ( 0 == memcmp(ftok, ".word", strlen(ftok)) ) memoff = parse_data_element(line, 4, mem, memoff);
	else if ( 0 == memcmp(ftok, ".zero", strlen(ftok)) ) memoff = parse_data_zero(line, mem, memoff);
	else {
		printf( "Undefined assembler directive at line %d: %s\n", line, ftok );
		//exit(3);
	}
	return memoff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r12
movl %edi, %r15d
movq %rsi, %rdi
callq 0x20f0
movq %rax, %r13
leaq 0x7fb1(%rip), %rsi      # 0xb6c6
movq %r12, %rdi
movq %rax, %rdx
callq 0x21c0
testl %eax, %eax
je 0x37c0
leaq 0x7fbe(%rip), %rsi      # 0xb6ed
movq %r12, %rdi
movq %r13, %rdx
callq 0x21c0
testl %eax, %eax
je 0x37f7
leaq 0x7faa(%rip), %rsi      # 0xb6f3
movq %r12, %rdi
movq %r13, %rdx
callq 0x21c0
testl %eax, %eax
je 0x380d
leaq 0x7f96(%rip), %rsi      # 0xb6f9
movq %r12, %rdi
movq %r13, %rdx
callq 0x21c0
testl %eax, %eax
je 0x3817
leaq 0x7f82(%rip), %rsi      # 0xb6ff
movq %r12, %rdi
movq %r13, %rdx
callq 0x21c0
testl %eax, %eax
je 0x3821
leaq 0x7f6e(%rip), %rsi      # 0xb705
movq %r12, %rdi
movq %r13, %rdx
callq 0x21c0
testl %eax, %eax
je 0x3841
leaq 0x7f5a(%rip), %rdi      # 0xb70b
movl %r15d, %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2040
jmp 0x37fc
leaq 0x7ed5(%rip), %rsi      # 0xb69c
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x2320
testq %rax, %rax
je 0x37fc
leaq 0x7d64(%rip), %rdi      # 0xb540
leaq 0x7ee9(%rip), %rdx      # 0xb6cc
movl %r15d, %esi
xorl %eax, %eax
callq 0x2040
movl $0x1, %edi
callq 0x2210
movl $0x8000, %ebx           # imm = 0x8000
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r15d, %edi
movl $0x1, %esi
jmp 0x3829
movl %r15d, %edi
movl $0x2, %esi
jmp 0x3829
movl %r15d, %edi
movl $0x4, %esi
movq %r14, %rdx
movl %ebx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x35c7
leaq 0x7e54(%rip), %rsi      # 0xb69c
xorl %edi, %edi
callq 0x2320
movq %rax, %rdi
callq 0x2310
movslq %ebx, %rcx
addq %rcx, %r14
movslq %eax, %r15
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x2120
addl %ebx, %r15d
movl %r15d, %ebx
jmp 0x37fc
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/emulator.cpp
// Function: main
int
main(int argc, char** argv) {
	if ( argc < 2 ) {
		printf( "usage: %s asmfile\n", argv[0] );
		exit(1);
	}

	FILE* fin = fopen(argv[1], "r" );
	if ( !fin ) {
		printf( "%s: No such file\n", argv[1] );
		exit(2);
	}

	bool start_immediate = false;
	if ( argc >= 3 ) {
		start_immediate = true;
	}


	//ProcessorState* ps = new ProcessorState();
	
	int memoff = 0;
	uint8_t* mem = (uint8_t*)malloc(MEM_BYTES);
	instr* imem = (instr*)malloc(DATA_OFFSET*sizeof(instr)/4);
	label_loc* labels = (label_loc*)malloc(MAX_LABEL_COUNT*sizeof(label_loc));
	int label_count = 0;
	source src;
	src.offset = 0;
	src.src = (char*)malloc(sizeof(char)*MAX_SRC_LEN);

	if ( !mem || !labels || !imem || !src.src ) {
		printf( "Memory allocation failed\n" );
		exit(2);
	}

	for ( int i = 0; i < DATA_OFFSET/4; i++ ) {
		imem[i].op = UNIMPL;
		imem[i].a1.type = OPTYPE_NONE;
		imem[i].a2.type = OPTYPE_NONE;
		imem[i].a3.type = OPTYPE_NONE;
	}

	parse(fin, mem, imem, memoff, labels, label_count, &src);
	normalize_labels(imem, labels, label_count, &src);
	
	execute(mem, imem, labels, label_count, start_immediate);

	printf( "Execution done!\n" );
	exit(0);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
cmpl $0x1, %edi
jg 0x564f
movq (%rbx), %rsi
leaq 0x6316(%rip), %rdi      # 0xb954
xorl %eax, %eax
callq 0x2040
movl $0x1, %edi
callq 0x2210
movl %edi, %r15d
movq 0x8(%rbx), %rdi
leaq 0x5f84(%rip), %rsi      # 0xb5e1
callq 0x2200
testq %rax, %rax
jne 0x567e
movq 0x8(%rbx), %rsi
leaq 0x62f5(%rip), %rdi      # 0xb967
xorl %eax, %eax
callq 0x2040
jmp 0x577b
movq %rax, -0x38(%rbp)
xorl %ebx, %ebx
movl %ebx, -0x30(%rbp)
movl $0x10000, %edi          # imm = 0x10000
callq 0x2260
movq %rax, %r13
movl $0x130000, %edi         # imm = 0x130000
callq 0x2260
movq %rax, %r14
movl $0x1200, %edi           # imm = 0x1200
callq 0x2260
movq %rax, %r12
movl %ebx, -0x2c(%rbp)
movl %ebx, -0x40(%rbp)
movl $0x100000, %edi         # imm = 0x100000
callq 0x2260
movq %rax, -0x48(%rbp)
testq %r13, %r13
sete %cl
testq %r12, %r12
sete %dl
orb %cl, %dl
testq %r14, %r14
sete %cl
testq %rax, %rax
sete %al
orb %cl, %al
orb %dl, %al
jne 0x576f
movq %r13, %rsi
movq %r12, %r13
xorl %eax, %eax
movq $0x0, (%r14,%rax)
movl %ebx, 0x30(%r14,%rax)
movl %ebx, 0x5c(%r14,%rax)
addq $0x98, %rax
cmpq $0x130000, %rax         # imm = 0x130000
jne 0x56ee
xorl %ebx, %ebx
cmpl $0x2, %r15d
setne %bl
leaq -0x48(%rbp), %rax
movq %rax, (%rsp)
leaq -0x30(%rbp), %rcx
leaq -0x2c(%rbp), %r15
movq -0x38(%rbp), %rdi
movq %rsi, %r12
movq %r14, %rdx
movq %r13, %r8
movq %r15, %r9
callq 0x46c2
movl (%r15), %edx
movq %r14, %rdi
movq %r13, %rsi
leaq -0x48(%rbp), %rcx
callq 0x53ee
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %r8d
callq 0x48f1
leaq 0x63d3(%rip), %rdi      # 0xbb36
callq 0x22e0
xorl %edi, %edi
callq 0x2210
leaq 0x63a7(%rip), %rdi      # 0xbb1d
callq 0x22e0
movl $0x2, %edi
callq 0x2210
nop
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/./linenoise.hpp
// Function: linenoise::linenoiseRaw(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
inline bool linenoiseRaw(const char *prompt, std::string& line) {
    bool quit = false;

    if (!isatty(STDIN_FILENO)) {
        /* Not a tty: read from file / pipe. */
        std::getline(std::cin, line);
    } else {
        /* Interactive editing. */
        if (enableRawMode(STDIN_FILENO) == false) {
            return quit;
        }

        char buf[LINENOISE_MAX_LINE];
        auto count = linenoiseEdit(STDIN_FILENO, STDOUT_FILENO, buf, LINENOISE_MAX_LINE, prompt);
        if (count == -1) {
            quit = true;
        } else {
            line.assign(buf, count);
        }

        disableRawMode(STDIN_FILENO);
        printf("\n");
    }
    return quit;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq %rsi, %rbx
movq %rdi, %r14
xorl %edi, %edi
callq 0x2360
testl %eax, %eax
je 0x5950
xorl %edi, %edi
callq 0x2360
testl %eax, %eax
je 0x5943
cmpb $0x0, 0x930d(%rip)      # 0xeb54
jne 0x585c
leaq 0x692(%rip), %rdi       # 0x5ee2
callq 0x74b0
movb $0x1, 0x92f8(%rip)      # 0xeb54
leaq 0x92f5(%rip), %rsi      # 0xeb58
xorl %edi, %edi
callq 0x21e0
cmpl $-0x1, %eax
je 0x5943
movups 0x92de(%rip), %xmm0     # 0xeb58
leaq -0x1010(%rbp), %rdx
movaps %xmm0, (%rdx)
movups 0x92dd(%rip), %xmm0     # 0xeb68
movaps %xmm0, 0x10(%rdx)
movups 0x92ee(%rip), %xmm0     # 0xeb84
movups %xmm0, 0x2c(%rdx)
movups 0x92d7(%rip), %xmm0     # 0xeb78
andl $0xfffffacd, (%rdx)     # imm = 0xFFFFFACD
movaps %xmm0, 0x20(%rdx)
orb $0x30, 0x8(%rdx)
andl $0xffff7ff4, 0xc(%rdx)  # imm = 0xFFFF7FF4
movw $0x100, 0x16(%rdx)      # imm = 0x100
xorl %edi, %edi
movl $0x2, %esi
callq 0x2250
testl %eax, %eax
js 0x5943
movb $0x1, 0x92c1(%rip)      # 0xeb94
leaq -0x1010(%rbp), %rdx
xorl %edi, %edi
movl $0x1, %esi
movl $0x1000, %ecx           # imm = 0x1000
movq %r14, %r8
callq 0x598b
cmpl $-0x1, %eax
sete %r14b
je 0x590f
movslq %eax, %r8
movq 0x8(%rbx), %rdx
leaq -0x1010(%rbp), %rcx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x22f0
cmpb $0x1, 0x927e(%rip)      # 0xeb94
jne 0x5937
leaq 0x9239(%rip), %rdx      # 0xeb58
xorl %edi, %edi
movl $0x2, %esi
callq 0x2250
cmpl $-0x1, %eax
je 0x5937
movb $0x0, 0x925d(%rip)      # 0xeb94
movl $0xa, %edi
callq 0x2270
jmp 0x597c
callq 0x2030
movl $0x19, (%rax)
jmp 0x5979
movq 0x8681(%rip), %r14      # 0xdfd8
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2390
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/./linenoise.hpp
// Function: linenoise::unicodeReadUTF8Char(int, char*, int*)
inline int unicodeReadUTF8Char(int fd, char* buf, int* cp)
{
    int nread = read(fd,&buf[0],1);

    if (nread <= 0) { return nread; }

    unsigned char byte = buf[0];

    if ((byte & 0x80) == 0) {
        ;
    } else if ((byte & 0xE0) == 0xC0) {
        nread = read(fd,&buf[1],1);
        if (nread <= 0) { return nread; }
    } else if ((byte & 0xF0) == 0xE0) {
        nread = read(fd,&buf[1],2);
        if (nread <= 0) { return nread; }
    } else if ((byte & 0xF8) == 0xF0) {
        nread = read(fd,&buf[1],3);
        if (nread <= 0) { return nread; }
    } else {
        return -1;
    }

    return unicodeUTF8CharToCodePoint(buf, 4, cp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %r15d
movl $0x1, %edx
callq 0x22b0
testl %eax, %eax
jle 0x6144
movzbl (%r14), %ecx
movl $0x1, %r12d
testb %cl, %cl
js 0x614d
movl %ecx, (%rbx)
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %ecx, %eax
andl $-0x20, %eax
cmpl $0xc0, %eax
jne 0x6164
leaq 0x1(%r14), %rsi
movl $0x1, %edx
jmp 0x6194
movl %ecx, %eax
andl $-0x10, %eax
cmpl $0xe0, %eax
jne 0x617b
leaq 0x1(%r14), %rsi
movl $0x2, %edx
jmp 0x6194
andl $-0x8, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0xf0, %ecx
jne 0x6144
leaq 0x1(%r14), %rsi
movl $0x3, %edx
movl %r15d, %edi
callq 0x22b0
testl %eax, %eax
jle 0x6144
movzbl (%r14), %ecx
testb %cl, %cl
jns 0x613f
movl %ecx, %eax
andl $-0x20, %eax
cmpl $0xc0, %eax
jne 0x61c9
andl $0x1f, %ecx
shll $0x6, %ecx
movl $0x2, %r12d
movl $0x1, %edx
movl %ecx, %eax
jmp 0x6233
movl %ecx, %eax
andl $-0x10, %eax
cmpl $0xe0, %eax
jne 0x61f5
andl $0xf, %ecx
shll $0xc, %ecx
movzbl 0x1(%r14), %eax
andl $0x3f, %eax
shll $0x6, %eax
orl %ecx, %eax
movl $0x3, %r12d
movl $0x2, %edx
jmp 0x6233
movl %ecx, %edx
andl $-0x8, %edx
xorl %eax, %eax
cmpl $0xf0, %edx
jne 0x6144
andl $0x7, %ecx
shll $0x12, %ecx
movzbl 0x1(%r14), %edx
andl $0x3f, %edx
shll $0xc, %edx
orl %ecx, %edx
movzbl 0x2(%r14), %eax
andl $0x3f, %eax
shll $0x6, %eax
orl %edx, %eax
movl $0x4, %r12d
movl $0x3, %edx
movzbl (%r14,%rdx), %ecx
andl $0x3f, %ecx
orl %eax, %ecx
jmp 0x613f
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/./linenoise.hpp
// Function: linenoise::linenoiseEditBackspace(linenoise::linenoiseState*)
inline void linenoiseEditBackspace(struct linenoiseState *l) {
    if (l->pos > 0 && l->len > 0) {
        int glen = unicodePrevGraphemeLen(l->buf,l->pos);
        memmove(l->buf+l->pos-glen,l->buf+l->pos,l->len-l->pos);
        l->pos-=glen;
        l->len-=glen;
        l->buf[l->len] = '\0';
        refreshLine(l);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movslq 0x38(%rdi), %rax
testq %rax, %rax
jle 0x662c
movq %rdi, %rbx
movl 0x40(%rdi), %ecx
testl %ecx, %ecx
jle 0x662c
movq 0x8(%rbx), %rsi
leaq 0x1c92(%rip), %rdx      # 0x8180
movl %eax, %edi
movl %edi, %r10d
movl %edi, %r8d
decq %r8
testl %edi, %edi
jle 0x6514
movl %r8d, %r9d
movb (%rsi,%r9), %r9b
andb $-0x40, %r9b
decl %edi
decq %r8
negb %r9b
jo 0x64f9
jmp 0x6519
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
subl %edi, %r10d
jne 0x6526
xorl %r11d, %r11d
jmp 0x6605
movslq %edi, %r8
addq %rsi, %r8
movzbl (%r8), %r9d
movl %r9d, %r11d
testb %r9b, %r9b
jns 0x6605
movl %r9d, %r11d
andl $-0x20, %r11d
cmpl $0xc0, %r11d
jne 0x656f
movl $0x0, %r11d
cmpl $0x2, %r10d
jl 0x6605
andl $0x1f, %r9d
shll $0x6, %r9d
movl $0x1, %r10d
jmp 0x65f9
movl %r9d, %r11d
andl $-0x10, %r11d
cmpl $0xe0, %r11d
jne 0x65ab
movl $0x0, %r11d
cmpl $0x3, %r10d
jl 0x6605
andl $0xf, %r9d
shll $0xc, %r9d
movzbl 0x1(%r8), %r10d
andl $0x3f, %r10d
shll $0x6, %r10d
orl %r10d, %r9d
movl $0x2, %r10d
jmp 0x65f9
cmpl $0x4, %r10d
jl 0x651e
movl %r9d, %r10d
andl $-0x8, %r10d
movl $0x0, %r11d
cmpl $0xf0, %r10d
jne 0x6605
andl $0x7, %r9d
shll $0x12, %r9d
movzbl 0x1(%r8), %r10d
andl $0x3f, %r10d
shll $0xc, %r10d
orl %r9d, %r10d
movzbl 0x2(%r8), %r9d
andl $0x3f, %r9d
shll $0x6, %r9d
orl %r10d, %r9d
movl $0x3, %r10d
movzbl (%r8,%r10), %r11d
andl $0x3f, %r11d
orl %r9d, %r11d
movl %r11d, %r8d
xorl %r9d, %r9d
cmpq %r8, (%r9,%rdx)
je 0x6620
addq $0x8, %r9
cmpq $0x30f8, %r9            # imm = 0x30F8
jne 0x660b
jmp 0x6631
testl %edi, %edi
jg 0x64f0
xorl %edx, %edx
jmp 0x6635
popq %rbx
popq %r14
popq %rbp
retq
movl %eax, %edx
subl %edi, %edx
addq %rax, %rsi
movslq %edx, %r14
movq %rsi, %rdi
subq %r14, %rdi
subl %eax, %ecx
movslq %ecx, %rdx
callq 0x2350
subl %r14d, 0x38(%rbx)
movslq 0x40(%rbx), %rax
subq %r14, %rax
movl %eax, 0x40(%rbx)
movq 0x8(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x6be1
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/./linenoise.hpp
// Function: linenoise::linenoiseEditHistoryNext(linenoise::linenoiseState*, int)
inline void linenoiseEditHistoryNext(struct linenoiseState *l, int dir) {
    if (history.size() > 1) {
        /* Update the current history entry before to
         * overwrite it with the next one. */
        history[history.size() - 1 - l->history_index] = l->buf;
        /* Show the new entry */
        l->history_index += (dir == LINENOISE_HISTORY_PREV) ? 1 : -1;
        if (l->history_index < 0) {
            l->history_index = 0;
            return;
        } else if (l->history_index >= (int)history.size()) {
            l->history_index = static_cast<int>(history.size())-1;
            return;
        }
        memset(l->buf, 0, l->buflen);
        strcpy(l->buf,history[history.size() - 1 - l->history_index].c_str());
        l->len = l->pos = static_cast<int>(strlen(l->buf));
        refreshLine(l);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x8319(%rip), %rcx      # 0xeb30
movq 0x830a(%rip), %rax      # 0xeb28
subq %rax, %rcx
cmpq $0x21, %rcx
jb 0x68f6
movl %esi, %r14d
movq %rdi, %rbx
movq 0x8(%rdi), %r15
movslq 0x4c(%rdi), %rdx
notq %rdx
addq %rcx, %rax
shlq $0x5, %rdx
leaq (%rax,%rdx), %r12
movq 0x8(%rdx,%rax), %r13
movq %r15, %rdi
callq 0x20f0
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x22f0
xorl %eax, %eax
cmpl $0x1, %r14d
sete %al
leal -0x1(,%rax,2), %eax
addl 0x4c(%rbx), %eax
movl %eax, 0x4c(%rbx)
js 0x68e8
movq 0x82aa(%rip), %rcx      # 0xeb30
subq 0x829b(%rip), %rcx      # 0xeb28
shrq $0x5, %rcx
cmpl %ecx, %eax
jge 0x68f1
movq 0x8(%rbx), %rdi
movslq 0x10(%rbx), %rdx
xorl %esi, %esi
callq 0x2120
movq 0x8(%rbx), %rdi
movq 0x8281(%rip), %rax      # 0xeb30
movslq 0x4c(%rbx), %rcx
notq %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rsi
callq 0x2170
movq 0x8(%rbx), %rdi
callq 0x20f0
movl %eax, 0x38(%rbx)
movl %eax, 0x40(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6be1
movl $0x0, 0x4c(%rbx)
jmp 0x68f6
decl %ecx
movl %ecx, 0x4c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/./linenoise.hpp
// Function: linenoise::linenoiseEditInsert(linenoise::linenoiseState*, char const*, int)
inline int linenoiseEditInsert(struct linenoiseState *l, const char* cbuf, int clen) {
    if (l->len < l->buflen) {
        if (l->len == l->pos) {
            memcpy(&l->buf[l->pos],cbuf,clen);
            l->pos+=clen;
            l->len+=clen;;
            l->buf[l->len] = '\0';
            if ((!mlmode && unicodeColumnPos(l->prompt.c_str(), static_cast<int>(l->prompt.length()))+unicodeColumnPos(l->buf,l->len) < l->cols) /* || mlmode */) {
                /* Avoid a full update of the line in the
                 * trivial case. */
                if (write(l->ofd,cbuf,clen) == -1) return -1;
            } else {
                refreshLine(l);
            }
        } else {
            memmove(l->buf+l->pos+clen,l->buf+l->pos,l->len-l->pos);
            memcpy(&l->buf[l->pos],cbuf,clen);
            l->pos+=clen;
            l->len+=clen;
            l->buf[l->len] = '\0';
            refreshLine(l);
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movslq 0x40(%rdi), %rax
cmpl 0x10(%rdi), %eax
jge 0x69d9
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x38(%rdi), %rcx
movq 0x8(%rdi), %rsi
movslq %edx, %r15
cmpl %ecx, %eax
jne 0x6997
addq %rax, %rsi
movq %rsi, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2150
addl %r15d, 0x38(%rbx)
movslq 0x40(%rbx), %rax
addq %r15, %rax
movl %eax, 0x40(%rbx)
movq 0x8(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq 0x18(%rbx), %rdi
movl 0x20(%rbx), %esi
callq 0x6f77
movl %eax, %r12d
movq 0x8(%rbx), %rdi
movl 0x40(%rbx), %esi
callq 0x6f77
addl %r12d, %eax
cmpl 0x44(%rbx), %eax
jge 0x69d1
movl 0x4(%rbx), %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x20a0
cmpq $-0x1, %rax
jne 0x69d9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x69db
addq %rcx, %rsi
leaq (%rsi,%r15), %rdi
subl %ecx, %eax
movslq %eax, %rdx
callq 0x2350
movslq 0x38(%rbx), %rdi
addq 0x8(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2150
addl %r15d, 0x38(%rbx)
movslq 0x40(%rbx), %rax
addq %r15, %rax
movl %eax, 0x40(%rbx)
movq 0x8(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq %rbx, %rdi
callq 0x6be1
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/sangwoojun[P]rv32emulator/./linenoise.hpp
// Function: linenoise::unicodeGraphemeLen(char*, int, int)
inline int unicodeGraphemeLen(char* buf, int buf_len, int pos)
{
    if (pos == buf_len) {
        return 0;
    }
    int beg = pos;
    pos += unicodeUTF8CharLen(buf, buf_len, pos);
    while (pos < buf_len) {
        int len = unicodeUTF8CharLen(buf, buf_len, pos);
        int cp = 0;
        unicodeUTF8CharToCodePoint(buf + pos, len, &cp);
        if (!unicodeIsCombiningChar(cp)) {
            return pos - beg;
        }
        pos += len;
    }
    return pos - beg;
}

// Assembly:
xorl %eax, %eax
cmpl %esi, %edx
je 0x6be0
movslq %edx, %rax
movb (%rdi,%rax), %cl
movl $0x1, %eax
testb %cl, %cl
jns 0x6ab0
movl $0x2, %eax
cmpb $-0x20, %cl
jb 0x6ab0
cmpb $-0x10, %cl
movl $0x4, %eax
sbbl $0x0, %eax
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
addl %edx, %eax
cmpl %esi, %eax
jge 0x6bda
leaq 0x16b8(%rip), %rcx      # 0x8180
movl $0x2, %r8d
movslq %eax, %r11
movzbl (%rdi,%r11), %r10d
testb %r10b, %r10b
js 0x6ae6
movl $0x1, %r9d
jmp 0x6bb7
addq %rdi, %r11
cmpb $-0x10, %r10b
movl $0x4, %r9d
sbbl $0x0, %r9d
cmpb $-0x20, %r10b
cmovbl %r8d, %r9d
movl %r10d, %ebx
andl $-0x20, %ebx
cmpl $0xc0, %ebx
jne 0x6b2f
andl $0x1f, %r10d
shll $0x6, %r10d
movl $0x1, %r14d
movq %r10, %rbx
movzbl (%r11,%r14), %r10d
andl $0x3f, %r10d
orq %rbx, %r10
jmp 0x6bb7
movl %r10d, %ebx
andl $-0x10, %ebx
cmpl $0xe0, %ebx
jne 0x6b61
cmpb $-0x20, %r10b
jb 0x6bae
andl $0xf, %r10d
shll $0xc, %r10d
movzbl 0x1(%r11), %ebx
andl $0x3f, %ebx
shll $0x6, %ebx
orl %r10d, %ebx
movl $0x2, %r14d
jmp 0x6b1e
movl %r10d, %ebx
andl $-0x8, %ebx
cmpl $0xf0, %ebx
setne %bl
cmpl $0x4, %r9d
setb %r14b
orb %bl, %r14b
jne 0x6bb4
andl $0x7, %r10d
shll $0x12, %r10d
movzbl 0x1(%r11), %r14d
andl $0x3f, %r14d
shll $0xc, %r14d
orl %r10d, %r14d
movzbl 0x2(%r11), %ebx
andl $0x3f, %ebx
shll $0x6, %ebx
orl %r14d, %ebx
movl $0x3, %r14d
jmp 0x6b1e
movl $0x2, %r9d
xorl %r10d, %r10d
xorl %r11d, %r11d
cmpq %r10, (%r11,%rcx)
je 0x6bcf
addq $0x8, %r11
cmpq $0x30f8, %r11           # imm = 0x30F8
jne 0x6bba
jmp 0x6bda
addl %r9d, %eax
cmpl %esi, %eax
jl 0x6ace
subl %edx, %eax
popq %rbx
popq %r14
popq %rbp
retq