// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/scripting.c
// Function: ldbEval
void ldbEval(lua_State *lua, sds *argv, int argc) {
    /* Glue the script together if it is composed of multiple arguments. */
    sds code = sdsjoinsds(argv+1,argc-1," ",1);
    sds expr = sdscatsds(sdsnew("return "),code);

    /* Try to compile it as an expression, prepending "return ". */
    if (luaL_loadbuffer(lua,expr,sdslen(expr),"@ldb_eval")) {
        lua_pop(lua,1);
        /* Failed? Try as a statement. */
        if (luaL_loadbuffer(lua,code,sdslen(code),"@ldb_eval")) {
            ldbLog(sdscatfmt(sdsempty(),"<error> %s",lua_tostring(lua,-1)));
            lua_pop(lua,1);
            sdsfree(code);
            return;
        }
    }

    /* Call it. */
    sdsfree(code);
    sdsfree(expr);
    if (lua_pcall(lua,0,1,0)) {
        ldbLog(sdscatfmt(sdsempty(),"<error> %s",lua_tostring(lua,-1)));
        lua_pop(lua,1);
        return;
    }
    ldbLogStackValue(lua,"<retval> ");
    lua_pop(lua,1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
movl -0x14(%rbp), %esi
subl $0x1, %esi
leaq 0xb1c61(%rip), %rdx     # 0x13f149
movl $0x1, %ecx
callq 0x3abb0
movq %rax, -0x20(%rbp)
leaq 0xb7342(%rip), %rdi     # 0x14483f
callq 0x38510
movq %rax, %rdi
movq -0x20(%rbp), %rsi
callq 0x39110
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x895c0
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq %rax, %rdx
leaq 0xb730a(%rip), %rcx     # 0x144847
callq 0xc18f0
cmpl $0x0, %eax
je 0x8d5e4
movq -0x8(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0xac570
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
callq 0x895c0
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %rax, %rdx
leaq 0xb72c3(%rip), %rcx     # 0x144847
callq 0xc18f0
cmpl $0x0, %eax
je 0x8d5e2
callq 0x384f0
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0xacf60
movq -0x50(%rbp), %rdi
movq %rax, %rdx
leaq 0xb62a9(%rip), %rsi     # 0x143860
movb $0x0, %al
callq 0x39660
movq %rax, %rdi
callq 0x88530
movq -0x8(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0xac570
movq -0x20(%rbp), %rdi
callq 0x38620
jmp 0x8d673
jmp 0x8d5e4
movq -0x20(%rbp), %rdi
callq 0x38620
movq -0x28(%rbp), %rdi
callq 0x38620
movq -0x8(%rbp), %rdi
xorl %ecx, %ecx
movl $0x1, %edx
movl %ecx, %esi
callq 0xae1c0
cmpl $0x0, %eax
je 0x8d655
callq 0x384f0
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0xacf60
movq -0x58(%rbp), %rdi
movq %rax, %rdx
leaq 0xb622a(%rip), %rsi     # 0x143860
movb $0x0, %al
callq 0x39660
movq %rax, %rdi
callq 0x88530
movq -0x8(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0xac570
jmp 0x8d673
movq -0x8(%rbp), %rdi
leaq 0xb71f1(%rip), %rsi     # 0x144851
callq 0x8cc80
movq -0x8(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0xac570
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)