// File: /workspace/github_cpp_makefile_star2_O3/mateuz[P]MTS-LS1/source/Benchmarks.cpp
// Function: Benchmarks::readOvectorVec()
double** Benchmarks::readOvectorVec()
{
  // read O vector from file in csv format, seperated by s_size groups
  double** d = (double**) malloc(s_size*sizeof(double*));
  stringstream ss;
  ss<< "cdatafiles/" << "F" << ID << "-xopt.txt";
  ifstream file (ss.str());
  string value;
  string line;
  int c = 0;                      // index over 1 to dim
  int i = -1;                      // index over 1 to s_size
  int up = 0;                   // current upper bound for one group
  
  if (file.is_open())
    {
      stringstream iss;
      while ( getline(file, line) )
        {
          if (c==up)             // out (start) of one group
            {
              // printf("=\n");
              i++;
              d[i] =  (double*) malloc(s[i]*sizeof(double));
              up += s[i];
            }
          iss<<line;
          while (getline(iss, value, ','))
            {
              // printf("c=%d\ts=%d\ti=%d\tup=%d\tindex=%d\n",c,s[i],i,up,c-(up-s[i]));
              d[i][c-(up-s[i])] = stod(value);
              // printf("1\n");
              c++;
            }
          iss.clear();
          // printf("2\n");
        }
      file.close();
    }
  else
    {
      cout<<"Cannot open datafiles"<<endl;
    }
  return d;  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x588, %rsp            # imm = 0x588
movq %rdi, -0x40(%rbp)
movslq 0x3c(%rdi), %rdi
shlq $0x3, %rdi
callq 0x3270
movq %rax, -0x38(%rbp)
leaq -0x3a8(%rbp), %rdi
callq 0x3160
leaq -0x398(%rbp), %rbx
leaq 0x7125(%rip), %rsi      # 0xb0d0
movl $0xb, %edx
movq %rbx, %rdi
callq 0x3230
leaq 0x711d(%rip), %rsi      # 0xb0dc
movl $0x1, %edx
movq %rbx, %rdi
callq 0x3230
movq -0x40(%rbp), %rax
movl 0x8(%rax), %esi
movq %rbx, %rdi
callq 0x3140
leaq 0x70fc(%rip), %rsi      # 0xb0de
movl $0x9, %edx
movq %rax, %rdi
callq 0x3230
leaq -0x390(%rbp), %rsi
leaq -0x220(%rbp), %rdi
callq 0x32b0
leaq -0x5b0(%rbp), %rbx
leaq -0x220(%rbp), %rsi
movq %rbx, %rdi
movl $0x8, %edx
callq 0x32c0
leaq -0x210(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4032
callq 0x31f0
leaq -0x88(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x60(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x538(%rbp), %rdi
callq 0x3090
testb %al, %al
je 0x41d9
leaq -0x220(%rbp), %rdi
callq 0x3160
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
xorl %r15d, %r15d
movl $0x0, -0x2c(%rbp)
movq -0x5b0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %edx
movq %rbx, %rdi
leaq -0x70(%rbp), %rsi
callq 0x3340
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4221
cmpl -0x2c(%rbp), %r15d
jne 0x40f4
movq -0x40(%rbp), %rax
movq 0xf0(%rax), %rax
movslq %r12d, %rbx
incl %r12d
movslq 0x4(%rax,%rbx,4), %r14
movq %r14, %rdi
shlq $0x3, %rdi
callq 0x3270
movq -0x38(%rbp), %rcx
movq %rax, 0x8(%rcx,%rbx,8)
leal (%r14,%r15), %eax
movl %eax, -0x2c(%rbp)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
leaq -0x210(%rbp), %rdi
callq 0x3230
movl %r12d, -0x44(%rbp)
movslq %r12d, %r13
movl -0x2c(%rbp), %eax
negl %eax
movq %rax, -0x50(%rbp)
leaq -0x220(%rbp), %rdi
leaq -0x98(%rbp), %rsi
movl $0x2c, %edx
callq 0x3340
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x41ad
movq -0x98(%rbp), %r12
callq 0x3050
movq %rax, %rbx
movl (%rax), %r14d
movl $0x0, (%rax)
movq %r12, %rdi
leaq -0x78(%rbp), %rsi
callq 0x3190
cmpq %r12, -0x78(%rbp)
je 0x42b7
movl (%rbx), %eax
testl %eax, %eax
je 0x417c
cmpl $0x22, %eax
jne 0x417f
jmp 0x42c3
movl %r14d, (%rbx)
movq -0x40(%rbp), %rax
movq 0xf0(%rax), %rax
movq -0x50(%rbp), %rcx
addl %r15d, %ecx
addl (%rax,%r13,4), %ecx
movq -0x38(%rbp), %rax
movq (%rax,%r13,8), %rax
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
incl %r15d
jmp 0x4118
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rdi
leaq -0x220(%rbp), %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x32f0
leaq -0x5b0(%rbp), %rbx
movl -0x44(%rbp), %r12d
jmp 0x4083
movq 0xadf0(%rip), %rbx      # 0xefd0
leaq 0x6f01(%rip), %rsi      # 0xb0e8
movl $0x15, %edx
movq %rbx, %rdi
callq 0x3230
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq 0xadbe(%rip), %rdi      # 0xefd0
callq 0x3040
movq %rax, %rdi
callq 0x3150
jmp 0x424c
leaq -0x5b0(%rbp), %rdi
callq 0x3070
movq 0xad84(%rip), %rsi      # 0xefb8
leaq -0x220(%rbp), %rdi
callq 0x3180
leaq -0x1a0(%rbp), %rdi
callq 0x30c0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x425e
callq 0x31f0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x4276
callq 0x31f0
leaq -0x5b0(%rbp), %rdi
callq 0x30a0
movq 0xad2f(%rip), %rsi      # 0xefb8
leaq -0x3a8(%rbp), %rdi
callq 0x3180
leaq -0x328(%rbp), %rdi
callq 0x30c0
movq -0x38(%rbp), %rax
addq $0x588, %rsp            # imm = 0x588
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6e7d(%rip), %rdi      # 0xb13b
callq 0x3130
leaq 0x6e71(%rip), %rdi      # 0xb13b
callq 0x3280
jmp 0x42fb
jmp 0x42ef
movq %rax, %r15
leaq -0x210(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4360
callq 0x31f0
jmp 0x4360
jmp 0x42f4
movq %rax, %r15
jmp 0x432a
movq %rax, %r15
jmp 0x4360
jmp 0x42fb
movq %rax, %r15
jmp 0x430b
movq %rax, %r15
cmpl $0x0, (%rbx)
jne 0x430b
movl %r14d, (%rbx)
movq 0xaca6(%rip), %rsi      # 0xefb8
leaq -0x220(%rbp), %rdi
callq 0x3180
leaq -0x1a0(%rbp), %rdi
callq 0x30c0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x433c
callq 0x31f0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x4354
callq 0x31f0
leaq -0x5b0(%rbp), %rdi
callq 0x30a0
movq 0xac51(%rip), %rsi      # 0xefb8
leaq -0x3a8(%rbp), %rdi
callq 0x3180
leaq -0x328(%rbp), %rdi
callq 0x30c0
movq %r15, %rdi
callq 0x3320
nop