// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x341d(%rip), %rsi      # 0xa2db
leaq -0x58(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x61e0
movl 0x31c(%r14), %ecx
leal -0x1(%rcx), %eax
cmpl $0x4, %eax
ja 0x6f26
leaq 0x311f(%rip), %rcx      # 0xa000
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x70f7(%rip), %rsi      # 0xdfe8
movq 0x70b0(%rip), %rdx      # 0xdfa8
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x64b0
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *0x10(%rax)
addq $0x1a8, %r14            # imm = 0x1A8
leaq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x6690
jmp 0x7053
cmpl $0x270f, %ecx           # imm = 0x270F
jne 0x706b
movq 0x70af(%rip), %rsi      # 0xdfe8
movq 0x7010(%rip), %rdx      # 0xdf50
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x64b0
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *0x10(%rax)
addq $0x1a8, %r14            # imm = 0x1A8
leaq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x6690
jmp 0x7053
movq 0x7073(%rip), %rsi      # 0xdfe8
movq 0x6fec(%rip), %rdx      # 0xdf68
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x64b0
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *0x10(%rax)
addq $0x1a8, %r14            # imm = 0x1A8
leaq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x6690
jmp 0x7053
movq 0x7037(%rip), %rsi      # 0xdfe8
movq 0x6f78(%rip), %rdx      # 0xdf30
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x64b0
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *0x10(%rax)
addq $0x1a8, %r14            # imm = 0x1A8
leaq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x6690
jmp 0x7053
movq 0x6ffe(%rip), %rsi      # 0xdfe8
movq 0x6f57(%rip), %rdx      # 0xdf48
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x64b0
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *0x10(%rax)
addq $0x1a8, %r14            # imm = 0x1A8
leaq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x6690
jmp 0x7053
movq 0x6fc5(%rip), %rsi      # 0xdfe8
movq 0x6fce(%rip), %rdx      # 0xdff8
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x64b0
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *0x10(%rax)
addq $0x1a8, %r14            # imm = 0x1A8
leaq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x6690
leaq -0x58(%rbp), %rdi
leaq -0x38(%rbp), %r14
movq %r14, %rsi
callq 0x64d0
movq %r14, %rdi
callq 0x6200
cmpq $0x14, -0x50(%rbp)
jb 0x7098
leaq -0x78(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x65a0
leaq -0x78(%rbp), %rsi
movq %rbx, %rdi
callq 0x6150
movl %eax, %ebx
leaq -0x78(%rbp), %rdi
callq 0x6200
jmp 0x70b1
xorl %ebx, %ebx
movq 0x6e87(%rip), %rdi      # 0xdf28
addq $0x10, %rdi
leaq 0x2fa0(%rip), %rsi      # 0xa04c
callq 0x6460
leaq -0x58(%rbp), %rdi
callq 0x6200
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x70df
jmp 0x71a1
jmp 0x7140
jmp 0x7202
jmp 0x7263
jmp 0x72be
movq %rax, %r14
cmpl $0x1, %edx
jne 0x732e
movq %r14, %rdi
callq 0x61f0
movq %rax, %r14
movq 0x6e2b(%rip), %rdi      # 0xdf28
addq $0x10, %rdi
leaq 0x2f38(%rip), %rsi      # 0xa040
callq 0x6460
movq %rax, %r15
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x6460
callq 0x66c0
jmp 0x706b
jmp 0x732b
movq %rax, %r14
callq 0x66c0
jmp 0x732e
movq %rax, %r14
cmpl $0x1, %edx
jne 0x732e
movq %r14, %rdi
callq 0x61f0
movq %rax, %r14
movq 0x6dca(%rip), %rdi      # 0xdf28
addq $0x10, %rdi
leaq 0x2ed7(%rip), %rsi      # 0xa040
callq 0x6460
movq %rax, %r15
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x6460
callq 0x66c0
jmp 0x706b
jmp 0x732b
movq %rax, %r14
callq 0x66c0
jmp 0x732e
movq %rax, %r14
cmpl $0x1, %edx
jne 0x732e
movq %r14, %rdi
callq 0x61f0
movq %rax, %r14
movq 0x6d69(%rip), %rdi      # 0xdf28
addq $0x10, %rdi
leaq 0x2e76(%rip), %rsi      # 0xa040
callq 0x6460
movq %rax, %r15
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x6460
callq 0x66c0
jmp 0x706b
jmp 0x732b
movq %rax, %r14
callq 0x66c0
jmp 0x732e
movq %rax, %r14
cmpl $0x1, %edx
jne 0x732e
movq %r14, %rdi
callq 0x61f0
movq %rax, %r14
movq 0x6d08(%rip), %rdi      # 0xdf28
addq $0x10, %rdi
leaq 0x2e15(%rip), %rsi      # 0xa040
callq 0x6460
movq %rax, %r15
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x6460
callq 0x66c0
jmp 0x706b
jmp 0x732b
movq %rax, %r14
callq 0x66c0
jmp 0x732e
movq %rax, %r14
cmpl $0x1, %edx
jne 0x732e
movq %r14, %rdi
callq 0x61f0
movq %rax, %r14
movq 0x6ca7(%rip), %rdi      # 0xdf28
addq $0x10, %rdi
leaq 0x2db4(%rip), %rsi      # 0xa040
callq 0x6460
movq %rax, %r15
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x6460
callq 0x66c0
jmp 0x706b
jmp 0x732b
movq %rax, %r14
callq 0x66c0
jmp 0x732e
movq %rax, %r14
cmpl $0x1, %edx
jne 0x732e
movq %r14, %rdi
callq 0x61f0
movq %rax, %r14
movq 0x6c50(%rip), %rdi      # 0xdf28
addq $0x10, %rdi
leaq 0x2d5d(%rip), %rsi      # 0xa040
callq 0x6460
movq %rax, %r15
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x6460
callq 0x66c0
jmp 0x706b
jmp 0x732b
movq %rax, %r14
callq 0x66c0
jmp 0x732e
movq %rax, %rdi
callq 0x7939
movq %rax, %r14
leaq -0x78(%rbp), %rdi
callq 0x6200
jmp 0x732e
movq %rax, %r14
leaq -0x58(%rbp), %rdi
callq 0x6200
jmp 0x733c
movq %rax, %r14
movq %r14, %rdi
callq 0x6740