// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/rnn.c
// Function: vec_char_rnn
void vec_char_rnn(char *cfgfile, char *weightfile, char *seed)
{
    char *base = basecfg(cfgfile);
    fprintf(stderr, "%s\n", base);

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

    int c;
    int seed_len = strlen(seed);
    float *input = calloc(inputs, sizeof(float));
    int i;
    char *line;
    while((line=fgetl(stdin)) != 0){
        reset_network_state(net, 0);
        for(i = 0; i < seed_len; ++i){
            c = seed[i];
            input[(int)c] = 1;
            network_predict(net, input);
            input[(int)c] = 0;
        }
        strip(line);
        int str_len = strlen(line);
        for(i = 0; i < str_len; ++i){
            c = line[i];
            input[(int)c] = 1;
            network_predict(net, input);
            input[(int)c] = 0;
        }
        c = ' ';
        input[(int)c] = 1;
        network_predict(net, input);
        input[(int)c] = 0;

        layer l = net->layers[0];
        printf("%s", line);
        for(i = 0; i < l.outputs; ++i){
            printf(",%g", l.output[i]);
        }
        printf("\n");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r15
callq 0xef02
movq 0x60dbb(%rip), %rcx     # 0x6bff8
movq (%rcx), %rdi
leaq 0x4d863(%rip), %rsi     # 0x58aaa
movq %rax, %rdx
xorl %eax, %eax
callq 0x3270
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x316bc
movq %rax, %r14
movslq 0x80(%rax), %r15
movq %r13, %rdi
callq 0x3140
movq %rax, 0x8(%rsp)
pushq $0x4
popq %rsi
movq %r15, %rdi
callq 0x3250
movq %rax, %r12
movq 0x60d4e(%rip), %rax     # 0x6bfd8
movq (%rax), %rdi
callq 0xe948
testq %rax, %rax
je 0xb3d0
movq %rax, %rcx
movq 0x8(%rsp), %rax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, 0x10(%rsp)
movq %r13, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x31713
cmpl $0x0, 0x8(%rsp)
movq 0x10(%rsp), %rbp
jle 0xb2f5
xorl %ebx, %ebx
movsbq (%r13,%rbx), %r15
movl $0x3f800000, (%r12,%r15,4) # imm = 0x3F800000
movq %r14, %rdi
movq %r12, %rsi
callq 0x32690
andl $0x0, (%r12,%r15,4)
incq %rbx
cmpq %rbx, %rbp
jne 0xb2cf
movq 0x20(%rsp), %r13
movq %r13, %rdi
callq 0xf25f
movq %r13, %rdi
callq 0x3140
movq %rax, %r15
testl %r15d, %r15d
jle 0xb341
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %ebx, %ebx
movsbq (%r13,%rbx), %rbp
movl $0x3f800000, (%r12,%rbp,4) # imm = 0x3F800000
movq %r14, %rdi
movq %r12, %rsi
callq 0x32690
andl $0x0, (%r12,%rbp,4)
incq %rbx
cmpq %rbx, %r15
jne 0xb31b
movl $0x3f800000, 0x80(%r12) # imm = 0x3F800000
movq %r14, %rdi
movq %r12, %rsi
callq 0x32690
andl $0x0, 0x80(%r12)
movq 0x20(%r14), %rax
movslq 0x58(%rax), %r15
movq 0x268(%rax), %rbx
leaq 0x4d704(%rip), %rdi     # 0x58a7b
movq %r13, %rsi
xorl %eax, %eax
callq 0x3160
testq %r15, %r15
leaq 0x4f80e(%rip), %rbp     # 0x5ab99
jle 0xb3a8
xorl %r13d, %r13d
cvtss2sd (%rbx,%r13,4), %xmm0
movq %rbp, %rdi
movb $0x1, %al
callq 0x3160
incq %r13
cmpq %r13, %r15
jne 0xb390
pushq $0xa
popq %rdi
callq 0x3060
movq 0x60c21(%rip), %rax     # 0x6bfd8
movq (%rax), %rdi
callq 0xe948
movq %rax, %rcx
testq %rax, %rax
movq 0x18(%rsp), %r13
jne 0xb2b2
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq