// File: /workspace/github_cpp_makefile_star2_O1/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 0x3896
movq (%r14), %rdi
callq 0x245d
jmp 0x3c09
xorl %edi, %edi
callq 0x2100
movl %eax, %edi
callq 0x2110
movq 0x8(%r14), %rsi
leaq -0x2b8(%rbp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x21e0
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x10(%r14), %rdi
callq 0x2180
movl %eax, 0x387f(%rip)      # 0x7160
movl $0x4, %r15d
leaq -0xb0(%rbp), %r14
movq -0x2b8(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21f0
decl %r15d
jne 0x38ee
leaq 0x3838(%rip), %rsi      # 0x7158
leaq -0x2b8(%rbp), %rdi
callq 0x21c0
leaq 0x3829(%rip), %rsi      # 0x715c
movq %rax, %rdi
callq 0x21c0
cmpl $0x0, 0x3816(%rip)      # 0x7158
je 0x39f0
xorl %r14d, %r14d
leaq -0x5c(%rbp), %rbx
leaq -0x2b8(%rbp), %r12
leaq -0x60(%rbp), %r13
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
cmpl $0x0, 0x37ec(%rip)      # 0x715c
je 0x39bb
xorl %r15d, %r15d
movq %r12, %rdi
movq %r13, %rsi
callq 0x21c0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21c0
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x39a3
movq -0x60(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, -0x38(%rbp)
jmp 0x39af
leaq -0x40(%rbp), %rdi
movq %r13, %rdx
callq 0x478c
incl %r15d
cmpl 0x37a3(%rip), %r15d     # 0x715c
jb 0x3975
leaq 0x377e(%rip), %rdi      # 0x7140
leaq -0x40(%rbp), %rsi
callq 0x4022
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x39e0
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
incl %r14d
cmpl 0x376e(%rip), %r14d     # 0x7158
jb 0x395a
leaq 0x3749(%rip), %rsi      # 0x7140
leaq -0x60(%rbp), %rdi
callq 0x3697
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rbx
movaps %xmm0, (%rbx)
movups 0x3717(%rip), %xmm0     # 0x7128
movq 0x3720(%rip), %rax      # 0x7138
leaq -0x60(%rbp), %r14
movups (%r14), %xmm1
movups %xmm1, 0x3701(%rip)     # 0x7128
movq 0x10(%r14), %rcx
movq %rcx, 0x3706(%rip)      # 0x7138
movaps (%rbx), %xmm1
movaps %xmm0, (%rbx)
movq %rax, 0x10(%rbx)
movups %xmm1, (%r14)
xorl %r15d, %r15d
movq %r15, 0x10(%r14)
movq %rbx, %rdi
callq 0x3cc6
movq %r14, %rdi
callq 0x3cc6
movq %r15, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
cmpl $0x0, 0x36f0(%rip)      # 0x7158
je 0x3ab4
cmpl $0x0, 0x36eb(%rip)      # 0x715c
je 0x3aa8
xorl %r12d, %r12d
movl %r15d, -0x60(%rbp)
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x3a91
movl %r15d, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x38(%rbp)
jmp 0x3a9c
movq %rbx, %rdi
movq %r14, %rdx
callq 0x4abc
incl %r12d
cmpl 0x36b6(%rip), %r12d     # 0x715c
jb 0x3a76
incl %r15d
cmpl 0x36a6(%rip), %r15d     # 0x7158
jb 0x3a6a
leaq -0x60(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x26a5
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x60(%rbp), %rax
movq %rax, -0x40(%rbp)
movups -0x58(%rbp), %xmm0
movups %xmm0, -0x38(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
testq %rdi, %rdi
je 0x3af5
subq %rdi, %rsi
callq 0x2140
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3b0a
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
leaq -0x90(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3e06
leaq -0x60(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x33a8
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x3b42
movq -0x80(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
leaq -0x78(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x3e06
leaq -0x78(%rbp), %rdi
callq 0x24ed
movl %eax, %esi
movq 0x3477(%rip), %rdi      # 0x6fd8
callq 0x20c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x3ba5
movq -0x68(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
leaq -0x2b8(%rbp), %rdi
callq 0x2040
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3bc6
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x3bdb
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x3bfd
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x2b8(%rbp), %rdi
callq 0x2050
xorl %eax, %eax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x3c7a
movq -0x80(%rbp), %rsi
jmp 0x3c64
jmp 0x3c77
jmp 0x3c77
jmp 0x3c70
movq %rax, %rbx
jmp 0x3c57
jmp 0x3c70
movq %rax, %rbx
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x3c57
movq -0x68(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3c7a
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
jmp 0x3c7a
jmp 0x3c77
movq %rax, %rbx
jmp 0x3c8f
jmp 0x3c77
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x3c8f
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x3cb1
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x2b8(%rbp), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x21d0
nop