// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/parser.c
// Function: save_weights_upto
void save_weights_upto(network *net, char *filename, int cutoff)
{
    fprintf(stderr, "Saving weights to %s\n", filename);
    FILE *fp = fopen(filename, "wb");
    if(!fp) file_error(filename);

    int major = 0;
    int minor = 2;
    int revision = 0;
    fwrite(&major, sizeof(int), 1, fp);
    fwrite(&minor, sizeof(int), 1, fp);
    fwrite(&revision, sizeof(int), 1, fp);
    fwrite(net->seen, sizeof(size_t), 1, fp);

    int i;
    for(i = 0; i < net->n && i < cutoff; ++i){
        layer l = net->layers[i];
        if (l.dontsave) continue;
        if(l.type == CONVOLUTIONAL || l.type == DECONVOLUTIONAL){
            save_convolutional_weights(l, fp);
        } if(l.type == CONNECTED){
            save_connected_weights(l, fp);
        } if(l.type == BATCHNORM){
            save_batchnorm_weights(l, fp);
        } if(l.type == RNN){
            save_connected_weights(*(l.input_layer), fp);
            save_connected_weights(*(l.self_layer), fp);
            save_connected_weights(*(l.output_layer), fp);
        } if (l.type == LSTM) {
            save_connected_weights(*(l.wi), fp);
            save_connected_weights(*(l.wf), fp);
            save_connected_weights(*(l.wo), fp);
            save_connected_weights(*(l.wg), fp);
            save_connected_weights(*(l.ui), fp);
            save_connected_weights(*(l.uf), fp);
            save_connected_weights(*(l.uo), fp);
            save_connected_weights(*(l.ug), fp);
        } if (l.type == GRU) {
            if(1){
                save_connected_weights(*(l.wz), fp);
                save_connected_weights(*(l.wr), fp);
                save_connected_weights(*(l.wh), fp);
                save_connected_weights(*(l.uz), fp);
                save_connected_weights(*(l.ur), fp);
                save_connected_weights(*(l.uh), fp);
            }else{
                save_connected_weights(*(l.reset_layer), fp);
                save_connected_weights(*(l.update_layer), fp);
                save_connected_weights(*(l.state_layer), fp);
            }
        }  if(l.type == CRNN){
            save_convolutional_weights(*(l.input_layer), fp);
            save_convolutional_weights(*(l.self_layer), fp);
            save_convolutional_weights(*(l.output_layer), fp);
        } if(l.type == LOCAL){
            int locations = l.out_w*l.out_h;
            int size = l.size*l.size*l.c*l.n*locations;
            fwrite(l.biases, sizeof(float), l.outputs, fp);
            fwrite(l.weights, sizeof(float), size, fp);
        }
    }
    fclose(fp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa40, %rsp            # imm = 0xA40
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq 0x41c1b(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
leaq 0x33b82(%rip), %rsi     # 0x74f6d
movb $0x0, %al
callq 0x3240
movq -0x10(%rbp), %rdi
leaq 0x31c7a(%rip), %rsi     # 0x73077
callq 0x3360
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x41416
movq -0x10(%rbp), %rdi
callq 0x4110
movl $0x0, -0x24(%rbp)
movl $0x2, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x20(%rbp), %rcx
leaq -0x24(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x3410
movq -0x20(%rbp), %rcx
leaq -0x28(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x3410
movq -0x20(%rbp), %rcx
leaq -0x2c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x3410
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x3410
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %ecx
movq -0x8(%rbp), %rdx
xorl %eax, %eax
cmpl (%rdx), %ecx
movb %al, -0x4d9(%rbp)
jge 0x414b4
movl -0x30(%rbp), %eax
cmpl -0x14(%rbp), %eax
setl %al
movb %al, -0x4d9(%rbp)
movb -0x4d9(%rbp), %al
testb $0x1, %al
jne 0x414c3
jmp 0x4196b
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movslq -0x30(%rbp), %rax
imulq $0x4a0, %rax, %rax      # imm = 0x4A0
addq %rax, %rsi
leaq -0x4d0(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
cmpl $0x0, -0x350(%rbp)
je 0x414f8
jmp 0x4195d
cmpl $0x0, -0x4d0(%rbp)
je 0x4150a
cmpl $0x1, -0x4d0(%rbp)
jne 0x41533
movq -0x20(%rbp), %rax
movq %rax, -0x4e8(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
leaq -0x4d0(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x4e8(%rbp), %rdi
callq 0x411b0
cmpl $0x2, -0x4d0(%rbp)
jne 0x41565
movq -0x20(%rbp), %rax
movq %rax, -0x4f0(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
leaq -0x4d0(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x4f0(%rbp), %rdi
callq 0x41300
cmpl $0x13, -0x4d0(%rbp)
jne 0x41597
movq -0x20(%rbp), %rax
movq %rax, -0x4f8(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
leaq -0x4d0(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x4f8(%rbp), %rdi
callq 0x41290
cmpl $0xf, -0x4d0(%rbp)
jne 0x4161b
movq -0x140(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x510(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x510(%rbp), %rdi
callq 0x41300
movq -0x138(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x508(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x508(%rbp), %rdi
callq 0x41300
movq -0x130(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x500(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x500(%rbp), %rdi
callq 0x41300
cmpl $0x11, -0x4d0(%rbp)
jne 0x41758
movq -0x58(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x550(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x550(%rbp), %rdi
callq 0x41300
movq -0x68(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x548(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x548(%rbp), %rdi
callq 0x41300
movq -0x78(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x540(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x540(%rbp), %rdi
callq 0x41300
movq -0x48(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x538(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x538(%rbp), %rdi
callq 0x41300
movq -0x60(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x530(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x530(%rbp), %rdi
callq 0x41300
movq -0x70(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x528(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x528(%rbp), %rdi
callq 0x41300
movq -0x80(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x520(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x520(%rbp), %rdi
callq 0x41300
movq -0x50(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x518(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x518(%rbp), %rdi
callq 0x41300
cmpl $0x10, -0x4d0(%rbp)
jne 0x4185b
movq -0xb0(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x580(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x580(%rbp), %rdi
callq 0x41300
movq -0xa0(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x578(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x578(%rbp), %rdi
callq 0x41300
movq -0x90(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x570(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x570(%rbp), %rdi
callq 0x41300
movq -0xa8(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x568(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x568(%rbp), %rdi
callq 0x41300
movq -0x98(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x560(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x560(%rbp), %rdi
callq 0x41300
movq -0x88(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x558(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x558(%rbp), %rdi
callq 0x41300
cmpl $0x12, -0x4d0(%rbp)
jne 0x418df
movq -0x140(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x598(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x598(%rbp), %rdi
callq 0x411b0
movq -0x138(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x590(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x590(%rbp), %rdi
callq 0x411b0
movq -0x130(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x588(%rbp)
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x588(%rbp), %rdi
callq 0x411b0
cmpl $0xc, -0x4d0(%rbp)
jne 0x4195b
movl -0x454(%rbp), %eax
imull -0x458(%rbp), %eax
movl %eax, -0x4d4(%rbp)
movl -0x440(%rbp), %eax
imull -0x440(%rbp), %eax
imull -0x45c(%rbp), %eax
imull -0x44c(%rbp), %eax
imull -0x4d4(%rbp), %eax
movl %eax, -0x4d8(%rbp)
movq -0x2a0(%rbp), %rdi
movslq -0x478(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl $0x4, %esi
callq 0x3410
movq -0x280(%rbp), %rdi
movslq -0x4d8(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl $0x4, %esi
callq 0x3410
jmp 0x4195d
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x41492
movq -0x20(%rbp), %rdi
callq 0x3100
addq $0xa40, %rsp            # imm = 0xA40
popq %rbp
retq
nopl (%rax)