// File: /workspace/github_cpp_makefile_star2_O2/Marcos30004347[P]JSS-with-VNS/main.cpp
// Function: main
int main (int argc, char *argv[]) {

  if (argc < 3)
    return help(argv[0]);

  srand(time(nullptr));

  ifstream file(argv[1]);
  string line;
  
  it_max = atoi(argv[2]);
  
  for(unsigned i=0; i<4; i++)
    getline(file, line);

  file >> n >> m;
  for(unsigned i=0; i<n; i++) {
    vector<op> job;

    for(unsigned j=0; j<m; j++){
      op curr;
      file >> curr.machine >> curr.cost;
      job.push_back(curr);
    }

    ops.push_back(job);
  }

  costs = build_cost_matrix(ops);

  solution s;
  for (int j=0; j<n; j++)
    for (int i=0; i<m; i++)
      s.push_back(j);
  
  s = permutate(s);

  solution vns = general_vns(s);

  cout << total_cost(vns) << endl;

  file.close();
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rsi, %r14
cmpl $0x2, %edi
jg 0x2165
movq (%r14), %rdi
callq 0x13b2
jmp 0x2390
xorl %edi, %edi
callq 0x1100
movl %eax, %edi
callq 0x1110
movq 0x8(%r14), %rsi
leaq -0x2c0(%rbp), %rbx
pushq $0x8
popq %rdx
movq %rbx, %rdi
callq 0x11c0
leaq -0xa8(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x10(%r14), %rdi
callq 0x1170
movl %eax, 0x4f9d(%rip)      # 0x7148
pushq $0x4
popq %r15
leaq -0xb8(%rbp), %r14
subl $0x1, %r15d
jb 0x21c9
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1030
jmp 0x21b6
leaq 0x4f70(%rip), %rsi      # 0x7140
leaq -0x2c0(%rbp), %rdi
callq 0x11a0
leaq 0x4f61(%rip), %rsi      # 0x7144
movq %rax, %rdi
callq 0x11a0
xorl %eax, %eax
leaq -0x64(%rbp), %rbx
leaq -0x2c0(%rbp), %r14
leaq -0x68(%rbp), %r15
leaq -0x50(%rbp), %r12
movl %eax, -0x2c(%rbp)
cmpl 0x4f37(%rip), %eax      # 0x7140
jae 0x2267
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
andq $0x0, -0x40(%rbp)
xorl %r13d, %r13d
cmpl 0x4f23(%rip), %r13d     # 0x7144
jae 0x2249
movq %r14, %rdi
movq %r15, %rsi
callq 0x11a0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x11a0
movq %r12, %rdi
movq %r15, %rsi
callq 0x26b4
incl %r13d
jmp 0x221a
leaq 0x4ed8(%rip), %rdi      # 0x7128
movq %r12, %rsi
callq 0x26d8
movq %r12, %rdi
callq 0x30de
movl -0x2c(%rbp), %eax
incl %eax
jmp 0x2200
leaq 0x4eba(%rip), %rsi      # 0x7128
leaq -0x50(%rbp), %rdi
callq 0x1fef
leaq 0x4e92(%rip), %rdi      # 0x7110
leaq -0x50(%rbp), %rbx
movq %rbx, %rsi
callq 0x36ee
movq %rbx, %rdi
callq 0x2416
andq $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
xorl %r15d, %r15d
leaq -0x68(%rbp), %r14
cmpl 0x4e95(%rip), %r15d     # 0x7140
jae 0x22d2
xorl %r12d, %r12d
cmpl 0x4e8d(%rip), %r12d     # 0x7144
jae 0x22cd
movl %r15d, -0x68(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x375a
incl %r12d
jmp 0x22b0
incl %r15d
jmp 0x22a4
leaq -0x68(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x153a
leaq -0x50(%rbp), %rbx
leaq -0x68(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2a48
movq %r14, %rdi
callq 0x2722
leaq -0x98(%rbp), %rdi
movq %rbx, %rsi
callq 0x24f4
leaq -0x68(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x1eb6
leaq -0x98(%rbp), %rdi
callq 0x2722
leaq -0x80(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x24f4
leaq -0x80(%rbp), %rdi
callq 0x13e0
movl %eax, %esi
movq 0x4c94(%rip), %rdi      # 0x6fd8
callq 0x10d0
movq %rax, %rdi
callq 0x10b0
leaq -0x80(%rbp), %rdi
callq 0x2722
leaq -0x2c0(%rbp), %rdi
callq 0x1040
leaq -0x68(%rbp), %rdi
callq 0x2722
leaq -0x50(%rbp), %rdi
callq 0x2722
leaq -0xb8(%rbp), %rdi
callq 0x10a0
leaq -0x2c0(%rbp), %rdi
callq 0x1050
xorl %eax, %eax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
jmp 0x23cd
jmp 0x23db
jmp 0x23db
jmp 0x23d6
movq %rax, %rbx
jmp 0x23c9
jmp 0x23d6
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x2722
leaq -0x68(%rbp), %rdi
callq 0x2722
jmp 0x23de
jmp 0x23e9
movq %rax, %rbx
jmp 0x23f5
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x2722
jmp 0x23f5
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x30de
leaq -0xb8(%rbp), %rdi
callq 0x10a0
leaq -0x2c0(%rbp), %rdi
callq 0x1050
movq %rbx, %rdi
callq 0x11b0
nop