// File: shuimu[P]logistic-regression/lr.cpp
// Function: command_line_parse(int, char**)
int command_line_parse(int argc, char * argv[]) {
    int i = 0;
    while (i < argc) {
        char * arg = argv[i];
        if (strcmp(arg,"-n") == 0) { MAX_ITERS = atoi(argv[++i]); }
        else if (strcmp(arg, "-t") == 0) { train_file = argv[++i]; }
        else if (strcmp(arg, "-p") == 0) { predict_file = argv[++i]; }
        else if (strcmp(arg, "-o") == 0) { output_file= argv[++i]; }
        else if (strcmp(arg, "-a") == 0) { ALPHA = atof(argv[++i]); }
        else if (strcmp(arg, "-k") == 0) { ALGO  = atoi(argv[++i]); } 
        i++;
    }
    if (predict_file == NULL || train_file == NULL || output_file == NULL) {
        fprintf(stderr, "ERROR: command line not well formatted!");
        return -1;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x162b
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x3b3b(%rip), %rsi      # 0x5018
callq 0x1100
cmpl $0x0, %eax
jne 0x150b
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1140
movl %eax, 0x7bea(%rip)      # 0x90f0
jmp 0x161d
movq -0x20(%rbp), %rdi
leaq 0x3b05(%rip), %rsi      # 0x501b
callq 0x1100
cmpl $0x0, %eax
jne 0x1540
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x7bd5(%rip)      # 0x9110
jmp 0x161b
movq -0x20(%rbp), %rdi
leaq 0x3ad3(%rip), %rsi      # 0x501e
callq 0x1100
cmpl $0x0, %eax
jne 0x1575
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x7ba8(%rip)      # 0x9118
jmp 0x1619
movq -0x20(%rbp), %rdi
leaq 0x3aa1(%rip), %rsi      # 0x5021
callq 0x1100
cmpl $0x0, %eax
jne 0x15a7
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x7b7b(%rip)      # 0x9120
jmp 0x1617
movq -0x20(%rbp), %rdi
leaq 0x3a72(%rip), %rsi      # 0x5024
callq 0x1100
cmpl $0x0, %eax
jne 0x15df
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x10e0
movsd %xmm0, 0x7b03(%rip)     # 0x90e0
jmp 0x1615
movq -0x20(%rbp), %rdi
leaq 0x3a3d(%rip), %rsi      # 0x5027
callq 0x1100
cmpl $0x0, %eax
jne 0x1613
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1140
movl %eax, 0x7ae1(%rip)      # 0x90f4
jmp 0x1615
jmp 0x1617
jmp 0x1619
jmp 0x161b
jmp 0x161d
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x14b6
cmpq $0x0, 0x7ae5(%rip)      # 0x9118
je 0x1649
cmpq $0x0, 0x7ad3(%rip)      # 0x9110
je 0x1649
cmpq $0x0, 0x7ad9(%rip)      # 0x9120
jne 0x166a
movq 0x7988(%rip), %rax      # 0x8fd8
movq (%rax), %rdi
leaq 0x39d0(%rip), %rsi      # 0x502a
movb $0x0, %al
callq 0x1110
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1671
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)