// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rdi, %rbx
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x2130
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x20(%rbx), %rsi
movq %r14, %rdi
movl $0x8, %edx
callq 0x20c0
xorl %r13d, %r13d
leaq 0x30(%rsp), %rbx
leaq 0x2c(%rsp), %r14
leaq 0xf(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x20b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x20(%rax,%rcx), %ebp
testb $0x5, %bpl
jne 0x310f
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2170
movsbl 0xf(%rsp), %edi
callq 0x2030
testl %eax, %eax
je 0x323d
movl 0x2c(%rsp), %eax
cmpl $0x1a, %eax
jae 0x3268
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x3092
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x30a4
leaq 0x10(%rsp), %rdi
movq %r14, %rdx
callq 0x3be0
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rax
subq %rax, %rsi
shrq $0x2, %rsi
cmpl $0x2, %esi
jl 0x30d2
leal -0x1(%rsi), %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %edx
xorl %r12d, %r12d
cmpl %edx, (%rax,%r12,4)
je 0x317c
incq %r12
cmpq %r12, %rcx
jne 0x30c0
incl %r13d
cmpl $0x1a, %r13d
jne 0x302f
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rsi
callq 0x2160
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movb $0x1, %cl
testb $0x5, 0x20(%rax,%rdx)
jne 0x3116
movl $0x14, %edx
leaq 0x21bb(%rip), %rsi      # 0x52c5
jmp 0x32d0
testb $0x1, %r13b
sete %cl
movq 0x30(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x50(%rsp,%rax), %eax
testb $0x5, %al
setne %dl
testb $0x2, %al
sete %al
testb %al, %dl
jne 0x323d
testb $0x5, %bpl
jne 0x32ae
leaq 0x30(%rsp), %rdi
callq 0x2040
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3160
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
leaq 0x30(%rsp), %rdi
callq 0x2050
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb $0x1, %r12b
jne 0x31d0
addl $-0x2, %esi
cmpl %r12d, %esi
jne 0x31d0
movq 0x4e5f(%rip), %rdi      # 0x7ff0
leaq 0x21b0(%rip), %rsi      # 0x5348
movl $0x28, %edx
callq 0x2140
movq 0x10(%rsp), %rax
movl (%rax,%r12,4), %esi
movq 0x4e3e(%rip), %rdi      # 0x7ff0
callq 0x21c0
movq %rax, %rbx
leaq 0x20a7(%rip), %rsi      # 0x5268
movl $0x23, %edx
movq %rax, %rdi
callq 0x2140
jmp 0x3214
movq 0x4e19(%rip), %rdi      # 0x7ff0
leaq 0x216a(%rip), %rsi      # 0x5348
movl $0x28, %edx
callq 0x2140
movq 0x10(%rsp), %rax
movl (%rax,%r12,4), %esi
movq 0x4df8(%rip), %rdi      # 0x7ff0
callq 0x21c0
movq %rax, %rbx
leaq 0x2085(%rip), %rsi      # 0x528c
movl $0x38, %edx
movq %rax, %rdi
callq 0x2140
movq %rbx, %rdi
callq 0x2080
movl $0x4, %edi
callq 0x2090
movl $0x9, (%rax)
movq 0x4d7d(%rip), %rsi      # 0x7fb0
movq %rax, %rdi
xorl %edx, %edx
callq 0x21b0
movq 0x4dac(%rip), %rdi      # 0x7ff0
leaq 0x2099(%rip), %rsi      # 0x52e4
movl $0x35, %edx
callq 0x2140
movl $0x4, %ebx
movq 0x4d8f(%rip), %rdi      # 0x7ff0
callq 0x2080
jmp 0x3291
movq 0x4d81(%rip), %rdi      # 0x7ff0
leaq 0x20a4(%rip), %rsi      # 0x531a
movl $0x2d, %edx
callq 0x2140
movl $0x3, %ebx
movq 0x4d64(%rip), %rdi      # 0x7ff0
callq 0x2080
movl $0x4, %edi
callq 0x2090
movl %ebx, (%rax)
movq 0x4d0c(%rip), %rsi      # 0x7fb0
movq %rax, %rdi
xorl %edx, %edx
callq 0x21b0
leaq 0x20cc(%rip), %rax      # 0x5381
leaq 0x20b5(%rip), %rsi      # 0x5371
testb %cl, %cl
cmovneq %rax, %rsi
xorb $0x1, %cl
movzbl %cl, %eax
leaq (%rax,%rax,2), %rdx
addq $0xc, %rdx
movl $0xa, %ebx
movq 0x4d14(%rip), %rdi      # 0x7ff0
callq 0x2140
jmp 0x3291
jmp 0x32e7
jmp 0x32e7
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3301
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
leaq 0x30(%rsp), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x21d0
nop