// File: /workspace/github_cpp_makefile_star2_O2/CastellanZhang[P]lambdaFM/lambdafm_train.cpp
// Function: main
int main(int argc, char* argv[])
{
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);
    srand(time(NULL));
    trainer_option opt;
    try
    {
        opt.parse_option(argv_to_args(argc, argv));
    }
    catch(const invalid_argument& e)
    {
        cout << "invalid_argument:" << e.what() << endl;
        cout << train_help() << endl;
        return EXIT_FAILURE;
    }

    ftrl_trainer trainer(opt);

    if(opt.b_init) 
    {
        ifstream f_temp(opt.init_m_path.c_str());
        if(!trainer.loadModel(f_temp)) 
        {
            cout << "wrong model" << endl;
            return EXIT_FAILURE;
        }
        f_temp.close();
    }

    pc_frame frame;
    frame.init(trainer, opt.threads_num);
    frame.run();

    ofstream f_model(opt.model_path.c_str(), ofstream::out);
    trainer.outputModel(f_model);
    f_model.close();

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x450, %rsp            # imm = 0x450
movq %rsi, %rbx
movl %edi, %ebp
xorl %edi, %edi
callq 0x3100
xorl %edi, %edi
callq 0x3100
xorl %edi, %edi
callq 0x3270
movl %eax, %edi
callq 0x3290
movq %rsp, %rdi
callq 0x60b2
leaq 0x160(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x560d
movq %rsp, %rdi
leaq 0x160(%rsp), %rsi
callq 0x6176
leaq 0x160(%rsp), %rdi
callq 0x5cee
leaq 0xc8(%rsp), %rdi
movq %rsp, %rsi
callq 0x3be0
cmpb $0x1, 0x99(%rsp)
jne 0x578d
movq 0x20(%rsp), %rsi
leaq 0x160(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x3440
movq 0xd0(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x3ac8
movl %eax, %ebx
testb %al, %al
je 0x575a
xorl %ebp, %ebp
leaq 0x160(%rsp), %rdi
callq 0x3080
jmp 0x5778
movq 0xb857(%rip), %rdi      # 0x10fb8
leaq 0x5dd7(%rip), %rsi      # 0xb53f
callq 0x32a0
movq %rax, %rdi
callq 0x3130
pushq $0x1
popq %rbp
leaq 0x160(%rsp), %rdi
callq 0x3090
testb %bl, %bl
je 0x5820
leaq 0x368(%rsp), %rdi
callq 0x69ce
movl 0x90(%rsp), %edx
leaq 0x368(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
movl $0x1388, %ecx           # imm = 0x1388
movl $0x30d40, %r8d          # imm = 0x30D40
callq 0x8898
leaq 0x368(%rsp), %rdi
callq 0x8cfc
movq (%rsp), %rsi
leaq 0x160(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x32e0
movq 0xd0(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x3a20
leaq 0x160(%rsp), %rdi
callq 0x3330
leaq 0x160(%rsp), %rdi
callq 0x3370
leaq 0x368(%rsp), %rdi
callq 0x6a00
xorl %ebp, %ebp
leaq 0xc8(%rsp), %rdi
callq 0x6a1e
movq %rsp, %rdi
callq 0x6a46
movl %ebp, %eax
addq $0x450, %rsp            # imm = 0x450
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x584a
jmp 0x594e
movq %rax, %rbx
jmp 0x595e
movq %rax, %rbx
jmp 0x596b
movq %rdx, %r14
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x5cee
jmp 0x5875
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0x596b
movq %rbx, %rdi
callq 0x30f0
movq %rax, %rbx
movq 0xb727(%rip), %rdi      # 0x10fb8
leaq 0x5c95(%rip), %rsi      # 0xb52d
callq 0x32a0
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x32a0
movq %rax, %rdi
callq 0x3130
leaq 0x160(%rsp), %rdi
callq 0x55eb
movq 0xb6e8(%rip), %rdi      # 0x10fb8
leaq 0x160(%rsp), %rsi
callq 0x3240
movq %rax, %rdi
callq 0x3130
leaq 0x160(%rsp), %rdi
callq 0x3468
callq 0x33c0
pushq $0x1
popq %rbp
jmp 0x582d
jmp 0x5852
jmp 0x5918
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x3468
jmp 0x591b
movq %rax, %rbx
callq 0x33c0
jmp 0x596b
movq %rax, %rdi
callq 0x69c2
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x3090
jmp 0x595e
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x3370
jmp 0x5951
movq %rax, %rbx
leaq 0x368(%rsp), %rdi
callq 0x6a00
leaq 0xc8(%rsp), %rdi
callq 0x6a1e
movq %rsp, %rdi
callq 0x6a46
movq %rbx, %rdi
callq 0x3410
nop