// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/src/OpenTool.cpp
// Function: OpenTool::MIDOutputAction(Header*)
Error OpenTool::MIDOutputAction(Header* message)
{
	 Error result = Error::UNKNOWN;
	 string data("");

	 switch(message->Number)
	 {
		 case MID_Number::CommunicationStart:
			  try{
				  Mid_0001* mid0001 = dynamic_cast<Mid_0001*>(message);
				  mid0001->Packup();
				  data = mid0001->GetRawOutputString();
			  }
			  catch(exception& my_ex)
			  {
				  Log << "Exception: " << my_ex.what();
			  }
			  break;
		 case MID_Number::CommunicationStartAcknowledge:
			  try{
				  Mid_0002* mid0002 = dynamic_cast<Mid_0002*>(message);
				  mid0002->Packup();
				  data = mid0002->GetRawOutputString();
			  }
			  catch(exception& my_ex)
			  {
				  Log << "Exception: " << my_ex.what();
			  }
			  break;
		 case MID_Number::CommunicationStop:
			  try{
				  Mid_0003* mid0003 = dynamic_cast<Mid_0003*>(message);
				  mid0003->Packup();
				  data = mid0003->GetRawOutputString();
			  }
			  catch(exception& my_ex)
			  {
				  Log << "Exception: " << my_ex.what();
			  }
			  break;
		 case MID_Number::CommandError:
			  try{
				  Mid_0004* mid0004 = dynamic_cast<Mid_0004*>(message);
				  mid0004->Packup();
				  data = mid0004->GetRawOutputString();
			  }
			  catch(exception& my_ex)
			  {
				  Log << "Exception: " << my_ex.what();
			  }
			  break;
		 case MID_Number::CommandAccepted:
			  try{
				  Mid_0005* mid0005 = dynamic_cast<Mid_0005*>(message);
				  mid0005->Packup();
				  data = mid0005->GetRawOutputString();
			  }
			  catch(exception& my_ex)
			  {
				  Log << "Exception: " << my_ex.what();
			  }
			  break;
		 case MID_Number::KeepAliveMessage:
			  try{
				  Mid_9999* mid9999 = dynamic_cast<Mid_9999*>(message);
				  mid9999->Packup();
				  data = mid9999->GetRawOutputString();
			  }
			  catch(exception& my_ex)
			  {
				  Log << "Exception: " << my_ex.what();
			  }
			  break;

		 default:
			  break;
	 }

	 if(data.length() >= Header::HeaderTotalLength )
	 {
		 result = Send(data);
	 }
	 else
	 {
		 Log << "Opps data shorter than default header.";
	 }

	 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x50(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x4372(%rip), %rdx      # 0xb305
leaq -0x60(%rbp), %rdi
movq %rdx, %rsi
callq 0x61b0
movl 0x31c(%r14), %ecx
leal -0x1(%rcx), %eax
cmpl $0x4, %eax
ja 0x6ffa
leaq 0x404b(%rip), %rcx      # 0xb000
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8023(%rip), %rsi      # 0xefe8
movq 0x7fdc(%rip), %rdx      # 0xefa8
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x6450
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *0x10(%rax)
addq $0x1a8, %r14            # imm = 0x1A8
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x65e0
jmp 0x7127
cmpl $0x270f, %ecx           # imm = 0x270F
jne 0x7148
movq 0x7fdb(%rip), %rsi      # 0xefe8
movq 0x7f3c(%rip), %rdx      # 0xef50
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x6450
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *0x10(%rax)
addq $0x1a8, %r14            # imm = 0x1A8
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x65e0
jmp 0x7127
movq 0x7f9f(%rip), %rsi      # 0xefe8
movq 0x7f18(%rip), %rdx      # 0xef68
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x6450
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *0x10(%rax)
addq $0x1a8, %r14            # imm = 0x1A8
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x65e0
jmp 0x7127
movq 0x7f63(%rip), %rsi      # 0xefe8
movq 0x7e9c(%rip), %rdx      # 0xef28
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x6450
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *0x10(%rax)
addq $0x1a8, %r14            # imm = 0x1A8
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x65e0
jmp 0x7127
movq 0x7f2a(%rip), %rsi      # 0xefe8
movq 0x7e83(%rip), %rdx      # 0xef48
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x6450
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *0x10(%rax)
addq $0x1a8, %r14            # imm = 0x1A8
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x65e0
jmp 0x7127
movq 0x7ef1(%rip), %rsi      # 0xefe8
movq 0x7efa(%rip), %rdx      # 0xeff8
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x6450
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *0x10(%rax)
addq $0x1a8, %r14            # imm = 0x1A8
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x65e0
leaq -0x60(%rbp), %rdi
leaq -0x40(%rbp), %r14
movq %r14, %rsi
callq 0x6470
movq (%r14), %rdi
leaq -0x30(%rbp), %rax
cmpq %rax, %rdi
je 0x7148
callq 0x63e0
movq -0x58(%rbp), %rdx
cmpq $0x14, %rdx
jb 0x7188
leaq -0x70(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x60(%rbp), %rsi
addq %rsi, %rdx
leaq -0x80(%rbp), %rdi
callq 0x61c0
leaq -0x80(%rbp), %rsi
movq %rbx, %rdi
callq 0x6110
movl %eax, %ebx
movq -0x80(%rbp), %rdi
cmpq %r15, %rdi
je 0x71a6
callq 0x63e0
jmp 0x71a6
xorl %ebx, %ebx
movq 0x7d8f(%rip), %rdi      # 0xef20
addq $0x10, %rdi
leaq 0x3eb0(%rip), %rsi      # 0xb04c
movl $0x26, %edx
callq 0x6460
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x71b4
callq 0x63e0
movl %ebx, %eax
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x71db
jmp 0x72a7
jmp 0x7241
jmp 0x730d
jmp 0x7373
jmp 0x73d6
movq %rax, %r14
cmpl $0x1, %edx
jne 0x7450
movq %r14, %rdi
callq 0x61d0
movq %rax, %r15
movq 0x7d27(%rip), %r14      # 0xef20
addq $0x10, %r14
leaq 0x3e3c(%rip), %rsi      # 0xb040
movl $0xb, %edx
movq %r14, %rdi
callq 0x6460
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x6400
callq 0x6610
jmp 0x7148
jmp 0x744d
movq %rax, %r14
callq 0x6610
jmp 0x7450
movq %rax, %r14
cmpl $0x1, %edx
jne 0x7450
movq %r14, %rdi
callq 0x61d0
movq %rax, %r15
movq 0x7cc1(%rip), %r14      # 0xef20
addq $0x10, %r14
leaq 0x3dd6(%rip), %rsi      # 0xb040
movl $0xb, %edx
movq %r14, %rdi
callq 0x6460
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x6400
callq 0x6610
jmp 0x7148
jmp 0x744d
movq %rax, %r14
callq 0x6610
jmp 0x7450
movq %rax, %r14
cmpl $0x1, %edx
jne 0x7450
movq %r14, %rdi
callq 0x61d0
movq %rax, %r15
movq 0x7c5b(%rip), %r14      # 0xef20
addq $0x10, %r14
leaq 0x3d70(%rip), %rsi      # 0xb040
movl $0xb, %edx
movq %r14, %rdi
callq 0x6460
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x6400
callq 0x6610
jmp 0x7148
jmp 0x744d
movq %rax, %r14
callq 0x6610
jmp 0x7450
movq %rax, %r14
cmpl $0x1, %edx
jne 0x7450
movq %r14, %rdi
callq 0x61d0
movq %rax, %r15
movq 0x7bf5(%rip), %r14      # 0xef20
addq $0x10, %r14
leaq 0x3d0a(%rip), %rsi      # 0xb040
movl $0xb, %edx
movq %r14, %rdi
callq 0x6460
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x6400
callq 0x6610
jmp 0x7148
jmp 0x744d
movq %rax, %r14
callq 0x6610
jmp 0x7450
movq %rax, %r14
cmpl $0x1, %edx
jne 0x7450
movq %r14, %rdi
callq 0x61d0
movq %rax, %r15
movq 0x7b8f(%rip), %r14      # 0xef20
addq $0x10, %r14
leaq 0x3ca4(%rip), %rsi      # 0xb040
movl $0xb, %edx
movq %r14, %rdi
callq 0x6460
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x6400
callq 0x6610
jmp 0x7148
jmp 0x744d
movq %rax, %r14
callq 0x6610
jmp 0x7450
movq %rax, %r14
cmpl $0x1, %edx
jne 0x7450
movq %r14, %rdi
callq 0x61d0
movq %rax, %r15
movq 0x7b30(%rip), %r14      # 0xef20
addq $0x10, %r14
leaq 0x3c45(%rip), %rsi      # 0xb040
movl $0xb, %edx
movq %r14, %rdi
callq 0x6460
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x6400
callq 0x6610
jmp 0x7148
jmp 0x744d
movq %rax, %r14
callq 0x6610
jmp 0x7450
movq %rax, %rdi
callq 0x7b16
movq %rax, %r14
movq -0x80(%rbp), %rdi
cmpq %r15, %rdi
je 0x7450
callq 0x63e0
jmp 0x7450
movq %rax, %r14
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x7463
callq 0x63e0
jmp 0x7463
movq %rax, %r14
movq %r14, %rdi
callq 0x6680
nop