// File: /workspace/github_cpp_makefile_star2_O1/poseidon1214[P]logistic-regression-ftrl-mpi/src/load_data.h
// Function: Load_Data::load_data_batch(int, int)
void load_data_batch(int nproc, int rank){
        MPI_Status status;
        fea_matrix.clear();
        //std::cout<<"load batch data start..."<<std::endl;
        while(!fin_.eof()){
            std::getline(fin_, line);
            if(fin_.eof()) break;
            key_val.clear();
            const char *pline = line.c_str();
            if(sscanf(pline, "%d%n", &y, &nchar) >= 1){
                pline += nchar;
                label.push_back(y);
                while(sscanf(pline, "%ld:%d%n", &index, &value, &nchar) >= 2){
                //while(sscanf(pline, "%ld:%lf%n", &index, &value, &nchar) >= 2){
                    pline += nchar;
                    sf.idx = index;
                    if(index+1 > loc_fea_dim) loc_fea_dim = index+1;
                    sf.val = value;
                    key_val.push_back(sf);
                }
            }
            fea_matrix.push_back(key_val);
        }
        if(rank != 0) {
            MPI_Send(&loc_fea_dim, 1, MPI_LONG, 0, 90, MPI_COMM_WORLD);
        }
        else if(rank == 0){ 
            for(int i = 1; i < nproc; i++){
                MPI_Recv(&loc_fea_dim, 1, MPI_LONG, i, 90, MPI_COMM_WORLD, &status);
                if(loc_fea_dim > glo_fea_dim) glo_fea_dim = loc_fea_dim;
            }
        }
        MPI_Bcast(&glo_fea_dim, 1, MPI_LONG, 0, MPI_COMM_WORLD);//must be in all processes code;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, -0x30(%rbp)
movl %esi, -0x2c(%rbp)
movq %rdi, %rbx
addq $0x208, %rdi            # imm = 0x208
movq %rdi, -0x68(%rbp)
callq 0x320a
movq (%rbx), %rax
movq -0x18(%rax), %rdi
testb $0x2, 0x20(%rbx,%rdi)
jne 0x2ca6
leaq 0x260(%rbx), %r14
addq %rbx, %rdi
leaq 0x220(%rbx), %rax
movq %rax, -0x40(%rbp)
leaq 0x280(%rbx), %rax
movq %rax, -0x38(%rbp)
leaq 0x284(%rbx), %r12
leaq 0x248(%rbx), %rax
movq %rax, -0x58(%rbp)
leaq 0x290(%rbx), %rax
movq %rax, -0x50(%rbp)
leaq 0x288(%rbx), %r13
leaq 0x238(%rbx), %rax
movq %rax, -0x48(%rbp)
movq %r14, -0x60(%rbp)
movl $0xa, %esi
callq 0x21b0
movsbl %al, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2350
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%rbx,%rax)
jne 0x2ca6
movq 0x220(%rbx), %rax
cmpq %rax, 0x228(%rbx)
je 0x2b70
movq %rax, 0x228(%rbx)
movq (%r14), %r15
movq %r15, %rdi
leaq 0x2525(%rip), %rsi      # 0x50a2
movq -0x38(%rbp), %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x21c0
testl %eax, %eax
jle 0x2c7f
movslq 0x284(%rbx), %r14
movq 0x250(%rbx), %rsi
cmpq 0x258(%rbx), %rsi
je 0x2bbf
movl 0x280(%rbx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x250(%rbx)
jmp 0x2bcc
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rdx
callq 0x3288
addq %r14, %r15
movq %r15, %rdi
leaq 0x24c5(%rip), %rsi      # 0x509e
movq -0x50(%rbp), %rdx
movq %r13, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x21c0
cmpl $0x2, %eax
jl 0x2c7f
movslq 0x284(%rbx), %r14
movq 0x290(%rbx), %rax
movq %rax, 0x238(%rbx)
cmpq 0x298(%rbx), %rax
jl 0x2c1b
incq %rax
movq %rax, 0x298(%rbx)
movl 0x288(%rbx), %eax
movl %eax, 0x240(%rbx)
movq 0x228(%rbx), %rsi
cmpq 0x230(%rbx), %rsi
je 0x2c4b
movq -0x48(%rbp), %rax
movups (%rax), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x228(%rbx)
jmp 0x2c58
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rdx
callq 0x33c0
addq %r14, %r15
movq %r15, %rdi
leaq 0x2439(%rip), %rsi      # 0x509e
movq -0x50(%rbp), %rdx
movq %r13, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x21c0
cmpl $0x1, %eax
jg 0x2bf3
movq -0x68(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x324c
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
testb $0x2, 0x20(%rbx,%rax)
movq -0x60(%rbp), %r14
je 0x2b2f
cmpl $0x0, -0x30(%rbp)
je 0x2cd5
leaq 0x298(%rbx), %rdi
movq 0x430e(%rip), %rdx      # 0x6fc8
movq 0x42ef(%rip), %r9       # 0x6fb0
movl $0x1, %esi
xorl %ecx, %ecx
movl $0x5a, %r8d
callq 0x20b0
jmp 0x2d3a
cmpl $0x2, -0x2c(%rbp)
jl 0x2d3a
leaq 0x298(%rbx), %r14
movl $0x1, %r15d
movq 0x42d9(%rip), %r12      # 0x6fc8
movq 0x42ba(%rip), %r13      # 0x6fb0
leaq -0x80(%rbp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
movl $0x1, %esi
movq %r12, %rdx
movl %r15d, %ecx
movl $0x5a, %r8d
movq %r13, %r9
callq 0x2180
movq 0x298(%rbx), %rax
cmpq 0x2a0(%rbx), %rax
jle 0x2d31
movq %rax, 0x2a0(%rbx)
incl %r15d
cmpl %r15d, -0x2c(%rbp)
jne 0x2cf6
addq $0x2a0, %rbx            # imm = 0x2A0
movq 0x4280(%rip), %rdx      # 0x6fc8
movq 0x4261(%rip), %r8       # 0x6fb0
movq %rbx, %rdi
movl $0x1, %esi
xorl %ecx, %ecx
callq 0x2060
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop