// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/region_layer.c
// Function: forward_region_layer
void forward_region_layer(const layer l, network net)
{
    int i,j,b,t,n;
    memcpy(l.output, net.input, l.outputs*l.batch*sizeof(float));

    for (b = 0; b < l.batch; ++b){
        for(n = 0; n < l.n; ++n){
            int index = entry_index(l, b, n*l.w*l.h, 0);
            activate_array(l.output + index, 2*l.w*l.h, LOGISTIC);
            index = entry_index(l, b, n*l.w*l.h, l.coords);
            if(!l.background) activate_array(l.output + index,   l.w*l.h, LOGISTIC);
            index = entry_index(l, b, n*l.w*l.h, l.coords + 1);
            if(!l.softmax && !l.softmax_tree) activate_array(l.output + index, l.classes*l.w*l.h, LOGISTIC);
        }
    }
    if (l.softmax_tree){
        int i;
        int count = l.coords + 1;
        for (i = 0; i < l.softmax_tree->groups; ++i) {
            int group_size = l.softmax_tree->group_size[i];
            softmax_cpu(net.input + count, group_size, l.batch, l.inputs, l.n*l.w*l.h, 1, l.n*l.w*l.h, l.temperature, l.output + count);
            count += group_size;
        }
    } else if (l.softmax){
        int index = entry_index(l, 0, 0, l.coords + !l.background);
        softmax_cpu(net.input + index, l.classes + l.background, l.batch*l.n, l.inputs/l.n, l.w*l.h, 1, l.w*l.h, 1, l.output + index);
    }

    memset(l.delta, 0, l.outputs * l.batch * sizeof(float));
    if(!net.train) return;
    float avg_iou = 0;
    float recall = 0;
    float avg_cat = 0;
    float avg_obj = 0;
    float avg_anyobj = 0;
    int count = 0;
    int class_count = 0;
    *(l.cost) = 0;
    for (b = 0; b < l.batch; ++b) {
        if(l.softmax_tree){
            int onlyclass = 0;
            for(t = 0; t < 30; ++t){
                box truth = float_to_box(net.truth + t*(l.coords + 1) + b*l.truths, 1);
                if(!truth.x) break;
                int class = net.truth[t*(l.coords + 1) + b*l.truths + l.coords];
                float maxp = 0;
                int maxi = 0;
                if(truth.x > 100000 && truth.y > 100000){
                    for(n = 0; n < l.n*l.w*l.h; ++n){
                        int class_index = entry_index(l, b, n, l.coords + 1);
                        int obj_index = entry_index(l, b, n, l.coords);
                        float scale =  l.output[obj_index];
                        l.delta[obj_index] = l.noobject_scale * (0 - l.output[obj_index]);
                        float p = scale*get_hierarchy_probability(l.output + class_index, l.softmax_tree, class, l.w*l.h);
                        if(p > maxp){
                            maxp = p;
                            maxi = n;
                        }
                    }
                    int class_index = entry_index(l, b, maxi, l.coords + 1);
                    int obj_index = entry_index(l, b, maxi, l.coords);
                    delta_region_class(l.output, l.delta, class_index, class, l.classes, l.softmax_tree, l.class_scale, l.w*l.h, &avg_cat, !l.softmax);
                    if(l.output[obj_index] < .3) l.delta[obj_index] = l.object_scale * (.3 - l.output[obj_index]);
                    else  l.delta[obj_index] = 0;
                    l.delta[obj_index] = 0;
                    ++class_count;
                    onlyclass = 1;
                    break;
                }
            }
            if(onlyclass) continue;
        }
        for (j = 0; j < l.h; ++j) {
            for (i = 0; i < l.w; ++i) {
                for (n = 0; n < l.n; ++n) {
                    int box_index = entry_index(l, b, n*l.w*l.h + j*l.w + i, 0);
                    box pred = get_region_box(l.output, l.biases, n, box_index, i, j, l.w, l.h, l.w*l.h);
                    float best_iou = 0;
                    for(t = 0; t < 30; ++t){
                        box truth = float_to_box(net.truth + t*(l.coords + 1) + b*l.truths, 1);
                        if(!truth.x) break;
                        float iou = box_iou(pred, truth);
                        if (iou > best_iou) {
                            best_iou = iou;
                        }
                    }
                    int obj_index = entry_index(l, b, n*l.w*l.h + j*l.w + i, l.coords);
                    avg_anyobj += l.output[obj_index];
                    l.delta[obj_index] = l.noobject_scale * (0 - l.output[obj_index]);
                    if(l.background) l.delta[obj_index] = l.noobject_scale * (1 - l.output[obj_index]);
                    if (best_iou > l.thresh) {
                        l.delta[obj_index] = 0;
                    }

                    if(*(net.seen) < 12800){
                        box truth = {0};
                        truth.x = (i + .5)/l.w;
                        truth.y = (j + .5)/l.h;
                        truth.w = l.biases[2*n]/l.w;
                        truth.h = l.biases[2*n+1]/l.h;
                        delta_region_box(truth, l.output, l.biases, n, box_index, i, j, l.w, l.h, l.delta, .01, l.w*l.h);
                    }
                }
            }
        }
        for(t = 0; t < 30; ++t){
            box truth = float_to_box(net.truth + t*(l.coords + 1) + b*l.truths, 1);

            if(!truth.x) break;
            float best_iou = 0;
            int best_n = 0;
            i = (truth.x * l.w);
            j = (truth.y * l.h);
            box truth_shift = truth;
            truth_shift.x = 0;
            truth_shift.y = 0;
            for(n = 0; n < l.n; ++n){
                int box_index = entry_index(l, b, n*l.w*l.h + j*l.w + i, 0);
                box pred = get_region_box(l.output, l.biases, n, box_index, i, j, l.w, l.h, l.w*l.h);
                if(l.bias_match){
                    pred.w = l.biases[2*n]/l.w;
                    pred.h = l.biases[2*n+1]/l.h;
                }
                pred.x = 0;
                pred.y = 0;
                float iou = box_iou(pred, truth_shift);
                if (iou > best_iou){
                    best_iou = iou;
                    best_n = n;
                }
            }

            int box_index = entry_index(l, b, best_n*l.w*l.h + j*l.w + i, 0);
            float iou = delta_region_box(truth, l.output, l.biases, best_n, box_index, i, j, l.w, l.h, l.delta, l.coord_scale *  (2 - truth.w*truth.h), l.w*l.h);
            if(l.coords > 4){
                int mask_index = entry_index(l, b, best_n*l.w*l.h + j*l.w + i, 4);
                delta_region_mask(net.truth + t*(l.coords + 1) + b*l.truths + 5, l.output, l.coords - 4, mask_index, l.delta, l.w*l.h, l.mask_scale);
            }
            if(iou > .5) recall += 1;
            avg_iou += iou;

            int obj_index = entry_index(l, b, best_n*l.w*l.h + j*l.w + i, l.coords);
            avg_obj += l.output[obj_index];
            l.delta[obj_index] = l.object_scale * (1 - l.output[obj_index]);
            if (l.rescore) {
                l.delta[obj_index] = l.object_scale * (iou - l.output[obj_index]);
            }
            if(l.background){
                l.delta[obj_index] = l.object_scale * (0 - l.output[obj_index]);
            }

            int class = net.truth[t*(l.coords + 1) + b*l.truths + l.coords];
            if (l.map) class = l.map[class];
            int class_index = entry_index(l, b, best_n*l.w*l.h + j*l.w + i, l.coords + 1);
            delta_region_class(l.output, l.delta, class_index, class, l.classes, l.softmax_tree, l.class_scale, l.w*l.h, &avg_cat, !l.softmax);
            ++count;
            ++class_count;
        }
    }
    *(l.cost) = pow(mag_array(l.delta, l.outputs * l.batch), 2);
    printf("Region Avg IOU: %f, Class: %f, Obj: %f, No Obj: %f, Avg Recall: %f,  count: %d\n", avg_iou/count, avg_cat/class_count, avg_obj/count, avg_anyobj/(l.w*l.h*l.n*l.batch), recall/count, count);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
leaq 0x100(%rsp), %r13
movq 0x268(%r13), %rdi
movq 0x678(%rsp), %rbx
movslq 0x58(%r13), %rax
movslq 0x48(%r13), %rdx
imulq %rax, %rdx
shlq $0x2, %rdx
movq %rbx, %rsi
callq 0x32b0
movl 0x48(%r13), %ecx
testl %ecx, %ecx
jle 0x3d008
movl 0x84(%r13), %eax
xorl %ebp, %ebp
testl %eax, %eax
jle 0x3cffe
xorl %r14d, %r14d
movl 0x6c(%r13), %esi
imull 0x70(%r13), %esi
movl 0xfc(%r13), %edi
movl %esi, %ecx
imull %r14d, %ecx
movl %ecx, %eax
cltd
idivl %esi
movl 0x58(%r13), %eax
imull %ebp, %eax
movl 0x100(%r13), %r8d
addl %r8d, %edi
incl %edi
subl %edx, %ecx
imull %edi, %ecx
addl %edx, %eax
addl %ecx, %eax
movslq %eax, %rdi
shlq $0x2, %rdi
addq 0x268(%r13), %rdi
addl %esi, %esi
xorl %edx, %edx
callq 0x28c99
cmpl $0x0, 0x104(%r13)
jne 0x3cf7c
movl 0x58(%r13), %ecx
movl 0x6c(%r13), %esi
imull 0x70(%r13), %esi
movl 0xfc(%r13), %edi
movl %esi, %eax
imull %r14d, %eax
cltd
idivl %esi
imull %ebp, %ecx
addl %ecx, %edx
movl 0x100(%r13), %ecx
addl %ecx, %edi
incl %edi
imull %eax, %edi
addl %ecx, %edi
imull %esi, %edi
addl %edx, %edi
movslq %edi, %rdi
shlq $0x2, %rdi
addq 0x268(%r13), %rdi
xorl %edx, %edx
callq 0x28c99
cmpl $0x0, 0xf8(%r13)
jne 0x3cfe7
cmpq $0x0, 0x490(%r13)
jne 0x3cfe7
movl 0x58(%r13), %edi
movl 0x6c(%r13), %esi
movl 0xfc(%r13), %ecx
imull 0x70(%r13), %esi
movl %esi, %eax
imull %r14d, %eax
cltd
idivl %esi
imull %ebp, %edi
addl %edi, %edx
movl 0x100(%r13), %edi
leal (%rdi,%rcx), %r8d
incl %r8d
imull %eax, %r8d
leal (%r8,%rdi), %eax
incl %eax
imull %esi, %eax
addl %edx, %eax
movslq %eax, %rdi
shlq $0x2, %rdi
addq 0x268(%r13), %rdi
imull %ecx, %esi
xorl %edx, %edx
callq 0x28c99
incl %r14d
movl 0x84(%r13), %eax
cmpl %eax, %r14d
jl 0x3ced8
movl 0x48(%r13), %ecx
incl %ebp
cmpl %ecx, %ebp
jl 0x3cecd
leaq 0x5a0(%rsp), %r14
movq 0x490(%r13), %rax
testq %rax, %rax
je 0x3d0a3
cmpl $0x0, 0x30(%rax)
jle 0x3d119
movl 0x100(%r13), %r15d
incl %r15d
xorl %r12d, %r12d
movq 0x38(%rax), %rax
movl (%rax,%r12,4), %ebp
movslq %r15d, %r15
leaq (%rbx,%r15,4), %rdi
leaq (,%r15,4), %rax
movl 0x48(%r13), %edx
movl 0x70(%r13), %r8d
imull 0x84(%r13), %r8d
imull 0x6c(%r13), %r8d
movl 0x54(%r13), %ecx
movss 0x18c(%r13), %xmm0
addq 0x268(%r13), %rax
movl %ebp, %esi
movl $0x1, %r9d
pushq %rax
pushq %r8
callq 0x2a38c
addq $0x10, %rsp
addl %ebp, %r15d
incq %r12
movq 0x490(%r13), %rax
movslq 0x30(%rax), %rcx
cmpq %rcx, %r12
jl 0x3d037
jmp 0x3d119
cmpl $0x0, 0xf8(%r13)
je 0x3d119
movl 0x100(%r13), %edx
movl 0x104(%r13), %esi
cmpl $0x1, %esi
adcl $0x0, %edx
movl 0x54(%r13), %eax
movl 0x6c(%r13), %r8d
imull 0x70(%r13), %r8d
imull %r8d, %edx
movslq %edx, %r10
leaq (%rbx,%r10,4), %rdi
shlq $0x2, %r10
addl 0xfc(%r13), %esi
movl 0x84(%r13), %r9d
imull %r9d, %ecx
cltd
idivl %r9d
addq 0x268(%r13), %r10
movss 0x17f06(%rip), %xmm0    # 0x55008
movl %ecx, %edx
movl %eax, %ecx
movl $0x1, %r9d
pushq %r10
pushq %r8
callq 0x2a38c
addq $0x10, %rsp
movq 0x260(%r13), %rdi
movslq 0x58(%r13), %rax
movslq 0x48(%r13), %rdx
imulq %rax, %rdx
shlq $0x2, %rdx
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x31c0
cmpl $0x0, 0xf8(%r14)
je 0x3dce9
movl %ebx, 0x34(%rsp)
movq 0x1d8(%r13), %rax
movl %ebx, (%rax)
movl 0x48(%r13), %esi
testl %esi, %esi
jle 0x3dc25
movq 0x8(%r14), %rax
movq %rax, 0xc0(%rsp)
movq 0xe0(%r14), %rbx
leaq 0x14(%rbx), %rax
movq %rax, 0xb8(%rsp)
xorl %r8d, %r8d
xorps %xmm3, %xmm3
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
xorps %xmm0, %xmm0
movss %xmm0, 0x14(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x28(%rsp)
movss %xmm3, 0x8(%rsp)
movss %xmm2, 0x10(%rsp)
cmpq $0x0, 0x490(%r13)
movslq %r8d, %rbp
movq %r8, 0x20(%rsp)
movaps %xmm1, 0x70(%rsp)
je 0x3d22a
xorl %r14d, %r14d
movslq 0x100(%r13), %rax
incq %rax
movslq %r14d, %rcx
imulq %rax, %rcx
leaq (%rbx,%rcx,4), %rax
movslq 0x68(%r13), %rcx
imulq %rbp, %rcx
leaq (%rax,%rcx,4), %rdi
movl $0x1, %esi
callq 0x38d7b
movq 0x20(%rsp), %r8
ucomiss 0x17e9d(%rip), %xmm0    # 0x550a0
jne 0x3d207
jnp 0x3d22a
movss 0x1cbc1(%rip), %xmm2    # 0x59dd0
ucomiss %xmm2, %xmm0
jbe 0x3d221
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
ucomiss %xmm2, %xmm0
ja 0x3da1a
incl %r14d
cmpl $0x1e, %r14d
jne 0x3d1cc
movl 0x6c(%r13), %ecx
testl %ecx, %ecx
jle 0x3d537
movl 0x70(%r13), %eax
movl $0x0, 0xc(%rsp)
movss 0x14(%rsp), %xmm1
testl %eax, %eax
jle 0x3d523
xorps %xmm0, %xmm0
cvtsi2sdl 0xc(%rsp), %xmm0
addsd 0x17ee7(%rip), %xmm0    # 0x55148
movapd %xmm0, 0xa0(%rsp)
movl 0x84(%r13), %ecx
movl $0x0, 0x40(%rsp)
testl %ecx, %ecx
jle 0x3d50d
xorps %xmm0, %xmm0
cvtsi2sdl 0x40(%rsp), %xmm0
addsd 0x17eb6(%rip), %xmm0    # 0x55148
movapd 0xa0(%rsp), %xmm2
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
movapd %xmm2, 0x90(%rsp)
xorl %r15d, %r15d
movss %xmm1, 0x14(%rsp)
movl 0x6c(%r13), %r11d
movl 0x70(%r13), %r10d
movl %r11d, %ecx
imull %r15d, %ecx
movl 0xc(%rsp), %r9d
addl %r9d, %ecx
imull %r10d, %ecx
movq %r8, %rsi
movl 0x40(%rsp), %r8d
addl %r8d, %ecx
movl %r11d, %r14d
imull %r10d, %r14d
movl %ecx, %eax
cltd
idivl %r14d
movl 0x58(%r13), %r12d
imull %esi, %r12d
movl 0x100(%r13), %eax
movl 0xfc(%r13), %esi
addl %esi, %eax
incl %eax
subl %edx, %ecx
imull %eax, %ecx
addl %edx, %r12d
addl %ecx, %r12d
movq 0x268(%r13), %rdi
movq 0x230(%r13), %rsi
subq $0x8, %rsp
movl %r15d, %edx
movl %r12d, %ecx
pushq %r14
pushq %r11
pushq %r10
callq 0x3dd70
addq $0x20, %rsp
movapd %xmm0, 0x50(%rsp)
movaps %xmm1, 0x80(%rsp)
xorps %xmm1, %xmm1
xorl %r14d, %r14d
movss %xmm1, 0x18(%rsp)
movslq 0x100(%r13), %rax
incq %rax
movslq %r14d, %rcx
imulq %rax, %rcx
leaq (%rbx,%rcx,4), %rax
movslq 0x68(%r13), %rcx
imulq %rbp, %rcx
leaq (%rax,%rcx,4), %rdi
movl $0x1, %esi
callq 0x38d7b
ucomiss 0x17d24(%rip), %xmm0    # 0x550a0
jne 0x3d380
jnp 0x3d3ad
movapd %xmm0, %xmm2
movaps %xmm1, %xmm3
movaps 0x50(%rsp), %xmm0
movaps 0x80(%rsp), %xmm1
callq 0x389b3
maxss 0x18(%rsp), %xmm0
incl %r14d
movaps %xmm0, %xmm1
cmpl $0x1e, %r14d
jne 0x3d344
jmp 0x3d3b3
movss 0x18(%rsp), %xmm0
movq 0x6c(%r13), %r14
movq %r14, %xmm1
pshufd $0x55, %xmm1, %xmm2     # xmm2 = xmm1[1,1,1,1]
movd %xmm2, %r11d
movl %r14d, %eax
imull %r15d, %eax
addl 0xc(%rsp), %eax
imull %r11d, %eax
addl 0x40(%rsp), %eax
movl 0x100(%r13), %ecx
movl %r14d, %r10d
imull %r11d, %r10d
cltd
idivl %r10d
movl 0x58(%r13), %esi
movq 0x20(%rsp), %r8
imull %r8d, %esi
movl 0xfc(%r13), %edi
addl %ecx, %edi
incl %edi
imull %eax, %edi
addl %ecx, %edi
imull %r10d, %edi
addl %edx, %esi
addl %edi, %esi
movq 0x268(%r13), %rdi
movslq %esi, %rcx
movss (%rdi,%rcx,4), %xmm3
pxor %xmm2, %xmm2
subss %xmm3, %xmm2
mulss 0x148(%r13), %xmm2
movq 0x260(%r13), %rax
movss %xmm2, (%rax,%rcx,4)
cmpl $0x0, 0x104(%r13)
je 0x3d461
movss 0x17bba(%rip), %xmm2    # 0x55008
subss (%rdi,%rcx,4), %xmm2
mulss 0x148(%r13), %xmm2
movss %xmm2, (%rax,%rcx,4)
ucomiss 0x164(%r13), %xmm0
jbe 0x3d472
movl $0x0, (%rax,%rcx,4)
movq 0xc0(%rsp), %rcx
cmpq $0x31ff, (%rcx)         # imm = 0x31FF
ja 0x3d4ec
cvtdq2pd %xmm1, %xmm0
movapd 0x90(%rsp), %xmm2
divpd %xmm0, %xmm2
cvtpd2ps %xmm2, %xmm0
shufps $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq 0x230(%r13), %rsi
cvtdq2ps %xmm1, %xmm2
shufps $0xe1, %xmm2, %xmm2     # xmm2 = xmm2[1,0,2,3]
movsd (%rsi,%r15,8), %xmm1
divps %xmm2, %xmm1
movl %r15d, %edx
movl %r12d, %ecx
movl 0x40(%rsp), %r8d
movl 0xc(%rsp), %r9d
movss 0x1b18d(%rip), %xmm2    # 0x58658
pushq %r10
pushq %rax
pushq %r14
pushq %r11
movss %xmm3, 0x38(%rsp)
callq 0x3de62
movss 0x38(%rsp), %xmm3
movq 0x40(%rsp), %r8
addq $0x20, %rsp
movss 0x14(%rsp), %xmm1
addss %xmm3, %xmm1
incq %r15
movslq 0x84(%r13), %rcx
cmpq %rcx, %r15
jl 0x3d2ab
movl 0x70(%r13), %eax
movl 0x40(%rsp), %edx
incl %edx
movl %edx, 0x40(%rsp)
cmpl %eax, %edx
jl 0x3d279
movl 0x6c(%r13), %ecx
movl 0xc(%rsp), %edx
incl %edx
movl %edx, 0xc(%rsp)
cmpl %ecx, %edx
jl 0x3d248
jmp 0x3d53d
movss 0x14(%rsp), %xmm1
movss %xmm1, 0x14(%rsp)
movq 0x28(%rsp), %rax
addl $0x1e, %eax
movl %eax, 0x6c(%rsp)
movq 0x38(%rsp), %rax
addl $0x1e, %eax
movl %eax, 0x68(%rsp)
xorl %r14d, %r14d
movslq 0x100(%r13), %rax
incq %rax
movslq %r14d, %rcx
imulq %rax, %rcx
leaq (%rbx,%rcx,4), %rax
movslq 0x68(%r13), %rcx
imulq %rbp, %rcx
leaq (%rax,%rcx,4), %rdi
movl $0x1, %esi
callq 0x38d7b
movaps %xmm1, 0x40(%rsp)
ucomiss 0x17b0b(%rip), %xmm0    # 0x550a0
jne 0x3d59d
jnp 0x3da04
movl %r14d, 0x90(%rsp)
movl 0x6c(%r13), %r11d
movl 0x70(%r13), %r10d
xorps %xmm1, %xmm1
cvtsi2ss %r10d, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
movl %eax, 0x80(%rsp)
movaps %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm2     # xmm2 = xmm2[1,1],xmm0[1,1]
xorps %xmm1, %xmm1
cvtsi2ss %r11d, %xmm1
mulss %xmm2, %xmm1
cvttss2si %xmm1, %eax
movl %eax, 0xc(%rsp)
cmpl $0x0, 0x84(%r13)
movq 0x20(%rsp), %rdi
jle 0x3d6fe
movaps %xmm0, 0xa0(%rsp)
xorps %xmm0, %xmm0
xorl %r12d, %r12d
xorl %r14d, %r14d
movss %xmm0, 0x50(%rsp)
movl %r14d, 0x18(%rsp)
movl 0x6c(%r13), %r14d
movl 0x70(%r13), %r10d
movl %r14d, %esi
imull %r12d, %esi
movl 0xc(%rsp), %r9d
addl %r9d, %esi
imull %r10d, %esi
movl 0x80(%rsp), %r8d
addl %r8d, %esi
movl %r14d, %r11d
imull %r10d, %r11d
movl %esi, %eax
cltd
idivl %r11d
movl 0x58(%r13), %ecx
imull %edi, %ecx
movl 0x100(%r13), %eax
movl 0xfc(%r13), %edi
addl %edi, %eax
incl %eax
subl %edx, %esi
imull %eax, %esi
addl %edx, %ecx
addl %esi, %ecx
movq 0x268(%r13), %rdi
movq 0x230(%r13), %rsi
subq $0x8, %rsp
movl %r12d, %edx
pushq %r11
pushq %r14
pushq %r10
callq 0x3dd70
addq $0x20, %rsp
cmpl $0x0, 0x154(%r13)
je 0x3d6ae
movq 0x230(%r13), %rax
movsd (%rax,%r12,8), %xmm1
movsd 0x6c(%r13), %xmm0
cvtdq2ps %xmm0, %xmm0
shufps $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
divps %xmm0, %xmm1
movl 0x18(%rsp), %r14d
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
movaps 0x40(%rsp), %xmm3
callq 0x389b3
movss 0x50(%rsp), %xmm1
ucomiss %xmm1, %xmm0
maxss %xmm1, %xmm0
cmoval %r12d, %r14d
incq %r12
movslq 0x84(%r13), %rax
cmpq %rax, %r12
movq 0x20(%rsp), %rdi
jl 0x3d603
movl 0x6c(%r13), %r11d
movl 0x70(%r13), %r10d
movaps 0xa0(%rsp), %xmm0
jmp 0x3d701
xorl %r14d, %r14d
movl %r11d, %esi
imull %r14d, %esi
movl 0xc(%rsp), %r15d
addl %r15d, %esi
imull %r10d, %esi
movl 0x80(%rsp), %eax
addl %eax, %esi
movl %eax, %r8d
movl %r11d, %r12d
imull %r10d, %r12d
movl %esi, %eax
cltd
idivl %r12d
movl 0x58(%r13), %ecx
imull %edi, %ecx
movl 0xfc(%r13), %eax
movl 0x100(%r13), %edi
addl %edi, %eax
incl %eax
subl %edx, %esi
imull %eax, %esi
addl %edx, %ecx
addl %esi, %ecx
movq 0x268(%r13), %rdi
movq 0x230(%r13), %rsi
movaps 0x40(%rsp), %xmm1
movaps %xmm1, %xmm3
shufps $0x55, %xmm1, %xmm3     # xmm3 = xmm3[1,1],xmm1[1,1]
mulss %xmm1, %xmm3
movss 0x17b17(%rip), %xmm2    # 0x5528c
subss %xmm3, %xmm2
mulss 0x140(%r13), %xmm2
movl %r14d, %edx
movl %r15d, %r9d
pushq %r12
pushq 0x260(%r13)
pushq %r11
pushq %r10
callq 0x3de62
addq $0x20, %rsp
movl 0x100(%r13), %r11d
movl 0x70(%r13), %eax
movl 0x58(%r13), %r12d
movl 0x6c(%r13), %r10d
movl 0xfc(%r13), %r8d
imull %r10d, %r14d
addl %r15d, %r14d
imull %eax, %r14d
addl 0x80(%rsp), %r14d
imull %eax, %r10d
movl %r14d, %eax
cltd
idivl %r10d
movl %edx, %ecx
imull 0x20(%rsp), %r12d
leal 0x1(%r11), %r9d
leal (%r8,%r11), %edx
incl %edx
imull %eax, %edx
movq 0x268(%r13), %rdi
movq 0x260(%r13), %rsi
cmpl $0x4, %r11d
jle 0x3d898
movq %r8, 0x18(%rsp)
leal 0x4(%rdx), %eax
imull %r10d, %eax
leal (%r12,%rcx), %r8d
movl %r8d, 0x50(%rsp)
movslq 0x68(%r13), %r8
leal -0x4(%r11), %r14d
movss 0x14c(%r13), %xmm1
cvttps2dq %xmm1, %xmm1
cvtdq2ps %xmm1, %xmm1
movslq %r10d, %r15
addl %ecx, %r12d
addl %eax, %r12d
movslq %r12d, %rcx
shlq $0x2, %rcx
shlq $0x2, %r15
imulq %rbp, %r8
movl 0x90(%rsp), %eax
imull %r9d, %eax
cltq
shlq $0x2, %rax
leaq (%rax,%r8,4), %r12
addq 0xb8(%rsp), %r12
xorl %eax, %eax
movss 0x8(%rsp), %xmm5
movss (%r12,%rax,4), %xmm2
subss (%rdi,%rcx), %xmm2
mulss %xmm1, %xmm2
movss %xmm2, (%rsi,%rcx)
incq %rax
addq %r15, %rcx
cmpq %rax, %r14
jne 0x3d86d
movq 0x18(%rsp), %r8
movl 0x50(%rsp), %r15d
jmp 0x3d8a4
addl %ecx, %r12d
movl %r12d, %r15d
movss 0x8(%rsp), %xmm5
leal (%rdx,%r11), %eax
imull %r10d, %eax
addl %r15d, %eax
movslq %eax, %rcx
movss (%rdi,%rcx,4), %xmm1
movss 0x17749(%rip), %xmm2    # 0x55008
subss %xmm1, %xmm2
mulss 0x144(%r13), %xmm2
movss %xmm2, (%rsi,%rcx,4)
cmpl $0x0, 0x108(%r13)
movl 0x90(%rsp), %r14d
je 0x3d8fd
movss (%rdi,%rcx,4), %xmm2
movaps %xmm0, %xmm3
subss %xmm2, %xmm3
mulss 0x144(%r13), %xmm3
movss %xmm3, (%rsi,%rcx,4)
cmpl $0x0, 0x104(%r13)
je 0x3d91d
xorps %xmm2, %xmm2
subss (%rdi,%rcx,4), %xmm2
mulss 0x144(%r13), %xmm2
movss %xmm2, (%rsi,%rcx,4)
movl %r9d, %eax
imull %r14d, %eax
movl 0x68(%r13), %ecx
imull 0x20(%rsp), %ecx
addl %r11d, %eax
addl %ecx, %eax
cltq
cvttss2si (%rbx,%rax,4), %ecx
movq 0x1b8(%r13), %rax
testq %rax, %rax
je 0x3d94b
movslq %ecx, %rcx
movl (%rax,%rcx,4), %ecx
movaps 0x70(%rsp), %xmm4
movaps %xmm4, %xmm2
addss 0x176ad(%rip), %xmm2    # 0x55008
movss 0x17901(%rip), %xmm3    # 0x55264
cmpltss %xmm0, %xmm3
andps %xmm3, %xmm2
andnps %xmm4, %xmm3
orps %xmm2, %xmm3
movaps %xmm3, 0x70(%rsp)
addss %xmm0, %xmm5
movss %xmm5, 0x8(%rsp)
movss 0x10(%rsp), %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x10(%rsp)
addl %r9d, %edx
imull %r10d, %edx
addl %r15d, %edx
movq 0x490(%r13), %r9
movss 0x150(%r13), %xmm0
xorl %eax, %eax
cmpl $0x0, 0xf8(%r13)
sete %al
subq $0x8, %rsp
pushq %rax
leaq 0x44(%rsp), %rax
pushq %rax
pushq %r10
callq 0x3e046
addq $0x20, %rsp
movq 0x38(%rsp), %rax
incl %eax
movq %rax, 0x38(%rsp)
movq 0x28(%rsp), %rax
incl %eax
movq %rax, 0x28(%rsp)
incl %r14d
cmpl $0x1e, %r14d
jne 0x3d55e
movl 0x6c(%rsp), %eax
movq %rax, 0x28(%rsp)
movl 0x68(%rsp), %eax
movq %rax, 0x38(%rsp)
movss 0x10(%rsp), %xmm2
movss 0x8(%rsp), %xmm3
movq 0x20(%rsp), %r8
jmp 0x3dbe9
movl 0x68(%r13), %eax
imull %r8d, %eax
movl 0x100(%r13), %esi
addl %esi, %eax
leal 0x1(%rsi), %r10d
imull %r10d, %r14d
addl %eax, %r14d
movslq %r14d, %rax
cvttss2si (%rbx,%rax,4), %ebp
movl 0x6c(%r13), %ecx
movl 0x70(%r13), %eax
movl %ecx, %r11d
imull %eax, %r11d
movl 0x84(%r13), %edx
imull %r11d, %edx
testl %edx, %edx
jle 0x3db3e
xorps %xmm0, %xmm0
xorl %r15d, %r15d
xorl %r14d, %r14d
movss %xmm0, 0x18(%rsp)
imull %eax, %ecx
movl 0x100(%r13), %esi
movl %r15d, %eax
cltd
idivl %ecx
leal 0x1(%rsi), %edi
movl 0x58(%r13), %r9d
imull %r8d, %r9d
addl 0xfc(%r13), %edi
imull %eax, %edi
leal (%rdi,%rsi), %eax
incl %eax
imull %ecx, %eax
addl %edx, %r9d
addl %r9d, %eax
addl %esi, %edi
imull %ecx, %edi
addl %r9d, %edi
movq 0x268(%r13), %rdx
movslq %edi, %rsi
movss (%rdx,%rsi,4), %xmm1
movss %xmm1, 0x50(%rsp)
xorps %xmm0, %xmm0
subss %xmm1, %xmm0
mulss 0x148(%r13), %xmm0
movq 0x260(%r13), %rdi
movss %xmm0, (%rdi,%rsi,4)
cltq
leaq (%rdx,%rax,4), %rdi
movq 0x490(%r13), %rsi
movl %ebp, %edx
callq 0x3eeac
movq 0x20(%rsp), %r8
mulss 0x50(%rsp), %xmm0
movss 0x18(%rsp), %xmm1
ucomiss %xmm1, %xmm0
cmoval %r15d, %r14d
maxss %xmm1, %xmm0
incl %r15d
movl 0x6c(%r13), %ecx
movl 0x70(%r13), %eax
movl %ecx, %r11d
imull %eax, %r11d
movl 0x84(%r13), %edx
imull %r11d, %edx
cmpl %edx, %r15d
jl 0x3da69
movl 0x100(%r13), %esi
leal 0x1(%rsi), %r10d
jmp 0x3db41
xorl %r14d, %r14d
movl %r14d, %eax
cltd
idivl %r11d
movl 0x58(%r13), %ecx
imull %r8d, %ecx
movl 0xfc(%r13), %r8d
leal (%r8,%r10), %r14d
imull %eax, %r14d
addl %r14d, %r10d
imull %r11d, %r10d
addl %edx, %ecx
addl %ecx, %r10d
addl %esi, %r14d
imull %r11d, %r14d
addl %ecx, %r14d
movq 0x268(%r13), %rdi
movq 0x260(%r13), %rsi
movq 0x490(%r13), %r9
movss 0x150(%r13), %xmm0
xorl %eax, %eax
cmpl $0x0, 0xf8(%r13)
sete %al
subq $0x8, %rsp
movl %r10d, %edx
movl %ebp, %ecx
pushq %rax
leaq 0x44(%rsp), %rax
pushq %rax
pushq %r11
callq 0x3e046
movq 0x40(%rsp), %r8
addq $0x20, %rsp
movslq %r14d, %rax
movq 0x260(%r13), %rcx
movl $0x0, (%rcx,%rax,4)
movq 0x28(%rsp), %rax
incl %eax
movq %rax, 0x28(%rsp)
movss 0x10(%rsp), %xmm2
movss 0x8(%rsp), %xmm3
incl %r8d
movl 0x48(%r13), %esi
cmpl %esi, %r8d
movaps 0x70(%rsp), %xmm1
jl 0x3d1a6
movss 0x34(%rsp), %xmm4
xorps %xmm0, %xmm0
cvtsi2ssl 0x28(%rsp), %xmm0
movq 0x38(%rsp), %rbx
movaps %xmm1, 0x70(%rsp)
movss %xmm2, 0x10(%rsp)
movss %xmm3, 0x8(%rsp)
jmp 0x3dc45
xorps %xmm4, %xmm4
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movss %xmm1, 0x14(%rsp)
movss %xmm1, 0x10(%rsp)
movaps %xmm1, 0x70(%rsp)
movss %xmm1, 0x8(%rsp)
divss %xmm0, %xmm4
movss %xmm4, 0x18(%rsp)
movq 0x260(%r13), %rdi
imull 0x58(%r13), %esi
callq 0xf92d
mulss %xmm0, %xmm0
movq 0x1d8(%r13), %rax
xorps %xmm4, %xmm4
cvtsi2ss %ebx, %xmm4
movss %xmm0, (%rax)
movss 0x8(%rsp), %xmm0
divss %xmm4, %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x18(%rsp), %xmm1
movss 0x10(%rsp), %xmm2
divss %xmm4, %xmm2
movl 0x6c(%r13), %eax
imull 0x70(%r13), %eax
imull 0x84(%r13), %eax
imull 0x48(%r13), %eax
cvtss2sd %xmm2, %xmm2
xorps %xmm3, %xmm3
cvtsi2ss %eax, %xmm3
movss 0x14(%rsp), %xmm5
divss %xmm3, %xmm5
xorps %xmm3, %xmm3
cvtss2sd %xmm5, %xmm3
movaps 0x70(%rsp), %xmm5
divss %xmm4, %xmm5
xorps %xmm4, %xmm4
cvtss2sd %xmm5, %xmm4
leaq 0x1c0ff(%rip), %rdi     # 0x59ddf
movl %ebx, %esi
movb $0x5, %al
callq 0x3160
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq