// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movss %xmm0, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x5ec37
movq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x5dfb0
movq %rax, -0x38(%rbp)
movl -0x28(%rbp), %edi
callq 0x31e0
movq -0x8(%rbp), %rdi
callq 0x4850
movq %rax, -0x48(%rbp)
movq 0x243a5(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
movq -0x48(%rbp), %rdx
leaq 0x1573c(%rip), %rsi     # 0x7439d
movb $0x0, %al
callq 0x3240
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x39a70
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl 0x80(%rax), %eax
movl %eax, -0x54(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
movq -0x50(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x5ecc8
movss -0x24(%rbp), %xmm0
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x58(%rbp), %rcx
imulq $0x4a0, %rcx, %rcx      # imm = 0x4A0
addq %rcx, %rax
movss %xmm0, 0x18c(%rax)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x5ec8f
movl $0x0, -0x60(%rbp)
movq -0x20(%rbp), %rdi
callq 0x3110
movl %eax, -0x64(%rbp)
movslq -0x54(%rbp), %rdi
movl $0x4, %esi
callq 0x3220
movq %rax, -0x70(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x5ed59
movq -0x20(%rbp), %rax
movslq -0x58(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x60(%rbp)
movq -0x70(%rbp), %rax
movslq -0x60(%rbp), %rcx
movss 0x122ec(%rip), %xmm0    # 0x7100c
movss %xmm0, (%rax,%rcx,4)
movq -0x50(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x3b160
movq -0x70(%rbp), %rax
movslq -0x60(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl -0x60(%rbp), %edi
movq -0x38(%rbp), %rsi
callq 0x5eba0
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x5ecf4
cmpl $0x0, -0x64(%rbp)
je 0x5ed73
movq -0x20(%rbp), %rax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %edi
movq -0x38(%rbp), %rsi
callq 0x5eba0
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x5ee56
movq -0x70(%rbp), %rax
movslq -0x60(%rbp), %rcx
movss 0x1226a(%rip), %xmm0    # 0x7100c
movss %xmm0, (%rax,%rcx,4)
movq -0x50(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x3b160
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rax
movslq -0x60(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl $0x20, -0x5c(%rbp)
cmpl $0x7f, -0x5c(%rbp)
jge 0x5ede2
jmp 0x5edd7
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x5edcf
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x5ee2d
movq -0x78(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x163a6(%rip), %xmm0    # 0x751b0
ucomisd %xmm1, %xmm0
jbe 0x5ee20
movq -0x78(%rbp), %rax
movslq -0x5c(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
jmp 0x5ee22
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x5ede9
movq -0x78(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0x5a80
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %edi
movq -0x38(%rbp), %rsi
callq 0x5eba0
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x5ed86
leaq 0x16f51(%rip), %rdi     # 0x75dae
movb $0x0, %al
callq 0x3130
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)