// File: czmccrory[P]ManchesterBaby/baby.cpp
// Function: ManchesterBaby::getValidFile[abi:cxx11]()
string ManchesterBaby::getValidFile(){
  bool isValid=true;
  //Initalise the variable
  string filename="";
 do{
  //Display the files available to load
  cout << "\nAvailable files to load: \n" << endl;
  
  //Display
  system("ls | grep .txt | cat");
   cout << "\nPlease enter the filename: " << endl;
  
  //Store the file name
  cin >> filename;
   //Initalise variable
  ifstream infile;
  //Open file
  infile.open(filename, ios::in);
   //Open the file to prove that it exists
  if(infile.is_open() == 1)
  {
     // P0W how-to-detect-empty-file-in-c stackoverflow
    // If file is empty 
    if(infile.peek() == ifstream::traits_type::eof())
    {
       cout << "\nFILE IS EMPTY. " << endl;
      isValid=false;
      cin.clear();
      cin.ignore();
    }
     // close file
    infile.close();
   }else{
    cout << "\nError- The file ente does not exist" << endl;
    cout << "Try again: " << endl;
    isValid=false;
    cin.clear();
    cin.ignore();
  }
}while(isValid==false);
 return filename;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x280, %rsp            # imm = 0x280
movq %rdi, -0x240(%rbp)
movq %rdi, %rax
movq %rax, -0x248(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x1, -0x11(%rbp)
movb $0x0, -0x12(%rbp)
leaq -0x13(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x33f0
movq -0x240(%rbp), %rdi
movq -0x238(%rbp), %rdx
leaq 0x5ee5(%rip), %rsi      # 0xb106
callq 0x5dc0
jmp 0x5228
leaq -0x13(%rbp), %rdi
callq 0x3260
movq 0xad88(%rip), %rdi      # 0xffc0
leaq 0x5f57(%rip), %rsi      # 0xb196
callq 0x3210
movq %rax, -0x250(%rbp)
jmp 0x524d
movq -0x250(%rbp), %rdi
movq 0xad55(%rip), %rsi      # 0xffb0
callq 0x3240
jmp 0x5262
leaq 0x5f49(%rip), %rdi      # 0xb1b2
callq 0x31c0
jmp 0x5270
movq 0xad49(%rip), %rdi      # 0xffc0
leaq 0x5f49(%rip), %rsi      # 0xb1c7
callq 0x3210
movq %rax, -0x258(%rbp)
jmp 0x528c
movq -0x258(%rbp), %rdi
movq 0xad16(%rip), %rsi      # 0xffb0
callq 0x3240
jmp 0x52a1
movq -0x240(%rbp), %rsi
movq 0xad29(%rip), %rdi      # 0xffd8
callq 0x3300
jmp 0x52b6
leaq -0x230(%rbp), %rdi
callq 0x3290
jmp 0x52c4
movq -0x240(%rbp), %rsi
leaq -0x230(%rbp), %rdi
movl $0x8, %edx
callq 0x31d0
jmp 0x52de
leaq -0x230(%rbp), %rdi
callq 0x3370
movb %al, -0x259(%rbp)
jmp 0x52f2
movb -0x259(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x53e9
leaq -0x230(%rbp), %rdi
callq 0x30c0
movl %eax, -0x260(%rbp)
jmp 0x531a
callq 0x5e70
movl %eax, %ecx
movl -0x260(%rbp), %eax
cmpl %ecx, %eax
jne 0x53d6
movq 0xac8a(%rip), %rdi      # 0xffc0
leaq 0x5ea7(%rip), %rsi      # 0xb1e4
callq 0x3210
movq %rax, -0x268(%rbp)
jmp 0x534b
movq -0x268(%rbp), %rdi
movq 0xac57(%rip), %rsi      # 0xffb0
callq 0x3240
jmp 0x5360
movb $0x0, -0x11(%rbp)
movq 0xac6d(%rip), %rdi      # 0xffd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x33b0
jmp 0x537e
movq 0xac53(%rip), %rdi      # 0xffd8
callq 0x3420
jmp 0x538c
jmp 0x53d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x13(%rbp), %rdi
callq 0x3260
jmp 0x54c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x54bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x3090
jmp 0x54bc
leaq -0x230(%rbp), %rdi
callq 0x3060
jmp 0x53e4
jmp 0x5479
movq 0xabd0(%rip), %rdi      # 0xffc0
leaq 0x5dfe(%rip), %rsi      # 0xb1f5
callq 0x3210
movq %rax, -0x270(%rbp)
jmp 0x5405
movq -0x270(%rbp), %rdi
movq 0xab9d(%rip), %rsi      # 0xffb0
callq 0x3240
jmp 0x541a
movq 0xab9f(%rip), %rdi      # 0xffc0
leaq 0x5df2(%rip), %rsi      # 0xb21a
callq 0x3210
movq %rax, -0x278(%rbp)
jmp 0x5436
movq -0x278(%rbp), %rdi
movq 0xab6c(%rip), %rsi      # 0xffb0
callq 0x3240
jmp 0x544b
movb $0x0, -0x11(%rbp)
movq 0xab82(%rip), %rdi      # 0xffd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x33b0
jmp 0x5469
movq 0xab68(%rip), %rdi      # 0xffd8
callq 0x3420
jmp 0x5477
jmp 0x5479
leaq -0x230(%rbp), %rdi
callq 0x3090
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x5231
movb $0x1, -0x12(%rbp)
testb $0x1, -0x12(%rbp)
jne 0x54ac
movq -0x240(%rbp), %rdi
callq 0x3150
movq -0x248(%rbp), %rax
addq $0x280, %rsp            # imm = 0x280
popq %rbp
retq
movq -0x240(%rbp), %rdi
callq 0x3150
movq -0x20(%rbp), %rdi
callq 0x33e0
nopw %cs:(%rax,%rax)