// File: /workspace/github_c_makefile_star2_O0/erikdubbelboer[P]discnt/src/discnt-cli.c
// Function: evalMode
static int evalMode(int argc, char **argv) {
    sds script = sdsempty();
    FILE *fp;
    char buf[1024];
    size_t nread;
    char **argv2;
    int j, got_comma = 0, keys = 0;

    /* Load the script from the file, as an sds string. */
    fp = fopen(config.eval,"r");
    if (!fp) {
        fprintf(stderr,
            "Can't open file '%s': %s\n", config.eval, strerror(errno));
        exit(1);
    }
    while((nread = fread(buf,1,sizeof(buf),fp)) != 0) {
        script = sdscatlen(script,buf,nread);
    }
    fclose(fp);

    /* Create our argument vector */
    argv2 = zmalloc(sizeof(sds)*(argc+3));
    argv2[0] = sdsnew("EVAL");
    argv2[1] = script;
    for (j = 0; j < argc; j++) {
        if (!got_comma && argv[j][0] == ',' && argv[j][1] == 0) {
            got_comma = 1;
            continue;
        }
        argv2[j+3-got_comma] = sdsnew(argv[j]);
        if (!got_comma) keys++;
    }
    argv2[2] = sdscatprintf(sdsempty(),"%d",keys);

    /* Call it */
    return cliSendCommand(argc+3-got_comma, argv2, config.repeat);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
callq 0xe410
movq %rax, -0x18(%rbp)
movl $0x0, -0x438(%rbp)
movl $0x0, -0x43c(%rbp)
movq 0x83b62(%rip), %rdi     # 0x96ca8
leaq 0x6fec2(%rip), %rsi     # 0x8300f
callq 0xc340
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x131b1
movq 0x82e8c(%rip), %rax     # 0x95ff0
movq (%rax), %rax
movq %rax, -0x450(%rbp)
movq 0x83b33(%rip), %rax     # 0x96ca8
movq %rax, -0x448(%rbp)
callq 0xc080
movl (%rax), %edi
callq 0xc5f0
movq -0x450(%rbp), %rdi
movq -0x448(%rbp), %rdx
movq %rax, %rcx
leaq 0x70e58(%rip), %rsi     # 0x83ff8
movb $0x0, %al
callq 0xc320
movl $0x1, %edi
callq 0xc590
jmp 0x131b3
leaq -0x420(%rbp), %rdi
movq -0x20(%rbp), %rcx
movl $0x1, %esi
movl $0x400, %edx            # imm = 0x400
callq 0xc0e0
movq %rax, -0x428(%rbp)
cmpq $0x0, %rax
je 0x131f7
movq -0x18(%rbp), %rdi
leaq -0x420(%rbp), %rsi
movq -0x428(%rbp), %rdx
callq 0xef60
movq %rax, -0x18(%rbp)
jmp 0x131b3
movq -0x20(%rbp), %rdi
callq 0xc180
movl -0x4(%rbp), %eax
addl $0x3, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x14a70
movq %rax, -0x430(%rbp)
leaq 0x70df2(%rip), %rdi     # 0x84012
callq 0xe430
movq %rax, %rcx
movq -0x430(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
movq -0x430(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x434(%rbp)
movl -0x434(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x13300
cmpl $0x0, -0x438(%rbp)
jne 0x1329e
movq -0x10(%rbp), %rax
movslq -0x434(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
jne 0x1329e
movq -0x10(%rbp), %rax
movslq -0x434(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x1329e
movl $0x1, -0x438(%rbp)
jmp 0x132ec
movq -0x10(%rbp), %rax
movslq -0x434(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xe430
movq %rax, %rdx
movq -0x430(%rbp), %rax
movl -0x434(%rbp), %ecx
addl $0x3, %ecx
subl -0x438(%rbp), %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
cmpl $0x0, -0x438(%rbp)
jne 0x132ea
movl -0x43c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x43c(%rbp)
jmp 0x132ec
movl -0x434(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x434(%rbp)
jmp 0x1324b
callq 0xe410
movq %rax, %rdi
movl -0x43c(%rbp), %edx
leaq 0x6ede4(%rip), %rsi     # 0x820f9
movb $0x0, %al
callq 0xf4d0
movq %rax, %rcx
movq -0x430(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x4(%rbp), %edi
addl $0x3, %edi
subl -0x438(%rbp), %edi
movq -0x430(%rbp), %rsi
movq 0x8388c(%rip), %rax     # 0x96bd0
movl %eax, %edx
callq 0x13b20
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq
nopw %cs:(%rax,%rax)