// File: Manca[P]algorithms2/./assignment3.hpp
// Function: assignment3::knapsack_big::run_algorithm(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void run_algorithm(const std::string& fileName)
        {
            std::vector<int> values;
            std::vector<int> weights;
            int W;

            read_file(fileName, values, weights, W);

            PROFILE("Knapsack Recursive Memoization");
            int optimal_value = knapsack_rec_memoization((int)values.size(), values, weights, W);
            PROFILE_STOP();
            long long elapsedRM = tools::Profile::getInstance()->elapsed();

            assert(optimal_value == 4243395);

            PROFILE("Knapsack Original Smaller Array");
            optimal_value = knapsack_smallArray(values, weights, W);
            PROFILE_STOP();
            long long elapsedIter = tools::Profile::getInstance()->elapsed();

            assert(optimal_value == 4243395);

            std::cout << "Optimal value for big knapsack problem is: " << optimal_value << std::endl;
            if (elapsedIter < elapsedRM)
                std::cout << "Iterative algorithm outperforms recursive with memoization by: " << elapsedRM - elapsedIter << "ms" << std::endl;
            else
                std::cout << "Recursive algorithm with memoization outperforms iterative by: " << elapsedIter - elapsedRM << "ms" << std::endl;
        }

// Assembly:
subq $0x168, %rsp            # imm = 0x168
movq %rdi, 0x160(%rsp)
leaq 0x148(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0x10fd0
leaq 0x130(%rsp), %rdi
movq %rdi, 0xb0(%rsp)
callq 0x10fd0
movq 0xa8(%rsp), %rsi
movq 0xb0(%rsp), %rdx
movq 0x160(%rsp), %rdi
leaq 0x12c(%rsp), %rcx
callq 0x7270
jmp 0x8240
callq 0x10a60
movq %rax, 0xa0(%rsp)
jmp 0x824f
leaq 0xf7(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x3470
movq 0x98(%rsp), %rdx
leaq 0x283b3(%rip), %rsi     # 0x30626
leaq 0xf8(%rsp), %rdi
callq 0x3360
jmp 0x8282
movq 0xa0(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x10ad0
jmp 0x8299
leaq 0xf8(%rsp), %rdi
callq 0x31f0
leaq 0xf7(%rsp), %rdi
callq 0x3300
leaq 0x148(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x102a0
movq 0x88(%rsp), %rsi
movl %eax, %edi
movl 0x12c(%rsp), %ecx
leaq 0x130(%rsp), %rdx
callq 0x7b90
movl %eax, 0x94(%rsp)
jmp 0x82ef
movl 0x94(%rsp), %eax
movl %eax, 0xf0(%rsp)
callq 0x10a60
movq %rax, 0x80(%rsp)
jmp 0x830c
movq 0x80(%rsp), %rdi
callq 0x10b90
jmp 0x831b
callq 0x10a60
movq %rax, 0x78(%rsp)
jmp 0x8327
movq 0x78(%rsp), %rdi
callq 0x119a0
movq %rax, 0x70(%rsp)
jmp 0x8338
movq 0x70(%rsp), %rax
movq %rax, 0xe8(%rsp)
cmpl $0x40bfc3, 0xf0(%rsp) # imm = 0x40BFC3
jne 0x8357
jmp 0x83d8
leaq 0x282e7(%rip), %rdi     # 0x30645
leaq 0x281b4(%rip), %rsi     # 0x30519
movl $0xf8, %edx
leaq 0x282ed(%rip), %rcx     # 0x3065e
callq 0x3200
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0x8672
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0x83c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x31f0
leaq 0xf7(%rsp), %rdi
callq 0x3300
jmp 0x8672
callq 0x10a60
movq %rax, 0x68(%rsp)
jmp 0x83e4
leaq 0xc7(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x3470
movq 0x60(%rsp), %rdx
leaq 0x2829f(%rip), %rsi     # 0x306a1
leaq 0xc8(%rsp), %rdi
callq 0x3360
jmp 0x8411
movq 0x68(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x10ad0
jmp 0x8425
leaq 0xc8(%rsp), %rdi
callq 0x31f0
leaq 0xc7(%rsp), %rdi
callq 0x3300
movl 0x12c(%rsp), %edx
leaq 0x148(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x7db0
movl %eax, 0x5c(%rsp)
jmp 0x8461
movl 0x5c(%rsp), %eax
movl %eax, 0xf0(%rsp)
callq 0x10a60
movq %rax, 0x50(%rsp)
jmp 0x8478
movq 0x50(%rsp), %rdi
callq 0x10b90
jmp 0x8484
callq 0x10a60
movq %rax, 0x48(%rsp)
jmp 0x8490
movq 0x48(%rsp), %rdi
callq 0x119a0
movq %rax, 0x40(%rsp)
jmp 0x84a1
movq 0x40(%rsp), %rax
movq %rax, 0xb8(%rsp)
cmpl $0x40bfc3, 0xf0(%rsp) # imm = 0x40BFC3
jne 0x84bd
jmp 0x8525
leaq 0x28181(%rip), %rdi     # 0x30645
leaq 0x2804e(%rip), %rsi     # 0x30519
movl $0xff, %edx
leaq 0x28187(%rip), %rcx     # 0x3065e
callq 0x3200
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0x8513
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x31f0
leaq 0xc7(%rsp), %rdi
callq 0x3300
jmp 0x8672
movq 0x3baac(%rip), %rdi     # 0x43fd8
leaq 0x2818e(%rip), %rsi     # 0x306c1
callq 0x32c0
movq %rax, 0x38(%rsp)
jmp 0x853f
movq 0x38(%rsp), %rdi
movl 0xf0(%rsp), %esi
callq 0x3440
movq %rax, 0x30(%rsp)
jmp 0x8557
movq 0x30(%rsp), %rdi
movq 0x3ba65(%rip), %rsi     # 0x43fc8
callq 0x32f0
jmp 0x856a
movq 0xb8(%rsp), %rax
cmpq 0xe8(%rsp), %rax
jge 0x85e7
movq 0x3ba55(%rip), %rdi     # 0x43fd8
leaq 0x28163(%rip), %rsi     # 0x306ed
callq 0x32c0
movq %rax, 0x28(%rsp)
jmp 0x8596
movq 0x28(%rsp), %rdi
movq 0xe8(%rsp), %rsi
movq 0xb8(%rsp), %rax
subq %rax, %rsi
callq 0x3180
movq %rax, 0x20(%rsp)
jmp 0x85ba
movq 0x20(%rsp), %rdi
leaq 0x28167(%rip), %rsi     # 0x3072d
callq 0x32c0
movq %rax, 0x18(%rsp)
jmp 0x85d2
movq 0x18(%rsp), %rdi
movq 0x3b9ea(%rip), %rsi     # 0x43fc8
callq 0x32f0
jmp 0x85e5
jmp 0x8650
movq 0x3b9ea(%rip), %rdi     # 0x43fd8
leaq 0x2813b(%rip), %rsi     # 0x30730
callq 0x32c0
movq %rax, 0x10(%rsp)
jmp 0x8601
movq 0x10(%rsp), %rdi
movq 0xb8(%rsp), %rsi
movq 0xe8(%rsp), %rax
subq %rax, %rsi
callq 0x3180
movq %rax, 0x8(%rsp)
jmp 0x8625
movq 0x8(%rsp), %rdi
leaq 0x280fc(%rip), %rsi     # 0x3072d
callq 0x32c0
movq %rax, (%rsp)
jmp 0x863c
movq (%rsp), %rdi
movq 0x3b981(%rip), %rsi     # 0x43fc8
callq 0x32f0
jmp 0x864e
jmp 0x8650
leaq 0x130(%rsp), %rdi
callq 0x107c0
leaq 0x148(%rsp), %rdi
callq 0x107c0
addq $0x168, %rsp            # imm = 0x168
retq
leaq 0x130(%rsp), %rdi
callq 0x107c0
leaq 0x148(%rsp), %rdi
callq 0x107c0
movq 0x120(%rsp), %rdi
callq 0x3460
nopl (%rax)