// File: yuroitaki[P]enigma_machine/rotor.cpp
// Function: Rotor::store_encrypt(int)
void Rotor::store_encrypt(int rotor_id){
  ifstream input_1,input_2;
  vector<const char*>* buffer_files;
  buffer_files = (config_rot->get_rotor_files());
  int buffer;
  int count = 0;
  
  input_1.open(config_rot->get_file(RP));      //function to read rotor position file
  vector<int> buffer_num;
  while(input_1>>buffer){
    buffer_num.push_back(buffer);
  }
  ground_position = buffer_num[rotor_id];
  input_1.close();

  input_2.open((*buffer_files)[rotor_id]);     //function to read rotor mapping file
  
  while(input_2>>buffer){
    count++;
    if(count < 27){
      forward_encryption.push_back(buffer);
    }else                                       //storing the notch positions
      notch.push_back(buffer);                         
  }
  input_2.close();  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x460(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x2150
leaq -0x420(%rbp), %rdi
callq 0x2150
jmp 0x6c27
movq -0x460(%rbp), %rax
movq (%rax), %rdi
callq 0x57c0
movq %rax, -0x468(%rbp)
jmp 0x6c3f
movq -0x460(%rbp), %rax
movq -0x468(%rbp), %rcx
movq %rcx, -0x438(%rbp)
movl $0x0, -0x440(%rbp)
movq (%rax), %rdi
movl $0x12c, %esi            # imm = 0x12C
callq 0x5740
movq %rax, -0x470(%rbp)
jmp 0x6c74
movq -0x470(%rbp), %rsi
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x20e0
jmp 0x6c8e
leaq -0x458(%rbp), %rdi
callq 0x58b0
leaq -0x218(%rbp), %rdi
leaq -0x43c(%rbp), %rsi
callq 0x20d0
movq %rax, -0x478(%rbp)
jmp 0x6cb6
movq -0x478(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2170
movb %al, -0x479(%rbp)
jmp 0x6cd4
movb -0x479(%rbp), %al
testb $0x1, %al
jne 0x6ce0
jmp 0x6d48
leaq -0x458(%rbp), %rdi
leaq -0x43c(%rbp), %rsi
callq 0x58d0
jmp 0x6cf5
jmp 0x6c9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
jmp 0x6e7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
jmp 0x6e71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
leaq -0x458(%rbp), %rdi
callq 0x30b0
jmp 0x6e71
movslq -0xc(%rbp), %rsi
leaq -0x458(%rbp), %rdi
callq 0x5960
movq %rax, %rcx
movq -0x460(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, 0x50(%rax)
leaq -0x218(%rbp), %rdi
callq 0x2050
jmp 0x6d75
movq -0x438(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0x5890
movq (%rax), %rsi
leaq -0x420(%rbp), %rdi
movl $0x8, %edx
callq 0x20e0
jmp 0x6d9b
jmp 0x6d9d
leaq -0x420(%rbp), %rdi
leaq -0x43c(%rbp), %rsi
callq 0x20d0
movq %rax, -0x488(%rbp)
jmp 0x6db9
movq -0x488(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2170
movb %al, -0x489(%rbp)
jmp 0x6dd7
movb -0x489(%rbp), %al
testb $0x1, %al
jne 0x6de3
jmp 0x6e36
movl -0x440(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x440(%rbp)
cmpl $0x1b, -0x440(%rbp)
jge 0x6e16
movq -0x460(%rbp), %rdi
addq $0x8, %rdi
leaq -0x43c(%rbp), %rsi
callq 0x58d0
jmp 0x6e14
jmp 0x6e31
movq -0x460(%rbp), %rdi
addq $0x38, %rdi
leaq -0x43c(%rbp), %rsi
callq 0x58d0
jmp 0x6e2f
jmp 0x6e31
jmp 0x6d9d
leaq -0x420(%rbp), %rdi
callq 0x2050
jmp 0x6e44
leaq -0x458(%rbp), %rdi
callq 0x30b0
leaq -0x420(%rbp), %rdi
callq 0x2060
leaq -0x218(%rbp), %rdi
callq 0x2060
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
leaq -0x420(%rbp), %rdi
callq 0x2060
leaq -0x218(%rbp), %rdi
callq 0x2060
movq -0x428(%rbp), %rdi
callq 0x21f0
nopw %cs:(%rax,%rax)