// File: /workspace/github_cpp_makefile_star2_O2/malcolmyeh[P]CC3K/game.cc
// Function: Controller::runGame[abi:cxx11](char)
std::string Controller::runGame(char type) {

	gameInit(type);
	
	display->printFloor(floor,"You have entered the dungeon.");
	while (true) {
		std::string moveStatus;
		std::string log;
		std::string str;
		std::cin >> str; 
		if (validDirection(str)) {
			moveStatus = floor->movePlayer(str);
			if (moveStatus == "invalid") {
				log += "Move is invalid.";
				display->printFloor(floor, log);
				continue;
			} else if (moveStatus == "newfloor") {
				if (floor->getLevel() + 1 == 6) {
					return "won";
				}
				this->newFloor();
				log += "Welcome to Floor " + std::to_string(floor->getLevel()) + ". ";
				display->updateDisplay(floor);
				display->printFloor(floor, log);
				continue;
			} else {
				log += moveStatus;
			}
		} else if (str == "a") {
			std::cin >> str;
			if (validDirection(str)) {
				log += floor->atkPlayer(str);
				if (log == "Invalid attack. ") {
					display->printFloor(floor, log);
					continue;
				}
			} else {
				log += "Invalid input. Try again.";
				display->printFloor(floor, log);
				continue;
			}
		} else if (str == "u") {
			std::cin >> str;
			if (validDirection(str)) {
				log += floor->usePotion(str);
				if (log == "No potion in direction. ") {
					display->printFloor(floor, log);
					continue;
				}
			} else {
				log += "Invalid input. Try again.";
				display->printFloor(floor, log);
				continue;
			}
		} else if (str == "b"){
			std::cin >> str;
			if (validDirection(str)){
				log += floor->talkMerchant(str);
				if (log == "Invalid input." || log == "You are my enemy!"){
					display->printFloor(floor, log);
					continue;
				} else if (log == "(B)uckler Shield: 3g (T)arge Shield: 6g (P)avise Shield: 12g (N)odachi: 3g (K)atana: 7g (U)chigatana: 15g"){
					display->printFloor(floor, log);
					std::cin >> str;
					log = floor->buyMerchant(str);
					if (log == "Sorry I don't have that item. " || log == "You are too poor. "){
						display->printFloor(floor, log);
						continue;
					}
				} else {
					log += "Invalid input. Try again.";
					display->printFloor(floor, log);
					continue;
				}
			}
		} else if (str == "r") {
			return "restart";
		} else if (str == "q") {
			return "quit";
		} else {
			log += "Invalid input. Try again.";
			display->printFloor(floor, log);
			continue;
		}
		log += floor->actEnemy();
		display->updateDisplay(floor);
		display->printFloor(floor, log);
		if (floor->player->getHP() == 0) {
			std::cout << std::endl;
			std::cout << "Game over!" << std::endl;
			std::cout << "Enter any command to continue:" << std::endl;
			std::cin >> str;
			return "loss";
		}	
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x388, %rsp            # imm = 0x388
movq %rsi, %r14
movq %rdi, -0x50(%rbp)
movq %rsi, %rdi
movl %edx, %esi
callq 0xdf9c
movq (%r14), %rbx
movq 0x8(%r14), %r15
leaq 0x391b(%rip), %rsi      # 0x10df0
leaq -0xd0(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0x40b0
leaq -0xd0(%rbp), %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4e88
leaq -0xd0(%rbp), %rdi
callq 0x40e0
leaq -0xb0(%rbp), %r12
leaq -0x80(%rbp), %rax
movq %rax, -0x90(%rbp)
andq $0x0, -0x88(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
andq $0x0, -0x40(%rbp)
xorl %ecx, %ecx
movb %cl, -0x80(%rbp)
movb %cl, -0x38(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, -0xb0(%rbp)
andq $0x0, -0xa8(%rbp)
movb %cl, -0xa0(%rbp)
movq 0x9a88(%rip), %rdi      # 0x16fe0
movq %r12, %rsi
callq 0x41e0
leaq -0x350(%rbp), %rdi
movq %r12, %rsi
callq 0x4200
leaq -0x350(%rbp), %r13
movq %r13, %rdi
callq 0xe0b8
movl %eax, %r15d
movq %r13, %rdi
callq 0x40e0
testb %r15b, %r15b
je 0xd633
movq (%r14), %r13
leaq -0x3b0(%rbp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x4200
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x658e
leaq -0x90(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x41d0
movq %rbx, %rdi
callq 0x40e0
movq %r15, %rdi
callq 0x40e0
movq %r13, %rdi
leaq 0x2d07(%rip), %rsi      # 0x102ec
callq 0x4ac7
testb %al, %al
je 0xd807
leaq -0x48(%rbp), %rdi
leaq 0x3811(%rip), %rsi      # 0x10e0e
callq 0x4290
movq (%r14), %r13
movq 0x8(%r14), %r15
leaq -0x330(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4200
movq %r15, %rdi
movq %r13, %rsi
leaq -0x330(%rbp), %rbx
movq %rbx, %rdx
callq 0x4e88
jmp 0xdb58
movq %r12, %rdi
leaq 0x2b67(%rip), %rsi      # 0x101a4
callq 0x4ac7
testb %al, %al
je 0xd71d
movq 0x998f(%rip), %rdi      # 0x16fe0
movq %r12, %rsi
callq 0x41e0
leaq -0x2b0(%rbp), %rdi
movq %r12, %rsi
callq 0x4200
leaq -0x2b0(%rbp), %rbx
movq %rbx, %rdi
callq 0xe0b8
movl %eax, %r15d
movq %rbx, %rdi
callq 0x40e0
testb %r15b, %r15b
je 0xda6f
movq (%r14), %r13
leaq -0x290(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4200
leaq -0x70(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x7ebc
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x42b0
movq %r15, %rdi
callq 0x40e0
leaq -0x290(%rbp), %rdi
callq 0x40e0
movq %rbx, %rdi
leaq 0x30b3(%rip), %rsi      # 0x10792
callq 0x4ac7
testb %al, %al
je 0xd9ef
movq (%r14), %r13
movq 0x8(%r14), %r15
leaq -0x270(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4200
movq %r15, %rdi
movq %r13, %rsi
leaq -0x270(%rbp), %rbx
movq %rbx, %rdx
callq 0x4e88
jmp 0xdb58
movq %r12, %rdi
leaq 0x2e4c(%rip), %rsi      # 0x10573
callq 0x4ac7
testb %al, %al
je 0xd8e8
movq 0x98a5(%rip), %rdi      # 0x16fe0
movq %r12, %rsi
callq 0x41e0
leaq -0x230(%rbp), %rdi
movq %r12, %rsi
callq 0x4200
leaq -0x230(%rbp), %rbx
movq %rbx, %rdi
callq 0xe0b8
movl %eax, %r15d
movq %rbx, %rdi
callq 0x40e0
testb %r15b, %r15b
je 0xdb1c
movq (%r14), %r13
leaq -0x210(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4200
leaq -0x70(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x7660
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x42b0
movq %r15, %rdi
callq 0x40e0
leaq -0x210(%rbp), %rdi
callq 0x40e0
movq %rbx, %rdi
leaq 0x2f7c(%rip), %rsi      # 0x10745
callq 0x4ac7
testb %al, %al
je 0xd9ef
movq (%r14), %r13
movq 0x8(%r14), %r15
leaq -0x1f0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4200
movq %r15, %rdi
movq %r13, %rsi
leaq -0x1f0(%rbp), %rbx
movq %rbx, %rdx
callq 0x4e88
jmp 0xdb58
movq %r13, %rdi
leaq 0x2b06(%rip), %rsi      # 0x10317
callq 0x4ac7
testb %al, %al
je 0xd9e3
movq (%r14), %rdi
callq 0x824c
cmpl $0x5, %eax
je 0xdd2b
movq %r14, %rdi
callq 0xe210
movq (%r14), %rdi
callq 0x824c
leaq -0x2f0(%rbp), %rbx
movq %rbx, %rdi
movl %eax, %esi
callq 0x851e
leaq -0x310(%rbp), %r13
movq %r13, %rdi
leaq 0x35be(%rip), %rsi      # 0x10e1f
movq %rbx, %rdx
callq 0x84f0
leaq -0x70(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
leaq 0x334c(%rip), %rdx      # 0x10bc6
callq 0x84c7
leaq -0x48(%rbp), %rdi
movq %r15, %rsi
callq 0x42b0
movq %r15, %rdi
callq 0x40e0
leaq -0x310(%rbp), %rdi
callq 0x40e0
leaq -0x2f0(%rbp), %rdi
callq 0x40e0
movq (%r14), %rsi
movq 0x8(%r14), %rdi
callq 0x5068
movq (%r14), %r13
movq 0x8(%r14), %r15
leaq -0x2d0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4200
movq %r15, %rdi
movq %r13, %rsi
leaq -0x2d0(%rbp), %rbx
movq %rbx, %rdx
callq 0x4e88
jmp 0xdb58
movq %r12, %rdi
leaq 0x2bbc(%rip), %rsi      # 0x104ae
callq 0x4ac7
testb %al, %al
je 0xdab0
movq 0x96da(%rip), %rdi      # 0x16fe0
movq %r12, %rsi
callq 0x41e0
leaq -0x1b0(%rbp), %rdi
movq %r12, %rsi
callq 0x4200
leaq -0x1b0(%rbp), %rbx
movq %rbx, %rdi
callq 0xe0b8
movl %eax, %r15d
movq %rbx, %rdi
callq 0x40e0
testb %r15b, %r15b
je 0xd9ef
movq (%r14), %r13
leaq -0x390(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4200
leaq -0x70(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x7136
movq %rbx, %r13
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x42b0
movq %r15, %rdi
callq 0x40e0
movq %r13, %rdi
callq 0x40e0
movq %rbx, %rdi
leaq 0x349e(%rip), %rsi      # 0x10e31
callq 0x4ac7
testb %al, %al
jne 0xd9b3
movq %rbx, %rdi
leaq 0x2a72(%rip), %rsi      # 0x10418
callq 0x4ac7
testb %al, %al
je 0xdb82
movq (%r14), %r13
movq 0x8(%r14), %r15
leaq -0x190(%rbp), %rdi
movq %rbx, %rsi
callq 0x4200
movq %r15, %rdi
movq %r13, %rsi
leaq -0x190(%rbp), %rbx
movq %rbx, %rdx
callq 0x4e88
jmp 0xdb58
leaq -0x48(%rbp), %rdi
movq %r13, %rsi
callq 0x42b0
movq (%r14), %rsi
leaq -0x70(%rbp), %r15
movq %r15, %rdi
callq 0x615c
leaq -0x48(%rbp), %rdi
movq %r15, %rsi
callq 0x42b0
movq %r15, %rdi
callq 0x40e0
movq (%r14), %rsi
movq 0x8(%r14), %rdi
callq 0x5068
movq (%r14), %r13
movq 0x8(%r14), %r15
leaq -0xf0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4200
movq %r15, %rdi
movq %r13, %rsi
leaq -0xf0(%rbp), %rbx
movq %rbx, %rdx
callq 0x4e88
movq %rbx, %rdi
callq 0x40e0
movq (%r14), %rax
movq 0xfe0(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
testl %eax, %eax
jne 0xdb60
jmp 0xdcc0
leaq -0x48(%rbp), %rdi
leaq 0x2a1a(%rip), %rsi      # 0x10494
callq 0x4290
movq (%r14), %r13
movq 0x8(%r14), %r15
leaq -0x250(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4200
movq %r15, %rdi
movq %r13, %rsi
leaq -0x250(%rbp), %rbx
movq %rbx, %rdx
callq 0x4e88
jmp 0xdb58
movq %r12, %rdi
leaq 0x2864(%rip), %rsi      # 0x1031e
callq 0x4ac7
testb %al, %al
jne 0xdd41
movq %r12, %rdi
leaq 0x26d0(%rip), %rsi      # 0x101a1
callq 0x4ac7
testb %al, %al
jne 0xdd57
leaq -0x48(%rbp), %rdi
leaq 0x29ab(%rip), %rsi      # 0x10494
callq 0x4290
movq (%r14), %r13
movq 0x8(%r14), %r15
leaq -0x110(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4200
movq %r15, %rdi
movq %r13, %rsi
leaq -0x110(%rbp), %rbx
movq %rbx, %rdx
callq 0x4e88
jmp 0xdb58
leaq -0x48(%rbp), %rdi
leaq 0x296d(%rip), %rsi      # 0x10494
callq 0x4290
movq (%r14), %r13
movq 0x8(%r14), %r15
leaq -0x1d0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4200
movq %r15, %rdi
movq %r13, %rsi
leaq -0x1d0(%rbp), %rbx
movq %rbx, %rdx
callq 0x4e88
movq %rbx, %rdi
callq 0x40e0
movq %r12, %rdi
callq 0x40e0
leaq -0x48(%rbp), %rdi
callq 0x40e0
leaq -0x90(%rbp), %rdi
callq 0x40e0
jmp 0xd50d
movq %rbx, %rdi
leaq 0x289e(%rip), %rsi      # 0x1042a
callq 0x4ac7
testb %al, %al
je 0xdc80
movq (%r14), %r13
movq 0x8(%r14), %r15
leaq -0x170(%rbp), %rdi
movq %rbx, %rsi
callq 0x4200
movq %r15, %rdi
movq %r13, %rsi
leaq -0x170(%rbp), %rbx
movq %rbx, %rdx
callq 0x4e88
movq %rbx, %rdi
callq 0x40e0
movq 0x940d(%rip), %rdi      # 0x16fe0
movq %r12, %rsi
callq 0x41e0
movq (%r14), %r13
leaq -0x370(%rbp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x4200
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %r13
movq %r15, %rdx
callq 0x728c
leaq -0x48(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x41d0
movq %rbx, %rdi
callq 0x40e0
movq %r13, %rdi
callq 0x40e0
movq %r15, %rdi
leaq 0x296a(%rip), %rsi      # 0x10598
callq 0x4ac7
testb %al, %al
jne 0xdc4f
leaq -0x48(%rbp), %rdi
leaq 0x2894(%rip), %rsi      # 0x104d6
callq 0x4ac7
testb %al, %al
je 0xd9ef
movq (%r14), %r13
movq 0x8(%r14), %r15
leaq -0x150(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4200
movq %r15, %rdi
movq %r13, %rsi
leaq -0x150(%rbp), %rbx
movq %rbx, %rdx
callq 0x4e88
jmp 0xdb58
movq %rbx, %rdi
leaq 0x280a(%rip), %rsi      # 0x10494
callq 0x4290
movq (%r14), %r13
movq 0x8(%r14), %r15
leaq -0x130(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4200
movq %r15, %rdi
movq %r13, %rsi
leaq -0x130(%rbp), %rbx
movq %rbx, %rdx
callq 0x4e88
jmp 0xdb58
movq 0x9309(%rip), %rdi      # 0x16fd0
callq 0x40f0
movq 0x92fd(%rip), %rdi      # 0x16fd0
leaq 0x3166(%rip), %rsi      # 0x10e40
callq 0x4180
movq %rax, %rdi
callq 0x40f0
movq 0x92e2(%rip), %rdi      # 0x16fd0
leaq 0x3156(%rip), %rsi      # 0x10e4b
callq 0x4180
movq %rax, %rdi
callq 0x40f0
movq 0x92d7(%rip), %rdi      # 0x16fe0
leaq -0xb0(%rbp), %rsi
callq 0x41e0
leaq 0x2446(%rip), %rsi      # 0x10162
leaq -0x70(%rbp), %rdx
movq -0x50(%rbp), %rdi
callq 0x40b0
jmp 0xdd6b
leaq 0x2416(%rip), %rsi      # 0x10148
leaq -0x70(%rbp), %rdx
movq -0x50(%rbp), %rdi
callq 0x40b0
jmp 0xdd6b
leaq 0x23e8(%rip), %rsi      # 0x10130
leaq -0x70(%rbp), %rdx
movq -0x50(%rbp), %rdi
callq 0x40b0
jmp 0xdd6b
leaq 0x2416(%rip), %rsi      # 0x10174
leaq -0x70(%rbp), %rdx
movq -0x50(%rbp), %rdi
callq 0x40b0
leaq -0xb0(%rbp), %rdi
callq 0x40e0
leaq -0x48(%rbp), %rdi
callq 0x40e0
leaq -0x90(%rbp), %rdi
callq 0x40e0
movq -0x50(%rbp), %rax
addq $0x388, %rsp            # imm = 0x388
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xdf6f
jmp 0xdf6f
movq %rax, %rbx
leaq -0x150(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
leaq -0x370(%rbp), %rdi
jmp 0xdf68
jmp 0xdf6f
movq %rax, %rbx
leaq -0x170(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
jmp 0xdf68
jmp 0xdf6f
jmp 0xdf6f
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
jmp 0xdf8e
movq %rax, %rbx
jmp 0xdf93
movq %rax, %rbx
leaq -0x190(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
leaq -0x1f0(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x40e0
jmp 0xde3d
movq %rax, %rbx
leaq -0x390(%rbp), %rdi
jmp 0xdf68
jmp 0xdf6f
jmp 0xdf6f
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x40e0
jmp 0xde73
movq %rax, %rbx
leaq -0x210(%rbp), %rdi
jmp 0xdf68
jmp 0xdf6f
movq %rax, %rbx
leaq -0x1d0(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
leaq -0x270(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
leaq -0x1b0(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
jmp 0xded3
movq %rax, %rbx
jmp 0xdec7
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x40e0
leaq -0x310(%rbp), %rdi
callq 0x40e0
leaq -0x2f0(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
leaq -0x2d0(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
leaq -0x230(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x40e0
jmp 0xdf08
movq %rax, %rbx
leaq -0x290(%rbp), %rdi
jmp 0xdf68
jmp 0xdf6f
movq %rax, %rbx
leaq -0x250(%rbp), %rdi
jmp 0xdf68
jmp 0xdf6f
movq %rax, %rbx
leaq -0x2b0(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
leaq -0x330(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
jmp 0xdf68
jmp 0xdf6f
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
jmp 0xdf68
jmp 0xdf6f
movq %rax, %rbx
leaq -0x3b0(%rbp), %rdi
jmp 0xdf68
movq %rax, %rbx
leaq -0x350(%rbp), %rdi
callq 0x40e0
jmp 0xdf72
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x40e0
leaq -0x48(%rbp), %rdi
callq 0x40e0
leaq -0x90(%rbp), %rdi
callq 0x40e0
movq %rbx, %rdi
callq 0x4280
nop