// File: /workspace/github_cpp_makefile_star2_O3/pelrun[P]aft/aft.cpp
// Function: main
int main(int argc, char *argv[])
{
	try
	{
		COptionParser optParser(appliOption, appliName, appliUsageShort, appliUsageLong, authorName, authorMail);
		
		optParser.PrintHeader(std::cout);

		if (!optParser.ParseCommandLine(&argc, &argv, 0, false))
		{
			optParser.PrintError(std::cout);
			optParser.PrintUsage(std::cout);
			return -1;
		}

		bool noLoop = false;
		std::string COMport = defaultComPort();
		std::string filename = "";
		std::string dir = "";

		
		int i=0;
		while (optParser.GetOptionI(i) != 0)
		{
			switch(optParser.GetOptionI(i))
			{
			case 'p':
				{
					COMport = optParser.GetStringOptionI(i);
					break;
				}
			case 'f':
				{
					filename = optParser.GetStringOptionI(i);
					noLoop = true;
					break;
				}
			case 'd':
				{
					dir = optParser.GetStringOptionI(i);
					break;
				}
			case 'n':
				{
					noLoop = true;
					break;
				}
			default:
				{
					break;
				}
			}

			i++;
		}

		CAksFileTransfert transfert(COMport);

		if (!transfert.IsOpen())
		{
			std::cout << "Unable to open comport " << COMport << std::endl;
			return -1;
		} else {
			std::cout << "AFT now listening on " << COMport << std::endl;
		}

		if (filename.size() != 0)
		{
			transfert.SetForceFilename(filename);
		}
		if (dir.size() != 0)
		{
			transfert.SetFilepath(dir);
		}

		while (!noLoop || (noLoop && (transfert.GetNbTransfertDone() != 1)))
		{
			transfert.Run();
		}
	}
	catch(tools::CException &e)
	{
		std::cerr << e << std::endl;
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movl %edi, 0xc(%rsp)
movq %rsi, 0x70(%rsp)
leaq 0x12b13(%rip), %rax     # 0x16510
movq %rax, (%rsp)
leaq 0x128c8(%rip), %rsi     # 0x162d0
leaq 0x12b21(%rip), %rdx     # 0x16530
leaq 0x12b3a(%rip), %rcx     # 0x16550
leaq 0x12b53(%rip), %r8      # 0x16570
leaq 0x12acc(%rip), %r9      # 0x164f0
leaq 0x148(%rsp), %rdi
callq 0x80b2
movq 0x12590(%rip), %rsi     # 0x15fc8
leaq 0x148(%rsp), %rdi
callq 0x871c
leaq 0x148(%rsp), %rdi
leaq 0xc(%rsp), %rsi
leaq 0x70(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x82c6
testb %al, %al
je 0x3bb3
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xc6ca(%rip), %rsi      # 0x10143
leaq 0xc6cf(%rip), %rdx      # 0x1014f
leaq 0x10(%rsp), %rdi
callq 0x400a
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xcf19(%rip), %rdx      # 0x109b3
leaq 0x50(%rsp), %rdi
movq %rdx, %rsi
callq 0x400a
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xcefc(%rip), %rdx      # 0x109b3
leaq 0x30(%rsp), %rdi
movq %rdx, %rsi
callq 0x400a
leaq 0xa8(%rsp), %r12
xorl %r15d, %r15d
leaq 0x148(%rsp), %rbx
leaq 0xc526(%rip), %r13      # 0x10004
leaq 0x98(%rsp), %r14
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x8554
testb %al, %al
je 0x3bf2
movq %rbx, %rdi
movl %ebp, %esi
callq 0x8554
movsbl %al, %eax
addl $-0x64, %eax
rorl %eax
cmpl $0x6, %eax
ja 0x3bac
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
xorl %ecx, %ecx
callq 0x86ea
leaq 0x30(%rsp), %rdi
jmp 0x3b87
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
xorl %ecx, %ecx
callq 0x86ea
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
callq 0x3370
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0x3b6e
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x32d0
movb $0x1, %r15b
jmp 0x3bac
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
xorl %ecx, %ecx
callq 0x86ea
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x3370
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0x3bac
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x32d0
incl %ebp
jmp 0x3ae8
movq 0x1240e(%rip), %rsi     # 0x15fc8
leaq 0x148(%rsp), %rdi
callq 0x87f4
movq 0x123fa(%rip), %rsi     # 0x15fc8
leaq 0x148(%rsp), %rdi
callq 0x8866
leaq 0x148(%rsp), %rdi
callq 0x8220
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x3ddc
leaq 0x88(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x78(%rsp), %rdi
callq 0x3f74
leaq 0x98(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x40a0
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0x3c42
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0x98(%rsp), %rdi
callq 0x54c6
testb %al, %al
je 0x3d0d
movq 0x1236a(%rip), %rdi     # 0x15fc8
leaq 0xc4c8(%rip), %rsi      # 0x1012d
movl $0x15, %edx
callq 0x3320
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x12348(%rip), %rdi     # 0x15fc8
callq 0x3320
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
cmpq $0x0, 0x58(%rsp)
je 0x3cc9
leaq 0x98(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x4232
cmpq $0x0, 0x38(%rsp)
je 0x3ce3
leaq 0x98(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x423c
leaq 0x98(%rsp), %rbx
testb $0x1, %r15b
je 0x3cfe
movq %rbx, %rdi
callq 0x4312
cmpl $0x1, %eax
je 0x3d6c
movq %rbx, %rdi
movl $0x1, %esi
callq 0x431a
jmp 0x3ceb
movq 0x122b4(%rip), %rdi     # 0x15fc8
leaq 0xc3fa(%rip), %rsi      # 0x10115
movl $0x17, %edx
callq 0x3320
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x12292(%rip), %rdi     # 0x15fc8
callq 0x3320
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %rax, %rdi
callq 0x31d0
jmp 0x3d6e
xorl %ebx, %ebx
leaq 0x98(%rsp), %rdi
callq 0x419a
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x3d97
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x3db3
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x3dcf
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0x148(%rsp), %rdi
callq 0x8220
movl %ebx, %eax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r14
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0x3e5c
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x32d0
jmp 0x3e5c
jmp 0x3e56
movq %rdx, %r14
movq %rax, %rbx
jmp 0x3e78
movq %rdx, %r14
movq %rax, %rbx
jmp 0x3e94
jmp 0x3e31
movq %rdx, %r14
movq %rax, %rbx
jmp 0x3ebd
movq %rdx, %r14
movq %rax, %rbx
jmp 0x3eb0
jmp 0x3e56
jmp 0x3e56
jmp 0x3e56
jmp 0x3e41
movq %rdx, %r14
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x419a
jmp 0x3e5c
movq %rdx, %r14
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x3e78
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x3e94
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x3eb0
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0x148(%rsp), %rdi
callq 0x8220
cmpl $0x1, %r14d
jne 0x3ef4
movq %rbx, %rdi
callq 0x3120
movq 0x1211e(%rip), %rdi     # 0x15ff0
movq %rax, %rsi
callq 0x3f04
movq %rax, %rdi
callq 0x3140
callq 0x34d0
jmp 0x3be8
movq %rax, %rbx
callq 0x34d0
movq %rbx, %rdi
callq 0xce30
movq %rax, %rdi
callq 0x3f68