// File: /workspace/github_cpp_makefile_star2_O2/hobbitsyfeet[P]Turn/turn.cc
// Function: Turn::movePlayer(Unit&, Chart&)
void Turn::movePlayer(Unit& player, Chart& world){
	string option;
			bool spawning;
			int dist;
			cout<<"which way>>";
			cin>>option;
			cout<<"how much>>"<<endl;

			cin>>dist;
			world.setCanEnter(player.getPosX(),player.getPosY(),false);
			if(option == "north" || option == "up"){
				for(int i =0; i<dist;i++){
					//cout<<i;
					if( world.canEnter(player.getPosX(), player.getPosY()+1 ) ==false ){
						///increment Y
					player.posY += 1;
					world.isPortal(player.getPosX(),player.getPosY(),spawning);
						if(spawning == true){
							world.setSpawn('O',player.posX,player.posY);
							spawning = false;
							break;
						}
					}
					else{
						break;
					}
				}
				world.setCanEnter(player.getPosX(),player.getPosY(),true);
			}

			else if(option == "east" || option == "right"){
				for(int i =0; i<dist;i++){
					if( world.canEnter(player.getPosX()+1, player.getPosY() ) ==false ){
						//increment X
						player.posX += 1;
						world.isPortal(player.getPosX(),player.getPosY(),spawning);
						if(spawning == true){
							world.setSpawn('O',player.posX,player.posY);
							spawning = false;
							break;
						}
					}
					else{
						break;
						}
				}
				world.setCanEnter(player.getPosX(),player.getPosY(),true);
			}

			else if(option == "south" || option == "down"){
				for(int i =0; i<dist;i++){
					if( world.canEnter(player.getPosX(), player.getPosY()-1 ) ==false ){
						//decrement Y
					player.posY -=1;
					world.isPortal(player.getPosX(),player.getPosY(),spawning);
						if(spawning == true){
							world.setSpawn('O',player.posX,player.posY);
							spawning = false;
							break;
						}
					}
					else{
						break;
						}
				}
				world.setCanEnter(player.getPosX(),player.getPosY(),true);
			}

			else if(option == "west" || option == "left"){
				for(int i =0; i<dist;i++){
					if( world.canEnter(player.getPosX()-1, player.getPosY() ) ==false ){
						//decrement X
						player.posX -=1;
						world.isPortal(player.getPosX(),player.getPosY(),spawning);
						if(spawning == true){
							world.setSpawn('O',player.posX,player.posY);
							spawning = false;
							break;
						}
					}
					else{
						break;
						return;
					}
				}
				world.setCanEnter(player.getPosX(),player.getPosY(),true);
			}
			cout<<world.getChartName()<<endl;
			world.displayRange(player.getPosX(),player.getPosY(),5);
			player.setCurrentWorld(world.getChartName());
			//cout<<"you are at:"<<player.getCurrentWorld();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %r14
movq %rsi, %rbx
leaq -0x48(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x84ce(%rip), %rdi      # 0xdfd0
leaq 0x3b8f(%rip), %rsi      # 0x9698
callq 0x21c0
movq 0x84cb(%rip), %rdi      # 0xdfe0
leaq -0x58(%rbp), %rsi
callq 0x2220
movq 0x84ab(%rip), %rdi      # 0xdfd0
leaq 0x3b78(%rip), %rsi      # 0x96a4
callq 0x21c0
movq %rax, %rdi
callq 0x2110
movq 0x84a0(%rip), %rdi      # 0xdfe0
leaq -0x30(%rbp), %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r15d
movq %rbx, %rdi
callq 0x31ba
movq %r14, %rdi
movl %r15d, %esi
movl %eax, %edx
xorl %ecx, %ecx
callq 0x696e
leaq 0x3b3d(%rip), %rsi      # 0x96af
leaq -0x58(%rbp), %rdi
callq 0x2e13
testb %al, %al
jne 0x5b97
leaq 0x3b2f(%rip), %rsi      # 0x96b5
leaq -0x58(%rbp), %rdi
callq 0x2e13
testb %al, %al
je 0x5cce
leaq 0x7c(%rbx), %rax
movq %rax, -0x38(%rbp)
pushq $-0x1
popq %r15
leaq -0x29(%rbp), %r12
incl %r15d
cmpl -0x30(%rbp), %r15d
jge 0x5c19
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r13d
movq %rbx, %rdi
callq 0x31ba
incl %eax
movq %r14, %rdi
movl %r13d, %esi
movl %eax, %edx
callq 0x6940
testb %al, %al
jne 0x5c19
incl 0x7c(%rbx)
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r13d
movq %rbx, %rdi
callq 0x31ba
movq %r14, %rdi
movl %r13d, %esi
movl %eax, %edx
movq %r12, %rcx
callq 0x69de
cmpb $0x1, -0x29(%rbp)
jne 0x5ba7
leaq 0x78(%rbx), %rdx
pushq $0x4f
popq %rsi
movq %r14, %rdi
movq -0x38(%rbp), %rcx
callq 0x699c
movb $0x0, -0x29(%rbp)
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r15d
movq %rbx, %rdi
callq 0x31ba
pushq $0x1
popq %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %eax, %edx
callq 0x696e
leaq -0x98(%rbp), %rdi
movq %r14, %rsi
callq 0x6ad2
movq 0x837e(%rip), %rdi      # 0xdfd0
leaq -0x98(%rbp), %rsi
callq 0x21b0
movq %rax, %rdi
callq 0x2110
leaq -0x98(%rbp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r15d
movq %rbx, %rdi
callq 0x31ba
pushq $0x5
popq %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %eax, %edx
callq 0x6742
leaq -0x78(%rbp), %rdi
movq %r14, %rsi
callq 0x6ad2
leaq -0x78(%rbp), %rsi
movq %rbx, %rdi
callq 0x31ea
leaq -0x78(%rbp), %rdi
callq 0x2100
leaq -0x58(%rbp), %rdi
callq 0x2100
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x39e3(%rip), %rsi      # 0x96b8
leaq -0x58(%rbp), %rdi
callq 0x2e13
testb %al, %al
jne 0x5cfa
leaq 0x39d4(%rip), %rsi      # 0x96bd
leaq -0x58(%rbp), %rdi
callq 0x2e13
testb %al, %al
je 0x5d95
leaq 0x78(%rbx), %rax
movq %rax, -0x38(%rbp)
pushq $-0x1
popq %r15
leaq -0x29(%rbp), %r12
incl %r15d
cmpl -0x30(%rbp), %r15d
jge 0x5d7d
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r13d
movq %rbx, %rdi
callq 0x31ba
incl %r13d
movq %r14, %rdi
movl %r13d, %esi
movl %eax, %edx
callq 0x6940
testb %al, %al
jne 0x5d7d
incl 0x78(%rbx)
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r13d
movq %rbx, %rdi
callq 0x31ba
movq %r14, %rdi
movl %r13d, %esi
movl %eax, %edx
movq %r12, %rcx
callq 0x69de
cmpb $0x1, -0x29(%rbp)
jne 0x5d0a
leaq 0x7c(%rbx), %rcx
pushq $0x4f
popq %rsi
movq %r14, %rdi
movq -0x38(%rbp), %rdx
callq 0x699c
movb $0x0, -0x29(%rbp)
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r15d
movq %rbx, %rdi
callq 0x31ba
jmp 0x5c2c
leaq 0x3927(%rip), %rsi      # 0x96c3
leaq -0x58(%rbp), %rdi
callq 0x2e13
testb %al, %al
jne 0x5dc1
leaq 0x3919(%rip), %rsi      # 0x96c9
leaq -0x58(%rbp), %rdi
callq 0x2e13
testb %al, %al
je 0x5e5b
leaq 0x7c(%rbx), %rax
movq %rax, -0x38(%rbp)
pushq $-0x1
popq %r15
leaq -0x29(%rbp), %r12
incl %r15d
cmpl -0x30(%rbp), %r15d
jge 0x5e43
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r13d
movq %rbx, %rdi
callq 0x31ba
decl %eax
movq %r14, %rdi
movl %r13d, %esi
movl %eax, %edx
callq 0x6940
testb %al, %al
jne 0x5e43
decl 0x7c(%rbx)
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r13d
movq %rbx, %rdi
callq 0x31ba
movq %r14, %rdi
movl %r13d, %esi
movl %eax, %edx
movq %r12, %rcx
callq 0x69de
cmpb $0x1, -0x29(%rbp)
jne 0x5dd1
leaq 0x78(%rbx), %rdx
pushq $0x4f
popq %rsi
movq %r14, %rdi
movq -0x38(%rbp), %rcx
callq 0x699c
movb $0x0, -0x29(%rbp)
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r15d
movq %rbx, %rdi
callq 0x31ba
jmp 0x5c2c
leaq 0x386c(%rip), %rsi      # 0x96ce
leaq -0x58(%rbp), %rdi
callq 0x2e13
testb %al, %al
jne 0x5e87
leaq 0x385d(%rip), %rsi      # 0x96d3
leaq -0x58(%rbp), %rdi
callq 0x2e13
testb %al, %al
je 0x5c3c
pushq $-0x1
popq %r15
leaq 0x78(%rbx), %rax
movq %rax, -0x38(%rbp)
leaq -0x29(%rbp), %r12
incl %r15d
cmpl -0x30(%rbp), %r15d
jge 0x5f0a
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r13d
movq %rbx, %rdi
callq 0x31ba
decl %r13d
movq %r14, %rdi
movl %r13d, %esi
movl %eax, %edx
callq 0x6940
testb %al, %al
jne 0x5f0a
decl 0x78(%rbx)
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r13d
movq %rbx, %rdi
callq 0x31ba
movq %r14, %rdi
movl %r13d, %esi
movl %eax, %edx
movq %r12, %rcx
callq 0x69de
cmpb $0x1, -0x29(%rbp)
jne 0x5e97
leaq 0x7c(%rbx), %rcx
pushq $0x4f
popq %rsi
movq %r14, %rdi
movq -0x38(%rbp), %rdx
callq 0x699c
movb $0x0, -0x29(%rbp)
movq %rbx, %rdi
callq 0x31c4
movl %eax, %r15d
movq %rbx, %rdi
callq 0x31ba
jmp 0x5c2c
jmp 0x5f4e
jmp 0x5f4e
jmp 0x5f4e
jmp 0x5f4e
jmp 0x5f4e
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
jmp 0x5f41
jmp 0x5f4e
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x2100
jmp 0x5f51
jmp 0x5f4e
jmp 0x5f4e
jmp 0x5f4e
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2300