#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct termios {
  int /*<<< orphan*/ c_lflag;
};

/* Variables and functions */
int /*<<< orphan*/ ECHO;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ TCSANOW;
int /*<<< orphan*/ about();
int /*<<< orphan*/ assert(char *);
char *calloc(int, int);
int checkProfiles(int, char *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scpFrom(char *, char *);
int /*<<< orphan*/ scpTo(char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, ...);
int /*<<< orphan*/ sshLogin(char *, char *);
int /*<<< orphan*/ startup(char *, char *, char *, int);
int /*<<< orphan*/ stdin;
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ tcgetattr(int /*<<< orphan*/, struct termios *);
int /*<<< orphan*/ tcsetattr(int /*<<< orphan*/, int /*<<< orphan*/,
                             struct termios *);
int main(int argc, char *argv[]) {
  system("clear");
  char buf[1024];
  char *uname = calloc(30, sizeof(char));
  assert(uname);
  char *hostname = calloc(50, sizeof(char));
  assert(hostname);
  char *password = calloc(100, sizeof(char));
  assert(password);
  printf("\x1b[34m"
         "    _______          _____ _____ _    _ \n");
  printf("   |__   __|        / ____/ ____| |  | |\n");
  printf("      | |_   ___  _| (___| (___ | |__| |\n");
  printf("      | | | | \\ \\/ /\\___  \\___ \\|  __  |\n");
  printf("      | | |_| |>  < ____) |___) | |  | |\n");
  printf("      |_|\\__,_/_/\\_\\_____/_____/|_|  |_|\n\n\n"
         "\x1b[0m");
  printf("Username: ");
  fgets(buf, 1024, stdin);
  sscanf(buf, "%s", uname);
  printf("Hostname: ");
  fgets(buf, 1024, stdin);
  sscanf(buf, "%s", hostname);
  printf("Password: ");
  struct termios term, term_orig;
  tcgetattr(STDIN_FILENO, &term);
  term_orig = term;
  term.c_lflag &= ~ECHO;
  tcsetattr(STDIN_FILENO, TCSANOW, &term);
  fgets(buf, 1024, stdin);
  strncpy(password, buf, strlen(buf));
  tcsetattr(STDIN_FILENO, TCSANOW, &term_orig);
  system("clear");
  for (int i = 0; i < strlen(password); i++) {
    if (password[i] == '\n')
      password[i] = '\0';
  }
  int profileExists = 0;
  profileExists = checkProfiles(profileExists, uname, hostname);
  startup(uname, hostname, password, profileExists);
  int menuChoice = 0;
  while (1) {
    printf("\x1b[34m"
           "    _______          _____ _____ _    _ \n");
    printf("   |__   __|        / ____/ ____| |  | |\n");
    printf("      | |_   ___  _| (___| (___ | |__| |\n");
    printf("      | | | | \\ \\/ /\\___  \\___ \\|  __  |\n");
    printf("      | | |_| |>  < ____) |___) | |  | |\n");
    printf("      |_|\\__,_/_/\\_\\_____/_____/|_|  |_|\n\n\n"
           "\x1b[0m");
    printf("\x1b[32m"
           "(1) SSH into machine\n(2) Upload files TO server\n(3) Download "
           "files FROM Server\n(4) About / License\n(5) Quit\n>>> "
           "\x1b[0m");
    fgets(buf, 1024, stdin);
    sscanf(buf, "%d", &menuChoice);
    if (menuChoice == 1) {
      sshLogin(uname, hostname);
      system("clear");
    } else if (menuChoice == 2) {
      scpTo(uname, hostname);
    } else if (menuChoice == 3) {
      scpFrom(uname, hostname);
    } else if (menuChoice == 4) {
      about();
    } else if (menuChoice == 5) {
      system("clear");
      free(uname);
      free(hostname);
      free(password);
      exit(EXIT_SUCCESS);
    } else {
      system("clear");
      printf("Input not understood, retrying\n\n");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xdc0(%rip),%rdi
call   1060 <system@plt>
mov    $0x1e,%edi
mov    $0x1,%esi
call   10a0 <calloc@plt>
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rdi
call   10b0 <assert@plt>
mov    $0x32,%edi
mov    $0x1,%esi
call   10a0 <calloc@plt>
mov    %rax,-0x420(%rbp)
mov    -0x420(%rbp),%rdi
call   10b0 <assert@plt>
mov    $0x64,%edi
mov    $0x1,%esi
call   10a0 <calloc@plt>
mov    %rax,-0x428(%rbp)
mov    -0x428(%rbp),%rdi
call   10b0 <assert@plt>
lea    0xd54(%rip),%rdi
call   1070 <printf@plt>
lea    0xd77(%rip),%rdi
call   1070 <printf@plt>
lea    0xd95(%rip),%rdi
call   1070 <printf@plt>
lea    0xdb3(%rip),%rdi
call   1070 <printf@plt>
lea    0xdd1(%rip),%rdi
call   1070 <printf@plt>
lea    0xdef(%rip),%rdi
call   1070 <printf@plt>
lea    0xe13(%rip),%rdi
call   1070 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    0x2cdb(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1090 <fgets@plt>
lea    -0x410(%rbp),%rdi
mov    -0x418(%rbp),%rdx
lea    0xdea(%rip),%rsi
mov    $0x0,%al
call   10d0 <sscanf@plt>
lea    0xddf(%rip),%rdi
call   1070 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    0x2c99(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1090 <fgets@plt>
lea    -0x410(%rbp),%rdi
mov    -0x420(%rbp),%rdx
lea    0xda8(%rip),%rsi
mov    $0x0,%al
call   10d0 <sscanf@plt>
lea    0xda8(%rip),%rdi
call   1070 <printf@plt>
mov    0x2c36(%rip),%rax
mov    (%rax),%edi
lea    -0x430(%rbp),%rsi
call   1110 <tcgetattr@plt>
mov    -0x430(%rbp),%eax
mov    %eax,-0x438(%rbp)
mov    0x2c2d(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x430(%rbp),%eax
mov    %eax,-0x430(%rbp)
mov    0x2bfd(%rip),%rax
mov    (%rax),%edi
mov    0x2c14(%rip),%rax
mov    (%rax),%esi
lea    -0x430(%rbp),%rdx
call   1120 <tcsetattr@plt>
lea    -0x410(%rbp),%rdi
mov    0x2c00(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1090 <fgets@plt>
mov    -0x428(%rbp),%rax
mov    %rax,-0x458(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x450(%rbp)
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x458(%rbp),%rdi
mov    -0x450(%rbp),%rsi
mov    %eax,%edx
call   1040 <strncpy@plt>
mov    0x2b88(%rip),%rax
mov    (%rax),%edi
mov    0x2b9f(%rip),%rax
mov    (%rax),%esi
lea    -0x438(%rbp),%rdx
call   1120 <tcsetattr@plt>
lea    0xbaa(%rip),%rdi
call   1060 <system@plt>
movl   $0x0,-0x43c(%rbp)
mov    -0x43c(%rbp),%eax
mov    %eax,-0x45c(%rbp)
mov    -0x428(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x45c(%rbp),%eax
cmp    %ecx,%eax
jge    14d3 <main+0x2b3>
mov    -0x428(%rbp),%rax
movslq -0x43c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    14ba <main+0x29a>
mov    -0x428(%rbp),%rax
movslq -0x43c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    14bf <main+0x29f>
mov    -0x43c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x43c(%rbp)
jmp    1465 <main+0x245>
movl   $0x0,-0x440(%rbp)
mov    -0x440(%rbp),%edi
mov    -0x418(%rbp),%rsi
mov    -0x420(%rbp),%rdx
call   1080 <checkProfiles@plt>
mov    %eax,-0x440(%rbp)
mov    -0x418(%rbp),%rdi
mov    -0x420(%rbp),%rsi
mov    -0x428(%rbp),%rdx
mov    -0x440(%rbp),%ecx
call   10f0 <startup@plt>
movl   $0x0,-0x444(%rbp)
lea    0xad9(%rip),%rdi
call   1070 <printf@plt>
lea    0xafc(%rip),%rdi
call   1070 <printf@plt>
lea    0xb1a(%rip),%rdi
call   1070 <printf@plt>
lea    0xb38(%rip),%rdi
call   1070 <printf@plt>
lea    0xb56(%rip),%rdi
call   1070 <printf@plt>
lea    0xb74(%rip),%rdi
call   1070 <printf@plt>
lea    0xbbc(%rip),%rdi
call   1070 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    0x2a60(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1090 <fgets@plt>
lea    -0x410(%rbp),%rdi
lea    0xc09(%rip),%rsi
lea    -0x444(%rbp),%rdx
mov    $0x0,%al
call   10d0 <sscanf@plt>
cmpl   $0x1,-0x444(%rbp)
jne    15e1 <main+0x3c1>
mov    -0x418(%rbp),%rdi
mov    -0x420(%rbp),%rsi
call   1100 <sshLogin@plt>
lea    0xa29(%rip),%rdi
call   1060 <system@plt>
jmp    16bb <main+0x49b>
cmpl   $0x2,-0x444(%rbp)
jne    1606 <main+0x3e6>
mov    -0x418(%rbp),%rdi
mov    -0x420(%rbp),%rsi
call   1130 <scpTo@plt>
jmp    16b6 <main+0x496>
cmpl   $0x3,-0x444(%rbp)
jne    162b <main+0x40b>
mov    -0x418(%rbp),%rdi
mov    -0x420(%rbp),%rsi
call   10e0 <scpFrom@plt>
jmp    16b1 <main+0x491>
cmpl   $0x4,-0x444(%rbp)
jne    1644 <main+0x424>
mov    $0x0,%al
call   10c0 <about@plt>
jmp    16ac <main+0x48c>
cmpl   $0x5,-0x444(%rbp)
jne    168f <main+0x46f>
lea    0x9a8(%rip),%rdi
call   1060 <system@plt>
mov    -0x418(%rbp),%rdi
call   1030 <free@plt>
mov    -0x420(%rbp),%rdi
call   1030 <free@plt>
mov    -0x428(%rbp),%rdi
call   1030 <free@plt>
mov    0x2940(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
lea    0x96a(%rip),%rdi
call   1060 <system@plt>
lea    0xb0c(%rip),%rdi
call   1070 <printf@plt>
jmp    16ac <main+0x48c>
jmp    16b1 <main+0x491>
jmp    16b6 <main+0x496>
jmp    16bb <main+0x49b>
jmp    1526 <main+0x306>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
lea    0xdcc(%rip),%rdi
call   1070 <system@plt>
mov    $0x1e,%edi
mov    $0x1,%esi
call   10b0 <calloc@plt>
mov    %rax,%r13
mov    %rax,%rdi
call   10c0 <assert@plt>
mov    $0x32,%edi
mov    $0x1,%esi
call   10b0 <calloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   10c0 <assert@plt>
mov    $0x64,%edi
mov    $0x1,%esi
call   10b0 <calloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   10c0 <assert@plt>
lea    0xe49(%rip),%rdi
call   1050 <puts@plt>
lea    0xe6b(%rip),%rdi
call   1050 <puts@plt>
lea    0xe88(%rip),%rdi
call   1050 <puts@plt>
lea    0xea5(%rip),%rdi
call   1050 <puts@plt>
lea    0xec2(%rip),%rdi
call   1050 <puts@plt>
lea    0xd3c(%rip),%rdi
call   1080 <printf@plt>
lea    0xd60(%rip),%rdi
call   1080 <printf@plt>
mov    0x2cf2(%rip),%r12
mov    (%r12),%edx
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   10a0 <fgets@plt>
lea    0xd42(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r13,0x10(%rsp)
mov    %r13,%rdx
xor    %eax,%eax
call   10e0 <sscanf@plt>
lea    0xd29(%rip),%rdi
call   1080 <printf@plt>
mov    (%r12),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   10a0 <fgets@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,0x8(%rsp)
mov    %r15,%rdx
xor    %eax,%eax
call   10e0 <sscanf@plt>
lea    0xd02(%rip),%rdi
call   1080 <printf@plt>
mov    0x2c53(%rip),%r14
mov    (%r14),%edi
lea    0x18(%rsp),%r13
mov    %r13,%rsi
call   1120 <tcgetattr@plt>
mov    0x18(%rsp),%eax
mov    %eax,0x20(%rsp)
mov    0x2c4c(%rip),%rcx
mov    (%rcx),%ecx
not    %ecx
and    %eax,%ecx
mov    %ecx,0x18(%rsp)
mov    (%r14),%edi
mov    0x2c40(%rip),%r15
mov    (%r15),%esi
mov    %r13,%rdx
call   1130 <tcsetattr@plt>
mov    (%r12),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   10a0 <fgets@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <strncpy@plt>
mov    (%r14),%edi
mov    (%r15),%esi
lea    0x20(%rsp),%rdx
call   1130 <tcsetattr@plt>
lea    0xc2c(%rip),%rdi
call   1070 <system@plt>
mov    %rbp,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    1421 <main+0x1f1>
xor    %ebx,%ebx
jmp    1413 <main+0x1e3>
nopl   (%rax)
add    $0x1,%rbx
mov    %rbp,%rdi
call   1060 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    1421 <main+0x1f1>
cmpb   $0xa,0x0(%rbp,%rbx,1)
jne    1400 <main+0x1d0>
movb   $0x0,0x0(%rbp,%rbx,1)
jmp    1400 <main+0x1d0>
xor    %edi,%edi
mov    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    0x8(%rsp),%r14
mov    %r14,%rdx
call   1090 <checkProfiles@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rbp,0x28(%rsp)
mov    %rbp,%rdx
mov    %eax,%ecx
call   1100 <startup@plt>
movl   $0x0,0x1c(%rsp)
lea    0xbbe(%rip),%r13
lea    0xc0b(%rip),%r12
lea    0x30(%rsp),%rbx
lea    0xc79(%rip),%rbp
lea    0x1c(%rsp),%r15
lea    0xb85(%rip),%r14
jmp    1490 <main+0x260>
xor    %eax,%eax
call   10d0 <about@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xc54(%rip),%rdi
call   1050 <puts@plt>
lea    0xc76(%rip),%rdi
call   1050 <puts@plt>
lea    0xc93(%rip),%rdi
call   1050 <puts@plt>
lea    0xcb0(%rip),%rdi
call   1050 <puts@plt>
lea    0xccd(%rip),%rdi
call   1050 <puts@plt>
mov    %r13,%rdi
call   1080 <printf@plt>
mov    %r12,%rdi
call   1080 <printf@plt>
mov    0x2b05(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   10a0 <fgets@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10e0 <sscanf@plt>
mov    0x1c(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     154b <main+0x31b>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1110 <sshLogin@plt>
lea    0xae7(%rip),%rdi
call   1070 <system@plt>
jmp    1490 <main+0x260>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
call   10f0 <scpFrom@plt>
jmp    1490 <main+0x260>
lea    0xac2(%rip),%rdi
call   1070 <system@plt>
lea    0xc5f(%rip),%rdi
call   1050 <puts@plt>
jmp    1490 <main+0x260>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1140 <scpTo@plt>
jmp    1490 <main+0x260>
lea    0xa91(%rip),%rdi
call   1070 <system@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x2a1b(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>

LLVM IR (-O0):
%struct.termios = type { i32 }
@.str = [6 x i8] c"clear\00"
@.str.1 = [47 x i8] c"\1B[34m _______ _____ _____ _ _ \0A\00"
@.str.2 = [42 x i8] c" |__ __| / ____/ ____| | | |\0A\00"
@.str.3 = [42 x i8] c" | |_ ___ _| (___| (___ | |__| |\0A\00"
@.str.4 = [42 x i8] c" | | | | \\ \\/ /\\___ \\___ \\| __ |\0A\00"
@.str.5 = [42 x i8] c" | | |_| |> < ____) |___) | | | |\0A\00"
@.str.6 = [48 x i8] c" |_|\\__,_/_/\\_\\_____/_____/|_| |_|\0A\0A\0A\1B[0m\00"
@.str.7 = [11 x i8] c"Username: \00"
@stdin = global i32 0
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [11 x i8] c"Hostname: \00"
@.str.10 = [11 x i8] c"Password: \00"
@STDIN_FILENO = global i32 0
@ECHO = global i32 0
@TCSANOW = global i32 0
@.str.11 = [122 x i8] c"\1B[32m(1) SSH into machine\0A(2) Upload files TO server\0A(3) Download files FROM Server\0A(4) About / License\0A(5) Quit\0A>>> \1B[0m\00"
@.str.12 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
@.str.13 = [33 x i8] c"Input not understood, retrying\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca %struct.termios
%11 = alloca %struct.termios
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%16 = call i8* @calloc(i32 30, i32 1)
store i8* %16, i8** %7
%17 = load i8*, i8** %7
%18 = call i32 @assert(i8* %17)
%19 = call i8* @calloc(i32 50, i32 1)
store i8* %19, i8** %8
%20 = load i8*, i8** %8
%21 = call i32 @assert(i8* %20)
%22 = call i8* @calloc(i32 100, i32 1)
store i8* %22, i8** %9
%23 = load i8*, i8** %9
%24 = call i32 @assert(i8* %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%29 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%30 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
%31 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%33 = load i32, i32* @stdin
%34 = call i32 @fgets(i8* %32, i32 1024, i32 %33)
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%36 = load i8*, i8** %7
%37 = call i32 (i8*, i8*, ...) @sscanf(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %36)
%38 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%40 = load i32, i32* @stdin
%41 = call i32 @fgets(i8* %39, i32 1024, i32 %40)
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%43 = load i8*, i8** %8
%44 = call i32 (i8*, i8*, ...) @sscanf(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %43)
%45 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%46 = load i32, i32* @STDIN_FILENO
%47 = call i32 @tcgetattr(i32 %46, %struct.termios* %10)
%48 = bitcast %struct.termios* %11 to i8*
%49 = bitcast %struct.termios* %10 to i8*
%50 = load i32, i32* @ECHO
%51 = xor i32 %50, -1
%52 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 0
%53 = load i32, i32* %52
%54 = and i32 %53, %51
store i32 %54, i32* %52
%55 = load i32, i32* @STDIN_FILENO
%56 = load i32, i32* @TCSANOW
%57 = call i32 @tcsetattr(i32 %55, i32 %56, %struct.termios* %10)
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%59 = load i32, i32* @stdin
%60 = call i32 @fgets(i8* %58, i32 1024, i32 %59)
%61 = load i8*, i8** %9
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%64 = call i32 @strlen(i8* %63)
%65 = call i32 @strncpy(i8* %61, i8* %62, i32 %64)
%66 = load i32, i32* @STDIN_FILENO
%67 = load i32, i32* @TCSANOW
%68 = call i32 @tcsetattr(i32 %66, i32 %67, %struct.termios* %11)
%69 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %12
br label %70
70: ; preds = %89, %2
%71 = load i32, i32* %12
%72 = load i8*, i8** %9
%73 = call i32 @strlen(i8* %72)
%74 = icmp slt i32 %71, %73
br i1 %74, label %75, label %92
75: ; preds = %70
%76 = load i8*, i8** %9
%77 = load i32, i32* %12
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %76, i64 %78
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = icmp eq i32 %81, 10
br i1 %82, label %83, label %88
83: ; preds = %75
%84 = load i8*, i8** %9
%85 = load i32, i32* %12
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %84, i64 %86
store i8 0, i8* %87
br label %88
88: ; preds = %83, %75
br label %89
89: ; preds = %88
%90 = load i32, i32* %12
%91 = add nsw i32 %90, 1
store i32 %91, i32* %12
br label %70
92: ; preds = %70
store i32 0, i32* %13
%93 = load i32, i32* %13
%94 = load i8*, i8** %7
%95 = load i8*, i8** %8
%96 = call i32 @checkProfiles(i32 %93, i8* %94, i8* %95)
store i32 %96, i32* %13
%97 = load i8*, i8** %7
%98 = load i8*, i8** %8
%99 = load i8*, i8** %9
%100 = load i32, i32* %13
%101 = call i32 @startup(i8* %97, i8* %98, i8* %99, i32 %100)
store i32 0, i32* %14
br label %102
102: ; preds = %92, %161
%103 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%104 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%105 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%106 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%107 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%108 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
%109 = call i32 @printf(i8* getelementptr inbounds ([122 x i8], [122 x i8]* @.str.11, i64 0, i64 0))
%110 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%111 = load i32, i32* @stdin
%112 = call i32 @fgets(i8* %110, i32 1024, i32 %111)
%113 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%114 = call i32 (i8*, i8*, ...) @sscanf(i8* %113, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i32* %14)
%115 = load i32, i32* %14
%116 = icmp eq i32 %115, 1
br i1 %116, label %117, label %122
117: ; preds = %102
%118 = load i8*, i8** %7
%119 = load i8*, i8** %8
%120 = call i32 @sshLogin(i8* %118, i8* %119)
%121 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %161
122: ; preds = %102
%123 = load i32, i32* %14
%124 = icmp eq i32 %123, 2
br i1 %124, label %125, label %129
125: ; preds = %122
%126 = load i8*, i8** %7
%127 = load i8*, i8** %8
%128 = call i32 @scpTo(i8* %126, i8* %127)
br label %160
129: ; preds = %122
%130 = load i32, i32* %14
%131 = icmp eq i32 %130, 3
br i1 %131, label %132, label %136
132: ; preds = %129
%133 = load i8*, i8** %7
%134 = load i8*, i8** %8
%135 = call i32 @scpFrom(i8* %133, i8* %134)
br label %159
136: ; preds = %129
%137 = load i32, i32* %14
%138 = icmp eq i32 %137, 4
br i1 %138, label %139, label %141
139: ; preds = %136
%140 = call i32 (...) @about()
br label %158
141: ; preds = %136
%142 = load i32, i32* %14
%143 = icmp eq i32 %142, 5
br i1 %143, label %144, label %154
144: ; preds = %141
%145 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%146 = load i8*, i8** %7
%147 = call i32 @free(i8* %146)
%148 = load i8*, i8** %8
%149 = call i32 @free(i8* %148)
%150 = load i8*, i8** %9
%151 = call i32 @free(i8* %150)
%152 = load i32, i32* @EXIT_SUCCESS
%153 = call i32 @exit(i32 %152)
unreachable
154: ; preds = %141
%155 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%156 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.13, i64 0, i64 0))
br label %157
157: ; preds = %154
br label %158
158: ; preds = %157, %139
br label %159
159: ; preds = %158, %132
br label %160
160: ; preds = %159, %125
br label %161
161: ; preds = %160, %117
br label %102
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@.str = [6 x i8] c"clear\00"
@.str.6 = [48 x i8] c" |_|\\__,_/_/\\_\\_____/_____/|_| |_|\0A\0A\0A\1B[0m\00"
@.str.7 = [11 x i8] c"Username: \00"
@stdin = global i32 0
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [11 x i8] c"Hostname: \00"
@.str.10 = [11 x i8] c"Password: \00"
@STDIN_FILENO = global i32 0
@ECHO = global i32 0
@TCSANOW = global i32 0
@.str.11 = [122 x i8] c"\1B[32m(1) SSH into machine\0A(2) Upload files TO server\0A(3) Download files FROM Server\0A(4) About / License\0A(5) Quit\0A>>> \1B[0m\00"
@.str.12 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
@str.18 = [46 x i8] c"\1B[34m _______ _____ _____ _ _ \00"
@str.19 = [41 x i8] c" |__ __| / ____/ ____| | | |\00"
@str.20 = [41 x i8] c" | |_ ___ _| (___| (___ | |__| |\00"
@str.21 = [41 x i8] c" | | | | \\ \\/ /\\___ \\___ \\| __ |\00"
@str.22 = [41 x i8] c" | | |_| |> < ____) |___) | | | |\00"
@str.23 = [32 x i8] c"Input not understood, retrying\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = alloca %struct.termios
%5 = alloca %struct.termios
%6 = alloca i32
%7 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = tail call dereferenceable_or_null(30) i8* @calloc(i32 30, i32 1)
%10 = tail call i32 @assert(i8* %9)
%11 = tail call dereferenceable_or_null(50) i8* @calloc(i32 50, i32 1)
%12 = tail call i32 @assert(i8* %11)
%13 = tail call dereferenceable_or_null(100) i8* @calloc(i32 100, i32 1)
%14 = tail call i32 @assert(i8* %13)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.18, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.19, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.20, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.21, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.22, i64 0, i64 0))
%20 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
%21 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%22 = load i32, i32* @stdin
%23 = call i32 @fgets(i8* %8, i32 1024, i32 %22)
%24 = call i32 (i8*, i8*, ...) @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %9)
%25 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%26 = load i32, i32* @stdin
%27 = call i32 @fgets(i8* %8, i32 1024, i32 %26)
%28 = call i32 (i8*, i8*, ...) @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %11)
%29 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%30 = bitcast %struct.termios* %4 to i8*
%31 = bitcast %struct.termios* %5 to i8*
%32 = load i32, i32* @STDIN_FILENO
%33 = call i32 @tcgetattr(i32 %32, %struct.termios* %4)
%34 = getelementptr inbounds %struct.termios, %struct.termios* %4, i64 0, i32 0
%35 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 0
%36 = load i32, i32* %34
store i32 %36, i32* %35
%37 = load i32, i32* @ECHO
%38 = xor i32 %37, -1
%39 = and i32 %36, %38
store i32 %39, i32* %34
%40 = load i32, i32* @STDIN_FILENO
%41 = load i32, i32* @TCSANOW
%42 = call i32 @tcsetattr(i32 %40, i32 %41, %struct.termios* %4)
%43 = load i32, i32* @stdin
%44 = call i32 @fgets(i8* %8, i32 1024, i32 %43)
%45 = call i32 @strlen(i8* %8)
%46 = call i32 @strncpy(i8* %13, i8* %8, i32 %45)
%47 = load i32, i32* @STDIN_FILENO
%48 = load i32, i32* @TCSANOW
%49 = call i32 @tcsetattr(i32 %47, i32 %48, %struct.termios* %5)
%50 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%51 = call i32 @strlen(i8* %13)
%52 = icmp sgt i32 %51, 0
br i1 %52, label %57, label %53
53: ; preds = %63, %2
%54 = call i32 @checkProfiles(i32 0, i8* %9, i8* %11)
%55 = call i32 @startup(i8* %9, i8* %11, i8* %13, i32 %54)
%56 = bitcast i32* %6 to i8*
store i32 0, i32* %6
br label %68
57: ; preds = %2, %63
%58 = phi i64 [ %64, %63 ], [ 0, %2 ]
%59 = getelementptr inbounds i8, i8* %13, i64 %58
%60 = load i8, i8* %59
%61 = icmp eq i8 %60, 10
br i1 %61, label %62, label %63
62: ; preds = %57
store i8 0, i8* %59
br label %63
63: ; preds = %57, %62
%64 = add nuw nsw i64 %58, 1
%65 = call i32 @strlen(i8* %13)
%66 = sext i32 %65 to i64
%67 = icmp slt i64 %64, %66
br i1 %67, label %57, label %53
68: ; preds = %85, %53
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.18, i64 0, i64 0))
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.19, i64 0, i64 0))
%71 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.20, i64 0, i64 0))
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.21, i64 0, i64 0))
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.22, i64 0, i64 0))
%74 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
%75 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([122 x i8], [122 x i8]* @.str.11, i64 0, i64 0))
%76 = load i32, i32* @stdin
%77 = call i32 @fgets(i8* %8, i32 1024, i32 %76)
%78 = call i32 (i8*, i8*, ...) @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i32* %6)
%79 = load i32, i32* %6
switch i32 %79, label %97 [
i32 1, label %80
i32 2, label %83
i32 3, label %86
i32 4, label %88
i32 5, label %90
]
80: ; preds = %68
%81 = call i32 @sshLogin(i8* %9, i8* %11)
%82 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %85
83: ; preds = %68
%84 = call i32 @scpTo(i8* %9, i8* %11)
br label %85
85: ; preds = %83, %88, %97, %86, %80
br label %68
86: ; preds = %68
%87 = call i32 @scpFrom(i8* %9, i8* %11)
br label %85
88: ; preds = %68
%89 = call i32 (...) @about()
br label %85
90: ; preds = %68
%91 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%92 = call i32 @free(i8* %9)
%93 = call i32 @free(i8* %11)
%94 = call i32 @free(i8* %13)
%95 = load i32, i32* @EXIT_SUCCESS
%96 = call i32 @exit(i32 %95)
unreachable
97: ; preds = %68
%98 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%99 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.23, i64 0, i64 0))
br label %85
}