// File: /workspace/github_c_makefile_star2_O1/SimpleDoger[P]Darknet_CPU_Only/parser.c
// Function: load_weights_upto
void load_weights_upto(network *net, char *filename, int start, int cutoff)
{
    fprintf(stderr, "Loading weights from %s...", filename);
    fflush(stdout);
    FILE *fp = fopen(filename, "rb");
    if(!fp) file_error(filename);

    int major;
    int minor;
    int revision;
    fread(&major, sizeof(int), 1, fp);
    fread(&minor, sizeof(int), 1, fp);
    fread(&revision, sizeof(int), 1, fp);
    if ((major*10 + minor) >= 2 && major < 1000 && minor < 1000){
        fread(net->seen, sizeof(size_t), 1, fp);
    } else {
        int iseen = 0;
        fread(&iseen, sizeof(int), 1, fp);
        *net->seen = iseen;
    }
    int transpose = (major > 1000) || (minor > 1000);

    int i;
    for(i = start; i < net->n && i < cutoff; ++i){
        layer l = net->layers[i];
        if (l.dontload) continue;
        if(l.type == CONVOLUTIONAL || l.type == DECONVOLUTIONAL){
            load_convolutional_weights(l, fp);
        }
        if(l.type == CONNECTED){
            load_connected_weights(l, fp, transpose);
        }
        if(l.type == BATCHNORM){
            load_batchnorm_weights(l, fp);
        }
        if(l.type == CRNN){
            load_convolutional_weights(*(l.input_layer), fp);
            load_convolutional_weights(*(l.self_layer), fp);
            load_convolutional_weights(*(l.output_layer), fp);
        }
        if(l.type == RNN){
            load_connected_weights(*(l.input_layer), fp, transpose);
            load_connected_weights(*(l.self_layer), fp, transpose);
            load_connected_weights(*(l.output_layer), fp, transpose);
        }
        if (l.type == LSTM) {
            load_connected_weights(*(l.wi), fp, transpose);
            load_connected_weights(*(l.wf), fp, transpose);
            load_connected_weights(*(l.wo), fp, transpose);
            load_connected_weights(*(l.wg), fp, transpose);
            load_connected_weights(*(l.ui), fp, transpose);
            load_connected_weights(*(l.uf), fp, transpose);
            load_connected_weights(*(l.uo), fp, transpose);
            load_connected_weights(*(l.ug), fp, transpose);
        }
        if (l.type == GRU) {
            if(1){
                load_connected_weights(*(l.wz), fp, transpose);
                load_connected_weights(*(l.wr), fp, transpose);
                load_connected_weights(*(l.wh), fp, transpose);
                load_connected_weights(*(l.uz), fp, transpose);
                load_connected_weights(*(l.ur), fp, transpose);
                load_connected_weights(*(l.uh), fp, transpose);
            }else{
                load_connected_weights(*(l.reset_layer), fp, transpose);
                load_connected_weights(*(l.update_layer), fp, transpose);
                load_connected_weights(*(l.state_layer), fp, transpose);
            }
        }
        if(l.type == LOCAL){
            int locations = l.out_w*l.out_h;
            int size = l.size*l.size*l.c*l.n*locations;
            fread(l.biases, sizeof(float), l.outputs, fp);
            fread(l.weights, sizeof(float), size, fp);
        }
    }
    fprintf(stderr, "Done!\n");
    fclose(fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x968, %rsp            # imm = 0x968
movl %ecx, 0x4a8(%rsp)
movl %edx, 0x4b0(%rsp)
movq %rsi, %r13
movq %rdi, %rbx
movq 0x638f8(%rip), %rax     # 0x69ff8
movq (%rax), %rdi
leaq 0x50fbd(%rip), %rsi     # 0x576c7
movq %r13, %rdx
xorl %eax, %eax
callq 0x3280
movq 0x638b5(%rip), %rax     # 0x69fd0
movq (%rax), %rdi
callq 0x3320
leaq 0x4c986(%rip), %rsi     # 0x530b0
movq %r13, %rdi
callq 0x33a0
movq %rax, %r14
testq %rax, %rax
jne 0x6742
movq %r13, %rdi
callq 0xe142
leaq 0x4c4(%rsp), %r13
pushq $0x4
popq %rbp
pushq $0x1
popq %r15
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x30e0
leaq 0x4c0(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x30e0
leaq 0x4bc(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x30e0
movl (%r13), %r13d
movl (%r12), %ebp
cmpl $0x3e7, %ebp            # imm = 0x3E7
jg 0x67c9
cmpl $0x3e7, %r13d           # imm = 0x3E7
jg 0x67c9
imull $0xa, %r13d, %eax
addl %ebp, %eax
cmpl $0x2, %eax
jl 0x67c9
movq 0x8(%rbx), %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x30e0
jmp 0x67f0
leaq 0x4c8(%rsp), %r15
andl $0x0, (%r15)
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %r15, %rdi
movq %r14, %rcx
callq 0x30e0
movslq (%r15), %rax
movq 0x8(%rbx), %rcx
movq %rax, (%rcx)
movl $0x3e9, %ecx            # imm = 0x3E9
cmpl %ecx, %r13d
setge %al
cmpl %ecx, %ebp
setge %cl
movl 0x4a8(%rsp), %edx
movl 0x4b0(%rsp), %esi
cmpl %edx, %esi
jge 0x6c16
cmpl %esi, (%rbx)
jle 0x6c16
orb %cl, %al
movzbl %al, %eax
movl %eax, 0x4a4(%rsp)
movslq %esi, %r15
movslq %edx, %r12
imulq $0x4a0, %r15, %rbp      # imm = 0x4A0
incq %r15
movq %r12, 0x4a8(%rsp)
movq 0x20(%rbx), %r13
addq %rbp, %r13
movl $0x4a0, %edx            # imm = 0x4A0
leaq 0x4c8(%rsp), %rdi
movq %r13, %rsi
callq 0x32c0
cmpl $0x0, 0x644(%rsp)
jne 0x6bf7
cmpl $0x1, 0x4c8(%rsp)
ja 0x688c
movl $0x94, %ecx
movq %rsp, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
callq 0x34a8d
movl 0x4c8(%rsp), %eax
leal -0xc(%rax), %ecx
cmpl $0x7, %ecx
ja 0x6916
leaq 0x5067a(%rip), %rdx     # 0x56f1c
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movl 0x540(%rsp), %eax
movl 0x558(%rsp), %r12d
imull 0x544(%rsp), %eax
imull %r12d, %r12d
imull %eax, %r12d
imull 0x53c(%rsp), %r12d
imull 0x54c(%rsp), %r12d
movq 0x6f8(%rsp), %rdi
movslq 0x520(%rsp), %rdx
pushq $0x4
popq %r13
movq %r13, %rsi
movq %r14, %rcx
callq 0x30e0
movq 0x718(%rsp), %rdi
movslq %r12d, %rdx
movq 0x4a8(%rsp), %r12
movq %r13, %rsi
jmp 0x6a49
cmpl $0x2, %eax
jne 0x6bf7
movl $0x94, %ecx
movq %rsp, %rdi
leaq 0x4c8(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl 0x4a4(%rsp), %esi
jmp 0x6b9f
movq 0x8e8(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl 0x4a4(%rsp), %r12d
movl %r12d, %esi
callq 0x34772
movq 0x8f8(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl %r12d, %esi
callq 0x34772
movq 0x908(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl %r12d, %esi
callq 0x34772
movq 0x8f0(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl %r12d, %esi
callq 0x34772
movq 0x900(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl %r12d, %esi
callq 0x34772
movq 0x910(%rsp), %rsi
jmp 0x6b86
movslq 0x53c(%rsp), %r13
movq 0x708(%rsp), %rdi
movq 0x778(%rsp), %r12
movq 0x780(%rsp), %rax
movq %rax, 0x4b0(%rsp)
pushq $0x4
popq %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x30e0
movq %r12, %rdi
movq 0x4a8(%rsp), %r12
pushq $0x4
popq %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x30e0
movq 0x4b0(%rsp), %rdi
pushq $0x4
popq %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x30e0
jmp 0x6bf7
movq 0x940(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl 0x4a4(%rsp), %r12d
movl %r12d, %esi
callq 0x34772
movq 0x930(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl %r12d, %esi
callq 0x34772
movq 0x920(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl %r12d, %esi
callq 0x34772
movq 0x950(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl %r12d, %esi
callq 0x34772
movq 0x938(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl %r12d, %esi
callq 0x34772
movq 0x928(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl %r12d, %esi
callq 0x34772
movq 0x918(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl %r12d, %esi
callq 0x34772
movq 0x948(%rsp), %rsi
jmp 0x6b86
movq 0x858(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl 0x4a4(%rsp), %r12d
movl %r12d, %esi
callq 0x34772
movq 0x860(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl %r12d, %esi
callq 0x34772
movq 0x868(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movl %r12d, %esi
movq 0x4a8(%rsp), %r12
callq 0x34772
jmp 0x6bf7
movq 0x858(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
callq 0x34a8d
movq 0x860(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
callq 0x34a8d
movq 0x868(%rsp), %rsi
movl $0x94, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
callq 0x34a8d
cmpq %r12, %r15
jge 0x6c16
movslq (%rbx), %rax
addq $0x4a0, %rbp            # imm = 0x4A0
leaq 0x1(%r15), %rcx
cmpq %rax, %r15
movq %rcx, %r15
jl 0x6842
movq 0x633db(%rip), %rax     # 0x69ff8
movq (%rax), %rcx
leaq 0x50abb(%rip), %rdi     # 0x576e2
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
callq 0x3450
movq %r14, %rdi
addq $0x968, %rsp            # imm = 0x968
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3140