// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x960, %rsp            # imm = 0x960
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x94(%rax)
movl -0x10(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x90(%rax)
movl $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x3aca4
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movslq -0x14(%rbp), %rax
imulq $0x4a0, %rax, %rax      # imm = 0x4A0
addq %rax, %rsi
leaq -0x4c0(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
cmpl $0x0, -0x4c0(%rbp)
jne 0x3aa9b
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq -0x4c0(%rbp), %rdi
callq 0x8690
jmp 0x3ac0c
cmpl $0x7, -0x4c0(%rbp)
jne 0x3aabb
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq -0x4c0(%rbp), %rdi
callq 0x30680
jmp 0x3ac0a
cmpl $0x3, -0x4c0(%rbp)
jne 0x3aadb
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq -0x4c0(%rbp), %rdi
callq 0x30fe0
jmp 0x3ac08
cmpl $0x16, -0x4c0(%rbp)
jne 0x3aafb
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq -0x4c0(%rbp), %rdi
callq 0x4d360
jmp 0x3ac06
cmpl $0x17, -0x4c0(%rbp)
jne 0x3ab1b
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq -0x4c0(%rbp), %rdi
callq 0x529f0
jmp 0x3ac04
cmpl $0x8, -0x4c0(%rbp)
jne 0x3ab39
movq -0x8(%rbp), %rsi
leaq -0x4c0(%rbp), %rdi
callq 0x442d0
jmp 0x3ac02
cmpl $0xd, -0x4c0(%rbp)
jne 0x3ab59
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq -0x4c0(%rbp), %rdi
callq 0x481f0
jmp 0x3ac00
cmpl $0x1a, -0x4c0(%rbp)
jne 0x3ab79
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq -0x4c0(%rbp), %rdi
callq 0x44860
jmp 0x3abfe
cmpl $0x19, -0x4c0(%rbp)
jne 0x3ab96
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq -0x4c0(%rbp), %rdi
callq 0x4ed00
jmp 0x3abfc
cmpl $0xb, -0x4c0(%rbp)
jne 0x3abb3
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq -0x4c0(%rbp), %rdi
callq 0x46ec0
jmp 0x3abfa
cmpl $0xa, -0x4c0(%rbp)
jne 0x3abd0
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq -0x4c0(%rbp), %rdi
callq 0x46a30
jmp 0x3abf8
cmpl $0x9, -0x4c0(%rbp)
jne 0x3abea
movl -0x18(%rbp), %esi
leaq -0x4c0(%rbp), %rdi
callq 0x3d1a0
jmp 0x3abf6
leaq 0x39a6b(%rip), %rdi     # 0x7465c
callq 0x4c50
jmp 0x3abf8
jmp 0x3abfa
jmp 0x3abfc
jmp 0x3abfe
jmp 0x3ac00
jmp 0x3ac02
jmp 0x3ac04
jmp 0x3ac06
jmp 0x3ac08
jmp 0x3ac0a
jmp 0x3ac0c
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jbe 0x3ac1e
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x77359400, -0x28(%rbp) # imm = 0x77359400
jbe 0x3ac47
leaq 0x399fc(%rip), %rdi     # 0x7462b
leaq 0x399f7(%rip), %rsi     # 0x7462d
movl $0x169, %edx            # imm = 0x169
leaq 0x39a3b(%rip), %rcx     # 0x7467d
callq 0x3180
movl -0x468(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0x4a0, %rax, %rax      # imm = 0x4A0
addq %rax, %rdi
leaq -0x4c0(%rbp), %rsi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movl -0x444(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x448(%rbp), %eax
movl %eax, -0x10(%rbp)
cmpl $0xb, -0x4c0(%rbp)
jne 0x3ac94
jmp 0x3aca4
jmp 0x3ac96
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3aa45
movq -0x8(%rbp), %rsi
leaq -0x960(%rbp), %rdi
callq 0x3ae00
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl 0x54(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x80(%rax)
movl -0x908(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x84(%rax)
movl -0x908(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x88(%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x4a0, %rcx, %rcx      # imm = 0x4A0
addq %rcx, %rax
cmpl $0x0, 0x68(%rax)
je 0x3ad38
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x4a0, %rcx, %rcx      # imm = 0x4A0
addq %rcx, %rax
movl 0x68(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x88(%rax)
movq -0x6f8(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rax
movq 0xd8(%rax), %rdi
callq 0x3030
movq -0x8(%rbp), %rax
movq 0xe0(%rax), %rdi
callq 0x3030
movq -0x8(%rbp), %rax
movl 0x80(%rax), %eax
movq -0x8(%rbp), %rcx
imull 0x4(%rcx), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xd8(%rax)
movq -0x8(%rbp), %rax
movl 0x88(%rax), %eax
movq -0x8(%rbp), %rcx
imull 0x4(%rcx), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xe0(%rax)
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rdi
callq 0x3030
movq -0x20(%rbp), %rsi
movl $0x1, %edi
callq 0x3220
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xf0(%rax)
xorl %eax, %eax
addq $0x960, %rsp            # imm = 0x960
popq %rbp
retq
nopl (%rax,%rax)