// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/parser.c
// Function: save_convolutional_weights_binary
void save_convolutional_weights_binary(layer l, FILE *fp)
{
    binarize_weights(l.weights, l.n, l.c*l.size*l.size, l.binary_weights);
    int size = l.c*l.size*l.size;
    int i, j, k;
    fwrite(l.biases, sizeof(float), l.n, fp);
    if (l.batch_normalize){
        fwrite(l.scales, sizeof(float), l.n, fp);
        fwrite(l.rolling_mean, sizeof(float), l.n, fp);
        fwrite(l.rolling_variance, sizeof(float), l.n, fp);
    }
    for(i = 0; i < l.n; ++i){
        float mean = l.binary_weights[i*size];
        if(mean < 0) mean = -mean;
        fwrite(&mean, sizeof(float), 1, fp);
        for(j = 0; j < size/8; ++j){
            int index = i*size + j*8;
            unsigned char c = 0;
            for(k = 0; k < 8; ++k){
                if (j*8 + k >= size) break;
                if (l.binary_weights[index + k] > 0) c = (c | 1<<k);
            }
            fwrite(&c, sizeof(char), 1, fp);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq %rdi, -0x8(%rbp)
movq 0x250(%rax), %rdi
movl 0x84(%rax), %esi
movl 0x74(%rax), %edx
imull 0x90(%rax), %edx
imull 0x90(%rax), %edx
movq 0x228(%rax), %rcx
callq 0x71e0
movq -0x30(%rbp), %rax
movl 0x74(%rax), %ecx
imull 0x90(%rax), %ecx
imull 0x90(%rax), %ecx
movl %ecx, -0xc(%rbp)
movq 0x230(%rax), %rdi
movslq 0x84(%rax), %rdx
movq -0x8(%rbp), %rcx
movl $0x4, %esi
callq 0x3410
movq -0x30(%rbp), %rax
cmpl $0x0, 0x40(%rax)
je 0x4106c
movq -0x30(%rbp), %rax
movq 0x240(%rax), %rdi
movslq 0x84(%rax), %rdx
movq -0x8(%rbp), %rcx
movl $0x4, %esi
callq 0x3410
movq -0x30(%rbp), %rax
movq 0x2b0(%rax), %rdi
movslq 0x84(%rax), %rdx
movq -0x8(%rbp), %rcx
movl $0x4, %esi
callq 0x3410
movq -0x30(%rbp), %rax
movq 0x2b8(%rax), %rdi
movslq 0x84(%rax), %rdx
movq -0x8(%rbp), %rcx
movl $0x4, %esi
callq 0x3410
movl $0x0, -0x10(%rbp)
movq -0x30(%rbp), %rcx
movl -0x10(%rbp), %eax
cmpl 0x84(%rcx), %eax
jge 0x411aa
movq -0x30(%rbp), %rax
movq 0x228(%rax), %rax
movl -0x10(%rbp), %ecx
imull -0xc(%rbp), %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x1c(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x1c(%rbp), %xmm0
jbe 0x410c5
movss -0x1c(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0x1c(%rbp)
movq -0x8(%rbp), %rcx
leaq -0x1c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x3410
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0xc(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x34(%rbp), %eax
cmpl %ecx, %eax
jge 0x4119a
movl -0x10(%rbp), %eax
imull -0xc(%rbp), %eax
movl -0x14(%rbp), %ecx
shll $0x3, %ecx
addl %ecx, %eax
movl %eax, -0x20(%rbp)
movb $0x0, -0x21(%rbp)
movl $0x0, -0x18(%rbp)
cmpl $0x8, -0x18(%rbp)
jge 0x41177
movl -0x14(%rbp), %eax
shll $0x3, %eax
addl -0x18(%rbp), %eax
cmpl -0xc(%rbp), %eax
jl 0x41134
jmp 0x41177
movq -0x30(%rbp), %rax
movq 0x228(%rax), %rax
movl -0x20(%rbp), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x4116a
movzbl -0x21(%rbp), %eax
movl -0x18(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
orl %ecx, %eax
movb %al, -0x21(%rbp)
jmp 0x4116c
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x4111e
movq -0x8(%rbp), %rcx
leaq -0x21(%rbp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x3410
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x410e3
jmp 0x4119c
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x41073
addq $0x40, %rsp
popq %rbp
retq