// File: Marcos30004347[P]JSS-with-VNS/main.cpp
// Function: total_cost(std::vector<unsigned int, std::allocator<unsigned int>>)
unsigned total_cost(solution s) {
  vector<unsigned> positions(costs.size(), 0);
  vector<unsigned> job_time(costs.size(), 0);
  vector<unsigned> machine_time(costs[0].size(), 0);

  for(unsigned j : s) {
    unsigned o = positions[j];
    unsigned m = ops[j][o].machine;
    unsigned time = costs[j][m] + max(job_time[j], machine_time[m]);
    job_time[j] = time;
    machine_time[m] = time;
    positions[j]++;
  }

  unsigned total = 0;
  for(unsigned m : machine_time)
    total = max(total, m);

  return total;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0xe0(%rbp)
movq %rdi, -0x8(%rbp)
leaq 0xecab(%rip), %rdi      # 0x11118
callq 0x4120
movq %rax, -0xd8(%rbp)
movl $0x0, -0x24(%rbp)
leaq -0x25(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x4150
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rcx
leaq -0x20(%rbp), %rdi
leaq -0x24(%rbp), %rdx
callq 0x4170
jmp 0x24ad
leaq -0x25(%rbp), %rdi
callq 0x41f0
leaq 0xec5b(%rip), %rdi      # 0x11118
callq 0x4120
movq %rax, -0xf0(%rbp)
movl $0x0, -0x54(%rbp)
leaq -0x55(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x4150
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rcx
leaq -0x50(%rbp), %rdi
leaq -0x54(%rbp), %rdx
callq 0x4170
jmp 0x24fd
leaq -0x55(%rbp), %rdi
callq 0x41f0
leaq 0xec0b(%rip), %rdi      # 0x11118
xorl %eax, %eax
movl %eax, %esi
callq 0x4210
movq %rax, %rdi
callq 0x4230
movq %rax, -0x100(%rbp)
movl $0x0, -0x74(%rbp)
leaq -0x75(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x4150
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rcx
leaq -0x70(%rbp), %rdi
leaq -0x74(%rbp), %rdx
callq 0x4170
jmp 0x2559
leaq -0x75(%rbp), %rdi
callq 0x41f0
movq -0xe0(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
callq 0x4250
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
callq 0x4280
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x42b0
testb $0x1, %al
jne 0x25a9
jmp 0x275f
leaq -0x88(%rbp), %rdi
callq 0x42f0
movl (%rax), %eax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
movl %eax, %esi
leaq -0x20(%rbp), %rdi
callq 0x4310
movl (%rax), %eax
movl %eax, -0x98(%rbp)
movl -0x94(%rbp), %eax
movl %eax, %esi
leaq 0xeb4b(%rip), %rdi      # 0x11130
callq 0x4330
movq %rax, %rdi
movl -0x98(%rbp), %eax
movl %eax, %esi
callq 0x4350
movl (%rax), %eax
movl %eax, -0x9c(%rbp)
movl -0x94(%rbp), %eax
movl %eax, %esi
leaq 0xeb07(%rip), %rdi      # 0x11118
callq 0x4210
movq %rax, %rdi
movl -0x9c(%rbp), %eax
movl %eax, %esi
callq 0x4310
movl (%rax), %eax
movl %eax, -0x114(%rbp)
movl -0x94(%rbp), %eax
movl %eax, %esi
leaq -0x50(%rbp), %rdi
callq 0x4310
movq %rax, -0x110(%rbp)
movl -0x9c(%rbp), %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
callq 0x4310
movq -0x110(%rbp), %rdi
movq %rax, %rsi
callq 0x4370
movq %rax, -0x108(%rbp)
jmp 0x266f
movq -0x108(%rbp), %rcx
movl -0x114(%rbp), %eax
addl (%rcx), %eax
movl %eax, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
movl %eax, -0x11c(%rbp)
movl -0x94(%rbp), %eax
movl %eax, %esi
leaq -0x50(%rbp), %rdi
callq 0x4310
movl -0x11c(%rbp), %ecx
movl %ecx, (%rax)
movl -0xa0(%rbp), %eax
movl %eax, -0x118(%rbp)
movl -0x9c(%rbp), %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
callq 0x4310
movl -0x118(%rbp), %ecx
movl %ecx, (%rax)
movl -0x94(%rbp), %eax
movl %eax, %esi
leaq -0x20(%rbp), %rdi
callq 0x4310
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
leaq -0x88(%rbp), %rdi
callq 0x43b0
jmp 0x258d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x25(%rbp), %rdi
callq 0x41f0
jmp 0x2848
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x55(%rbp), %rdi
callq 0x41f0
jmp 0x283f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x75(%rbp), %rdi
callq 0x41f0
jmp 0x2836
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x43d0
jmp 0x2836
movl $0x0, -0xa4(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x4250
movq %rax, -0xb8(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x4280
movq %rax, -0xc0(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x42b0
testb $0x1, %al
jne 0x27b3
jmp 0x2800
leaq -0xb8(%rbp), %rdi
callq 0x42f0
movl (%rax), %eax
movl %eax, -0xc4(%rbp)
leaq -0xa4(%rbp), %rdi
leaq -0xc4(%rbp), %rsi
callq 0x4370
movq %rax, -0x128(%rbp)
jmp 0x27e3
movq -0x128(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xa4(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x43b0
jmp 0x279a
movl -0xa4(%rbp), %eax
movl %eax, -0x12c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x43d0
leaq -0x50(%rbp), %rdi
callq 0x43d0
leaq -0x20(%rbp), %rdi
callq 0x43d0
movl -0x12c(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
leaq -0x50(%rbp), %rdi
callq 0x43d0
leaq -0x20(%rbp), %rdi
callq 0x43d0
movq -0x30(%rbp), %rdi
callq 0x21c0
nopw %cs:(%rax,%rax)