// File: /workspace/github_cpp_makefile_star2_O1/CDISC2020[P]Projet_satellite_agile/src/communication/Ground.cpp
// Function: main
int main (int argc,char* argv[])
{
	char cmde[100];
	char name[9];

	cout << "Welcome to the Ground Station, ";

	while (1)
	{
		cout << "what do you want to do ?"<< endl;
		cout << "'p' to send a plan\n" << "'c' to send a commande\n" << "'r' to receive the photos\n" << endl;
		char c;
		scanf(" %c", &c);

		if (c == 'p')	// Envoi d'un plan
		{
			cout << "What is the plan name ? (end it by '.txt')" << endl;
			scanf("%9s[^\n]", name);
			cout << "Sending Plan..." << endl;
			sprintf(cmde, "sh ../src/communication/uploadGtoSplans.sh %s", name);
			system(cmde);
			sleep(2);

			cout << "Plan sent !" << endl;
		}

		else if (c=='c')  // Envoi d'une commande
		{
			cout << "What is the commande name ? (end it by '.txt')" << endl;
			scanf("%9s[^\n]", name);
			cout << "Sending Commande..." << endl;
			sprintf(cmde, "sh ../src/communication/uploadGtoStm.sh %s", name);
			system(cmde);
			sleep(2);

			cout << "Commande sent !" << endl;
		}

		else if (c=='r')  // Demande des photos
		{
			sprintf(cmde, "sh ../src/communication/uploadGtoSplans.sh demande_imgs.txt");
			system(cmde);
			printf("Demande image envoyée");
			cout << "Receiving the images..." << endl;
			sleep(2);
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq 0x2da4(%rip), %rbx      # 0x3fd8
leaq 0xdc9(%rip), %rsi       # 0x2004
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x10b0
leaq 0xe35(%rip), %r14       # 0x2084
leaq -0x29(%rbp), %r15
leaq -0x32(%rbp), %r12
leaq -0xa0(%rbp), %r13
movl $0x18, %edx
movq %rbx, %rdi
leaq 0xdb7(%rip), %rsi       # 0x2024
callq 0x10b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
movl $0x13, %edx
movq %rbx, %rdi
leaq 0xd95(%rip), %rsi       # 0x203d
callq 0x10b0
movl $0x17, %edx
movq %rbx, %rdi
leaq 0xd95(%rip), %rsi       # 0x2051
callq 0x10b0
movl $0x1a, %edx
movq %rbx, %rdi
leaq 0xd99(%rip), %rsi       # 0x2069
callq 0x10b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x10c0
movzbl -0x29(%rbp), %eax
cmpl $0x63, %eax
je 0x147b
cmpl $0x72, %eax
je 0x13e9
cmpl $0x70, %eax
jne 0x125e
movl $0x2a, %edx
movq %rbx, %rdi
leaq 0xd51(%rip), %rsi       # 0x2088
callq 0x10b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
leaq 0xd49(%rip), %rdi       # 0x20b3
movq %r12, %rsi
xorl %eax, %eax
callq 0x10c0
movl $0xf, %edx
movq %rbx, %rdi
leaq 0xd38(%rip), %rsi       # 0x20bb
callq 0x10b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq %r13, %rdi
leaq 0xd12(%rip), %rsi       # 0x20cb
movq %r12, %rdx
xorl %eax, %eax
callq 0x1050
movq %r13, %rdi
callq 0x1080
movl $0x2, %edi
callq 0x1070
movl $0xb, %edx
movq %rbx, %rdi
leaq 0xd15(%rip), %rsi       # 0x20f9
jmp 0x1537
movups 0xdbf(%rip), %xmm0      # 0x21af
movups %xmm0, -0x74(%rbp)
movups 0xda8(%rip), %xmm0      # 0x21a3
movaps %xmm0, -0x80(%rbp)
movups 0xd8d(%rip), %xmm0      # 0x2193
movaps %xmm0, -0x90(%rbp)
movups 0xd6f(%rip), %xmm0      # 0x2183
movaps %xmm0, -0xa0(%rbp)
movq %r13, %rdi
callq 0x1080
leaq 0xd95(%rip), %rdi       # 0x21bf
xorl %eax, %eax
callq 0x1040
movl $0x17, %edx
movq %rbx, %rdi
leaq 0xd96(%rip), %rsi       # 0x21d6
callq 0x10b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
movl $0x2, %edi
callq 0x1070
jmp 0x125e
movl $0x2e, %edx
movq %rbx, %rdi
leaq 0xc7b(%rip), %rsi       # 0x2105
callq 0x10b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
leaq 0xbf6(%rip), %rdi       # 0x20b3
movq %r12, %rsi
xorl %eax, %eax
callq 0x10c0
movl $0x13, %edx
movq %rbx, %rdi
leaq 0xc5e(%rip), %rsi       # 0x2134
callq 0x10b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq %r13, %rdi
leaq 0xc3c(%rip), %rsi       # 0x2148
movq %r12, %rdx
xorl %eax, %eax
callq 0x1050
movq %r13, %rdi
callq 0x1080
movl $0x2, %edi
callq 0x1070
movl $0xf, %edx
movq %rbx, %rdi
leaq 0xc3c(%rip), %rsi       # 0x2173
callq 0x10b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
jmp 0x125e