// File: /workspace/github_cpp_makefile_star2_O3/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 0x3874
movq (%r14), %rdi
callq 0x249d
jmp 0x3bf3
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, 0x38a1(%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 0x38cc
leaq 0x385a(%rip), %rsi      # 0x7158
leaq -0x2b8(%rbp), %rdi
callq 0x21c0
leaq 0x384b(%rip), %rsi      # 0x715c
movq %rax, %rdi
callq 0x21c0
cmpl $0x0, 0x3838(%rip)      # 0x7158
je 0x39ce
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, 0x380e(%rip)      # 0x715c
je 0x3999
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 0x3981
movq -0x60(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, -0x38(%rbp)
jmp 0x398d
leaq -0x40(%rbp), %rdi
movq %r13, %rdx
callq 0x475c
incl %r15d
cmpl 0x37c5(%rip), %r15d     # 0x715c
jb 0x3953
leaq 0x37a0(%rip), %rdi      # 0x7140
leaq -0x40(%rbp), %rsi
callq 0x4026
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x39be
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
incl %r14d
cmpl 0x3790(%rip), %r14d     # 0x7158
jb 0x3938
leaq 0x376b(%rip), %rsi      # 0x7140
leaq -0x60(%rbp), %rdi
callq 0x3674
movups 0x3743(%rip), %xmm0     # 0x7128
movq 0x374c(%rip), %rax      # 0x7138
leaq -0x60(%rbp), %rbx
movaps (%rbx), %xmm1
movups %xmm1, 0x372e(%rip)     # 0x7128
movq 0x10(%rbx), %rcx
movq %rcx, 0x3733(%rip)      # 0x7138
leaq -0x40(%rbp), %r14
movups %xmm0, (%r14)
movq %rax, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
xorl %r15d, %r15d
movq %r15, 0x10(%rbx)
movq %r14, %rdi
callq 0x3cb0
movq %rbx, %rdi
callq 0x3cb0
movq %r15, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movl 0x3719(%rip), %eax      # 0x7158
testl %eax, %eax
je 0x3a9e
movl 0x3713(%rip), %ecx      # 0x715c
leaq -0x40(%rbp), %rbx
leaq -0x60(%rbp), %r14
testl %ecx, %ecx
je 0x3a94
xorl %r12d, %r12d
movl %r15d, -0x60(%rbp)
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x3a73
movl %r15d, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x38(%rbp)
jmp 0x3a7e
movq %rbx, %rdi
movq %r14, %rdx
callq 0x4a7a
incl %r12d
movl 0x36d5(%rip), %ecx      # 0x715c
cmpl %ecx, %r12d
jb 0x3a58
movl 0x36c6(%rip), %eax      # 0x7158
jmp 0x3a96
xorl %ecx, %ecx
incl %r15d
cmpl %eax, %r15d
jb 0x3a51
leaq -0x60(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x26e5
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 0x3af4
subq %rdi, %rsi
callq 0x2140
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3af4
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
leaq -0x90(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3dfc
leaq -0x60(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x338c
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x3b2c
movq -0x80(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
leaq -0x78(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x3dfc
leaq -0x78(%rbp), %rdi
callq 0x252d
movl %eax, %esi
movq 0x348d(%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 0x3b8f
movq -0x68(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
leaq -0x2b8(%rbp), %rdi
callq 0x2040
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3bb0
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x3bc5
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x3be7
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 0x3c64
movq -0x80(%rbp), %rsi
jmp 0x3c4e
jmp 0x3c61
jmp 0x3c61
jmp 0x3c5a
movq %rax, %rbx
jmp 0x3c41
jmp 0x3c5a
movq %rax, %rbx
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x3c41
movq -0x68(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3c64
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
jmp 0x3c64
jmp 0x3c61
movq %rax, %rbx
jmp 0x3c79
jmp 0x3c61
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x3c79
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x3c9b
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x2b8(%rbp), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x21d0
nop