// File: /workspace/github_c_makefile_star2_O2/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, %r12d
movq %rdi, %r14
movl %esi, 0x94(%rdi)
movl %edx, 0x90(%rdi)
xorl %r13d, %r13d
pushq $-0x1
popq %rbx
xorl %r15d, %r15d
movq $0x0, (%rsp)
movslq (%r14), %rax
incq %rbx
cmpq %rax, %rbx
jge 0x230e0
movl %edx, %ebp
movq 0x20(%r14), %rsi
addq %r13, %rsi
movl $0x4a0, %edx            # imm = 0x4A0
leaq 0x8(%rsp), %rdi
callq 0x32b0
movl 0x8(%rsp), %eax
cmpq $0x1a, %rax
ja 0x23072
leaq 0x2cbc7(%rip), %rcx     # 0x4fb5c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x6ba7
jmp 0x2307e
leaq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x32336
jmp 0x2307e
leaq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x1be8f
jmp 0x2307e
leaq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x2c2bb
jmp 0x2307e
leaq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x2af4a
jmp 0x2307e
leaq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x1c59a
jmp 0x2307e
leaq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x2c5ac
jmp 0x2307e
leaq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x2d36c
jmp 0x2307e
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x2abbe
jmp 0x2307e
leaq 0x8(%rsp), %rdi
movl %r15d, %esi
callq 0x24ca8
jmp 0x2307e
leaq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x354a2
jmp 0x2307e
leaq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x312eb
jmp 0x2307e
leaq 0x2ccaf(%rip), %rdi     # 0x4fd28
callq 0x43df
movq 0x4a0(%rsp), %rax
cmpq $0x77359401, %rax       # imm = 0x77359401
jae 0x231b8
movq (%rsp), %rdx
cmpq %rdx, %rax
cmovaq %rax, %rdx
movq %rdx, (%rsp)
leaq 0x4a0(%r13), %rbp
movl 0x60(%rsp), %r15d
addq 0x20(%r14), %r13
movl $0x4a0, %edx            # imm = 0x4A0
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0x32b0
movl 0x84(%rsp), %r12d
movl 0x80(%rsp), %edx
cmpl $0xb, 0x8(%rsp)
movq %rbp, %r13
jne 0x22f59
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x231d7
movq 0x20(%r14), %rax
movq 0xd8(%r14), %rdi
movl 0x54(%rax), %ecx
movl %ecx, 0x80(%r14)
movl 0x58(%r15), %ecx
movl %ecx, 0x84(%r14)
movslq (%r14), %rdx
imulq $0x4a0, %rdx, %rdx      # imm = 0x4A0
movl -0x438(%rax,%rdx), %eax
testl %eax, %eax
cmovel %ecx, %eax
movl %eax, 0x88(%r14)
movq 0x268(%r15), %rax
movq %rax, 0x28(%r14)
callq 0x3040
movq 0xe0(%r14), %rdi
callq 0x3040
movslq 0x80(%r14), %rdi
movslq 0x4(%r14), %rbx
imulq %rbx, %rdi
pushq $0x4
popq %r15
movq %r15, %rsi
callq 0x3250
movq %rax, 0xd8(%r14)
movslq 0x88(%r14), %rdi
imulq %rbx, %rdi
movq %r15, %rsi
callq 0x3250
movq %rax, 0xe0(%r14)
movq 0xf0(%r14), %rdi
callq 0x3040
pushq $0x1
popq %rdi
movq (%rsp), %rsi
callq 0x3250
movq %rax, 0xf0(%r14)
xorl %eax, %eax
addq $0x4a8, %rsp            # imm = 0x4A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2cb38(%rip), %rdi     # 0x4fcf7
leaq 0x2cb33(%rip), %rsi     # 0x4fcf9
leaq 0x2cb7c(%rip), %rcx     # 0x4fd49
movl $0x169, %edx            # imm = 0x169
callq 0x31b0