LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/SneachChea[P]Wolf-Monte-Carlo-Cpp/tools.cpp
// Function: linspace(double, double, int, bool)
d_vector linspace(double min, double max, int nbr, bool endpoint)
{
    d_vector d;
    if(nbr==1){
        d.push_back(min);
        return d;
    }
    if(min==max){
        d.push_back(max);
        return d;
    }
    d.reserve(nbr);
    if(endpoint==false){
    for(int i=0; i<nbr; i++){
        d.push_back(min +i*(max-min)/double(nbr));
    }
    }else{
    for(int i=0; i<nbr; i++){
        d.push_back(min +i*(max-min)/double(nbr-1));
    }   
    }
    return d;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
vmovsd %xmm0, 0x20(%rsp)
vmovsd %xmm1, 0x18(%rsp)
vxorpd %xmm2, %xmm2, %xmm2
vmovupd %xmm2, (%rdi)
movq $0x0, 0x10(%rdi)
cmpl $0x1, %esi
jne 0x4662
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x468c
leaq 0x8(%rbx), %rax
vmovsd %xmm0, (%rsi)
jmp 0x4680
vucomisd %xmm1, %xmm0
jne 0x4696
jp 0x4696
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x471d
leaq 0x8(%rbx), %rax
vmovsd %xmm1, (%rsi)
addq $0x8, %rsi
movq %rsi, (%rax)
jmp 0x472a
leaq 0x20(%rsp), %rdx
jmp 0x4722
movl %edx, %ebp
movl %esi, %r14d
movslq %esi, %rsi
movq %rbx, %rdi
callq 0x48a2
testb %bpl, %bpl
je 0x4738
testl %r14d, %r14d
jle 0x472a
leal -0x1(%r14), %eax
vcvtsi2sd %eax, %xmm3, %xmm0
vmovsd %xmm0, 0x8(%rsp)
xorl %ebp, %ebp
leaq 0x10(%rsp), %r15
vmovsd 0x20(%rsp), %xmm0
vcvtsi2sd %ebp, %xmm3, %xmm1
vmovsd 0x18(%rsp), %xmm2
vsubsd %xmm0, %xmm2, %xmm2
vmulsd %xmm1, %xmm2, %xmm1
vdivsd 0x8(%rsp), %xmm1, %xmm1
vaddsd %xmm1, %xmm0, %xmm0
vmovsd %xmm0, 0x10(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x4709
vmovsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x4714
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4a44
incl %ebp
cmpl %ebp, %r14d
jne 0x46c9
jmp 0x472a
leaq 0x18(%rsp), %rdx
movq %rbx, %rdi
callq 0x4930
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
testl %r14d, %r14d
jle 0x472a
vcvtsi2sd %r14d, %xmm3, %xmm0
vmovsd %xmm0, 0x8(%rsp)
xorl %ebp, %ebp
leaq 0x10(%rsp), %r15
vmovsd 0x20(%rsp), %xmm0
vcvtsi2sd %ebp, %xmm3, %xmm1
vmovsd 0x18(%rsp), %xmm2
vsubsd %xmm0, %xmm2, %xmm2
vmulsd %xmm1, %xmm2, %xmm1
vdivsd 0x8(%rsp), %xmm1, %xmm1
vaddsd %xmm1, %xmm0, %xmm0
vmovsd %xmm0, 0x10(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x478f
vmovsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x479a
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4a44
incl %ebp
cmpl %ebp, %r14d
jne 0x474f
jmp 0x472a
jmp 0x47a7
jmp 0x47a7
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x47b7
callq 0x2200
movq %r14, %rdi
callq 0x2350
// File: /workspace/github_cpp_makefile_star2_O1/SneachChea[P]Wolf-Monte-Carlo-Cpp/tools.cpp
// Function: initLattice(std::vector<int, std::allocator<int>>&)
void initLattice(std::vector<int> &S)
{   
    std::random_device rd;  
    std::mt19937 gen(rd()); 
    std::uniform_int_distribution<> dis(0, 1);
    for(auto & i : S)
    {
        i = dis(gen)*2-1;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x2718, %rsp           # imm = 0x2718
movq %rdi, %rbx
leaq 0x1390(%rsp), %r14
movq %r14, %rdi
callq 0x3338
movq %r14, %rdi
callq 0x22a0
movl %eax, %eax
movq %rax, 0x8(%rsp)
movl $0x1, %ecx
movq %rax, %rdx
shrq $0x1e, %rdx
xorl %eax, %edx
imull $0x6c078965, %edx, %eax # imm = 0x6C078965
addl %ecx, %eax
movq %rax, 0x8(%rsp,%rcx,8)
incq %rcx
cmpq $0x270, %rcx            # imm = 0x270
jne 0x47f4
movq $0x270, 0x1388(%rsp) # imm = 0x270
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, (%rsp)
movq (%rbx), %r15
movq 0x8(%rbx), %r12
cmpq %r12, %r15
je 0x4862
leaq 0x8(%rsp), %rbx
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3964
leal -0x1(%rax,%rax), %eax
movl %eax, (%r15)
addq $0x4, %r15
cmpq %r12, %r15
jne 0x4844
leaq 0x1390(%rsp), %rdi
callq 0x21f0
addq $0x2718, %rsp           # imm = 0x2718
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x489a
jmp 0x4882
movq %rax, %rbx
leaq 0x1390(%rsp), %rdi
callq 0x21f0
movq %rbx, %rdi
callq 0x2350
movq %rax, %rdi
callq 0x37a0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x408e(%rip), %rdi      # 0x5322
callq 0x1140
leaq 0x40aa(%rip), %rdi      # 0x534a
callq 0x1140
leaq 0x414a(%rip), %rbx      # 0x53f6
movq %rbx, %rdi
callq 0x1140
leaq 0x40ab(%rip), %rdi      # 0x5366
callq 0x1140
leaq 0x40b3(%rip), %rdi      # 0x537a
callq 0x1140
movq %rbx, %rdi
callq 0x1140
leaq 0x4141(%rip), %rdi      # 0x541c
callq 0x1140
leaq 0x4157(%rip), %rdi      # 0x543e
callq 0x1140
leaq 0x418e(%rip), %rdi      # 0x5481
callq 0x1140
leaq 0x41c0(%rip), %rdi      # 0x54bf
callq 0x1140
leaq 0x41d6(%rip), %rdi      # 0x54e1
callq 0x1140
leaq 0x41fe(%rip), %rdi      # 0x5515
callq 0x1140
leaq 0x420c(%rip), %rdi      # 0x552f
callq 0x1140
leaq 0x4229(%rip), %rdi      # 0x5558
popq %rbx
jmp 0x1140
// File: /workspace/github_cpp_makefile_star2_O1/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 0x5b82(%rip), %rax      # 0x7114
testq %rax, %rax
jle 0x15fd
movq 0x5c32(%rip), %rcx      # 0x71d0
movq 0x5c8b(%rip), %rdx      # 0x7230
movq 0x5bcc(%rip), %rsi      # 0x7178
xorl %edi, %edi
movq $0x0, (%rcx,%rdi,8)
movq (%rdx,%rdi,8), %r8
movq %r8, 0x5c67(%rip)       # 0x7228
movslq (%rsi,%rdi,4), %r9
testq %r9, %r9
jle 0x15f5
xorl %r10d, %r10d
xorps %xmm0, %xmm0
cvtsi2sdl 0x4(%r8,%r10,8), %xmm0
mulsd 0x5bb1(%rip), %xmm0     # 0x7190
mulsd %xmm0, %xmm0
addsd (%rcx,%rdi,8), %xmm0
movsd %xmm0, (%rcx,%rdi,8)
incq %r10
cmpq %r10, %r9
jne 0x15cd
incq %rdi
cmpq %rax, %rdi
jne 0x15ae
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
cmpl $0x0, 0x57bf(%rip)      # 0x7114
jle 0x19bc
pushq %r15
pushq %r14
pushq %rbx
xorl %r15d, %r15d
movq 0x58ca(%rip), %rax      # 0x7230
movq (%rax,%r15,8), %rbx
movq %rbx, 0x58b7(%rip)      # 0x7228
movq 0x5800(%rip), %rax      # 0x7178
movslq (%rax,%r15,4), %rax
testq %rax, %rax
je 0x19a8
leaq (%rbx,%rax,8), %r14
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x391c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3a18
incq %r15
movslq 0x5762(%rip), %rax      # 0x7114
cmpq %rax, %r15
jl 0x195f
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rsi, %rbx
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
movb $0x0, 0xc(%rsp)
cmpl $0x4, %edi
je 0x58d7
cmpl $0x2, %edi
jne 0x58ef
movq 0x8(%rbx), %rsi
leaq 0x30(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5a7c
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x258c
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x58c8
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0x8(%rsp), %rdi
callq 0x3e4c
jmp 0x59e2
movq 0x8(%rbx), %rdi
leaq 0x987(%rip), %rsi       # 0x6269
callq 0x22c0
testl %eax, %eax
je 0x59ea
movq 0x36fa(%rip), %rbx      # 0x8ff0
leaq 0x96f(%rip), %rsi       # 0x626c
movl $0x14, %edx
movq %rbx, %rdi
callq 0x2270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2170
leaq 0x949(%rip), %rsi       # 0x6281
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x2270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2170
leaq 0x92d(%rip), %rsi       # 0x62a0
movl $0x17, %edx
movq %rbx, %rdi
callq 0x2270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2170
leaq 0x90a(%rip), %rsi       # 0x62b8
movl $0x28, %edx
movq %rbx, %rdi
callq 0x2270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2170
xorl %eax, %eax
addq $0x50, %rsp
popq %rbx
retq
movq 0x18(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5a7c
leaq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x258c
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5a27
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2230
movq 0x10(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x461a
jmp 0x59e2
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5a74
movq 0x20(%rsp), %rsi
jmp 0x5a67
jmp 0x5a71
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5a74
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2230
jmp 0x5a74
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2360
// File: /workspace/github_cpp_makefile_star2_O1/iZhangHui[P]CppPrimer/CH04_Expressions/examples/int-div.cc
// Function: main
int main() 
{
	// ival1 is 3; result is truncated; remainder is discarded
	int ival1 = 21/6;

	// ival2 is 3; no remainder; result is an integral value
	int ival2 = 21/7;

	cout << ival1 << " " << ival2 << endl;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x2def(%rip), %rdi      # 0x3fd8
movl $0x3, %esi
callq 0x1090
movq %rax, %rbx
leaq 0xe07(%rip), %rsi       # 0x2004
movl $0x1, %edx
movq %rax, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x3, %esi
callq 0x1090
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %ecx, %ecx
xorl %eax, %eax
testl %esi, %esi
jle 0x132a
movl $0x1, %edx
shll %cl, %edx
movslq %edx, %rdx
andq %rdi, %rdx
addq %rdx, %rax
incl %ecx
cmpl %ecx, %esi
jne 0x1314
movl $0x1, %edx
movl %esi, %ecx
shll %cl, %edx
andl %edx, %edi
movslq %edi, %rcx
subq %rcx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x13e2
movl %edi, %ebp
movl %esi, %eax
leaq 0x8d90(%rip), %rcx      # 0xa0f0
leaq (%rcx,%rax,8), %r14
movq %r14, %rdi
callq 0x5c86
movq %rax, %rbx
movq %r14, %rdi
callq 0x5c86
movq %rax, %r14
leaq 0x18e77(%rip), %rdi     # 0x1a1f8
callq 0x5c86
subl %eax, %r14d
movl %r14d, 0x18e78(%rip)    # 0x1a208
testl %ebp, %ebp
je 0x13c3
leaq 0x4f69(%rip), %rdi      # 0x6304
callq 0x1140
leaq 0x18e51(%rip), %rdi     # 0x1a1f8
callq 0x5c86
leaq 0x8e2d(%rip), %rdi      # 0xa1e0
movq %rax, %rsi
callq 0x5c8e
incl 0x1de4f(%rip)           # 0x1f210
jmp 0x13cf
leaq 0x4f5d(%rip), %rdi      # 0x6327
callq 0x1140
leaq 0x18e22(%rip), %rdi     # 0x1a1f8
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x5c8e
leaq 0x4c93(%rip), %rdi      # 0x607c
leaq 0x4c9f(%rip), %rsi      # 0x608f
leaq 0x4cab(%rip), %rcx      # 0x60a2
movl $0x1a, %edx
callq 0x1080
// File: /workspace/github_cpp_makefile_star2_O1/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 0x18de8(%rip), %rdi     # 0x1a1f8
callq 0x5c86
movl %ebx, %ecx
subl %eax, %ecx
movl %ecx, 0x18de9(%rip)     # 0x1a208
testl %ebp, %ebp
je 0x1452
leaq 0x4f23(%rip), %rdi      # 0x634d
callq 0x1140
incl 0x1dddb(%rip)           # 0x1f210
leaq 0x18dbc(%rip), %rdi     # 0x1a1f8
callq 0x5c86
leaq 0x8d98(%rip), %rdi      # 0xa1e0
movq %rax, %rsi
callq 0x5c8e
jmp 0x145e
leaq 0x4f18(%rip), %rdi      # 0x6371
callq 0x1140
leaq 0x18d93(%rip), %rdi     # 0x1a1f8
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5c8e
// File: /workspace/github_cpp_makefile_star2_O1/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 0x4b80(%rip), %rdx      # 0x6004
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movb 0x8c4e(%rip), %cl       # 0xa0e1
jmp 0x14f9
movb 0x8c46(%rip), %cl       # 0xa0e1
xorb $0x1, %cl
movzbl %cl, %edx
xorl %ecx, %ecx
cmpb $0x0, 0x8c3a(%rip)      # 0xa0e4
cmovnel %edx, %ecx
jmp 0x14f9
movb 0x8c2e(%rip), %cl       # 0xa0e3
jmp 0x14f9
movb 0x8c25(%rip), %cl       # 0xa0e2
jmp 0x14f9
movb $0x1, %cl
jmp 0x14f9
movb 0x8c1b(%rip), %cl       # 0xa0e4
jmp 0x14f9
movb 0x8c12(%rip), %cl       # 0xa0e3
cmpb 0x8c0b(%rip), %cl       # 0xa0e2
sete %cl
jmp 0x14f9
movb 0x8c01(%rip), %cl       # 0xa0e3
movb 0x8bf9(%rip), %dl       # 0xa0e1
xorb $0x1, %dl
xorl %edi, %edi
cmpb 0x8bef(%rip), %cl       # 0xa0e2
movzbl %dl, %ecx
cmovnel %edi, %ecx
cmpl $0xf, %esi
setne %dl
andb %sil, %dl
andb $0x1, %cl
cmpb %cl, %dl
je 0x1513
xorl %edi, %edi
movq %rax, %rsi
jmp 0x1401
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x153e
cmpl $0x1, %edi
jne 0x1554
movslq %edx, %rax
leaq 0x8bc0(%rip), %rcx      # 0xa0f0
leaq (%rcx,%rax,8), %rdi
callq 0x5c86
movq %rax, %r14
jmp 0x1554
movslq %edx, %rax
leaq 0x8ba8(%rip), %rcx      # 0xa0f0
leaq (%rcx,%rax,8), %rdi
callq 0x5c8a
movl %eax, %r14d
cmpl $0x1, %ebp
je 0x1575
testl %ebp, %ebp
jne 0x1570
leaq 0x4b52(%rip), %rdi      # 0x60b6
xorl %eax, %eax
callq 0x1040
testq %r14, %r14
je 0x1588
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x4b52(%rip), %rdi      # 0x60ce
xorl %eax, %eax
callq 0x1040
testq %r14, %r14
je 0x1570
xorl %edi, %edi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x1401
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x18c6b(%rip)     # 0x1a20d
jne 0x15b1
movb $0x0, 0x18c62(%rip)     # 0x1a20d
popq %rbx
popq %r14
popq %r15
retq
movl %edi, %ebx
leaq 0x4dde(%rip), %rdi      # 0x6398
callq 0x1140
cmpl $0x20, %ebx
jae 0x1613
movl %ebx, %eax
leaq 0x8b23(%rip), %rcx      # 0xa0f0
leaq (%rcx,%rax,8), %rbx
movq %rbx, %rdi
callq 0x5c86
movq %rax, %r14
leaq 0x18c15(%rip), %r15     # 0x1a1f8
movq %r15, %rdi
callq 0x5c86
subl %eax, %r14d
movl %r14d, 0x18c13(%rip)    # 0x1a208
decl 0x1dc15(%rip)           # 0x1f210
movq %rbx, %rdi
callq 0x5c86
movq %r15, %rdi
movq %rax, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x5c8e
leaq 0x4acd(%rip), %rdi      # 0x60e7
leaq 0x4a6e(%rip), %rsi      # 0x608f
leaq 0x4ad0(%rip), %rcx      # 0x60f8
movl $0x8c, %edx
callq 0x1080
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1909
testl %esi, %esi
je 0x1940
movslq %r14d, %rax
leaq 0x8810(%rip), %r15      # 0xa0f0
leaq (%r15,%rax,8), %rdi
callq 0x5c86
movq %rax, %r14
movslq %ebp, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5c86
movl %eax, %ecx
shrq %cl, %r14
movslq %ebx, %rax
leaq (%r15,%rax,8), %rdi
movq %r14, %rsi
jmp 0x196e
testl %esi, %esi
je 0x197d
movslq %r14d, %rax
leaq 0x87d9(%rip), %r15      # 0xa0f0
leaq (%r15,%rax,8), %rdi
callq 0x5c8a
movl %eax, %r14d
movslq %ebp, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5c8a
movl %eax, %ecx
sarl %cl, %r14d
movslq %ebx, %rax
leaq (%r15,%rax,8), %rdi
movl %r14d, %esi
jmp 0x19a9
leaq 0x4b36(%rip), %rdi      # 0x647d
callq 0x1140
movslq %r14d, %rax
leaq 0x879a(%rip), %r14      # 0xa0f0
leaq (%r14,%rax,8), %rdi
callq 0x5c86
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 0x5c8e
leaq 0x4ad7(%rip), %rdi      # 0x645b
callq 0x1140
movslq %r14d, %rax
leaq 0x875d(%rip), %r14      # 0xa0f0
leaq (%r14,%rax,8), %rdi
callq 0x5c8a
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 0x5c94
// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
movl %r8d, %r14d
movl %edx, %ebx
movslq %ecx, %rax
leaq 0x8721(%rip), %r12      # 0xa0f0
leaq (%r12,%rax,8), %r15
testl %edi, %edi
je 0x1a0f
testl %esi, %esi
je 0x1a44
leaq 0x4af1(%rip), %rdi      # 0x64d3
callq 0x1140
movq %r15, %rdi
callq 0x5c86
movq %rax, %r15
movslq %r14d, %rax
leaq (%r12,%rax,8), %rdi
callq 0x5c86
movl %eax, %ecx
shlq %cl, %r15
movslq %ebx, %rax
leaq (%r12,%rax,8), %rdi
movq %r15, %rsi
jmp 0x1a7c
testl %esi, %esi
je 0x1a89
leaq 0x4a80(%rip), %rdi      # 0x649a
callq 0x1140
movq %r15, %rdi
callq 0x5c8a
movl %eax, %ebp
movslq %r14d, %rax
leaq (%r12,%rax,8), %rdi
callq 0x5c8a
movl %eax, %ecx
shll %cl, %ebp
movslq %ebx, %rax
leaq (%r12,%rax,8), %rdi
movl %ebp, %esi
jmp 0x1aab
leaq 0x4aa4(%rip), %rdi      # 0x64ef
callq 0x1140
movq %r15, %rdi
callq 0x5c86
leal 0x3f(%r14), %ecx
testl %r14d, %r14d
cmovnsl %r14d, %ecx
andl $0xc0, %ecx
subl %ecx, %r14d
movl %r14d, %ecx
shlq %cl, %rax
movslq %ebx, %rcx
leaq (%r12,%rcx,8), %rdi
movq %rax, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5c8e
leaq 0x4a26(%rip), %rdi      # 0x64b6
callq 0x1140
movq %r15, %rdi
callq 0x5c8a
movl %r14d, %ecx
shll %cl, %eax
movslq %ebx, %rcx
leaq (%r12,%rcx,8), %rdi
movl %eax, %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5c94
// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r14d
movl %edx, %ebx
movl %esi, %r12d
movl %edi, %eax
movslq %ecx, %rcx
leaq 0x8619(%rip), %r13      # 0xa0f0
leaq (,%rcx,8), %rdi
addq %r13, %rdi
testl %eax, %eax
je 0x1b0a
callq 0x5c86
movq %rax, %r15
testl %r12d, %r12d
je 0x1b2d
movslq %r14d, %rax
leaq (,%rax,8), %rdi
addq %r13, %rdi
callq 0x5c86
movl %eax, %ecx
jmp 0x1b43
callq 0x5c8a
movl %eax, %ebp
testl %r12d, %r12d
je 0x1b6a
movslq %r14d, %rax
leaq (,%rax,8), %rdi
addq %r13, %rdi
callq 0x5c8a
movl %eax, %ecx
jmp 0x1b6d
leal 0x3f(%r14), %eax
testl %r14d, %r14d
cmovnsl %r14d, %eax
andl $0xc0, %eax
subl %eax, %r14d
movl %r14d, %ecx
shrq %cl, %r15
movslq %ebx, %rax
leaq (,%rax,8), %rdi
addq %r13, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5c8e
movl %r14d, %ecx
sarl %cl, %ebp
movslq %ebx, %rax
leaq (,%rax,8), %rdi
addq %r13, %rdi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5c94
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1be2
cmpl $0x1, %esi
je 0x1c29
testl %esi, %esi
jne 0x1c1e
leaq 0x499e(%rip), %rdi      # 0x6553
callq 0x1140
movslq %r14d, %rax
leaq 0x852c(%rip), %r14      # 0xa0f0
leaq (%r14,%rax,8), %rdi
callq 0x5c86
movslq %ebp, %rcx
subq %rcx, %rax
movslq %ebx, %rcx
leaq (%r14,%rcx,8), %rdi
movq %rax, %rsi
jmp 0x1c64
cmpl $0x1, %esi
je 0x1c73
testl %esi, %esi
jne 0x1c1e
leaq 0x4916(%rip), %rdi      # 0x650c
callq 0x1140
movslq %r14d, %rax
leaq 0x84eb(%rip), %r14      # 0xa0f0
leaq (%r14,%rax,8), %rdi
callq 0x5c8a
subl %ebp, %eax
movslq %ebx, %rcx
leaq (%r14,%rcx,8), %rdi
movl %eax, %esi
jmp 0x1cae
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4947(%rip), %rdi      # 0x6577
callq 0x1140
movslq %r14d, %rax
leaq 0x84b1(%rip), %r15      # 0xa0f0
leaq (%r15,%rax,8), %rdi
callq 0x5c86
movq %rax, %r14
movslq %ebp, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5c86
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 0x5c8e
leaq 0x48b6(%rip), %rdi      # 0x6530
callq 0x1140
movslq %r14d, %rax
leaq 0x8467(%rip), %r15      # 0xa0f0
leaq (%r15,%rax,8), %rdi
callq 0x5c8a
movl %eax, %r14d
movslq %ebp, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5c8a
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 0x5c94
// File: /workspace/github_cpp_makefile_star2_O1/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 0x8420(%rip), %r15      # 0xa0f0
leaq (%r15,%rax,8), %rbx
testl %edi, %edi
je 0x1cfc
movslq %ebp, %r14
testl %esi, %esi
je 0x1d1f
leaq 0x48d1(%rip), %rdi      # 0x65b7
callq 0x1140
leaq (%r15,%r14,8), %rdi
callq 0x5c86
movq %rbx, %rdi
movq %rax, %rsi
jmp 0x1d31
leaq 0x4897(%rip), %rdi      # 0x659a
testl %esi, %esi
je 0x1d40
callq 0x1140
movslq %ebp, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5c8a
movq %rbx, %rdi
movl %eax, %esi
jmp 0x1d4a
leaq 0x48ad(%rip), %rdi      # 0x65d3
callq 0x1140
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5c8e
callq 0x1140
movq %rbx, %rdi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5c94
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1dab
testl %eax, %eax
je 0x1ddd
movslq %ebp, %rax
leaq 0x836c(%rip), %r12      # 0xa0f0
leaq (%r12,%rax,8), %rdi
callq 0x5c86
movq %rax, %r15
movslq %r14d, %rax
leaq (%r12,%rax,8), %rdi
callq 0x5c86
andq %rax, %r15
movslq %ebx, %rax
leaq (%r12,%rax,8), %rdi
movq %r15, %rsi
jmp 0x1e0d
testl %eax, %eax
je 0x1e1a
movslq %ebp, %rax
leaq 0x8337(%rip), %r15      # 0xa0f0
leaq (%r15,%rax,8), %rdi
callq 0x5c8a
movl %eax, %ebp
movslq %r14d, %rax
leaq (%r15,%rax,8), %rdi
callq 0x5c8a
andl %eax, %ebp
movslq %ebx, %rax
leaq (%r15,%rax,8), %rdi
movl %ebp, %esi
jmp 0x1e4a
movl %r9d, %edi
movl $0x40, %ecx
callq 0x1e57
movq %rax, %r14
movslq %ebp, %rax
leaq 0x82f9(%rip), %r15      # 0xa0f0
leaq (%r15,%rax,8), %rdi
callq 0x5c86
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 0x5c8e
movl %r9d, %edi
movl $0x20, %ecx
callq 0x1e57
movq %rax, %r14
movslq %ebp, %rax
leaq 0x82bc(%rip), %r15      # 0xa0f0
leaq (%r15,%rax,8), %rdi
callq 0x5c8a
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 0x5c94
// File: /workspace/github_cpp_makefile_star2_O1/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 0x163bb(%rip), %rbx     # 0x1a1f0
movq %rbx, %rdi
callq 0x5c8a
movl %eax, %r15d
movq %rbx, %rdi
callq 0x5c8a
movl %eax, %ebp
movq %rbx, %rdi
callq 0x5c8a
movl %eax, %r14d
movq %rbx, %rdi
callq 0x5c8a
movl %eax, %ebx
leaq 0x1639a(%rip), %rdi     # 0x1a200
callq 0x5c86
testl %r15d, %r15d
js 0x3ea8
shrl $0x1d, %ebp
andl $0x3, %ebp
shrl $0x3, %r14d
movl %r14d, %edx
andl $0x1ffffc, %edx         # imm = 0x1FFFFC
orl %ebp, %edx
xorl %ecx, %ecx
xorl %esi, %esi
movl $0x1, %edi
shll %cl, %edi
andl %edx, %edi
addq %rdi, %rsi
incl %ecx
cmpl $0x14, %ecx
jne 0x3e89
andl $0x100000, %r14d        # imm = 0x100000
subq %r14, %rsi
jmp 0x3ead
andl $0xfffff000, %eax       # imm = 0xFFFFF000
addq %rax, %rsi
andl $0x1f, %ebx
leaq 0x6236(%rip), %rax      # 0xa0f0
leaq (%rax,%rbx,8), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5c8e
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x156a1(%rip), %rdi     # 0x1a210
xorl %r14d, %r14d
movl $0x1000, %edx           # imm = 0x1000
xorl %esi, %esi
callq 0x1070
leaq 0x1668b(%rip), %rdi     # 0x1b210
movl $0x4000, %edx           # imm = 0x4000
xorl %esi, %esi
callq 0x1070
leaq 0x5658(%rip), %rax      # 0xa1f0
movw $0x0, 0x8(%r14,%rax)
movq %rbx, (%r14,%rax)
incq %rbx
addq $0x10, %r14
cmpq $0x10000, %r14          # imm = 0x10000
jne 0x4b98
xorl %ebx, %ebx
leaq 0x5533(%rip), %r14      # 0xa0f0
leaq (%r14,%rbx), %rdi
xorl %esi, %esi
callq 0x5c8e
addq $0x8, %rbx
cmpq $0x100, %rbx            # imm = 0x100
jne 0x4bbd
movl $0x4, 0x15629(%rip)     # 0x1a208
xorl %eax, %eax
movb %al, 0x54fd(%rip)       # 0xa0e4
movb %al, 0x54f5(%rip)       # 0xa0e2
movb %al, 0x54f0(%rip)       # 0xa0e3
movb %al, 0x54e8(%rip)       # 0xa0e1
movl $0x0, 0x1a60d(%rip)     # 0x1f210
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
subq 0x55be(%rip), %rdi      # 0xa1f0
cmpl $0x64, %edx
je 0x4c3c
cmpl $0x78, %edx
jne 0x4ca7
testl %esi, %esi
jle 0x4c98
addl %edi, %esi
movslq %edi, %r15
movslq %esi, %r12
movq %r15, %rax
shlq $0x4, %rax
leaq 0x559a(%rip), %rbx      # 0xa1f0
addq %rax, %rbx
movsbl %dl, %ebp
leaq 0x1561(%rip), %r13      # 0x61c4
movq %r13, %r14
cmpl $0x64, %ebp
je 0x4c77
cmpl $0x78, %ebp
jne 0x4c8c
leaq 0x1551(%rip), %r14      # 0x61c8
movq %rbx, %rdi
callq 0x5c82
movzbl %al, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1040
incq %r15
addq $0x10, %rbx
cmpq %r12, %r15
jl 0x4c63
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14d3(%rip), %rdi      # 0x6181
leaq 0x14e1(%rip), %rsi      # 0x6196
leaq 0x14e5(%rip), %rcx      # 0x61a1
movl $0x33, %edx
callq 0x1080
// File: /workspace/github_cpp_makefile_star2_O1/akshayrajput[P]ARMV8_Simulator/simulo.cpp
// Function: setBreak(char*)
void setBreak(char* arg)
{
	//TODO -set bp_flag at particular address
	while(*arg == ' ')arg++;
	int ind = addrToIndex(arg);
	breakpt[ind] = true;
}

// Assembly:
pushq %rax
decq %rdi
cmpb $0x20, 0x1(%rdi)
leaq 0x1(%rdi), %rdi
je 0x4e9b
xorl %esi, %esi
movl $0x10, %edx
callq 0x1060
subl 0x5339(%rip), %eax      # 0xa1f0
cltq
leaq 0x15350(%rip), %rcx     # 0x1a210
movb $0x1, (%rax,%rcx)
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/akshayrajput[P]ARMV8_Simulator/simulo.cpp
// Function: delBreak(char*)
void delBreak(char* arg)
{
	//TODO -set bp_flag at particular address
	while(*arg == ' ')arg++;
	int ind = addrToIndex(arg);
	breakpt[ind] = false;
}

// Assembly:
pushq %rax
decq %rdi
cmpb $0x20, 0x1(%rdi)
leaq 0x1(%rdi), %rdi
je 0x4eca
xorl %esi, %esi
movl $0x10, %edx
callq 0x1060
subl 0x530a(%rip), %eax      # 0xa1f0
cltq
leaq 0x15321(%rip), %rcx     # 0x1a210
movb $0x0, (%rax,%rcx)
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1d6f(%rip), %rdi      # 0x6c6c
callq 0x1140
leaq 0x1d89(%rip), %rdi      # 0x6c92
callq 0x1140
leaq 0x1dad(%rip), %rdi      # 0x6cc2
callq 0x1140
leaq 0x1dce(%rip), %rdi      # 0x6cef
callq 0x1140
leaq 0x1dee(%rip), %rdi      # 0x6d1b
callq 0x1140
leaq 0x1e04(%rip), %rdi      # 0x6d3d
callq 0x1140
leaq 0x12d3(%rip), %rdi      # 0x6218
xorl %eax, %eax
callq 0x1040
leaq 0x1e1f(%rip), %rdi      # 0x6d72
popq %rax
jmp 0x1140
// File: /workspace/github_cpp_makefile_star2_O1/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 0x150ba(%rip), %rdi     # 0x1a1f8
callq 0x5c86
movq %rax, %rbx
movq %rax, %r15
subq 0x50a0(%rip), %r15      # 0xa1f0
movslq %r15d, %r14
leaq 0x160b6(%rip), %rax     # 0x1b210
movl (%rax,%r14,4), %ecx
cmpl $0x2, %ecx
jl 0x5175
cmpl $0x0, 0x1a0a6(%rip)     # 0x1f210
jne 0x5175
movb $0x1, 0x1509a(%rip)     # 0x1a20d
jmp 0x5182
cmpl $0x1, %ecx
jne 0x5182
movl $0x2, (%rax,%r14,4)
leaq 0x1c31(%rip), %rdi      # 0x6dba
callq 0x1140
cmpb $0x1, 0x15077(%rip)     # 0x1a20c
jne 0x51a8
leaq 0x1c37(%rip), %rdi      # 0x6dd5
callq 0x1140
callq 0x4f59
shlq $0x20, %r15
leaq 0x1505d(%rip), %rax     # 0x1a210
cmpb $0x1, (%r14,%rax)
jne 0x51d0
leaq 0x10b1(%rip), %rdi      # 0x6272
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1040
callq 0x4f59
shlq $0x4, %r14
leaq 0x5015(%rip), %r12      # 0xa1f0
addq %r12, %r14
movq %r14, %rdi
callq 0x5c82
movzbl %al, %eax
shll $0x18, %eax
movslq %eax, %r14
movabsq $0x100000000, %rdi      # imm = 0x100000000
addq %r15, %rdi
sarq $0x1c, %rdi
addq %r12, %rdi
callq 0x5c82
movzbl %al, %r13d
shll $0x10, %r13d
orq %r14, %r13
movabsq $0x200000000, %rdi      # imm = 0x200000000
addq %r15, %rdi
sarq $0x1c, %rdi
addq %r12, %rdi
callq 0x5c82
movzbl %al, %r14d
shll $0x8, %r14d
orq %r13, %r14
movabsq $0x300000000, %rdi      # imm = 0x300000000
addq %r15, %rdi
sarq $0x1c, %rdi
addq %r12, %rdi
callq 0x5c82
movzbl %al, %esi
orq %r14, %rsi
leaq 0x14f93(%rip), %rdi     # 0x1a1f0
callq 0x5c8e
leaq 0x14f8f(%rip), %r14     # 0x1a1f8
movq %r14, %rdi
callq 0x5c86
leaq 0x14f88(%rip), %rdi     # 0x1a200
movq %rax, %rsi
callq 0x5c8e
addq $0x4, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5c8e
leaq 0x1b52(%rip), %rdi      # 0x6de8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1140
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x14708(%rip)     # 0x1a20c
cmpl $0x2, %edi
jl 0x5b24
movq 0x8(%rsi), %rdi
leaq 0x794(%rip), %rsi       # 0x62a8
callq 0x1110
testl %eax, %eax
jne 0x5b24
movb $0x1, 0x146e8(%rip)     # 0x1a20c
leaq 0x783(%rip), %rdi       # 0x62ae
leaq 0x123e(%rip), %rbx      # 0x6d70
movq %rbx, %rsi
callq 0x10f0
movq %rax, %r14
leaq 0x773(%rip), %rdi       # 0x62b7
movq %rbx, %rsi
callq 0x10f0
movq %rax, %rbx
leaq 0x76a(%rip), %rsi       # 0x62c0
leaq 0x18(%rsp), %r15
leaq 0xb(%rsp), %rcx
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1170
movq %r14, %rdi
callq 0x10d0
movq (%r15), %rdi
callq 0x4b61
leaq 0x743(%rip), %rsi       # 0x62c7
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1170
testl %eax, %eax
jle 0x5bce
leaq 0x15672(%rip), %r12     # 0x1b210
leaq 0x722(%rip), %r14       # 0x62c7
leaq 0xc(%rsp), %r15
movl 0xc(%rsp), %eax
cmpq $0xfff, %rax            # imm = 0xFFF
ja 0x5bba
incl (%r12,%rax,4)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1170
testl %eax, %eax
jg 0x5baa
movq %rbx, %rdi
callq 0x10d0
leaq 0x1439(%rip), %rdi      # 0x7016
callq 0x1140
leaq 0x6e1(%rip), %rsi       # 0x62ca
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x5d70
movsbl 0xb(%rsp), %ecx
leaq 0x45ee(%rip), %rdx      # 0xa1f0
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5dcc
movl %eax, %ebx
leaq 0x1419(%rip), %rdi      # 0x7030
callq 0x1140
movq 0x45cd(%rip), %rsi      # 0xa1f0
leaq 0x145ce(%rip), %rdi     # 0x1a1f8
callq 0x5c8e
cmpl $0x4, %ebx
jl 0x5c4b
addl $-0x4, %ebx
callq 0x512e
callq 0x52a4
addl 0x145c1(%rip), %ebp     # 0x1a208
cmpl %ebx, %ebp
jle 0x5c37
leaq 0x13f4(%rip), %rdi      # 0x7046
callq 0x1140
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/akshayrajput[P]ARMV8_Simulator/mem.cpp
// Function: setDataW(mem*, unsigned int, int)
int setDataW(mem M[],uint32_t dat,int start)
{
	uint8_t w = (dat &0xff000000)>>24;
  	uint8_t x = (dat &0x00ff0000)>>16;
	uint8_t y = (dat &0x0000ff00)>>8;
	
	uint8_t z = (dat &0x000000ff);

	M[start].setData(w);
	start++;
	M[start].setData(x);
	start++;
	M[start].setData(y);
	start++;
	M[start].setData(z);
	start++;	

	return start;
}

// Assembly:
movl %esi, %ecx
shrl $0x18, %esi
movl %ecx, %r8d
shrl $0x10, %r8d
movslq %edx, %rax
movq %rax, %rdx
shlq $0x4, %rdx
movb %sil, 0x8(%rdi,%rdx)
movb $0x1, %sil
movb %sil, 0x9(%rdi,%rdx)
movb %r8b, 0x18(%rdi,%rdx)
movb %sil, 0x19(%rdi,%rdx)
movb %ch, 0x28(%rdi,%rdx)
movb %sil, 0x29(%rdi,%rdx)
movb %cl, 0x38(%rdi,%rdx)
movb %sil, 0x39(%rdi,%rdx)
addl $0x4, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/akshayrajput[P]ARMV8_Simulator/mem.cpp
// Function: setDataDW(mem*, unsigned long, int)
int setDataDW(mem M[],uint64_t dat,int start)
{
	uint64_t a = dat;
	uint8_t b = (a & 0xff00000000000000)>>56;
	uint8_t c = (a & 0x00ff000000000000)>>48;
	uint8_t d = (a & 0x0000ff0000000000)>>40;
	uint8_t e = (a & 0x000000ff00000000)>>32;
	uint8_t f = (a & 0x00000000ff000000)>>24;
	uint8_t g = (a & 0x0000000000ff0000)>>16;
	uint8_t h = (a & 0xff0000000000ff00)>>8;
	uint8_t i = (a & 0xff000000000000ff);


	M[start].setData(b);
	start++;
	M[start].setData(c);
	start++;
	M[start].setData(d);
	start++;
	M[start].setData(e);
	start++;
	M[start].setData(f);
	start++;
	M[start].setData(g);
	start++;
	M[start].setData(h);
	start++;
	M[start].setData(i);
	start++;	

	return start;
}

// Assembly:
pushq %rbx
movq %rsi, %rcx
shrq $0x38, %rsi
movq %rcx, %r8
shrq $0x30, %r8
movq %rcx, %r9
shrq $0x28, %r9
movq %rcx, %r10
shrq $0x20, %r10
movl %ecx, %r11d
shrl $0x18, %r11d
movl %ecx, %ebx
shrl $0x10, %ebx
movslq %edx, %rax
movq %rax, %rdx
shlq $0x4, %rdx
movb %sil, 0x8(%rdi,%rdx)
movb $0x1, %sil
movb %sil, 0x9(%rdi,%rdx)
movb %r8b, 0x18(%rdi,%rdx)
movb %sil, 0x19(%rdi,%rdx)
movb %r9b, 0x28(%rdi,%rdx)
movb %sil, 0x29(%rdi,%rdx)
movb %r10b, 0x38(%rdi,%rdx)
movb %sil, 0x39(%rdi,%rdx)
movb %r11b, 0x48(%rdi,%rdx)
movb %sil, 0x49(%rdi,%rdx)
movb %bl, 0x58(%rdi,%rdx)
movb %sil, 0x59(%rdi,%rdx)
movb %ch, 0x68(%rdi,%rdx)
movb %sil, 0x69(%rdi,%rdx)
movb %cl, 0x78(%rdi,%rdx)
movb %sil, 0x79(%rdi,%rdx)
addl $0x8, %eax
popq %rbx
retq
nop