// File: /workspace/github_cpp_makefile_star2_O2/bauerj4[P]Riemann1D/src/Context.cpp
// Function: readContext(char*, context_t&)
int readContext(char * PATH, context_t &context)
{
  ifstream file; 
  file.open(PATH,ifstream::in);
  vector<string> tokens;

  if (file.is_open())
    {
      int i=0;
      string line;
      while(getline(file,line))
        {
	  delimitString(tokens,line, " = ");
	  i++;
	}

      for (int j = 0; j < tokens.size(); j++)
	{
	  if(tokens[j] == "MESH_RESOLUTION")
            {
              context.MESH_RESOLUTION =  atoi(tokens[j + 2].c_str());
            }

	  if(tokens[j] == "RHO_L")
	    {
	      context.RHO_L = atof(tokens[j + 2].c_str());
	    }
         
	  if(tokens[j] == "RHO_R")
            {
              context.RHO_R = atof(tokens[j + 2].c_str());
            }

	  if (tokens[j] == "U_L")
	    {
	      context.U_L = atof(tokens[j + 2].c_str());
	    }

          if (tokens[j] == "U_R")
            {
              context.U_R = atof(tokens[j + 2].c_str());
            }


          if (tokens[j] == "P_L")
            {
              context.P_L = atof(tokens[j + 2].c_str());
            }

          if (tokens[j] == "P_R")
            {
              context.P_R = atof(tokens[j + 2].c_str());
            }


          if (tokens[j] == "CFL_NUMBER")
            {
              context.CFL_NUMBER = atof(tokens[j + 2].c_str());
            }

          if (tokens[j] == "EVOLVE_TIME")
            {
              context.EVOLVE_TIME = atof(tokens[j + 2].c_str());
            }

          if (tokens[j] == "X0")
            {
              context.X0 = atof(tokens[j + 2].c_str());
            }


          if (tokens[j] == "X1")
            {
              context.X1 = atof(tokens[j + 2].c_str());
            }

          if (tokens[j] == "INITIAL_DISCONTINUITY")
            {
              context.INITIAL_DISCONTINUITY = atof(tokens[j + 2].c_str());
            }



          if(tokens[j] == "SOLUTION_METHOD")
            {
              context.SOLUTION_METHOD = tokens[j + 2];
            }


          if(tokens[j] == "SNAPSHOT_PATH")
            {
              context.SNAPSHOT_PATH = tokens[j + 2];
            }

	  //cout << "Read token is " + tokens[j] << endl;
	}
    }
  file.close();

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xa0(%rsp), %r15
movq %r15, %rdi
callq 0x2200
pushq $0x8
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x2120
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x2070
testb %al, %al
je 0x28ed
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xa0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x2040
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x2925
leaq 0x60(%rbx), %rax
movq %rax, 0x38(%rsp)
leaq 0x80(%rbx), %rax
movq %rax, 0x30(%rsp)
pushq $0x40
popq %r14
xorl %r12d, %r12d
leaq 0x79ff(%rip), %r13      # 0xa063
leaq 0x7a08(%rip), %rbp      # 0xa073
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %r12, %rcx
jbe 0x28e3
leaq (%rax,%r14), %rdi
addq $-0x40, %rdi
leaq 0x7970(%rip), %rsi      # 0xa004
callq 0x2b6b
movq 0x10(%rsp), %r15
testb %al, %al
je 0x26ad
movq (%r15,%r14), %rdi
callq 0x22c0
movl %eax, (%rbx)
leaq (%r15,%r14), %rdi
addq $-0x40, %rdi
leaq 0x7958(%rip), %rsi      # 0xa014
callq 0x2b6b
movq 0x10(%rsp), %r15
testb %al, %al
je 0x26d8
movq (%r15,%r14), %rdi
callq 0x2240
movsd %xmm0, 0x18(%rbx)
leaq (%r15,%r14), %rdi
addq $-0x40, %rdi
leaq 0x7933(%rip), %rsi      # 0xa01a
callq 0x2b6b
movq 0x10(%rsp), %r15
testb %al, %al
je 0x2703
movq (%r15,%r14), %rdi
callq 0x2240
movsd %xmm0, 0x20(%rbx)
leaq (%r15,%r14), %rdi
addq $-0x40, %rdi
leaq 0x790e(%rip), %rsi      # 0xa020
callq 0x2b6b
movq 0x10(%rsp), %r15
testb %al, %al
je 0x272e
movq (%r15,%r14), %rdi
callq 0x2240
movsd %xmm0, 0x28(%rbx)
leaq (%r15,%r14), %rdi
addq $-0x40, %rdi
leaq 0x78e7(%rip), %rsi      # 0xa024
callq 0x2b6b
movq 0x10(%rsp), %r15
testb %al, %al
je 0x2759
movq (%r15,%r14), %rdi
callq 0x2240
movsd %xmm0, 0x30(%rbx)
leaq (%r15,%r14), %rdi
addq $-0x40, %rdi
leaq 0x78c0(%rip), %rsi      # 0xa028
callq 0x2b6b
movq 0x10(%rsp), %r15
testb %al, %al
je 0x2784
movq (%r15,%r14), %rdi
callq 0x2240
movsd %xmm0, 0x38(%rbx)
leaq (%r15,%r14), %rdi
addq $-0x40, %rdi
leaq 0x7899(%rip), %rsi      # 0xa02c
callq 0x2b6b
movq 0x10(%rsp), %r15
testb %al, %al
je 0x27af
movq (%r15,%r14), %rdi
callq 0x2240
movsd %xmm0, 0x40(%rbx)
leaq (%r15,%r14), %rdi
addq $-0x40, %rdi
leaq 0x7872(%rip), %rsi      # 0xa030
callq 0x2b6b
movq 0x10(%rsp), %r15
testb %al, %al
je 0x27da
movq (%r15,%r14), %rdi
callq 0x2240
movsd %xmm0, 0x50(%rbx)
leaq (%r15,%r14), %rdi
addq $-0x40, %rdi
leaq 0x7852(%rip), %rsi      # 0xa03b
callq 0x2b6b
movq 0x10(%rsp), %r15
testb %al, %al
je 0x2805
movq (%r15,%r14), %rdi
callq 0x2240
movsd %xmm0, 0x58(%rbx)
leaq (%r15,%r14), %rdi
addq $-0x40, %rdi
leaq 0x7833(%rip), %rsi      # 0xa047
callq 0x2b6b
movq 0x10(%rsp), %r15
testb %al, %al
je 0x2830
movq (%r15,%r14), %rdi
callq 0x2240
movsd %xmm0, 0x8(%rbx)
leaq (%r15,%r14), %rdi
addq $-0x40, %rdi
leaq 0x780b(%rip), %rsi      # 0xa04a
callq 0x2b6b
movq 0x10(%rsp), %r15
testb %al, %al
je 0x285b
movq (%r15,%r14), %rdi
callq 0x2240
movsd %xmm0, 0x10(%rbx)
leaq (%r15,%r14), %rdi
addq $-0x40, %rdi
leaq 0x77e3(%rip), %rsi      # 0xa04d
callq 0x2b6b
movq 0x10(%rsp), %r15
testb %al, %al
je 0x2886
movq (%r15,%r14), %rdi
callq 0x2240
movsd %xmm0, 0x48(%rbx)
leaq (%r15,%r14), %rdi
addq $-0x40, %rdi
movq %r13, %rsi
callq 0x2b6b
testb %al, %al
je 0x28ac
movq 0x10(%rsp), %rsi
addq %r14, %rsi
movq 0x38(%rsp), %rdi
callq 0x2100
movq 0x10(%rsp), %rax
leaq (%rax,%r14), %rdi
addq $-0x40, %rdi
movq %rbp, %rsi
callq 0x2b6b
testb %al, %al
je 0x28d7
movq 0x10(%rsp), %rsi
addq %r14, %rsi
movq 0x30(%rsp), %rdi
callq 0x2100
incq %r12
addq $0x20, %r14
jmp 0x266b
leaq 0x40(%rsp), %rdi
callq 0x20e0
leaq 0xa0(%rsp), %rdi
callq 0x2050
leaq 0x10(%rsp), %rdi
callq 0x2b78
leaq 0xa0(%rsp), %rdi
callq 0x2080
xorl %eax, %eax
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x2270
leaq 0x7844(%rip), %rsi      # 0xa17f
leaq 0x80(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2b30
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x250c
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x20e0
jmp 0x2971
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x20e0
jmp 0x298c
jmp 0x2989
movq %rax, %rbx
jmp 0x2996
movq %rax, %rbx
jmp 0x29a0
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x20e0
leaq 0x10(%rsp), %rdi
callq 0x2b78
leaq 0xa0(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2320