LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/hkbu-victor[P]SFastLDA/super_fast_final1_w.cpp
// Function: show_help()
void show_help(){
	printf("\nHKBU SuperFast Gibb's sampling for LDA\n");
	printf("\n word-by-word LDA modeling\n");
	printf("=====================================\n");
	printf("Command line usage:\n");
	printf("super_fast_final1_w -alpha <double> -beta <double> -ntopics <int> -niters <int> -dfile <string> -seed <int> -ofile <string>\n");
	printf("=====================================\n");
	printf("Parameters \t Type \t\t Descriptions\n");
	printf("-alpha\t\t<double> Hyper-parameter for documents-topic distributions\n");
    printf("-beta\t\t<double> Hyper-parameter for word-topic distributions \n");
    printf("-ntopics\t\t<int> Number of topics \n");
    printf("-niters\t\t<int> Number of Gibbs sampling iterations \n");
    printf("-seed\t\t<int> Random seed \n");
    printf("-dfile\t\t<file> Input training data file \n");
	printf("-ofile\t\t<file> The output WP file and Z file (in text format)\n");
}

// Assembly:
pushq %rbx
leaq 0x3076(%rip), %rdi      # 0x42fa
callq 0x1130
leaq 0x3092(%rip), %rdi      # 0x4322
callq 0x1130
leaq 0x3132(%rip), %rbx      # 0x43ce
movq %rbx, %rdi
callq 0x1130
leaq 0x3093(%rip), %rdi      # 0x433e
callq 0x1130
leaq 0x309b(%rip), %rdi      # 0x4352
callq 0x1130
movq %rbx, %rdi
callq 0x1130
leaq 0x3129(%rip), %rdi      # 0x43f4
callq 0x1130
leaq 0x313f(%rip), %rdi      # 0x4416
callq 0x1130
leaq 0x3176(%rip), %rdi      # 0x4459
callq 0x1130
leaq 0x31a8(%rip), %rdi      # 0x4497
callq 0x1130
leaq 0x31be(%rip), %rdi      # 0x44b9
callq 0x1130
leaq 0x31e6(%rip), %rdi      # 0x44ed
callq 0x1130
leaq 0x31f4(%rip), %rdi      # 0x4507
callq 0x1130
leaq 0x3211(%rip), %rdi      # 0x4530
popq %rbx
jmp 0x1130
// File: /workspace/github_cpp_makefile_star2_O2/hkbu-victor[P]SFastLDA/super_fast_final1_w.cpp
// Function: eval_BETA_D_2_norm()
void eval_BETA_D_2_norm(){
	double dtemp;
	for (int di=0; di<D; di++){
		BETA_D_2_norm[ di ] = 0.0;
		di_pair = dpPair[di];
		for (int j=0; j<D_pair_count[di]; j++){
			dtemp = (double) di_pair[j].value * BETA;
			BETA_D_2_norm[di] += dtemp * dtemp;
		}
	}
}

// Assembly:
movslq 0x5b93(%rip), %rax      # 0x710c
movq 0x5c48(%rip), %rcx      # 0x71c8
movq 0x5ca1(%rip), %rdx      # 0x7228
movq 0x5be2(%rip), %rsi      # 0x7170
xorl %edi, %edi
cmpq %rax, %rdi
jge 0x15db
andq $0x0, (%rcx,%rdi,8)
movq (%rdx,%rdi,8), %r8
movq %r8, 0x5c7b(%rip)       # 0x7220
movslq (%rsi,%rdi,4), %r9
xorpd %xmm0, %xmm0
xorl %r10d, %r10d
cmpq %r9, %r10
jge 0x15d6
cvtsi2sdl 0x4(%r8,%r10,8), %xmm1
mulsd 0x5bc4(%rip), %xmm1     # 0x7188
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, (%rcx,%rdi,8)
incq %r10
jmp 0x15b0
incq %rdi
jmp 0x1590
retq
// File: /workspace/github_cpp_makefile_star2_O2/hkbu-victor[P]SFastLDA/super_fast_final1_w.cpp
// Function: sort_dpPairIdx()
void sort_dpPairIdx(){
	int di, pair_count;

	for (di=0; di<D; di++){
		di_pair = dpPair[di];
		pair_count = D_pair_count[di];
		std::sort(di_pair, di_pair + pair_count, compare_D_DoublePair());
	}
}

// Assembly:
pushq %rbx
xorl %ebx, %ebx
movslq 0x59aa(%rip), %rax      # 0x710c
cmpq %rax, %rbx
jge 0x1792
movq 0x5aba(%rip), %rax      # 0x7228
movq (%rax,%rbx,8), %rdi
movq %rdi, 0x5aa7(%rip)      # 0x7220
movq 0x59f0(%rip), %rax      # 0x7170
movslq (%rax,%rbx,4), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x321a
incq %rbx
jmp 0x175b
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/dmonaldo[P]simple-network-file-system/client.cpp
// Function: main
int main(int argc, char **argv)
{
  Shell shell;

  if (argc == 2) {
    shell.mountNFS(string(argv[1]));
    shell.run();
  }
  else if (argc == 4 && strcmp(argv[1], "-s") == 0) {
    shell.mountNFS(string(argv[3]));
    shell.run_script(argv[2]);
  }
  else {
    cerr << "Invalid command line" << endl;
    cerr << "Usage (one of the following): " << endl;
    cerr << "./nfsclient server:port" << endl;
    cerr << "./nfsclient -s <script-name> server:port" << endl;
  }

  return 0;
}

