// File: yuroitaki[P]enigma_machine/config.cpp
// Function: Config::check_rf_file()
void Config::check_rf_file(){
  ifstream input;
  vector<int>buffer_vec;
  int len = 0;
  int buffer;
  char charac;
  int count = 0;
  input.open(reflector_file);

  while((count<26)&&(input>>buffer)){

    input.get(charac);
    if(!isspace(charac)){
      cerr << "Non-numeric character in reflector file: reflector.rf" <<endl;
      throw NON_NUMERIC_CHARACTER;
    } 
    if((buffer<0)||(buffer>25)){
      cerr << "Invalid index in reflector file: reflector.rf" <<endl;
      throw INVALID_INDEX;
    }
    buffer_vec.push_back(buffer);
    len = buffer_vec.size();
    
    for (int i=0;i<len-1;i++){
      if(buffer_vec[i]==buffer_vec[len-1]){
	if((i%2==0)&&(len-1-i==1))
	  cerr <<"Invalid connection of reflector contact "<< buffer_vec[i] << " as it is being connected to itself" << endl;
	else
	  cerr << "Invalid connection of reflector contact "<< buffer_vec[i] << " as it is being connected to more than one other contact" << endl;
	throw INVALID_REFLECTOR_MAPPING;
      }
    }count++;
  }
  if((count==26)&&(input>>charac)){
    cerr << "Exceeded the maximum";
    throw INCORRECT_NUMBER_OF_REFLECTOR_PARAMETERS;
  }
  if((input.fail())&&(!input.eof())){
    cerr << "Non-numeric character in reflector file: reflector.rf" <<endl;
    throw NON_NUMERIC_CHARACTER;
  }
  if(count!=26){
    if(count%2!=0)
      cerr << "Incorrect (odd)"; 
    else
      cerr << "Insufficient";
    throw INCORRECT_NUMBER_OF_REFLECTOR_PARAMETERS;
  }
  input.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2d0, %rsp            # imm = 0x2D0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x258(%rbp)
leaq -0x210(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x2150
leaq -0x228(%rbp), %rdi
callq 0x58b0
movq -0x258(%rbp), %rax
movq -0x250(%rbp), %rdi
movl $0x0, -0x22c(%rbp)
movl $0x0, -0x238(%rbp)
movq 0x20(%rax), %rsi
movl $0x8, %edx
callq 0x20e0
jmp 0x450b
jmp 0x450d
xorl %eax, %eax
cmpl $0x1a, -0x238(%rbp)
movb %al, -0x259(%rbp)
jge 0x4566
leaq -0x210(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x20d0
movq %rax, -0x268(%rbp)
jmp 0x453a
movq -0x268(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2170
movb %al, -0x269(%rbp)
jmp 0x4558
movb -0x269(%rbp), %al
movb %al, -0x259(%rbp)
jmp 0x4566
movb -0x259(%rbp), %al
testb $0x1, %al
jne 0x4575
jmp 0x488d
leaq -0x210(%rbp), %rdi
leaq -0x231(%rbp), %rsi
callq 0x2190
jmp 0x458a
movsbl -0x231(%rbp), %edi
callq 0x2040
cmpl $0x0, %eax
jne 0x4627
movq 0x7a4a(%rip), %rdi      # 0xbff0
leaq 0x3d37(%rip), %rsi      # 0x82e4
callq 0x2110
movq %rax, -0x278(%rbp)
jmp 0x45bb
movq -0x278(%rbp), %rdi
movq 0x79e7(%rip), %rsi      # 0xbfb0
callq 0x2140
jmp 0x45d0
movl $0x4, %edi
callq 0x20b0
movq %rax, %rdi
movl $0x4, (%rdi)
movq 0x79b6(%rip), %rsi      # 0xbfa0
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
jmp 0x4a7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x30b0
leaq -0x210(%rbp), %rdi
callq 0x2060
jmp 0x4a6f
cmpl $0x0, -0x230(%rbp)
jl 0x4639
cmpl $0x19, -0x230(%rbp)
jle 0x4692
movq 0x79b0(%rip), %rdi      # 0xbff0
leaq 0x3cd3(%rip), %rsi      # 0x831a
callq 0x2110
movq %rax, -0x280(%rbp)
jmp 0x4655
movq -0x280(%rbp), %rdi
movq 0x794d(%rip), %rsi      # 0xbfb0
callq 0x2140
jmp 0x466a
movl $0x4, %edi
callq 0x20b0
movq %rax, %rdi
movl $0x3, (%rdi)
movq 0x791c(%rip), %rsi      # 0xbfa0
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
jmp 0x4a7b
leaq -0x228(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x58d0
jmp 0x46a7
leaq -0x228(%rbp), %rdi
callq 0x5940
movl %eax, -0x22c(%rbp)
movl $0x0, -0x248(%rbp)
movl -0x248(%rbp), %eax
movl -0x22c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x4879
movslq -0x248(%rbp), %rsi
leaq -0x228(%rbp), %rdi
callq 0x5960
movl (%rax), %eax
movl %eax, -0x284(%rbp)
movl -0x22c(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq -0x228(%rbp), %rdi
callq 0x5960
movq %rax, %rcx
movl -0x284(%rbp), %eax
cmpl (%rcx), %eax
jne 0x4863
movl -0x248(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x47c2
movl -0x22c(%rbp), %eax
subl $0x1, %eax
subl -0x248(%rbp), %eax
cmpl $0x1, %eax
jne 0x47c2
movq 0x78a0(%rip), %rdi      # 0xbff0
leaq 0x3bf1(%rip), %rsi      # 0x8348
callq 0x2110
movq %rax, -0x290(%rbp)
jmp 0x4765
movslq -0x248(%rbp), %rsi
leaq -0x228(%rbp), %rdi
callq 0x5960
movq -0x290(%rbp), %rdi
movl (%rax), %esi
callq 0x21e0
movq %rax, -0x298(%rbp)
jmp 0x478f
movq -0x298(%rbp), %rdi
leaq 0x3acb(%rip), %rsi      # 0x8268
callq 0x2110
movq %rax, -0x2a0(%rbp)
jmp 0x47ab
movq -0x2a0(%rbp), %rdi
movq 0x77f7(%rip), %rsi      # 0xbfb0
callq 0x2140
jmp 0x47c0
jmp 0x483b
movq 0x7827(%rip), %rdi      # 0xbff0
leaq 0x3b78(%rip), %rsi      # 0x8348
callq 0x2110
movq %rax, -0x2a8(%rbp)
jmp 0x47de
movslq -0x248(%rbp), %rsi
leaq -0x228(%rbp), %rdi
callq 0x5960
movq -0x2a8(%rbp), %rdi
movl (%rax), %esi
callq 0x21e0
movq %rax, -0x2b0(%rbp)
jmp 0x4808
movq -0x2b0(%rbp), %rdi
leaq 0x3a76(%rip), %rsi      # 0x828c
callq 0x2110
movq %rax, -0x2b8(%rbp)
jmp 0x4824
movq -0x2b8(%rbp), %rdi
movq 0x777e(%rip), %rsi      # 0xbfb0
callq 0x2140
jmp 0x4839
jmp 0x483b
movl $0x4, %edi
callq 0x20b0
movq %rax, %rdi
movl $0x9, (%rdi)
movq 0x774b(%rip), %rsi      # 0xbfa0
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
jmp 0x4a7b
jmp 0x4865
movl -0x248(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x248(%rbp)
jmp 0x46c3
movl -0x238(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x238(%rbp)
jmp 0x450d
cmpl $0x1a, -0x238(%rbp)
jne 0x491d
leaq -0x210(%rbp), %rdi
leaq -0x231(%rbp), %rsi
callq 0x2180
movq %rax, -0x2c0(%rbp)
jmp 0x48b6
movq -0x2c0(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2170
movb %al, -0x2c1(%rbp)
jmp 0x48d4
movb -0x2c1(%rbp), %al
testb $0x1, %al
jne 0x48e0
jmp 0x491d
movq 0x7709(%rip), %rdi      # 0xbff0
leaq 0x39d7(%rip), %rsi      # 0x82c5
callq 0x2110
jmp 0x48f5
movl $0x4, %edi
callq 0x20b0
movq %rax, %rdi
movl $0xa, (%rdi)
movq 0x7691(%rip), %rsi      # 0xbfa0
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
jmp 0x4a7b
movq -0x210(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x210(%rbp,%rax), %rdi
callq 0x2030
movb %al, -0x2c2(%rbp)
jmp 0x493d
movb -0x2c2(%rbp), %al
testb $0x1, %al
jne 0x494c
jmp 0x49d1
movq -0x210(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x210(%rbp,%rax), %rdi
callq 0x2200
movb %al, -0x2c3(%rbp)
jmp 0x496c
movb -0x2c3(%rbp), %al
testb $0x1, %al
jne 0x49d1
jmp 0x4978
movq 0x7671(%rip), %rdi      # 0xbff0
leaq 0x395e(%rip), %rsi      # 0x82e4
callq 0x2110
movq %rax, -0x2d0(%rbp)
jmp 0x4994
movq -0x2d0(%rbp), %rdi
movq 0x760e(%rip), %rsi      # 0xbfb0
callq 0x2140
jmp 0x49a9
movl $0x4, %edi
callq 0x20b0
movq %rax, %rdi
movl $0x4, (%rdi)
movq 0x75dd(%rip), %rsi      # 0xbfa0
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
jmp 0x4a7b
cmpl $0x1a, -0x238(%rbp)
je 0x4a40
movl -0x238(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
je 0x4a04
movq 0x75fc(%rip), %rdi      # 0xbff0
leaq 0x3976(%rip), %rsi      # 0x8371
callq 0x2110
jmp 0x4a02
jmp 0x4a1b
movq 0x75e5(%rip), %rdi      # 0xbff0
leaq 0x396f(%rip), %rsi      # 0x8381
callq 0x2110
jmp 0x4a19
jmp 0x4a1b
movl $0x4, %edi
callq 0x20b0
movq %rax, %rdi
movl $0xa, (%rdi)
movq 0x756b(%rip), %rsi      # 0xbfa0
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
jmp 0x4a7b
leaq -0x210(%rbp), %rdi
callq 0x2050
jmp 0x4a4e
leaq -0x228(%rbp), %rdi
callq 0x30b0
leaq -0x210(%rbp), %rdi
callq 0x2060
addq $0x2d0, %rsp            # imm = 0x2D0
popq %rbp
retq
movq -0x240(%rbp), %rdi
callq 0x21f0
nopl (%rax,%rax)