// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/network.c
// Function: resize_network
int resize_network(network *net, int w, int h)
{
    int i;
    //if(w == net->w && h == net->h) return 0;
    net->w = w;
    net->h = h;
    int inputs = 0;
    size_t workspace_size = 0;
    //fprintf(stderr, "Resizing to %d x %d...\n", w, h);
    //fflush(stderr);
    for (i = 0; i < net->n; ++i){
        layer l = net->layers[i];
        if(l.type == CONVOLUTIONAL){
            resize_convolutional_layer(&l, w, h);
        }else if(l.type == CROP){
            resize_crop_layer(&l, w, h);
        }else if(l.type == MAXPOOL){
            resize_maxpool_layer(&l, w, h);
        }else if(l.type == REGION){
            resize_region_layer(&l, w, h);
        }else if(l.type == YOLO){
            resize_yolo_layer(&l, w, h);
        }else if(l.type == ROUTE){
            resize_route_layer(&l, net);
        }else if(l.type == SHORTCUT){
            resize_shortcut_layer(&l, w, h);
        }else if(l.type == UPSAMPLE){
            resize_upsample_layer(&l, w, h);
        }else if(l.type == REORG){
            resize_reorg_layer(&l, w, h);
        }else if(l.type == AVGPOOL){
            resize_avgpool_layer(&l, w, h);
        }else if(l.type == NORMALIZATION){
            resize_normalization_layer(&l, w, h);
        }else if(l.type == COST){
            resize_cost_layer(&l, inputs);
        }else{
            error("Cannot resize this type of layer");
        }
        if(l.workspace_size > workspace_size) workspace_size = l.workspace_size;
        if(l.workspace_size > 2000000000) assert(0);
        inputs = l.outputs;
        net->layers[i] = l;
        w = l.out_w;
        h = l.out_h;
        if(l.type == AVGPOOL) break;
    }
    layer out = get_network_output_layer(net);
    net->inputs = net->layers[0].inputs;
    net->outputs = out.outputs;
    net->truths = out.outputs;
    if(net->layers[net->n-1].truths) net->truths = net->layers[net->n-1].truths;
    net->output = out.output;
    free(net->input);
    free(net->truth);
    net->input = calloc(net->inputs*net->batch, sizeof(float));
    net->truth = calloc(net->truths*net->batch, sizeof(float));
    free(net->workspace);
    net->workspace = calloc(1, workspace_size);
    //fprintf(stderr, " Done!\n");
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4a8, %rsp            # imm = 0x4A8
movl %esi, 0x94(%rdi)
movl %edx, 0x90(%rdi)
movq %rdi, (%rsp)
movl (%rdi), %eax
xorl %r12d, %r12d
testl %eax, %eax
jle 0x32381
movl %edx, %ebp
movl %esi, %r13d
movl $0x1, %r15d
xorl %ebx, %ebx
xorl %r14d, %r14d
movq (%rsp), %rax
movq 0x20(%rax), %rsi
addq %rbx, %rsi
movl $0x4a0, %edx            # imm = 0x4A0
leaq 0x8(%rsp), %rdi
callq 0x32b0
movl 0x8(%rsp), %eax
cmpq $0x1a, %rax
ja 0x32305
leaq 0x269e8(%rip), %rcx     # 0x58c0c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x111f2
jmp 0x32311
leaq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x3edff
jmp 0x32311
leaq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x2a785
jmp 0x32311
leaq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x39ad3
jmp 0x32311
leaq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x385dc
jmp 0x32311
leaq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x2ac9f
jmp 0x32311
leaq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x39cce
jmp 0x32311
leaq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x3a908
jmp 0x32311
leaq 0x8(%rsp), %rdi
movq (%rsp), %rsi
callq 0x38380
jmp 0x32311
leaq 0x8(%rsp), %rdi
movl %r12d, %esi
callq 0x33d1f
jmp 0x32311
leaq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x41947
jmp 0x32311
leaq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x3dcfc
jmp 0x32311
leaq 0x26acc(%rip), %rdi     # 0x58dd8
callq 0xf141
movq 0x4a0(%rsp), %rax
cmpq $0x77359401, %rax       # imm = 0x77359401
jae 0x3248d
cmpq %r14, %rax
cmovaq %rax, %r14
movl 0x60(%rsp), %r12d
movq (%rsp), %r13
movq 0x20(%r13), %rdi
addq %rbx, %rdi
movl $0x4a0, %edx            # imm = 0x4A0
leaq 0x8(%rsp), %rsi
callq 0x32b0
cmpl $0xb, 0x8(%rsp)
movl (%r13), %eax
je 0x32384
movl 0x84(%rsp), %r13d
movl 0x80(%rsp), %ebp
leaq 0x1(%r15), %rcx
addq $0x4a0, %rbx            # imm = 0x4A0
movslq %eax, %rdx
cmpq %rdx, %r15
movq %rcx, %r15
jl 0x321f5
jmp 0x32384
xorl %r14d, %r14d
movl %eax, %edx
movl %eax, %esi
sarl $0x1f, %esi
andl %eax, %esi
decl %esi
movq (%rsp), %rcx
movq 0x20(%rcx), %rcx
decq %rdx
movl %eax, %edi
testl %edi, %edi
jle 0x323b8
movl %edx, %r8d
imulq $0x4a0, %r8, %r8        # imm = 0x4A0
decl %edi
decq %rdx
cmpl $0x9, (%rcx,%r8)
je 0x3239c
jmp 0x323ba
movl %esi, %edi
movslq %edi, %rdx
imulq $0x4a0, %rdx, %rdx      # imm = 0x4A0
movl 0x58(%rcx,%rdx), %esi
movq 0x268(%rcx,%rdx), %rdx
movl 0x54(%rcx), %edi
movq (%rsp), %r15
movl %edi, 0x80(%r15)
movl %esi, 0x84(%r15)
cltq
imulq $0x4a0, %rax, %rax      # imm = 0x4A0
movl -0x438(%rcx,%rax), %eax
testl %eax, %eax
cmovel %esi, %eax
movl %eax, 0x88(%r15)
movq %rdx, 0x28(%r15)
movq 0xd8(%r15), %rdi
callq 0x3040
movq 0xe0(%r15), %rdi
callq 0x3040
movslq 0x80(%r15), %rdi
movslq 0x4(%r15), %rbx
imulq %rbx, %rdi
movl $0x4, %esi
callq 0x3250
movq %rax, 0xd8(%r15)
movslq 0x88(%r15), %rdi
imulq %rbx, %rdi
movl $0x4, %esi
callq 0x3250
movq %rax, 0xe0(%r15)
movq 0xf0(%r15), %rdi
callq 0x3040
movl $0x1, %edi
movq %r14, %rsi
callq 0x3250
movq %rax, 0xf0(%r15)
xorl %eax, %eax
addq $0x4a8, %rsp            # imm = 0x4A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x26913(%rip), %rdi     # 0x58da7
leaq 0x2690e(%rip), %rsi     # 0x58da9
leaq 0x26957(%rip), %rcx     # 0x58df9
movl $0x169, %edx            # imm = 0x169
callq 0x31b0