// File: /workspace/github_cpp_makefile_star2_O1/bowbowbow[P]CollaborativeFiltering/recommender.cpp
// Function: main
int main(int argc, const char * argv[]) {
    if(argc!=3) {
        cout << "Please follow this format. recommender.exe [base file name] [test file name]";
        return 0;
    }
    
    string baseFileName(argv[1]);
    string testFileName(argv[2]);
    
    InputReader baseInputReader(baseFileName);
    
    MAT userToItem = baseInputReader.getUserToItem();
    CF cf(userToItem);
    cf.run();
    
    InputReader testInputReader(testFileName);
    vector<inputTuple> test = testInputReader.getInput();
    
    OutputPrinter outputPrinter(testFileName.substr(0, 2)+".base_prediction.txt");
    
    double RSME = 0.0;
    
    for(int i=0;i<test.size();i++) {
        int user = test[i].user;
        int item = test[i].item;
        int rating = test[i].rating;
        
        double predict = cf.predict(user, item);
        
        RSME += (predict-rating)*(predict-rating);
        outputPrinter.addLine(user, item, predict);
    }
    
    RSME /= (double)test.size();
    RSME = sqrt(RSME);
    cout << "RSME :" << RSME << endl;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7f8, %rsp            # imm = 0x7F8
cmpl $0x3, %edi
jne 0x25b4
movq %rsi, %rbx
movq 0x8(%rsi), %rsi
leaq -0x120(%rbp), %rdi
leaq -0x3c8(%rbp), %rdx
callq 0x2080
movq 0x10(%rbx), %rsi
leaq -0x90(%rbp), %rdi
leaq -0x3c8(%rbp), %rdx
callq 0x2080
leaq -0xf0(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x120(%rbp), %rsi
movq -0x118(%rbp), %rdx
addq %rsi, %rdx
leaq -0x100(%rbp), %rdi
callq 0x3c34
leaq -0x3c8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x29a4
movq -0x100(%rbp), %rdi
cmpq %r14, %rdi
je 0x24b6
callq 0x2170
leaq -0x1c0(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
callq 0x2a5e
leaq -0xa8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x2a5e
leaq -0x190(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x2afa
leaq -0xa8(%rbp), %rdi
callq 0x2bf0
leaq -0x190(%rbp), %rdi
callq 0x38d8
leaq -0xd0(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %rdi
callq 0x3c34
leaq -0x820(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x29a4
movq -0xe0(%rbp), %rdi
cmpq %r14, %rdi
je 0x2553
callq 0x2170
leaq -0x600(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x3ba2
leaq -0x140(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl $0x2, %ecx
xorl %edx, %edx
callq 0x21b0
leaq 0x1b21(%rip), %rsi      # 0x40a5
leaq -0x140(%rbp), %rdi
callq 0x2290
leaq -0x60(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x25d1
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x25da
movq 0x3a1d(%rip), %rdi      # 0x5fd8
leaq 0x1a96(%rip), %rsi      # 0x4058
movl $0x4c, %edx
callq 0x21d0
jmp 0x2883
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq -0x70(%rbp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x5e8(%rbp), %rdi
callq 0x2c3a
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x260f
callq 0x2170
leaq -0x130(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2624
callq 0x2170
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
subq %rax, %rcx
je 0x26db
xorpd %xmm0, %xmm0
movl $0x8, %ebx
xorl %r14d, %r14d
movsd %xmm0, -0x30(%rbp)
movl -0x8(%rax,%rbx), %r12d
movl -0x4(%rax,%rbx), %r13d
movl (%rax,%rbx), %r15d
leaq -0x190(%rbp), %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x2cf2
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
leaq -0x5e8(%rbp), %rdi
movl %r12d, %esi
movl %r13d, %edx
movsd %xmm0, -0x50(%rbp)
callq 0x2d94
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movsd -0x50(%rbp), %xmm1
subsd %xmm0, %xmm1
mulsd %xmm1, %xmm1
movsd -0x30(%rbp), %xmm0
addsd %xmm1, %xmm0
incq %r14
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
addq $0xc, %rbx
cmpq %r14, %rcx
ja 0x264b
jmp 0x26e7
sarq $0x2, %rcx
imulq %rdx, %rcx
xorpd %xmm0, %xmm0
movq %rcx, %xmm2
punpckldq 0x191c(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x1924(%rip), %xmm2     # 0x4020
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
ucomisd 0x192c(%rip), %xmm0     # 0x4040
jb 0x271c
sqrtsd %xmm0, %xmm0
jmp 0x2721
callq 0x2120
movsd %xmm0, -0x30(%rbp)
leaq -0x1c0(%rbp), %rbx
movq 0x38a4(%rip), %rdi      # 0x5fd8
leaq 0x197f(%rip), %rsi      # 0x40ba
movl $0x6, %edx
callq 0x21d0
movq 0x388c(%rip), %rdi      # 0x5fd8
movsd -0x30(%rbp), %xmm0
callq 0x2220
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
leaq -0x3d8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2795
callq 0x2170
movq 0x3834(%rip), %rax      # 0x5fd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x5e0(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x5e8(%rbp,%rcx)
callq 0x2140
leaq -0x4f0(%rbp), %rdi
callq 0x2060
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x27d9
callq 0x2170
movq -0x600(%rbp), %rdi
testq %rdi, %rdi
je 0x27ea
callq 0x2170
leaq -0x618(%rbp), %rdi
callq 0x2bf0
leaq -0x820(%rbp), %rdi
callq 0x2040
movq -0x160(%rbp), %rdi
testq %rdi, %rdi
je 0x2813
callq 0x2170
leaq -0x178(%rbp), %rdi
callq 0x2bf0
leaq -0x190(%rbp), %rdi
callq 0x2bf0
leaq -0xc0(%rbp), %rdi
callq 0x2bf0
movq -0x1a8(%rbp), %rdi
testq %rdi, %rdi
je 0x2848
callq 0x2170
movq %rbx, %rdi
callq 0x2bf0
leaq -0x3c8(%rbp), %rdi
callq 0x2040
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x286e
callq 0x2170
leaq -0x110(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2883
callq 0x2170
xorl %eax, %eax
addq $0x7f8, %rsp            # imm = 0x7F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x28ad
callq 0x2170
jmp 0x28ad
movq %rax, %rbx
leaq -0x130(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2937
callq 0x2170
jmp 0x2937
movq %rax, %rbx
jmp 0x2937
movq %rax, %rbx
jmp 0x2945
movq %rax, %rbx
movq -0xe0(%rbp), %rdi
cmpq %r14, %rdi
je 0x2951
callq 0x2170
jmp 0x2951
jmp 0x28e6
movq %rax, %rbx
jmp 0x2951
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x2bf0
jmp 0x295d
movq %rax, %rbx
jmp 0x295d
movq %rax, %rbx
jmp 0x2969
movq %rax, %rbx
movq -0x100(%rbp), %rdi
cmpq %r14, %rdi
je 0x2975
callq 0x2170
jmp 0x2975
movq %rax, %rbx
jmp 0x2975
movq %rax, %rbx
jmp 0x2987
jmp 0x2928
movq %rax, %rbx
leaq -0x5e8(%rbp), %rdi
callq 0x2e22
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x2945
callq 0x2170
leaq -0x820(%rbp), %rdi
callq 0x2e7a
leaq -0x190(%rbp), %rdi
callq 0x2eae
leaq -0xc0(%rbp), %rdi
callq 0x2bf0
leaq -0x3c8(%rbp), %rdi
callq 0x2e7a
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2987
callq 0x2170
leaq -0x110(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x299c
callq 0x2170
movq %rbx, %rdi
callq 0x2270