// File: /workspace/github_cpp_makefile_star2_O2/sthapliyal37[P]Microprocessor_8085_Updated/Memory_Allocation.cpp
// Function: allocate_memory(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string allocate_memory(string s,string pc)
{
		string 						size1[]={"MOV","LDAX","STAX","XCHG","ADD","DCR","INR","SUB","INX","DCX","CMP","CMA","DAD"};
		string size2[]={"ADI","SUI","MVI"};
		string size3[]={"LDA","LXI","STA","SHLD","LHLD","SET","JMP","JC","JNC","JZ","JNZ"};
		int num=0;
		string num1="0001",num2="0002",num3="0003";	
		int n=pc.length();
		//cout<<num<<endl;
		n=sizeof(size1)/sizeof(size1[0]);
		for(int i=0;i<n;i++)
		{
			if(!size1[i].compare(s))
			{
				/*std::stringstream ss;
				ss<< std::hex << num+1;
				std::string res ( ss.str() );*/
				pc=sumBase14(pc,num1);
				return pc;
			}
		}
		n=sizeof(size2)/sizeof(size2[0]);
		for(int i=0;i<n;i++)
		{
				if(!size2[i].compare(s))
				{
					/*pc=itos(num+2);
					std::stringstream ss;
					ss<< std::hex << num+2;
					std::string res ( ss.str() );*/
					pc=sumBase14(pc,num2);
					return pc;
				}							
		}
		n=sizeof(size3)/sizeof(size3[0]);
		for(int i=0;i<n;i++)
		{
				if(!size3[i].compare(s))
				{									
					/*pc=itos(num+3);
					std::stringstream ss;
					ss<< std::hex << num+3;
					std::string res ( ss.str() );*/
					pc=sumBase14(pc,num3);
					return pc;
				}				
		}

	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x488, %rsp            # imm = 0x488
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x6e91(%rip), %rsi      # 0xa054
leaq -0x4b0(%rbp), %r12
leaq -0x310(%rbp), %rdx
movq %r12, %rdi
callq 0x2f1e
leaq -0x490(%rbp), %r13
leaq 0x6fb6(%rip), %rsi      # 0xa19d
leaq -0x1b0(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x470(%rbp), %r13
leaq 0x6e65(%rip), %rsi      # 0xa069
leaq -0x90(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x450(%rbp), %r13
leaq 0x6e4d(%rip), %rsi      # 0xa06e
leaq -0x50(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x430(%rbp), %r13
leaq 0x6ddb(%rip), %rsi      # 0xa016
leaq -0x70(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x410(%rbp), %r13
leaq 0x6dd1(%rip), %rsi      # 0xa026
leaq -0x29(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x3f0(%rbp), %r13
leaq 0x6db3(%rip), %rsi      # 0xa022
leaq -0x30(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x3d0(%rbp), %r13
leaq 0x6d95(%rip), %rsi      # 0xa01e
leaq -0x2f(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x3b0(%rbp), %r13
leaq 0x6d87(%rip), %rsi      # 0xa02a
leaq -0x2e(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x390(%rbp), %r13
leaq 0x6d71(%rip), %rsi      # 0xa02e
leaq -0x2d(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x370(%rbp), %r13
leaq 0x6d67(%rip), %rsi      # 0xa03e
leaq -0x2c(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x350(%rbp), %r13
leaq 0x6d49(%rip), %rsi      # 0xa03a
leaq -0x2b(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x330(%rbp), %r13
leaq 0x6d27(%rip), %rsi      # 0xa032
leaq -0x2a(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq 0x6cfc(%rip), %rsi      # 0xa01a
leaq -0x1b0(%rbp), %r12
leaq -0x310(%rbp), %rdx
movq %r12, %rdi
callq 0x2f1e
leaq -0x190(%rbp), %r13
leaq 0x6cf4(%rip), %rsi      # 0xa036
leaq -0x90(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x170(%rbp), %r13
leaq 0x6cf9(%rip), %rsi      # 0xa058
leaq -0x50(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq 0x6cee(%rip), %rsi      # 0xa060
leaq -0x310(%rbp), %r12
leaq -0x90(%rbp), %rdx
movq %r12, %rdi
callq 0x2f1e
leaq -0x2f0(%rbp), %r13
leaq 0x6cc6(%rip), %rsi      # 0xa05c
leaq -0x50(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x2d0(%rbp), %r13
leaq 0x6cc3(%rip), %rsi      # 0xa073
leaq -0x70(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x2b0(%rbp), %r13
leaq 0x6c9a(%rip), %rsi      # 0xa064
leaq -0x29(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x290(%rbp), %r13
leaq 0x6c93(%rip), %rsi      # 0xa077
leaq -0x30(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x270(%rbp), %r13
leaq 0x6c7e(%rip), %rsi      # 0xa07c
leaq -0x2f(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x250(%rbp), %r13
leaq 0x6c2a(%rip), %rsi      # 0xa042
leaq -0x2e(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x230(%rbp), %r13
leaq 0x6c14(%rip), %rsi      # 0xa046
leaq -0x2d(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x210(%rbp), %r13
leaq 0x6bfd(%rip), %rsi      # 0xa049
leaq -0x2c(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x1f0(%rbp), %r13
leaq 0x6be7(%rip), %rsi      # 0xa04d
leaq -0x2b(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq -0x1d0(%rbp), %r13
leaq 0x6bd0(%rip), %rsi      # 0xa050
leaq -0x2a(%rbp), %rdx
movq %r13, %rdi
callq 0x2f1e
leaq 0x6d0f(%rip), %rsi      # 0xa1a2
leaq -0x90(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x2f1e
leaq 0x6cfd(%rip), %rsi      # 0xa1a7
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x2f1e
leaq 0x6cee(%rip), %rsi      # 0xa1ac
leaq -0x70(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x2f1e
xorl %ecx, %ecx
leaq 0x20(%rcx), %r13
cmpq $0x1c0, %r13            # imm = 0x1C0
je 0x354c
leaq (%rcx,%rbp), %rdi
addq $-0x4b0, %rdi           # imm = 0xFB50
movq %r15, %rsi
callq 0x2040
movq %r13, %rcx
testl %eax, %eax
jne 0x34cd
leaq -0x150(%rbp), %rdi
movq %r14, %rsi
callq 0x2280
leaq -0x130(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x2280
leaq -0x150(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x2ff8
movq %r14, %rdi
movq %rax, %rsi
callq 0x2340
leaq -0x130(%rbp), %rdi
callq 0x20f0
leaq -0x150(%rbp), %rdi
jmp 0x362a
xorl %ecx, %ecx
leaq 0x20(%rcx), %r13
cmpq $0x80, %r13
je 0x35c7
leaq (%rcx,%rbp), %rdi
addq $-0x1b0, %rdi           # imm = 0xFE50
movq %r15, %rsi
callq 0x2040
movq %r13, %rcx
testl %eax, %eax
jne 0x354e
leaq -0x110(%rbp), %rdi
movq %r14, %rsi
callq 0x2280
leaq -0xf0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2280
leaq -0x110(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x2ff8
movq %r14, %rdi
movq %rax, %rsi
callq 0x2340
leaq -0xf0(%rbp), %rdi
callq 0x20f0
leaq -0x110(%rbp), %rdi
jmp 0x362a
movq %r12, %rdi
movq %r15, %rsi
callq 0x2040
addq $0x20, %r12
testl %eax, %eax
jne 0x35c7
leaq -0xd0(%rbp), %rdi
movq %r14, %rsi
callq 0x2280
leaq -0xb0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2280
leaq -0xd0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x2ff8
movq %r14, %rdi
movq %rax, %rsi
callq 0x2340
leaq -0xb0(%rbp), %rdi
callq 0x20f0
leaq -0xd0(%rbp), %rdi
callq 0x20f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2270
leaq -0x70(%rbp), %rdi
callq 0x20f0
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq -0x90(%rbp), %rdi
callq 0x20f0
movl $0x140, %r14d           # imm = 0x140
leaq (%r14,%rbp), %rdi
addq $-0x310, %rdi           # imm = 0xFCF0
callq 0x20f0
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x365e
pushq $0x40
popq %r14
leaq (%r14,%rbp), %rdi
addq $-0x1b0, %rdi           # imm = 0xFE50
callq 0x20f0
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x367c
movl $0x180, %r14d           # imm = 0x180
leaq (%r14,%rbp), %rdi
addq $-0x4b0, %rdi           # imm = 0xFB50
callq 0x20f0
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x369c
movq %rbx, %rax
addq $0x488, %rsp            # imm = 0x488
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x36f8
jmp 0x37da
movq %rax, %rbx
jmp 0x3710
jmp 0x37da
movq %rax, %rbx
jmp 0x3728
jmp 0x37da
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x20f0
leaq -0x110(%rbp), %rdi
jmp 0x372f
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x20f0
leaq -0xd0(%rbp), %rdi
jmp 0x372f
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0x20f0
leaq -0x150(%rbp), %rdi
callq 0x20f0
jmp 0x37dd
movq %rax, %rbx
jmp 0x37e6
movq %rax, %rbx
jmp 0x37ef
movq %rax, %rbx
jmp 0x37fb
jmp 0x3763
jmp 0x3763
jmp 0x3763
jmp 0x3763
jmp 0x3763
jmp 0x3763
jmp 0x3763
jmp 0x3763
jmp 0x3763
movq %rax, %rbx
addq $-0x20, %r13
movq %r13, %rdi
callq 0x20f0
cmpq %r12, %r13
jne 0x3766
jmp 0x381b
movq %rax, %rbx
jmp 0x381b
jmp 0x3786
movq %rax, %rbx
addq $-0x20, %r13
movq %r13, %rdi
callq 0x20f0
cmpq %r12, %r13
jne 0x3789
jmp 0x3839
movq %rax, %rbx
jmp 0x3839
jmp 0x37bd
jmp 0x37bd
jmp 0x37bd
jmp 0x37bd
jmp 0x37bd
jmp 0x37bd
jmp 0x37bd
jmp 0x37bd
jmp 0x37bd
jmp 0x37bd
jmp 0x37bd
movq %rax, %rbx
addq $-0x20, %r13
movq %r13, %rdi
callq 0x20f0
cmpq %r12, %r13
jne 0x37c0
jmp 0x3859
jmp 0x37da
jmp 0x37da
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x20f0
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq -0x90(%rbp), %rdi
callq 0x20f0
movl $0x140, %r14d           # imm = 0x140
leaq (%r14,%rbp), %rdi
addq $-0x310, %rdi           # imm = 0xFCF0
callq 0x20f0
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x3801
pushq $0x40
popq %r14
leaq (%r14,%rbp), %rdi
addq $-0x1b0, %rdi           # imm = 0xFE50
callq 0x20f0
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x381f
movl $0x180, %r14d           # imm = 0x180
leaq (%r14,%rbp), %rdi
addq $-0x4b0, %rdi           # imm = 0xFB50
callq 0x20f0
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x383f
movq %rbx, %rdi
callq 0x2310
nopl (%rax)