// File: tomsmeding[P]MarioLANG/mariolang.cpp
// Function: Level::execcommandStep(mario*)
bool execcommandStep(mario *m){
		static bool lastTurnWasStanding=false;
		SHOW_MESSAGE("EC\tinstr=%c\tip=%d,%d\tmemp=%d\tmem[memp]=%d\tdir=%d\twalking=%d\tskip=%d",code[m->ipy][m->ipx],m->ipx,m->ipy,m->memp,memory[m->memp],m->dir,m->walking,m->skip);
		/*if(m->ipx<0||m->ipx>=code[m->ipy].size()){
			ERROR_FALSE("Mario walked out of the world.");
		}*/
		while(m->ipy<(int)code.size()-1
			&&code[m->ipy+1][m->ipx]!='='
			&&code[m->ipy+1][m->ipx]!='|'
			&&code[m->ipy+1][m->ipx]!='#'
			&&code[m->ipy+1][m->ipx]!='"'){
			if(!execcommandSingle(m))return false;
			m->ipy++;
		}
		if(m->ipy==(int)code.size()-1)ERROR_FALSE("Mario fell out of the world.");
		if(code[m->ipy+1][m->ipx]=='#'&&!m->walking){
			int newipy=m->ipy;
			while(newipy>0&&code[newipy][m->ipx]!='"')newipy--;
			if(newipy>0){
				newipy--;
				for(m->ipy-=1;m->ipy>newipy+1;m->ipy--)if(!execcommandSingle(m))return false;
				m->ipy=newipy;
			} else {
				newipy=m->ipy+2;
				while(newipy<(int)code.size()&&code[newipy][m->ipx]!='"')newipy++;
				if(newipy==(int)code.size())FATAL_FALSE("Elevator without ending.");
				newipy--;
				for(m->ipy+=2;m->ipy<newipy;m->ipy++)if(!execcommandSingle(m))return false;
				//now m->ipy == newipy
			}
		}
		if(!execcommandSingle(m))return false;
		if(m->walking){
			if(m->dir==DIRRIGHT){
				if(m->ipx<(int)code[m->ipy].size()-1)m->ipx++;
				else ERROR_FALSE("Mario walked out of the world.");
			} else if(m->dir==DIRLEFT){
				if(m->ipx>0)m->ipx--;
				else ERROR_FALSE("Mario walked out of the world.");
			} else FATAL_FALSE("The world glitched!");
			lastTurnWasStanding=false;
		} else {
			if(!lastTurnWasStanding)lastTurnWasStanding=true;
			else ERROR_FALSE("Mario got tired of standing still.");
		}
		return true;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x88, %rsp
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpl $0x2, 0x7149(%rip)      # 0xb1ac
jl 0x4152
movq 0x6f60(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x3434(%rip), %rsi      # 0x74ae
movb $0x0, %al
callq 0x2250
movq -0x30(%rbp), %rdi
movq 0x6f44(%rip), %rax      # 0xafd0
movq (%rax), %rax
movq %rax, -0x48(%rbp)
addq $0x30, %rdi
movq -0x20(%rbp), %rax
movslq 0x4(%rax), %rsi
callq 0x35d0
movq %rax, %rdi
movq -0x20(%rbp), %rax
movslq (%rax), %rsi
callq 0x22f0
movq -0x30(%rbp), %rdi
movsbl (%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x5c90
movq -0x48(%rbp), %rdi
movl -0x40(%rbp), %edx
movl -0x3c(%rbp), %ecx
movl -0x38(%rbp), %r8d
movl -0x34(%rbp), %r9d
movl (%rax), %ebx
movq -0x20(%rbp), %rax
movl 0xc(%rax), %r11d
movq -0x20(%rbp), %rax
movb 0x10(%rax), %al
andb $0x1, %al
movzbl %al, %r10d
movq -0x20(%rbp), %rax
movb 0x11(%rax), %al
andb $0x1, %al
movzbl %al, %eax
leaq 0x3392(%rip), %rsi      # 0x74b4
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movb $0x0, %al
callq 0x2250
movq 0x6e8f(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x33ad(%rip), %rsi      # 0x74f8
movb $0x0, %al
callq 0x2250
jmp 0x4154
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x50(%rbp)
addq $0x30, %rdi
callq 0x35b0
movl -0x50(%rbp), %ecx
movl %eax, %edx
subl $0x1, %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x49(%rbp)
jge 0x425b
movq -0x30(%rbp), %rdi
addq $0x30, %rdi
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x35d0
movq %rax, %rdi
movq -0x20(%rbp), %rax
movslq (%rax), %rsi
callq 0x22f0
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x3d, %ecx
movb %al, -0x49(%rbp)
je 0x425b
movq -0x30(%rbp), %rdi
addq $0x30, %rdi
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x35d0
movq %rax, %rdi
movq -0x20(%rbp), %rax
movslq (%rax), %rsi
callq 0x22f0
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x7c, %ecx
movb %al, -0x49(%rbp)
je 0x425b
movq -0x30(%rbp), %rdi
addq $0x30, %rdi
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x35d0
movq %rax, %rdi
movq -0x20(%rbp), %rax
movslq (%rax), %rsi
callq 0x22f0
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x23, %ecx
movb %al, -0x49(%rbp)
je 0x425b
movq -0x30(%rbp), %rdi
addq $0x30, %rdi
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x35d0
movq %rax, %rdi
movq -0x20(%rbp), %rax
movslq (%rax), %rsi
callq 0x22f0
movsbl (%rax), %eax
cmpl $0x22, %eax
setne %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
testb $0x1, %al
jne 0x4264
jmp 0x4290
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x5cf0
testb $0x1, %al
jne 0x427e
movb $0x0, -0x9(%rbp)
jmp 0x4765
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
jmp 0x4154
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x54(%rbp)
addq $0x30, %rdi
callq 0x35b0
movq %rax, %rcx
movl -0x54(%rbp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x430e
cmpl $0x1, 0x6ef1(%rip)      # 0xb1ac
jl 0x4305
movq 0x6d0c(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x3230(%rip), %rsi      # 0x74fe
movb $0x0, %al
callq 0x2250
movq 0x6cf4(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x321e(%rip), %rsi      # 0x7504
movb $0x0, %al
callq 0x2250
movq 0x6cdc(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x31fa(%rip), %rsi      # 0x74f8
movb $0x0, %al
callq 0x2250
movb $0x0, -0x9(%rbp)
jmp 0x4765
movq -0x30(%rbp), %rdi
addq $0x30, %rdi
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x35d0
movq %rax, %rdi
movq -0x20(%rbp), %rax
movslq (%rax), %rsi
callq 0x22f0
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x4543
movq -0x20(%rbp), %rax
testb $0x1, 0x10(%rax)
jne 0x4543
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x24(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x24(%rbp)
movb %al, -0x55(%rbp)
jle 0x4392
movq -0x30(%rbp), %rdi
addq $0x30, %rdi
movslq -0x24(%rbp), %rsi
callq 0x35d0
movq %rax, %rdi
movq -0x20(%rbp), %rax
movslq (%rax), %rsi
callq 0x22f0
movsbl (%rax), %eax
cmpl $0x22, %eax
setne %al
movb %al, -0x55(%rbp)
movb -0x55(%rbp), %al
testb $0x1, %al
jne 0x439b
jmp 0x43a6
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x435b
cmpl $0x0, -0x24(%rbp)
jle 0x440d
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
subl $0x1, %ecx
movl %ecx, 0x4(%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jle 0x43fe
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x5cf0
testb $0x1, %al
jne 0x43ed
movb $0x0, -0x9(%rbp)
jmp 0x4765
jmp 0x43ef
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x4(%rax)
jmp 0x43c2
movl -0x24(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x4541
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x2, %eax
movl %eax, -0x24(%rbp)
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, -0x5c(%rbp)
addq $0x30, %rdi
callq 0x35b0
movl -0x5c(%rbp), %ecx
movl %eax, %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x56(%rbp)
jge 0x4467
movq -0x30(%rbp), %rdi
addq $0x30, %rdi
movslq -0x24(%rbp), %rsi
callq 0x35d0
movq %rax, %rdi
movq -0x20(%rbp), %rax
movslq (%rax), %rsi
callq 0x22f0
movsbl (%rax), %eax
cmpl $0x22, %eax
setne %al
movb %al, -0x56(%rbp)
movb -0x56(%rbp), %al
testb $0x1, %al
jne 0x4470
jmp 0x447b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x441a
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, -0x60(%rbp)
addq $0x30, %rdi
callq 0x35b0
movq %rax, %rcx
movl -0x60(%rbp), %eax
cmpl %ecx, %eax
jne 0x44f2
cmpl $0x0, 0x6d0d(%rip)      # 0xb1ac
jl 0x44e9
movq 0x6b28(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x306f(%rip), %rsi      # 0x7521
movb $0x0, %al
callq 0x2250
movq 0x6b10(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x305f(%rip), %rsi      # 0x7529
movb $0x0, %al
callq 0x2250
movq 0x6af8(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x3016(%rip), %rsi      # 0x74f8
movb $0x0, %al
callq 0x2250
movb $0x0, -0x9(%rbp)
jmp 0x4765
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x2, %ecx
movl %ecx, 0x4(%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0x24(%rbp), %eax
jge 0x453f
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x5cf0
testb $0x1, %al
jne 0x452e
movb $0x0, -0x9(%rbp)
jmp 0x4765
jmp 0x4530
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
jmp 0x4508
jmp 0x4541
jmp 0x4543
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x5cf0
testb $0x1, %al
jne 0x455d
movb $0x0, -0x9(%rbp)
jmp 0x4765
movq -0x20(%rbp), %rax
testb $0x1, 0x10(%rax)
je 0x46f6
movq -0x20(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x4618
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x64(%rbp)
addq $0x30, %rdi
movq -0x20(%rbp), %rax
movslq 0x4(%rax), %rsi
callq 0x35d0
movq %rax, %rdi
callq 0x2130
movq %rax, %rcx
movl -0x64(%rbp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x45b9
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x4613
cmpl $0x1, 0x6bec(%rip)      # 0xb1ac
jl 0x460a
movq 0x6a07(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x2f2b(%rip), %rsi      # 0x74fe
movb $0x0, %al
callq 0x2250
movq 0x69ef(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x2f57(%rip), %rsi      # 0x7542
movb $0x0, %al
callq 0x2250
movq 0x69d7(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x2ef5(%rip), %rsi      # 0x74f8
movb $0x0, %al
callq 0x2250
movb $0x0, -0x9(%rbp)
jmp 0x4765
jmp 0x46ed
movq -0x20(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jne 0x4694
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
jle 0x4638
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
jmp 0x4692
cmpl $0x1, 0x6b6d(%rip)      # 0xb1ac
jl 0x4689
movq 0x6988(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x2eac(%rip), %rsi      # 0x74fe
movb $0x0, %al
callq 0x2250
movq 0x6970(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x2ed8(%rip), %rsi      # 0x7542
movb $0x0, %al
callq 0x2250
movq 0x6958(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x2e76(%rip), %rsi      # 0x74f8
movb $0x0, %al
callq 0x2250
movb $0x0, -0x9(%rbp)
jmp 0x4765
jmp 0x46eb
cmpl $0x0, 0x6b11(%rip)      # 0xb1ac
jl 0x46e5
movq 0x692c(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x2e73(%rip), %rsi      # 0x7521
movb $0x0, %al
callq 0x2250
movq 0x6914(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x2e9b(%rip), %rsi      # 0x7561
movb $0x0, %al
callq 0x2250
movq 0x68fc(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x2e1a(%rip), %rsi      # 0x74f8
movb $0x0, %al
callq 0x2250
movb $0x0, -0x9(%rbp)
jmp 0x4765
jmp 0x46ed
movb $0x0, 0x6acc(%rip)      # 0xb1c0
jmp 0x4761
testb $0x1, 0x6ac3(%rip)      # 0xb1c0
jne 0x4708
movb $0x1, 0x6aba(%rip)      # 0xb1c0
jmp 0x475f
cmpl $0x1, 0x6a9d(%rip)      # 0xb1ac
jl 0x4759
movq 0x68b8(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x2ddc(%rip), %rsi      # 0x74fe
movb $0x0, %al
callq 0x2250
movq 0x68a0(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x2e3b(%rip), %rsi      # 0x7575
movb $0x0, %al
callq 0x2250
movq 0x6888(%rip), %rax      # 0xafd0
movq (%rax), %rdi
leaq 0x2da6(%rip), %rsi      # 0x74f8
movb $0x0, %al
callq 0x2250
movb $0x0, -0x9(%rbp)
jmp 0x4765
jmp 0x4761
movb $0x1, -0x9(%rbp)
movb -0x9(%rbp), %al
andb $0x1, %al
addq $0x88, %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop