// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/data.c
// Function: split_data
data *split_data(data d, int part, int total)
{
    data *split = calloc(2, sizeof(data));
    int i;
    int start = part*d.X.rows/total;
    int end = (part+1)*d.X.rows/total;
    data train;
    data test;
    train.shallow = test.shallow = 1;

    test.X.rows = test.y.rows = end-start;
    train.X.rows = train.y.rows = d.X.rows - (end-start);
    train.X.cols = test.X.cols = d.X.cols;
    train.y.cols = test.y.cols = d.y.cols;

    train.X.vals = calloc(train.X.rows, sizeof(float*));
    test.X.vals = calloc(test.X.rows, sizeof(float*));
    train.y.vals = calloc(train.y.rows, sizeof(float*));
    test.y.vals = calloc(test.y.rows, sizeof(float*));

    for(i = 0; i < start; ++i){
        train.X.vals[i] = d.X.vals[i];
        train.y.vals[i] = d.y.vals[i];
    }
    for(i = start; i < end; ++i){
        test.X.vals[i-start] = d.X.vals[i];
        test.y.vals[i-start] = d.y.vals[i];
    }
    for(i = end; i < d.X.rows; ++i){
        train.X.vals[i-(end-start)] = d.X.vals[i];
        train.y.vals[i-(end-start)] = d.y.vals[i];
    }
    split[0] = train;
    split[1] = test;
    return split;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r14d
movl %edi, %r15d
pushq $0x2
popq %rdi
pushq $0x40
popq %rsi
callq 0x3250
movq %rax, %rbx
movslq 0x58(%rsp), %rbp
movl %ebp, %eax
imull %r15d, %eax
cltd
idivl %r14d
movl %eax, %ecx
movl %eax, (%rsp)
incl %r15d
imull %ebp, %r15d
movl %r15d, %eax
cltd
idivl %r14d
movl %eax, 0x4(%rsp)
movl %eax, %r15d
subl %ecx, %r15d
movl %ebp, %ecx
subl %r15d, %ecx
movl 0x5c(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x6c(%rsp), %eax
movl %eax, 0x10(%rsp)
movl %ecx, 0x8(%rsp)
movslq %ecx, %r12
pushq $0x8
popq %rsi
movq %r12, %rdi
callq 0x3250
movq %rax, %r14
movl %r15d, 0x14(%rsp)
movslq %r15d, %r13
movq %r13, %rdi
pushq $0x8
popq %rsi
callq 0x3250
movq %rax, %r15
movq %r12, %rdi
pushq $0x8
popq %rsi
callq 0x3250
movq %rax, %r12
movq %r13, %rdi
pushq $0x8
popq %rsi
callq 0x3250
movl (%rsp), %r9d
movq 0x60(%rsp), %rcx
movq 0x70(%rsp), %rdx
xorl %esi, %esi
testl %r9d, %r9d
movl $0x0, %edi
cmovgl %r9d, %edi
cmpq %rsi, %rdi
je 0x21e3d
movq (%rcx,%rsi,8), %r8
movq %r8, (%r14,%rsi,8)
movq (%rdx,%rsi,8), %r8
movq %r8, (%r12,%rsi,8)
incq %rsi
jmp 0x21e23
movslq %r9d, %rsi
movslq 0x4(%rsp), %rdi
leaq (%rcx,%rsi,8), %r8
leaq (%rdx,%rsi,8), %r9
xorl %r10d, %r10d
leaq (%rsi,%r10), %r11
cmpq %rdi, %r11
jge 0x21e84
movq (%r8,%r10,8), %r11
movq %r11, (%r15,%r10,8)
movq (%r9,%r10,8), %r11
movq %r11, (%rax,%r10,8)
incq %r10
jmp 0x21e50
movq (%rcx,%rdi,8), %r8
movq %r8, (%r14,%rsi,8)
movq (%rdx,%rdi,8), %r8
movq %r8, (%r12,%rsi,8)
incq %rdi
incq %rsi
cmpq %rbp, %rdi
jl 0x21e6e
movl 0x8(%rsp), %ecx
movl %ecx, 0x8(%rbx)
movl 0xc(%rsp), %edi
movl %edi, 0xc(%rbx)
movq %r14, 0x10(%rbx)
movl %ecx, 0x18(%rbx)
movl 0x10(%rsp), %esi
movl %esi, 0x1c(%rbx)
movq %r12, 0x20(%rbx)
pushq $0x1
popq %rcx
movl %ecx, 0x28(%rbx)
movl 0x14(%rsp), %edx
movl %edx, 0x48(%rbx)
movl %edi, 0x4c(%rbx)
movq %r15, 0x50(%rbx)
movl %edx, 0x58(%rbx)
movl %esi, 0x5c(%rbx)
movq %rax, 0x60(%rbx)
movl %ecx, 0x68(%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq