// File: yuroitaki[P]enigma_machine/config.cpp
// Function: Config::check_rot_pos_file()
void Config::check_rot_pos_file(){
  ifstream input;
  int buffer;
  int count = 0;
  char charac;
  
  input.open(rotor_pos_file);

  while((count<rotor_count)&&(input>>buffer)){
    input.get(charac);
    if(!isspace(charac)){
      cerr << "Non-numeric character in rotor position file: rotor.pos" <<endl;
      throw NON_NUMERIC_CHARACTER;
    } 
    if((buffer<0)||(buffer>25)){
      cerr << "Invalid index in rotor position file: rotor.pos" <<endl;
      throw INVALID_INDEX;
    }count++;
  }
  if((input.fail())&&(!input.eof())){
    cerr << "Non-numeric character in rotor position file: rotor.pos" <<endl;
    throw NON_NUMERIC_CHARACTER;
  }
  if(count<rotor_count){
    cerr << "No starting position for rotor " << count;
    throw NO_ROTOR_STARTING_POSITION;
  }
  input.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x280, %rsp            # imm = 0x280
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x240(%rbp)
leaq -0x210(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x2150
movq -0x240(%rbp), %rax
movq -0x238(%rbp), %rdi
movl $0x0, -0x218(%rbp)
movq 0x40(%rax), %rsi
movl $0x8, %edx
callq 0x20e0
jmp 0x5455
jmp 0x5457
movq -0x240(%rbp), %rdx
movl -0x218(%rbp), %ecx
xorl %eax, %eax
cmpl 0x10(%rdx), %ecx
movb %al, -0x241(%rbp)
jge 0x54b9
leaq -0x210(%rbp), %rdi
leaq -0x214(%rbp), %rsi
callq 0x20d0
movq %rax, -0x250(%rbp)
jmp 0x548d
movq -0x250(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2170
movb %al, -0x251(%rbp)
jmp 0x54ab
movb -0x251(%rbp), %al
movb %al, -0x241(%rbp)
jmp 0x54b9
movb -0x241(%rbp), %al
testb $0x1, %al
jne 0x54c8
jmp 0x55e9
leaq -0x210(%rbp), %rdi
leaq -0x219(%rbp), %rsi
callq 0x2190
jmp 0x54dd
movsbl -0x219(%rbp), %edi
callq 0x2040
cmpl $0x0, %eax
jne 0x556a
movq 0x6afb(%rip), %rdi      # 0xbff0
leaq 0x2fa3(%rip), %rsi      # 0x849f
callq 0x2110
movq %rax, -0x260(%rbp)
jmp 0x550a
movq -0x260(%rbp), %rdi
movq 0x6a98(%rip), %rsi      # 0xbfb0
callq 0x2140
jmp 0x551f
movl $0x4, %edi
callq 0x20b0
movq %rax, %rdi
movl $0x4, (%rdi)
movq 0x6a67(%rip), %rsi      # 0xbfa0
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
jmp 0x5733
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x2060
jmp 0x5727
cmpl $0x0, -0x214(%rbp)
jl 0x557c
cmpl $0x19, -0x214(%rbp)
jle 0x55d5
movq 0x6a6d(%rip), %rdi      # 0xbff0
leaq 0x2f4d(%rip), %rsi      # 0x84d7
callq 0x2110
movq %rax, -0x268(%rbp)
jmp 0x5598
movq -0x268(%rbp), %rdi
movq 0x6a0a(%rip), %rsi      # 0xbfb0
callq 0x2140
jmp 0x55ad
movl $0x4, %edi
callq 0x20b0
movq %rax, %rdi
movl $0x3, (%rdi)
movq 0x69d9(%rip), %rsi      # 0xbfa0
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
jmp 0x5733
movl -0x218(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x218(%rbp)
jmp 0x5457
movq -0x210(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x210(%rbp,%rax), %rdi
callq 0x2030
movb %al, -0x269(%rbp)
jmp 0x5609
movb -0x269(%rbp), %al
testb $0x1, %al
jne 0x5618
jmp 0x569d
movq -0x210(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x210(%rbp,%rax), %rdi
callq 0x2200
movb %al, -0x26a(%rbp)
jmp 0x5638
movb -0x26a(%rbp), %al
testb $0x1, %al
jne 0x569d
jmp 0x5644
movq 0x69a5(%rip), %rdi      # 0xbff0
leaq 0x2e4d(%rip), %rsi      # 0x849f
callq 0x2110
movq %rax, -0x278(%rbp)
jmp 0x5660
movq -0x278(%rbp), %rdi
movq 0x6942(%rip), %rsi      # 0xbfb0
callq 0x2140
jmp 0x5675
movl $0x4, %edi
callq 0x20b0
movq %rax, %rdi
movl $0x4, (%rdi)
movq 0x6911(%rip), %rsi      # 0xbfa0
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
jmp 0x5733
movq -0x240(%rbp), %rcx
movl -0x218(%rbp), %eax
cmpl 0x10(%rcx), %eax
jge 0x5704
movq 0x693a(%rip), %rdi      # 0xbff0
leaq 0x2e4a(%rip), %rsi      # 0x8507
callq 0x2110
movq %rax, -0x280(%rbp)
jmp 0x56cb
movq -0x280(%rbp), %rdi
movl -0x218(%rbp), %esi
callq 0x21e0
jmp 0x56df
movl $0x4, %edi
callq 0x20b0
movq %rax, %rdi
movl $0x8, (%rdi)
movq 0x68a7(%rip), %rsi      # 0xbfa0
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
jmp 0x5733
leaq -0x210(%rbp), %rdi
callq 0x2050
jmp 0x5712
leaq -0x210(%rbp), %rdi
callq 0x2060
addq $0x280, %rsp            # imm = 0x280
popq %rbp
retq
movq -0x228(%rbp), %rdi
callq 0x21f0
nopw %cs:(%rax,%rax)