// Assembly:
pushq %rbx
subq $0x50, %rsp
orl $-0x1, 0x8(%rsp)
movq %rsi, %rbx
movb $0x0, 0xc(%rsp)
cmpl $0x4, %edi
je 0x4488
cmpl $0x2, %edi
jne 0x449d
movq 0x8(%rbx), %rsi
leaq 0x30(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x3cae
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x251c
leaq 0x30(%rsp), %rdi
callq 0x2398
leaq 0x8(%rsp), %rdi
callq 0x3322
jmp 0x4500
movq 0x8(%rbx), %rax
cmpb $0x2d, (%rax)
jne 0x449d
cmpb $0x73, 0x1(%rax)
jne 0x449d
cmpb $0x0, 0x2(%rax)
je 0x4508
movq 0x3b4c(%rip), %rbx      # 0x7ff0
leaq 0xdbe(%rip), %rsi       # 0x5269
movq %rbx, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2110
leaq 0xdbc(%rip), %rsi       # 0x527e
movq %rbx, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2110
leaq 0xdc4(%rip), %rsi       # 0x529d
movq %rbx, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2110
leaq 0xdc5(%rip), %rsi       # 0x52b5
movq %rbx, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2110
xorl %eax, %eax
addq $0x50, %rsp
popq %rbx
retq
movq 0x18(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x3cae
leaq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x251c
leaq 0x10(%rsp), %rdi
callq 0x2398
movq 0x10(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x37b6
jmp 0x4500
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0x4558
jmp 0x455f
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2398
jmp 0x4562
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: signExtend(long, int)
uint64_t signExtend(int64_t x,int n)
{
	int mask = 0x1;
	uint64_t tmpval = 0;
	int sign = x & (mask<<n);
	REP(i,0,n-1)
		tmpval += x & (mask << i);
	if(sign)
	{
		tmpval -= sign;
	}

	return tmpval;
		
}

// Assembly:
xorl %eax, %eax
testl %esi, %esi
movl $0x0, %r8d
cmovgl %esi, %r8d
pushq $0x1
popq %rdx
xorl %ecx, %ecx
cmpl %ecx, %r8d
je 0x1317
movl %edx, %r9d
shll %cl, %r9d
movslq %r9d, %r9
andq %rdi, %r9
addq %r9, %rax
incl %ecx
jmp 0x12ff
movl %esi, %ecx
shll %cl, %edx
andl %edx, %edi
movslq %edi, %rcx
subq %rcx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: BBRL(int, int)
void BBRL(int sw,int RN)
{
	//unconditional register branch
	assert(RN>= 0 && RN <= 31);
	uint64_t target = R[RN].getData();
	NIO = R[RN].getData() - PC.getData();
	if(sw == 0)
	{
		printf(" [log]-unconditional branch(register)\n");

		PC.setData(target);
	}
	else
	{
 		printf("[log]-unconditional call(register)\n");
		//first save the address of next instruction
		R[30].setData(PC.getData());
		subroutine++;
		PC.setData(target);
	}

}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
cmpl $0x20, %esi
jae 0x13ca
movl %edi, %ebp
movl %esi, %eax
leaq 0x8d98(%rip), %rcx      # 0xa0e0
leaq (%rcx,%rax,8), %r14
movq %r14, %rdi
callq 0x5b22
movq %rax, %rbx
movq %r14, %rdi
callq 0x5b22
movq %rax, %r14
leaq 0x18e7f(%rip), %rdi     # 0x1a1e8
callq 0x5b22
subl %eax, %r14d
movl %r14d, 0x18e80(%rip)    # 0x1a1f8
testl %ebp, %ebp
je 0x13ab
leaq 0x4f81(%rip), %rdi      # 0x6304
callq 0x1120
leaq 0x18e59(%rip), %rdi     # 0x1a1e8
callq 0x5b22
leaq 0x8e35(%rip), %rdi      # 0xa1d0
movq %rax, %rsi
callq 0x5b2a
incl 0x1de57(%rip)           # 0x1f200
jmp 0x13b7
leaq 0x4f75(%rip), %rdi      # 0x6327
callq 0x1120
leaq 0x18e2a(%rip), %rdi     # 0x1a1e8
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x5b2a
leaq 0x4cab(%rip), %rdi      # 0x607c
leaq 0x4cb7(%rip), %rsi      # 0x608f
leaq 0x4cc3(%rip), %rcx      # 0x60a2
pushq $0x1a
popq %rdx
callq 0x1070
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: BBL(int, unsigned long)
void BBL(int sw,uint64_t offset)
{

	NIO = offset - PC.getData();		
	//unconditional immediate branch
	if(sw == 0)
	{
		printf(" [log]-unconditional branch(immediate)\n");
		PC.setData(offset);
	}
	else
	{
		printf("[log]-unconditional call(immediate)\n");
		subroutine++;
		R[30].setData(PC.getData());
		PC.setData(offset); 
	}
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x18df2(%rip), %rdi     # 0x1a1e8
callq 0x5b22
movl %ebx, %ecx
subl %eax, %ecx
movl %ecx, 0x18df3(%rip)     # 0x1a1f8
testl %ebp, %ebp
je 0x1438
leaq 0x4f3d(%rip), %rdi      # 0x634d
callq 0x1120
incl 0x1dde5(%rip)           # 0x1f200
leaq 0x18dc6(%rip), %rdi     # 0x1a1e8
callq 0x5b22
leaq 0x8da2(%rip), %rdi      # 0xa1d0
movq %rax, %rsi
callq 0x5b2a
jmp 0x1444
leaq 0x4f32(%rip), %rdi      # 0x6371
callq 0x1120
leaq 0x18d9d(%rip), %rdi     # 0x1a1e8
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5b2a
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: BCOND(unsigned long, int)
void BCOND(uint64_t offset,int condition)
{

	int cond = (condition&0x0000000e)>>1;
	bool result;
	switch(cond)
	{
		case 0:
			result = ZFLAG;
			break;
		case 1:
			result = CFLAG;
			break;
		case 2:
			result = NFLAG;
			break;
		case 3:
			result = OFLAG;
			break;
		case 4:
			result = CFLAG && !ZFLAG;
			break;
		case 5:
			result = NFLAG == OFLAG;
			break;
		case 6:
			result = (NFLAG== OFLAG)&& !ZFLAG ;
			break;
		case 7:
			result = true;
			break;


	}

	if((condition &0x01) && condition != 15)
		result = !result;

	if(result)
		BBL(0,offset);

}

// Assembly:
movq %rdi, %rax
movl %esi, %ecx
shrl %ecx
andl $0x7, %ecx
leaq 0x4b9a(%rip), %rdx      # 0x6004
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movb 0x8c58(%rip), %cl       # 0xa0d1
jmp 0x14df
movb 0x8c50(%rip), %cl       # 0xa0d1
xorb $0x1, %cl
movzbl %cl, %edx
xorl %ecx, %ecx
cmpb $0x0, 0x8c44(%rip)      # 0xa0d4
cmovnel %edx, %ecx
jmp 0x14df
movb 0x8c38(%rip), %cl       # 0xa0d3
jmp 0x14df
movb 0x8c2f(%rip), %cl       # 0xa0d2
jmp 0x14df
movb $0x1, %cl
jmp 0x14df
movb 0x8c25(%rip), %cl       # 0xa0d4
jmp 0x14df
movb 0x8c1c(%rip), %cl       # 0xa0d3
cmpb 0x8c15(%rip), %cl       # 0xa0d2
sete %cl
jmp 0x14df
movb 0x8c0b(%rip), %cl       # 0xa0d3
movb 0x8c03(%rip), %dl       # 0xa0d1
xorb $0x1, %dl
xorl %edi, %edi
cmpb 0x8bf9(%rip), %cl       # 0xa0d2
movzbl %dl, %ecx
cmovnel %edi, %ecx
cmpl $0xf, %esi
setne %dl
andb %sil, %dl
cmpb %dl, %cl
jne 0x14ed
retq
xorl %edi, %edi
movq %rax, %rsi
jmp 0x13e7
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: CBZNZ(int, int, int, unsigned long)
void CBZNZ(int sf,int sw,int RT,uint64_t offset)
{
	uint64_t dat;
	if(sf==1)
		dat = R[RT].getData();
	else if (sf == 0)
		dat = R[RT].getLowerData();

	if(sw == 0)
	{
		printf("[log]- CBZ instruction ");
		if(dat == 0)
			BBL(0,offset);
	}
	else if(sw ==1)
	{
		printf("[log]- CBNZ instruction ");
		if(dat != 0)
			BBL(0,offset);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rcx, %rbx
movl %esi, %ebp
testl %edi, %edi
je 0x1521
cmpl $0x1, %edi
jne 0x1537
movslq %edx, %rax
leaq 0x8bcd(%rip), %rcx      # 0xa0e0
leaq (%rcx,%rax,8), %rdi
callq 0x5b22
movq %rax, %r14
jmp 0x1537
movslq %edx, %rax
leaq 0x8bb5(%rip), %rcx      # 0xa0e0
leaq (%rcx,%rax,8), %rdi
callq 0x5b26
movl %eax, %r14d
cmpl $0x1, %ebp
je 0x1558
testl %ebp, %ebp
jne 0x1553
leaq 0x4b6f(%rip), %rdi      # 0x60b6
xorl %eax, %eax
callq 0x1030
testq %r14, %r14
je 0x156b
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x4b6f(%rip), %rdi      # 0x60ce
xorl %eax, %eax
callq 0x1030
testq %r14, %r14
je 0x1553
xorl %edi, %edi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x13e7
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: RET(int)
void RET(int n = 30)
{
	if(skip )
	{
		skip = false;
		return;
	}
	printf("[log] - RET instruction\n");
	assert(n>= 0 && n <= 31);
	NIO = R[n].getData() - PC.getData();
	subroutine--;
	PC.setData(R[n].getData());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpb $0x1, 0x18c78(%rip)     # 0x1a1fd
jne 0x1594
movb $0x0, 0x18c6f(%rip)     # 0x1a1fd
popq %rbx
popq %r14
popq %r15
retq
movl %edi, %ebx
leaq 0x4dfb(%rip), %rdi      # 0x6398
callq 0x1120
cmpl $0x20, %ebx
jae 0x15f6
movl %ebx, %eax
leaq 0x8b30(%rip), %rcx      # 0xa0e0
leaq (%rcx,%rax,8), %rbx
movq %rbx, %rdi
callq 0x5b22
movq %rax, %r14
leaq 0x18c22(%rip), %r15     # 0x1a1e8
movq %r15, %rdi
callq 0x5b22
subl %eax, %r14d
movl %r14d, 0x18c20(%rip)    # 0x1a1f8
decl 0x1dc22(%rip)           # 0x1f200
movq %rbx, %rdi
callq 0x5b22
movq %r15, %rdi
movq %rax, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x5b2a
leaq 0x4aea(%rip), %rdi      # 0x60e7
leaq 0x4a8b(%rip), %rsi      # 0x608f
leaq 0x4aed(%rip), %rcx      # 0x60f8
movl $0x8c, %edx
callq 0x1070
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: ASR(int, int, int, int, int)
void ASR(int sf, int sw, int op1, int op2, int  op3 )
{
    if(sf)
    {
        if(sw == 0) //immediate
        {
	   printf("[log] - ASR 64 bit immediate\n");
            uint64_t op2_data = R[op2].getData();
            uint64_t dat;
            dat = op2_data >> op3;
            R[op1].setData(dat);
            
        }
        
        else //register
        {
            uint64_t op2_data = R[op2].getData();
            uint64_t op3_data = R[op3].getData();
            uint64_t dat;
            dat = op2_data >> op3_data;
            R[op1].setData(dat);
            
        }
    }
    
    else    //32 bit registers
    {
        if(sw == 0) //immediate
        {
	    printf("[log] - ASR instruction - 32 bit \n");
            int op2_data = R[op2].getLowerData();
            int dat;
            dat = op2_data >> op3;
            R[op1].setLowerData(dat);
        }
        
        else    //register
        {
            int op2_data = R[op2].getLowerData();
            int op3_data = R[op3].getLowerData();
            int dat;
            dat = op2_data >> op3_data;
            R[op1].setLowerData(dat);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r8d, %ebp
movl %ecx, %r14d
movl %edx, %ebx
testl %edi, %edi
je 0x18ec
testl %esi, %esi
je 0x1923
movslq %r14d, %rax
leaq 0x881d(%rip), %r15      # 0xa0e0
leaq (%r15,%rax,8), %rdi
callq 0x5b22
movq %rax, %r14
movslq %ebp, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5b22
movl %eax, %ecx
shrq %cl, %r14
movslq %ebx, %rax
leaq (%r15,%rax,8), %rdi
movq %r14, %rsi
jmp 0x1951
testl %esi, %esi
je 0x1960
movslq %r14d, %rax
leaq 0x87e6(%rip), %r15      # 0xa0e0
leaq (%r15,%rax,8), %rdi
callq 0x5b26
movl %eax, %r14d
movslq %ebp, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5b26
movl %eax, %ecx
sarl %cl, %r14d
movslq %ebx, %rax
leaq (%r15,%rax,8), %rdi
movl %r14d, %esi
jmp 0x198c
leaq 0x4b53(%rip), %rdi      # 0x647d
callq 0x1120
movslq %r14d, %rax
leaq 0x87a7(%rip), %r14      # 0xa0e0
leaq (%r14,%rax,8), %rdi
callq 0x5b22
movl %ebp, %ecx
shrq %cl, %rax
movslq %ebx, %rcx
leaq (%r14,%rcx,8), %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5b2a
leaq 0x4af4(%rip), %rdi      # 0x645b
callq 0x1120
movslq %r14d, %rax
leaq 0x876a(%rip), %r14      # 0xa0e0
leaq (%r14,%rax,8), %rdi
callq 0x5b26
movl %ebp, %ecx
sarl %cl, %eax
movslq %ebx, %rcx
leaq (%r14,%rcx,8), %rdi
movl %eax, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5b30
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: LSL(int, int, int, int, int)
void LSL(int sf, int sw,int op1, int op2, int  op3 )
{
	//op1 = RD
	//op2 = RN
	//op3 = immRM
    if(sf)  //64 bit registers
    {
        if(sw == 0) //immediate
        {
   	    printf("[log] - LSL 64 bit immediate\n");
            uint64_t op2_data = R[op2].getData();
            uint64_t dat;
            dat = op2_data << (op3 % 64);
            R[op1].setData(dat);
        }
        
        else    //register
        {
	    printf("[log] - LSL 64 bit register\n");
            uint64_t op2_data = R[op2].getData();
            uint64_t op3_data = R[op3].getData();
            uint64_t dat;
            dat = op2_data << (op3_data % 64);
            R[op1].setData(dat);
        }
    }
    
    else    //32 bit registers
    {
        if(sw == 0) //immediate
        {
	    printf("[log] - LSL 32 bit immediate\n");
            int op2_data = R[op2].getLowerData();
            int dat = op2_data << (op3 % 32);
            R[op1].setLowerData(dat);
        }
        
        else    //register
        {
        	printf("[log] - LSL 32 bit register\n");
            int op2_data = R[op2].getLowerData();
            int op3_data = R[op3].getLowerData();
            int dat = op2_data << (op3_data % 32);
            R[op1].setLowerData(dat);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r8d, %ebp
movl %edx, %ebx
movslq %ecx, %rax
leaq 0x872f(%rip), %r15      # 0xa0e0
leaq (%r15,%rax,8), %r14
testl %edi, %edi
je 0x19f1
testl %esi, %esi
je 0x1a29
leaq 0x4b0f(%rip), %rdi      # 0x64d3
callq 0x1120
movq %r14, %rdi
callq 0x5b22
movq %rax, %r14
movslq %ebp, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5b22
movl %eax, %ecx
shlq %cl, %r14
movslq %ebx, %rax
leaq (%r15,%rax,8), %rdi
movq %r14, %rsi
jmp 0x1a54
testl %esi, %esi
je 0x1a63
leaq 0x4a9e(%rip), %rdi      # 0x649a
callq 0x1120
movq %r14, %rdi
callq 0x5b26
movl %eax, %r14d
movslq %ebp, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5b26
movl %eax, %ecx
shll %cl, %r14d
movslq %ebx, %rax
leaq (%r15,%rax,8), %rdi
movl %r14d, %esi
jmp 0x1a84
leaq 0x4abf(%rip), %rdi      # 0x64ef
callq 0x1120
movq %r14, %rdi
callq 0x5b22
movq %rax, %rsi
pushq $0x40
popq %rcx
movl %ebp, %eax
cltd
idivl %ecx
movl %edx, %ecx
shlq %cl, %rsi
movslq %ebx, %rax
leaq (%r15,%rax,8), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5b2a
leaq 0x4a4c(%rip), %rdi      # 0x64b6
callq 0x1120
movq %r14, %rdi
callq 0x5b26
movl %ebp, %ecx
shll %cl, %eax
movslq %ebx, %rcx
leaq (%r15,%rcx,8), %rdi
movl %eax, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5b30
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: LSR(int, int, int, int, int)
void LSR(int sf, int sw,int op1, int op2, int  op3 )
{
	//op1 - RD , op2 - RN, op3 - immr
    if(sf)  //64 bit registers
    {
        if(sw == 0) //immediate
        {
            uint64_t op2_data = R[op2].getData();
            uint64_t dat;
            dat = op2_data >> (op3 % 64);
            R[op1].setData(dat);
        }
        
        else    //register
        {
            uint64_t op2_data = R[op2].getData();
            uint64_t op3_data = R[op3].getData();
            uint64_t dat;
            dat = op2_data >> (op3_data % 64);
            R[op1].setData(dat);
        }
    }
    
    else    //32 bit registers
    {
        if(sw == 0) //immediate
        {
            int op2_data = R[op2].getLowerData();
            int dat = op2_data >> (op3 % 32);
            R[op1].setLowerData(dat);
        }
        
        else    //register
        {
            int op2_data = R[op2].getLowerData();
            int op3_data = R[op3].getLowerData();
            int dat = op2_data >> (op3_data % 32);
            R[op1].setLowerData(dat);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r8d, %ebp
movl %edx, %ebx
movl %esi, %r15d
movl %edi, %eax
movslq %ecx, %rcx
leaq 0x8631(%rip), %r12      # 0xa0e0
leaq (%r12,%rcx,8), %rdi
testl %eax, %eax
je 0x1ad4
callq 0x5b22
movq %rax, %r14
testl %r15d, %r15d
je 0x1af1
movslq %ebp, %rax
leaq (%r12,%rax,8), %rdi
callq 0x5b22
movl %eax, %ecx
jmp 0x1afb
callq 0x5b26
movl %eax, %r14d
testl %r15d, %r15d
je 0x1b15
movslq %ebp, %rax
leaq (%r12,%rax,8), %rdi
callq 0x5b26
movl %eax, %ecx
jmp 0x1b17
pushq $0x40
popq %rcx
movl %ebp, %eax
cltd
idivl %ecx
movl %edx, %ecx
shrq %cl, %r14
movslq %ebx, %rax
leaq (%r12,%rax,8), %rdi
movq %r14, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5b2a
movl %ebp, %ecx
sarl %cl, %r14d
movslq %ebx, %rax
leaq (%r12,%rax,8), %rdi
movl %r14d, %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5b30
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: SUB(int, int, int, int, int)
void SUB(int sf, int sw,int op1, int op2, int op3 )
{
	//op1 - RD , op2 - RN , op3 - immRM
    if(sf) //use 64 bit register
    {
        if(sw == 0) //immediate
        {
            printf("[log] - subracting immediate 64 bit\n");
            uint64_t dat;
            dat = R[op2].getData() - op3; 
            R[op1].setData(dat);
        }
        
        if (sw == 1)    //register
        {
            printf("[log] - subracting register 64 bit\n");
            uint64_t dat;
            dat = R[op2].getData() - R[op3].getData();
            R[op1].setData(dat);
        }
    }
    
    else    //use 32 bit register
    {
         if(sw == 0) //immediate
        {
            printf("[log] - subracting immediate 32 bit\n");
            uint64_t dat;
            dat = R[op2].getLowerData() - op3; 
            R[op1].setLowerData(dat);
        }
        
        if (sw == 1)    //register
        {
            printf("[log] - subracting register 32 bit\n");
            int dat;
            dat = R[op2].getLowerData() - R[op3].getLowerData();
            R[op1].setLowerData(dat);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r8d, %ebp
movl %ecx, %r14d
movl %edx, %ebx
testl %edi, %edi
je 0x1b81
cmpl $0x1, %esi
je 0x1bc8
testl %esi, %esi
jne 0x1bbd
leaq 0x49ff(%rip), %rdi      # 0x6553
callq 0x1120
movslq %r14d, %rax
leaq 0x857d(%rip), %r14      # 0xa0e0
leaq (%r14,%rax,8), %rdi
callq 0x5b22
movslq %ebp, %rcx
subq %rcx, %rax
movslq %ebx, %rcx
leaq (%r14,%rcx,8), %rdi
movq %rax, %rsi
jmp 0x1c03
cmpl $0x1, %esi
je 0x1c12
testl %esi, %esi
jne 0x1bbd
leaq 0x4977(%rip), %rdi      # 0x650c
callq 0x1120
movslq %r14d, %rax
leaq 0x853c(%rip), %r14      # 0xa0e0
leaq (%r14,%rax,8), %rdi
callq 0x5b26
subl %ebp, %eax
movslq %ebx, %rcx
leaq (%r14,%rcx,8), %rdi
movl %eax, %esi
jmp 0x1c4d
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x49a8(%rip), %rdi      # 0x6577
callq 0x1120
movslq %r14d, %rax
leaq 0x8502(%rip), %r15      # 0xa0e0
leaq (%r15,%rax,8), %rdi
callq 0x5b22
movq %rax, %r14
movslq %ebp, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5b22
subq %rax, %r14
movslq %ebx, %rax
leaq (%r15,%rax,8), %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5b2a
leaq 0x4917(%rip), %rdi      # 0x6530
callq 0x1120
movslq %r14d, %rax
leaq 0x84b8(%rip), %r15      # 0xa0e0
leaq (%r15,%rax,8), %rdi
callq 0x5b26
movl %eax, %r14d
movslq %ebp, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5b26
subl %eax, %r14d
movslq %ebx, %rax
leaq (%r15,%rax,8), %rdi
movl %r14d, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5b30
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: MOV(int, int, int, int)
void MOV(int sf, int _switch,int op1, int op2 )
{
    if(sf)  //64 bit registers
    {
	
        if(_switch == 0) //immediate
        {
            printf("[log] - mov immediate 64 bit\n");
            R[op1].setData(op2);
        }
        
        else    //register
        {
            printf("[log] - mov register 64 bit\n");
            R[op1].setData(R[op2].getData());
        }
    }
    
    else
    {
        if(_switch == 0) //immediate
        {
			printf("[log] - mov immediate 32 bit\n");
            R[op1].setLowerData(op2);
        }
        
        else    //register
        {
			printf("[log] - mov immediate 32 bit\n");
            R[op1].setLowerData(R[op2].getLowerData());
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movslq %edx, %rax
leaq 0x8471(%rip), %r15      # 0xa0e0
leaq (%r15,%rax,8), %rbx
testl %edi, %edi
je 0x1c9b
movslq %ebp, %r14
testl %esi, %esi
je 0x1cbe
leaq 0x4932(%rip), %rdi      # 0x65b7
callq 0x1120
leaq (%r15,%r14,8), %rdi
callq 0x5b22
movq %rbx, %rdi
movq %rax, %rsi
jmp 0x1cd0
leaq 0x48f8(%rip), %rdi      # 0x659a
testl %esi, %esi
je 0x1cdf
callq 0x1120
movslq %ebp, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5b26
movq %rbx, %rdi
movl %eax, %esi
jmp 0x1ce9
leaq 0x490e(%rip), %rdi      # 0x65d3
callq 0x1120
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5b2a
callq 0x1120
movq %rbx, %rdi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5b30
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: AND(int, int, int, int, int, int, int, int)
void AND(int sf, int sw, int op1, int op2, int op3, int N, int imms, int immr)
{
	//op1 - RD,op2 - RN, op3 - RM
    if(sf)
    {
		if(sw == 0)
		{
		    uint64_t imm = DecodeBitMask( N,  imms, immr, 64);
		    uint64_t dat = R[op2].getData() & imm;
		    R[op1].setData(dat);
		}
		
		else
		{
			uint64_t dat = R[op2].getData() & R[op3].getData();
			R[op1].setData(dat);
		}
    }
    else
    {
        if(sw == 0)
        {
      		uint32_t imm = DecodeBitMask(N, imms, immr, 32);
       	 	uint32_t dat = R[op2].getLowerData() & imm;
       	 	R[op1].setLowerData(dat);
       	 }
       	 else
       	 {
       	 	uint32_t dat = R[op2].getLowerData() & R[op3].getLowerData();
       	 	R[op1].setLowerData(dat);
       	 }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r8d, %r14d
movl %ecx, %ebp
movl %edx, %ebx
movl %esi, %eax
movl 0x38(%rsp), %edx
movl 0x30(%rsp), %esi
testl %edi, %edi
je 0x1d4a
testl %eax, %eax
je 0x1d7c
movslq %ebp, %rax
leaq 0x83bd(%rip), %r12      # 0xa0e0
leaq (%r12,%rax,8), %rdi
callq 0x5b22
movq %rax, %r15
movslq %r14d, %rax
leaq (%r12,%rax,8), %rdi
callq 0x5b22
andq %rax, %r15
movslq %ebx, %rax
leaq (%r12,%rax,8), %rdi
movq %r15, %rsi
jmp 0x1daa
testl %eax, %eax
je 0x1db7
movslq %ebp, %rax
leaq 0x8388(%rip), %r15      # 0xa0e0
leaq (%r15,%rax,8), %rdi
callq 0x5b26
movl %eax, %ebp
movslq %r14d, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5b26
andl %eax, %ebp
movslq %ebx, %rax
leaq (%r15,%rax,8), %rdi
movl %ebp, %esi
jmp 0x1de5
pushq $0x40
popq %rcx
movl %r9d, %edi
callq 0x1df2
movq %rax, %r14
movslq %ebp, %rax
leaq 0x834c(%rip), %r15      # 0xa0e0
leaq (%r15,%rax,8), %rdi
callq 0x5b22
andq %rax, %r14
movslq %ebx, %rax
leaq (%r15,%rax,8), %rdi
movq %r14, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5b2a
pushq $0x20
popq %rcx
movl %r9d, %edi
callq 0x1df2
movq %rax, %r14
movslq %ebp, %rax
leaq 0x8311(%rip), %r15      # 0xa0e0
leaq (%r15,%rax,8), %rdi
callq 0x5b26
andl %eax, %r14d
movslq %ebx, %rax
leaq (%r15,%rax,8), %rdi
movl %r14d, %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5b30
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: DecodeBitMask(int, int, int, int)
static uint64_t DecodeBitMask(int N, int imms, int immr, int size){
        int len, levels, S, R, diff, esize;

        uint64_t welem = 0;

        /* Finding the highest set bit in N:imms */
        if(N){
                len = 6;
        }
        else{
                imms = ~imms;
                for(int i=5; i>=0; i--){
                        if(imms & (1<<i)){
                                len = i;
                                break;
                        }
                }
                imms = ~imms;
        }
        if(len < 1){
                cout << "Invalid Instruction found" << endl;
        }

        /* caluclating levels value */
        levels = 0;
        for(int i=0; i<len; i++){
                levels = levels << 1;
                levels = (levels | 1) ;
        }

        if((levels & imms) == levels){
                cout << "Invalid Instruction found" << endl;
        }
        S = levels & imms;
        R = levels & immr;
        diff = S - R;
        esize = (1 << len);
        for(int i=0; i<(S+1); i++){
                welem = welem << 1;
                welem = (welem | 1) ;
        }

        for(int i=0; i<R; i++){
                uint64_t lbit = welem & 1;
                welem = welem >> 1;
                if(size == 32){
                        welem = welem & 0xffffffff7fffffff;
                        welem = (welem | (int)((lbit) << 31));
                }
                else{
                        welem = welem & 0x7fffffffffffffff;
                        welem = (welem |(uint64_t) ((lbit) << 63));
                }
        }
        return welem;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r14d
testl %edi, %edi
je 0x1e09
pushq $0x6
popq %rax
jmp 0x1e43
pushq $0x5
popq %rax
pushq $-0x1
popq %r15
testl %eax, %eax
js 0x1e25
btl %eax, %r14d
jae 0x1e1e
decl %eax
jmp 0x1e10
testl %eax, %eax
jne 0x1e43
xorl %r15d, %r15d
movq 0x81ac(%rip), %rdi      # 0x9fd8
leaq 0x44a0(%rip), %rsi      # 0x62d3
callq 0x10a0
movq %rax, %rdi
callq 0x1060
movl %r15d, %eax
xorl %r15d, %r15d
testl %eax, %eax
cmovlel %r15d, %eax
subl $0x1, %eax
jb 0x1e5b
leal 0x1(,%r15,2), %r15d
jmp 0x1e4c
andl %r15d, %r14d
cmpl %r15d, %r14d
jne 0x1e7e
movq 0x816e(%rip), %rdi      # 0x9fd8
leaq 0x4462(%rip), %rsi      # 0x62d3
callq 0x10a0
movq %rax, %rdi
callq 0x1060
xorl %eax, %eax
xorl %ecx, %ecx
cmpl %r14d, %ecx
jg 0x1e93
leaq 0x1(,%rax,2), %rax
incl %ecx
jmp 0x1e82
xorl %ecx, %ecx
andl %ebp, %r15d
cmovlel %ecx, %r15d
movabsq $0x7fffffff7fffffff, %rcx # imm = 0x7FFFFFFF7FFFFFFF
subl $0x1, %r15d
jb 0x1ecd
movq %rax, %rdx
shrq %rdx
cmpl $0x20, %ebx
jne 0x1ec4
andq %rcx, %rdx
shll $0x1f, %eax
cltq
orq %rdx, %rax
jmp 0x1ea6
shlq $0x3f, %rax
orq %rdx, %rax
jmp 0x1ea6
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/./ADR_ADRP.cpp
// Function: ADR()
void ADR()
{
    int op = (IR.getLowerData() & 0x80000000) >> 31;
    int immlo = (IR.getLowerData() & 0x60000000) >> 29;
    int immhi = (IR.getLowerData() & 0x00ffffe0) >> 5;
    int rd = (IR.getLowerData() & 0x0000001f);
    uint64_t temp = ((uint64_t)immhi << 2) |((uint64_t)immlo);
    uint64_t base = BR.getData();
    bool page = (op == 1);
    uint64_t imm;
    if(page)
    {
        imm = signExtend(temp << 12,32);
        base = base & 0xfffff000;
    }
    
    else
    {
        imm = signExtend(temp,20);
    }
    
    uint64_t dat = base + imm;
    R[rd].setData(dat);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x1640b(%rip), %rbx     # 0x1a1e0
movq %rbx, %rdi
callq 0x5b26
movl %eax, %ebp
movq %rbx, %rdi
callq 0x5b26
movl %eax, %r14d
shrl $0x1d, %r14d
andl $0x3, %r14d
movq %rbx, %rdi
callq 0x5b26
movl %eax, %r15d
movq %rbx, %rdi
callq 0x5b26
movl %eax, %ebx
shrl $0x3, %r15d
andl $0x1ffffc, %r15d        # imm = 0x1FFFFC
orl %r14d, %r15d
leaq 0x163d4(%rip), %rdi     # 0x1a1f0
callq 0x5b22
movq %rax, %r14
testl %ebp, %ebp
js 0x3e35
pushq $0x14
popq %rsi
movq %r15, %rdi
callq 0x12ec
jmp 0x3e4b
shlq $0xc, %r15
pushq $0x20
popq %rsi
movq %r15, %rdi
callq 0x12ec
andl $0xfffff000, %r14d      # imm = 0xFFFFF000
addq %r14, %rax
andl $0x1f, %ebx
leaq 0x6288(%rip), %rcx      # 0xa0e0
leaq (%rcx,%rbx,8), %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5b2a
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/simulo.cpp
// Function: initMem(unsigned long)
void initMem(uint64_t start)
{
	REP(i,0,4095)
	{
		Memory[i].data = 0;
		Memory[i].access = false;
		Memory[i].addr = start;
		start+= 1 ;//each location is of size 64 bits - 8 bytes
		breakpt[i] = false;
		SR[i] = false;
	}

	REP(i,0,31)
	{
		R[i].setData(0);

	}
	NIO = 4;
	ZFLAG =NFLAG= OFLAG = CFLAG = false;
	subroutine = 0;
}

// Assembly:
xorl %eax, %eax
leaq 0x5751(%rip), %rcx      # 0xa1e0
leaq 0x1576a(%rip), %rdx     # 0x1a200
leaq 0x16763(%rip), %rsi     # 0x1b200
xorl %r8d, %r8d
cmpq $0x1000, %r8            # imm = 0x1000
je 0x4ac9
andw $0x0, 0x8(%rcx,%rax,4)
leaq (%rdi,%r8), %r9
andl $0x0, (%rax,%rsi)
movq %r9, (%rcx,%rax,4)
movb $0x0, (%r8,%rdx)
incq %r8
addq $0x4, %rax
jmp 0x4aa0
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
leaq 0x560a(%rip), %r14      # 0xa0e0
cmpq $0x100, %rbx            # imm = 0x100
je 0x4af0
leaq (%r14,%rbx), %rdi
xorl %esi, %esi
callq 0x5b2a
addq $0x8, %rbx
jmp 0x4ad6
movl $0x4, 0x156fe(%rip)     # 0x1a1f8
xorl %eax, %eax
movb %al, 0x55d2(%rip)       # 0xa0d4
movb %al, 0x55ca(%rip)       # 0xa0d2
movb %al, 0x55c5(%rip)       # 0xa0d3
movb %al, 0x55bd(%rip)       # 0xa0d1
andl $0x0, 0x1a6e5(%rip)     # 0x1f200
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/simulo.cpp
// Function: printMem(unsigned long, int, char)
void printMem(uint64_t addr,int off,char c)
{
	int startind = addr - Memory[0].addr;
	
	int endind = startind + off; 

	assert(c == 'x' || c == 'd');

	REP(i,startind,endind-1)
		if(c == 'd')
			printf("%d\n",Memory[i].getData());
		else if(c == 'x')
			printf("%x\n",Memory[i].getData());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x64, %edx
je 0x4b4b
cmpl $0x78, %edx
jne 0x4bbb
leaq 0x568e(%rip), %rax      # 0xa1e0
subq 0x5687(%rip), %rdi      # 0xa1e0
addl %edi, %esi
movslq %edi, %r15
movslq %esi, %r12
movq %r15, %rbx
shlq $0x4, %rbx
addq %rax, %rbx
movsbl %dl, %ebp
leaq 0x164f(%rip), %r13      # 0x61c4
cmpq %r12, %r15
jge 0x4bac
movq %r13, %r14
cmpl $0x64, %ebp
je 0x4b8e
cmpl $0x78, %ebp
jne 0x4ba3
leaq 0x163a(%rip), %r14      # 0x61c8
movq %rbx, %rdi
callq 0x5b1e
movzbl %al, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1030
incq %r15
addq $0x10, %rbx
jmp 0x4b75
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x15bf(%rip), %rdi      # 0x6181
leaq 0x15cd(%rip), %rsi      # 0x6196
leaq 0x15d1(%rip), %rcx      # 0x61a1
pushq $0x33
popq %rdx
callq 0x1070
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/simulo.cpp
// Function: printHelp()
void printHelp()
{
	printf("Check register :- print/p x/d r(0-31)\n");
	printf("Check memory :- print/p x/d <absolute addr hex>\n");
	printf("Set breakpoint :-break/b <absolute addr hex>\n");
	printf("Delete breakpoint :-del <absolute addr hex>\n");
	printf("Execute next instruction:- next/n\n");
	printf("Exit debugger and continue program execution:- run/r\n");
	printf("Quit simulo:- quit/q");
	printf("Print this help:- help/h\n");
}

// Assembly:
pushq %rax
leaq 0x1e82(%rip), %rdi      # 0x6c6c
callq 0x1120
leaq 0x1e9c(%rip), %rdi      # 0x6c92
callq 0x1120
leaq 0x1ec0(%rip), %rdi      # 0x6cc2
callq 0x1120
leaq 0x1ee1(%rip), %rdi      # 0x6cef
callq 0x1120
leaq 0x1f01(%rip), %rdi      # 0x6d1b
callq 0x1120
leaq 0x1f17(%rip), %rdi      # 0x6d3d
callq 0x1120
leaq 0x13e6(%rip), %rdi      # 0x6218
xorl %eax, %eax
callq 0x1030
leaq 0x1f32(%rip), %rdi      # 0x6d72
popq %rax
jmp 0x1120
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/simulo.cpp
// Function: fetch()
void fetch()
{

		
	uint64_t addr = PC.getData();
	int i = addr - Memory[0].addr; 
	if(SR[i]>1 && subroutine == 0)//don't mess with main flow of control
	{	
			skip = true;
	}
	else if(SR[i] == 1)
		SR[i]++;

	printf("[log]-fetching instruction\n");
	if(debug_prompt)
	{
		printf("DEBUG-mode enabled\n");
		show_prompt();
	}

	if(breakpt[i])
	{
		printf("Break point at address - %lx\n",addr);
		show_prompt();
	}
		//TODO - read the memory
	uint64_t w = Memory[i].getData()<<24; i++;
	uint64_t x = Memory[i].getData()<<16; i++;
	uint64_t y = Memory[i].getData()<<8; i++;
	uint64_t z = Memory[i].getData(); i++;


	//TODO - take data to IR

	IR.setData(w|x|y|z);
	BR.setData(PC.getData());
	PC.setData(addr + 4 );
	printf("[log]-done fetching instruction\n");

}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x151c8(%rip), %rdi     # 0x1a1e8
callq 0x5b22
movq %rax, %rbx
movq %rax, %r15
subq 0x51ae(%rip), %r15      # 0xa1e0
movslq %r15d, %r14
leaq 0x161c4(%rip), %rax     # 0x1b200
movl (%rax,%r14,4), %ecx
cmpl $0x2, %ecx
jl 0x5057
cmpl $0x0, 0x1a1b4(%rip)     # 0x1f200
jne 0x5057
movb $0x1, 0x151a8(%rip)     # 0x1a1fd
jmp 0x5064
cmpl $0x1, %ecx
jne 0x5064
movl $0x2, (%rax,%r14,4)
leaq 0x1d4f(%rip), %rdi      # 0x6dba
callq 0x1120
cmpb $0x1, 0x15185(%rip)     # 0x1a1fc
jne 0x508a
leaq 0x1d55(%rip), %rdi      # 0x6dd5
callq 0x1120
callq 0x4e46
shlq $0x20, %r15
leaq 0x1516b(%rip), %rax     # 0x1a200
cmpb $0x1, (%r14,%rax)
jne 0x50b2
leaq 0x11cf(%rip), %rdi      # 0x6272
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1030
callq 0x4e46
shlq $0x4, %r14
leaq 0x5123(%rip), %r12      # 0xa1e0
addq %r12, %r14
movq %r14, %rdi
callq 0x5b1e
movzbl %al, %eax
shll $0x18, %eax
movslq %eax, %r14
movabsq $0x100000000, %rdi      # imm = 0x100000000
addq %r15, %rdi
sarq $0x1c, %rdi
addq %r12, %rdi
callq 0x5b1e
movzbl %al, %r13d
shll $0x10, %r13d
orq %r14, %r13
movabsq $0x200000000, %rdi      # imm = 0x200000000
addq %r15, %rdi
sarq $0x1c, %rdi
addq %r12, %rdi
callq 0x5b1e
movzbl %al, %r14d
shll $0x8, %r14d
orq %r13, %r14
movabsq $0x300000000, %rdi      # imm = 0x300000000
addq %r15, %rdi
sarq $0x1c, %rdi
addq %r12, %rdi
callq 0x5b1e
movzbl %al, %esi
orq %r14, %rsi
leaq 0x150a1(%rip), %rdi     # 0x1a1e0
callq 0x5b2a
leaq 0x1509d(%rip), %r14     # 0x1a1e8
movq %r14, %rdi
callq 0x5b22
leaq 0x15096(%rip), %rdi     # 0x1a1f0
movq %rax, %rsi
callq 0x5b2a
addq $0x4, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5b2a
leaq 0x1c70(%rip), %rdi      # 0x6de8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1120
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/simulo.cpp
// Function: main
int main(int argc, char* argv[])
{

	int start_ind = 0;
	uint64_t start_addr ;
	char endian;
	debug_prompt = false;
	if(argc > 1)
		if(strcmp(argv[1],"debug") == 0)
	 		debug_prompt = true;
	FILE* info = fopen("info.txt","r");
	FILE* data = fopen("data.txt","r");
	fscanf(info,"%lx %c",&start_addr,&endian);
	fclose(info);

	int ind;
	initMem(start_addr);

	while(fscanf(data, "%d",&ind)>0)
	{
		if(ind >= 0 && ind<=4095)
			SR[ind]++ ;	
	}
	fclose(data);

	printf("[log]- Memory initialised\n");
	Loader loader("inst.txt");
	
	int x = loader.loadmem(start_ind,Memory,endian);
	printf("[log]-Hex file loaded\n");
	//init memory and breakpoints
	PC.setData(Memory[start_ind].addr);

	int i = start_ind;
	while(i <= x-4)
	{
		
		fetch();
		decode();
		i += NIO;
	}

	printf("[log]-Execution completed!\n");			
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movb $0x0, 0x1483c(%rip)     # 0x1a1fc
cmpl $0x2, %edi
jl 0x59e0
movq 0x8(%rsi), %rdi
leaq 0x8d8(%rip), %rsi       # 0x62a8
callq 0x10f0
testl %eax, %eax
jne 0x59e0
movb $0x1, 0x1481c(%rip)     # 0x1a1fc
leaq 0x8c7(%rip), %rdi       # 0x62ae
leaq 0x1382(%rip), %rbx      # 0x6d70
movq %rbx, %rsi
callq 0x10d0
movq %rax, %r14
leaq 0x8b7(%rip), %rdi       # 0x62b7
movq %rbx, %rsi
callq 0x10d0
movq %rax, %rbx
leaq 0x8ae(%rip), %rsi       # 0x62c0
leaq 0x18(%rsp), %r15
leaq 0xb(%rsp), %rcx
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1150
movq %r14, %rdi
callq 0x10b0
movq (%r15), %rdi
callq 0x4a86
leaq 0x887(%rip), %r14       # 0x62c7
leaq 0xc(%rsp), %r15
leaq 0x157b4(%rip), %r12     # 0x1b200
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1150
testl %eax, %eax
jle 0x5a72
movl 0xc(%rsp), %eax
cmpq $0xfff, %rax            # imm = 0xFFF
ja 0x5a4c
incl (%r12,%rax,4)
jmp 0x5a4c
movq %rbx, %rdi
callq 0x10b0
leaq 0x1595(%rip), %rdi      # 0x7016
callq 0x1120
leaq 0x83d(%rip), %rsi       # 0x62ca
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x5c0a
movsbl 0xb(%rsp), %ecx
leaq 0x473a(%rip), %rdx      # 0xa1e0
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5c64
movl %eax, %ebx
leaq 0x1575(%rip), %rdi      # 0x7030
callq 0x1120
movq 0x4719(%rip), %rsi      # 0xa1e0
leaq 0x1471a(%rip), %rdi     # 0x1a1e8
callq 0x5b2a
addl $-0x4, %ebx
cmpl %ebx, %ebp
jg 0x5aec
callq 0x5010
callq 0x5186
addl 0x1470e(%rip), %ebp     # 0x1a1f8
jmp 0x5ad6
leaq 0x1553(%rip), %rdi      # 0x7046
callq 0x1120
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/akshayrajput[P]ARMV8_Simulator/loader.cpp
// Function: Loader::loadmem(int, mem*, char)
int Loader::loadmem(int start , mem m[],char endian)
{
	uint32_t x;uint32_t bigendian;
	char c,data[17];
	//TODO-get an instance of memory and load ldfile from start pos
	

	while((c = fgetc(ldfile)) != EOF)
	{
		ungetc(c,ldfile);
		REP(i,0,7)//TODO - take in 8 hex letters (1 hex letter 1 nibble- write instructions bitwise)
		{
			if(c = fgetc(ldfile))
				data[i] = c;
			else
				exit(3);

		}
		data[8] = '\0';

			//TODO - check big or little endian swap if necessary
	
		x =(uint32_t) strtoul(data,NULL,16);	 //TODO - convert string to uint64_t
		if(endian == 'L')
		 bigendian = __builtin_bswap32(x);
		else 
			bigendian = x;

		start = setDataW(m,bigendian,start);//TODO - write to mem 32 bit word 

		//start++;
	}//TODO - repeat from (a) until EOF
	return start;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
pushq $0x10
popq %r13
movq (%r15), %rdi
callq 0x1130
shll $0x18, %eax
cmpl $0xff000000, %eax       # imm = 0xFF000000
je 0x5ce7
sarl $0x18, %eax
movq (%r15), %rsi
movl %eax, %edi
callq 0x1040
xorl %r12d, %r12d
cmpq $0x8, %r12
je 0x5cbd
movq (%r15), %rdi
callq 0x1130
testb %al, %al
je 0x5cf8
movb %al, (%rsp,%r12)
incq %r12
jmp 0x5ca2
movb $0x0, 0x8(%rsp)
movq %rsp, %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x1050
cmpb $0x4c, %bl
movl %eax, %esi
bswapl %esi
cmovnel %eax, %esi
movq %r14, %rdi
movl %ebp, %edx
callq 0x5b38
movl %eax, %ebp
jmp 0x5c80
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x3
popq %rdi
callq 0x10e0
// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH06_Functions/examples/refparms.cc
// Function: find_char(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char, unsigned long&)
string::size_type find_char(const string &s, char c, 
                           string::size_type &occurs)
{
    auto ret = s.size();   // position of the first occurrence, if any
    occurs = 0;            // set the occurrence count parameter 

    for (decltype(ret) i = 0; i != s.size(); ++i) {
        if (s[i] == c) {
            if (ret == s.size()) 
                ret = i;   // remember the first occurrence of c
            ++occurs;      // increment the occurrence count
         }
	}
    return ret;            // count is returned implicitly in occurs
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x8(%rdi), %rax
andq $0x0, (%rdx)
movq (%rdi), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
movq 0x8(%rdi), %r10
cmpq %r10, %r9
je 0x12d2
cmpb %sil, (%rcx,%r9)
jne 0x12cd
cmpq %r10, %rax
cmoveq %r9, %rax
incq %r8
movq %r8, (%rdx)
incq %r9
jmp 0x12b1
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH06_Functions/examples/refparms.cc
// Function: main
int main() 
{
	
	string s;
	getline(cin, s); 
	size_t ctr = 0;
	auto index = find_char(s, 'o', ctr);
	cout << index << " " << ctr << endl;
	
	vector<int> ivec;
	int i;
	// read values into ivec
	while (cin >> i)
		ivec.push_back(i);

	// for each value in the list of ints
	for (auto i : {42, 33, 92}) {
		auto it = find_val(ivec.begin(), ivec.end(), i, ctr);
		if (it == ivec.end())
			cout << i << " is not in the input data" << endl;
		else
			cout << i << " was at position " 
			     << it - ivec.begin() << endl;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
leaq -0x70(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x2cb8(%rip), %rdi      # 0x3fe0
leaq -0x80(%rbp), %rsi
callq 0x1030
leaq -0x30(%rbp), %rdx
andq $0x0, (%rdx)
leaq -0x80(%rbp), %rdi
pushq $0x6f
popq %rsi
callq 0x129c
movq 0x2c84(%rip), %rdi      # 0x3fd0
movq %rax, %rsi
callq 0x10b0
leaq 0xcd3(%rip), %rsi       # 0x202e
movq %rax, %rdi
callq 0x10f0
movq -0x30(%rbp), %rsi
movq %rax, %rdi
callq 0x10b0
movq %rax, %rdi
callq 0x1080
leaq -0x50(%rbp), %rbx
andq $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
movq 0x2c53(%rip), %r14      # 0x3fe0
leaq -0x60(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x10a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x13b7
movq %rbx, %rdi
movq %r15, %rsi
callq 0x14b0
jmp 0x1391
movabsq $0x210000002a, %rax     # imm = 0x210000002A
movq %rax, -0x5c(%rbp)
movl $0x5c, -0x54(%rbp)
xorl %ebx, %ebx
movq 0x2bfb(%rip), %r14      # 0x3fd0
cmpq $0xc, %rbx
je 0x1465
movl -0x5c(%rbp,%rbx), %r15d
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %r12
movq %r12, %rsi
movl %r15d, %edx
leaq -0x30(%rbp), %rcx
callq 0x12d4
cmpq %r12, %rax
je 0x143a
movq %rax, %r13
movq %r14, %rdi
movl %r15d, %esi
callq 0x1140
movq %rax, %rdi
leaq 0xc06(%rip), %rsi       # 0x201e
callq 0x10f0
subq -0x50(%rbp), %r13
sarq $0x2, %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0x10e0
movq %rax, %rdi
callq 0x1080
jmp 0x145c
movq %r14, %rdi
movl %r15d, %esi
callq 0x1140
movq %rax, %rdi
leaq 0xbb5(%rip), %rsi       # 0x2004
callq 0x10f0
movq %rax, %rdi
callq 0x1080
addq $0x4, %rbx
jmp 0x13d5
leaq -0x50(%rbp), %rdi
callq 0x14e4
leaq -0x80(%rbp), %rdi
callq 0x1070
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x148a
movq %rax, %rbx
jmp 0x149f
jmp 0x1493
jmp 0x1493
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x14e4
leaq -0x80(%rbp), %rdi
callq 0x1070
movq %rbx, %rdi
callq 0x1150
// File: /workspace/github_cpp_makefile_star2_O2/spatialfruitsalad[P]volume2position/./colors.hpp
// Function: hsv2rgb(hsv)
static inline rgb   hsv2rgb(hsv in){
    double      hh, p, q, t, ff;
    long        i;
    rgb         out;

    if(in.s <= 0.0)         // < is bogus, just shuts up warnings
    {
        out.r = in.v;
        out.g = in.v;
        out.b = in.v;
        return out;
    }
    hh = in.h;
    if(hh >= 360.0) hh = 0.0;
    hh /= 60.0;
    i = (long)hh;
    ff = hh - i;
    p = in.v * (1.0 - in.s);
    q = in.v * (1.0 - (in.s * ff));
    t = in.v * (1.0 - (in.s * (1.0 - ff)));

    switch(i)
    {
    case 0:
        out.r = in.v;
        out.g = t;
        out.b = p;
        break;
    case 1:
        out.r = q;
        out.g = in.v;
        out.b = p;
        break;
    case 2:
        out.r = p;
        out.g = in.v;
        out.b = t;
        break;

    case 3:
        out.r = p;
        out.g = q;
        out.b = in.v;
        break;
    case 4:
        out.r = t;
        out.g = p;
        out.b = in.v;
        break;
    case 5:
    default:
        out.r = in.v;
        out.g = p;
        out.b = q;
        break;
    }
    return out;
}

// Assembly:
movq %rdi, %rax
leaq 0x8(%rsp), %rdx
movsd 0x8(%rdx), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jae 0x4edd
movsd (%rdx), %xmm0
movsd 0xc23c(%rip), %xmm4     # 0x11098
cmpnlesd %xmm0, %xmm4
divsd 0xc227(%rip), %xmm0     # 0x11090
andpd %xmm0, %xmm4
cvttsd2si %xmm4, %rcx
cvtsi2sd %rcx, %xmm2
movsd 0x10(%rdx), %xmm0
subsd %xmm2, %xmm4
movsd 0xc1c0(%rip), %xmm3     # 0x11048
movapd %xmm3, %xmm2
subsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
movapd %xmm1, %xmm6
mulsd %xmm4, %xmm6
movapd %xmm3, %xmm5
subsd %xmm6, %xmm5
mulsd %xmm0, %xmm5
cmpq $0x4, %rcx
ja 0x4f25
movapd %xmm3, %xmm6
subsd %xmm4, %xmm6
mulsd %xmm6, %xmm1
subsd %xmm1, %xmm3
mulsd %xmm0, %xmm3
leaq 0xc293(%rip), %rdx      # 0x1115c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movsd %xmm0, (%rax)
movsd %xmm3, 0x8(%rax)
jmp 0x4f1f
movsd 0x10(%rdx), %xmm0
movsd %xmm0, (%rax)
movsd %xmm0, 0x8(%rax)
movsd %xmm0, 0x10(%rax)
retq
movsd %xmm3, (%rax)
movsd %xmm2, 0x8(%rax)
jmp 0x4eeb
movsd %xmm2, (%rax)
movsd %xmm0, 0x8(%rax)
movsd %xmm3, 0x10(%rax)
retq
movsd %xmm2, (%rax)
movsd %xmm5, 0x8(%rax)
jmp 0x4eeb
movsd %xmm5, (%rax)
movsd %xmm0, 0x8(%rax)
movsd %xmm2, 0x10(%rax)
retq
movsd %xmm0, (%rax)
movsd %xmm2, 0x8(%rax)
movsd %xmm5, 0x10(%rax)
retq