// File: /workspace/github_c_makefile_star2_O1/SimpleDoger[P]Darknet_CPU_Only/rnn.c
// Function: test_char_rnn
void test_char_rnn(char *cfgfile, char *weightfile, int num, char *seed, float temp, int rseed, char *token_file)
{
    char **tokens = 0;
    if(token_file){
        size_t n;
        tokens = read_tokens(token_file, &n);
    }

    srand(rseed);
    char *base = basecfg(cfgfile);
    fprintf(stderr, "%s\n", base);

    network *net = load_network(cfgfile, weightfile, 0);
    int inputs = net->inputs;

    int i, j;
    for(i = 0; i < net->n; ++i) net->layers[i].temperature = temp;
    int c = 0;
    int len = strlen(seed);
    float *input = calloc(inputs, sizeof(float));

    /*
       fill_cpu(inputs, 0, input, 1);
       for(i = 0; i < 10; ++i){
       network_predict(net, input);
       }
       fill_cpu(inputs, 0, input, 1);
     */

    for(i = 0; i < len-1; ++i){
        c = seed[i];
        input[c] = 1;
        network_predict(net, input);
        input[c] = 0;
        print_symbol(c, tokens);
    }
    if(len) c = seed[len-1];
    print_symbol(c, tokens);
    for(i = 0; i < num; ++i){
        input[c] = 1;
        float *out = network_predict(net, input);
        input[c] = 0;
        for(j = 32; j < 127; ++j){
            //printf("%d %c %f\n",j, j, out[j]);
        }
        for(j = 0; j < inputs; ++j){
            if (out[j] < .0001) out[j] = 0;
        }
        c = sample_array(out, inputs);
        print_symbol(c, tokens);
    }
    printf("\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %ebp
movss %xmm0, (%rsp)
movq %rcx, %r12
movl %edx, 0x4(%rsp)
movq %rsi, %rbx
movq %rdi, %r15
testq %r9, %r9
jne 0xa304
xorl %eax, %eax
jmp 0xa311
leaq 0x20(%rsp), %rsi
movq %r9, %rdi
callq 0x47183
movq %rax, 0x8(%rsp)
movl %ebp, %edi
callq 0x3230
movq %r15, %rdi
callq 0xe717
movq 0x5fccc(%rip), %rcx     # 0x69ff8
movq (%rcx), %rdi
leaq 0x4c674(%rip), %rsi     # 0x569aa
xorl %ebp, %ebp
movq %rax, %rdx
xorl %eax, %eax
callq 0x3280
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2f9e4
movq %rax, %r14
movslq 0x80(%rax), %rbx
movslq (%rax), %rcx
testq %rcx, %rcx
movss (%rsp), %xmm0
jle 0xa388
movq 0x20(%r14), %rax
imulq $0x4a0, %rcx, %rcx      # imm = 0x4A0
xorl %edx, %edx
movss %xmm0, 0x18c(%rax,%rdx)
addq $0x4a0, %rdx            # imm = 0x4A0
cmpq %rdx, %rcx
jne 0xa373
movq %r12, %rdi
callq 0x3150
movq %rax, %r15
pushq $0x4
popq %rsi
movq %rbx, 0x18(%rsp)
movq %rbx, %rdi
callq 0x3260
movq %rax, %rbx
leal -0x1(%r15), %eax
movl %eax, (%rsp)
movq %r15, 0x10(%rsp)
cmpl $0x2, %r15d
jl 0xa3ee
movl (%rsp), %r15d
xorl %r13d, %r13d
movsbq (%r12,%r13), %rbp
movl $0x3f800000, (%rbx,%rbp,4) # imm = 0x3F800000
movq %r14, %rdi
movq %rbx, %rsi
callq 0x307ea
andl $0x0, (%rbx,%rbp,4)
movl %ebp, %edi
movq 0x8(%rsp), %rsi
callq 0x47615
incq %r13
cmpq %r13, %r15
jne 0xa3bf
cmpl $0x0, 0x10(%rsp)
je 0xa3fe
movslq (%rsp), %rax
movsbl (%r12,%rax), %ebp
movl %ebp, %edi
movq 0x8(%rsp), %rsi
callq 0x47615
cmpl $0x0, 0x4(%rsp)
movq 0x18(%rsp), %r12
jle 0xa481
movq %r14, %r15
movl %r12d, %r13d
xorl %r14d, %r14d
movslq %ebp, %rbp
movl $0x3f800000, (%rbx,%rbp,4) # imm = 0x3F800000
movq %r15, %rdi
movq %rbx, %rsi
callq 0x307ea
andl $0x0, (%rbx,%rbp,4)
testl %r12d, %r12d
movsd 0x4d55d(%rip), %xmm1    # 0x579a0
jle 0xa45e
xorl %ecx, %ecx
cvtss2sd (%rax,%rcx,4), %xmm0
ucomisd %xmm0, %xmm1
jbe 0xa456
andl $0x0, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r13
jne 0xa447
movq %rax, %rdi
movl %r12d, %esi
callq 0xf171
movl %eax, %ebp
movl %eax, %edi
movq 0x8(%rsp), %rsi
callq 0x47615
incl %r14d
cmpl 0x4(%rsp), %r14d
jne 0xa41f
pushq $0xa
popq %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3060