// File: /workspace/github_cpp_makefile_star2_O1/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 $0x68, %rsp
movq %rdx, %r14
movq %rsi, %rbx
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x7ba1(%rip), %rdi      # 0xefd0
leaq 0x4262(%rip), %rsi      # 0xb698
movl $0xb, %edx
callq 0x2240
movq 0x7b99(%rip), %rdi      # 0xefe0
leaq -0x50(%rbp), %rsi
callq 0x2260
movq 0x7b79(%rip), %r15      # 0xefd0
leaq 0x4246(%rip), %rsi      # 0xb6a4
movl $0xa, %edx
movq %r15, %rdi
callq 0x2240
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x7b47(%rip), %rdi      # 0xefd0
callq 0x2040
movq %rax, %rdi
callq 0x2170
movq 0x7b43(%rip), %rdi      # 0xefe0
leaq -0x30(%rbp), %rsi
callq 0x2150
movq %rbx, %rdi
callq 0x379e
movl %eax, %r15d
movq %rbx, %rdi
callq 0x3794
movq %r14, %rdi
movl %r15d, %esi
movl %eax, %edx
xorl %ecx, %ecx
callq 0x86c8
leaq 0x41e0(%rip), %rsi      # 0xb6af
leaq -0x50(%rbp), %rdi
callq 0x20c0
testl %eax, %eax
je 0x75fe
leaq 0x41ce(%rip), %rsi      # 0xb6b5
leaq -0x50(%rbp), %rdi
callq 0x20c0
testl %eax, %eax
je 0x75fe
leaq 0x41b9(%rip), %rsi      # 0xb6b8
leaq -0x50(%rbp), %rdi
callq 0x20c0
testl %eax, %eax
je 0x7677
leaq 0x41a6(%rip), %rsi      # 0xb6bd
leaq -0x50(%rbp), %rdi
callq 0x20c0
testl %eax, %eax
je 0x7677
leaq 0x4194(%rip), %rsi      # 0xb6c3
leaq -0x50(%rbp), %rdi
callq 0x20c0
testl %eax, %eax
je 0x7722
leaq 0x4182(%rip), %rsi      # 0xb6c9
leaq -0x50(%rbp), %rdi
callq 0x20c0
testl %eax, %eax
je 0x7722
leaq 0x416f(%rip), %rsi      # 0xb6ce
leaq -0x50(%rbp), %rdi
callq 0x20c0
testl %eax, %eax
je 0x7584
leaq 0x4160(%rip), %rsi      # 0xb6d3
leaq -0x50(%rbp), %rdi
callq 0x20c0
testl %eax, %eax
jne 0x782a
cmpl $0x0, -0x30(%rbp)
jle 0x7805
xorl %r13d, %r13d
leaq -0x29(%rbp), %r15
movq %rbx, %rdi
callq 0x379e
movl %eax, %r12d
movq %rbx, %rdi
callq 0x3794
decl %r12d
movq %r14, %rdi
movl %r12d, %esi
movl %eax, %edx
callq 0x8696
testb %al, %al
jne 0x7805
decl 0x78(%rbx)
movq %rbx, %rdi
callq 0x379e
movl %eax, %r12d
movq %rbx, %rdi
callq 0x3794
movq %r14, %rdi
movl %r12d, %esi
movl %eax, %edx
movq %r15, %rcx
callq 0x8740
cmpb $0x1, -0x29(%rbp)
je 0x77ec
incl %r13d
cmpl -0x30(%rbp), %r13d
jl 0x7595
jmp 0x7805
cmpl $0x0, -0x30(%rbp)
jle 0x770a
xorl %r13d, %r13d
leaq -0x29(%rbp), %r15
movq %rbx, %rdi
callq 0x379e
movl %eax, %r12d
movq %rbx, %rdi
callq 0x3794
incl %eax
movq %r14, %rdi
movl %r12d, %esi
movl %eax, %edx
callq 0x8696
testb %al, %al
jne 0x770a
incl 0x7c(%rbx)
movq %rbx, %rdi
callq 0x379e
movl %eax, %r12d
movq %rbx, %rdi
callq 0x3794
movq %r14, %rdi
movl %r12d, %esi
movl %eax, %edx
movq %r15, %rcx
callq 0x8740
cmpb $0x1, -0x29(%rbp)
je 0x76f1
incl %r13d
cmpl -0x30(%rbp), %r13d
jl 0x760f
jmp 0x770a
cmpl $0x0, -0x30(%rbp)
jle 0x77a9
xorl %r13d, %r13d
leaq -0x29(%rbp), %r15
movq %rbx, %rdi
callq 0x379e
movl %eax, %r12d
movq %rbx, %rdi
callq 0x3794
incl %r12d
movq %r14, %rdi
movl %r12d, %esi
movl %eax, %edx
callq 0x8696
testb %al, %al
jne 0x77a9
incl 0x78(%rbx)
movq %rbx, %rdi
callq 0x379e
movl %eax, %r12d
movq %rbx, %rdi
callq 0x3794
movq %r14, %rdi
movl %r12d, %esi
movl %eax, %edx
movq %r15, %rcx
callq 0x8740
cmpb $0x1, -0x29(%rbp)
je 0x7790
incl %r13d
cmpl -0x30(%rbp), %r13d
jl 0x7688
jmp 0x77a9
leaq 0x7c(%rbx), %rcx
leaq 0x78(%rbx), %rdx
movq %r14, %rdi
movl $0x4f, %esi
callq 0x86fa
movb $0x0, -0x29(%rbp)
movq %rbx, %rdi
callq 0x379e
movl %eax, %r15d
movq %rbx, %rdi
callq 0x3794
jmp 0x7818
cmpl $0x0, -0x30(%rbp)
jle 0x77d7
xorl %r13d, %r13d
leaq -0x29(%rbp), %r15
movq %rbx, %rdi
callq 0x379e
movl %eax, %r12d
movq %rbx, %rdi
callq 0x3794
decl %eax
movq %r14, %rdi
movl %r12d, %esi
movl %eax, %edx
callq 0x8696
testb %al, %al
jne 0x77d7
decl 0x7c(%rbx)
movq %rbx, %rdi
callq 0x379e
movl %eax, %r12d
movq %rbx, %rdi
callq 0x3794
movq %r14, %rdi
movl %r12d, %esi
movl %eax, %edx
movq %r15, %rcx
callq 0x8740
cmpb $0x1, -0x29(%rbp)
je 0x77be
incl %r13d
cmpl -0x30(%rbp), %r13d
jl 0x7733
jmp 0x77d7
leaq 0x78(%rbx), %rdx
leaq 0x7c(%rbx), %rcx
movq %r14, %rdi
movl $0x4f, %esi
callq 0x86fa
movb $0x0, -0x29(%rbp)
movq %rbx, %rdi
callq 0x379e
movl %eax, %r15d
movq %rbx, %rdi
callq 0x3794
jmp 0x7818
leaq 0x7c(%rbx), %rcx
leaq 0x78(%rbx), %rdx
movq %r14, %rdi
movl $0x4f, %esi
callq 0x86fa
movb $0x0, -0x29(%rbp)
movq %rbx, %rdi
callq 0x379e
movl %eax, %r15d
movq %rbx, %rdi
callq 0x3794
jmp 0x7818
leaq 0x78(%rbx), %rdx
leaq 0x7c(%rbx), %rcx
movq %r14, %rdi
movl $0x4f, %esi
callq 0x86fa
movb $0x0, -0x29(%rbp)
movq %rbx, %rdi
callq 0x379e
movl %eax, %r15d
movq %rbx, %rdi
callq 0x3794
movq %r14, %rdi
movl %r15d, %esi
movl %eax, %edx
movl $0x1, %ecx
callq 0x86c8
leaq -0x70(%rbp), %rdi
movq %r14, %rsi
callq 0x88b4
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq 0x778b(%rip), %rdi      # 0xefd0
callq 0x2240
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x788d
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x379e
movl %eax, %r15d
movq %rbx, %rdi
callq 0x3794
movq %r14, %rdi
movl %r15d, %esi
movl %eax, %edx
movl $0x5, %ecx
callq 0x8422
leaq -0x90(%rbp), %rdi
movq %r14, %rsi
callq 0x88b4
leaq -0x90(%rbp), %rsi
movq %rbx, %rdi
callq 0x37d6
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x78e9
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x7902
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2210
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7957
jmp 0x7957
jmp 0x7957
jmp 0x7957
movq %rax, %rbx
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x795a
movq -0x80(%rbp), %rsi
jmp 0x7949
jmp 0x7957
jmp 0x7957
jmp 0x7957
movq %rax, %rbx
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x795a
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x795a
jmp 0x7957
jmp 0x7957
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x7973
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2320
nop