// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x448, %rsp            # imm = 0x448
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x240(%rsp), %rdi
callq 0x2130
leaq 0x38(%rsp), %rdi
callq 0x2130
movq (%rbx), %rdi
callq 0x3b5c
movq %rax, %r14
movq (%rbx), %rdi
movl $0x12c, %esi            # imm = 0x12C
callq 0x3b30
leaq 0x240(%rsp), %rdi
movq %rax, %rsi
movl $0x8, %edx
callq 0x20c0
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r15
movaps %xmm0, (%r15)
movq $0x0, 0x10(%r15)
leaq 0x240(%rsp), %r12
leaq 0xc(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x20b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x40d8
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x40cb
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x4095
movq %r15, %rdi
movq %r13, %rdx
callq 0x3ca2
jmp 0x4095
movslq %ebp, %r15
movq 0x10(%rsp), %rax
movl (%rax,%r15,4), %eax
movl %eax, 0x50(%rbx)
leaq 0x240(%rsp), %rdi
callq 0x2040
movq (%r14), %rax
movq (%rax,%r15,8), %rsi
leaq 0x38(%rsp), %rdi
movl $0x8, %edx
callq 0x20c0
leaq 0x40(%rbx), %r12
leaq 0x38(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x10(%rbx), %rbp
leaq 0x8(%rbx), %rax
movq %rax, 0x28(%rsp)
xorl %r13d, %r13d
leaq 0x38(%rsp), %r14
leaq 0xc(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x20b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x419a
cmpl $0x19, %r13d
ja 0x4165
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x4181
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
movq %rbp, %rax
jmp 0x4178
movq 0x40(%rbx), %rsi
cmpq 0x48(%rbx), %rsi
je 0x4188
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
movq %r12, %rax
addq $0x4, %rsi
movq %rsi, (%rax)
jmp 0x4195
movq 0x28(%rsp), %rdi
jmp 0x418d
movq 0x30(%rsp), %rdi
movq %r15, %rdx
callq 0x3ca2
incl %r13d
jmp 0x4131
leaq 0x38(%rsp), %rdi
callq 0x2040
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x41bb
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
leaq 0x38(%rsp), %rdi
callq 0x2050
leaq 0x240(%rsp), %rdi
callq 0x2050
addq $0x448, %rsp            # imm = 0x448
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x41eb
movq %rax, %rbx
jmp 0x4218
movq %rax, %rbx
jmp 0x420e
jmp 0x41f4
jmp 0x41f4
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x420e
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
leaq 0x38(%rsp), %rdi
callq 0x2050
leaq 0x240(%rsp), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x21d0
nop