// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x8(%rsi), %rdi
leal -0x1(%rdx), %esi
leaq 0x53568(%rip), %rdx     # 0xc4c9d
movl $0x1, %ecx
callq 0x38241
movq %rax, %r14
leaq 0x591d6(%rip), %rdi     # 0xca91f
callq 0x362b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x36bc3
movq %rax, %r15
movzbl -0x1(%rax), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x71799
leaq 0x5815b(%rip), %rcx     # 0xc98cc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x7179b
movq -0x11(%r15), %rdx
jmp 0x7179b
movzwl -0x5(%r15), %edx
jmp 0x7179b
movl -0x9(%r15), %edx
jmp 0x7179b
movzbl -0x3(%r15), %edx
jmp 0x7179b
xorl %edx, %edx
leaq 0x59185(%rip), %rcx     # 0xca927
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9204c
testl %eax, %eax
je 0x7186c
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x85d59
movzbl -0x1(%r14), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x71800
leaq 0x58108(%rip), %rcx     # 0xc98e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x71802
movq -0x11(%r14), %rdx
jmp 0x71802
movzwl -0x5(%r14), %edx
jmp 0x71802
movl -0x9(%r14), %edx
jmp 0x71802
movzbl -0x3(%r14), %edx
jmp 0x71802
xorl %edx, %edx
leaq 0x5911e(%rip), %rcx     # 0xca927
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9204c
testl %eax, %eax
je 0x7186c
callq 0x3628d
movq %rax, %r15
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x862f8
leaq 0x5810a(%rip), %rsi     # 0xc9940
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x36fb1
movq 0xa4a26(%rip), %rdi     # 0x116270
movq %rax, %rsi
callq 0x2b24b
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x85d59
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x36330
movq %r14, %rdi
callq 0x36330
movq %r15, %rdi
callq 0x36330
movq %rbx, %rdi
xorl %esi, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x86bad
testl %eax, %eax
je 0x718cd
callq 0x3628d
movq %rax, %r14
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x862f8
leaq 0x58091(%rip), %rsi     # 0xc9940
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x36fb1
movq 0xa49ad(%rip), %rdi     # 0x116270
movq %rax, %rsi
callq 0x2b24b
jmp 0x718dc
leaq 0x5905d(%rip), %rsi     # 0xca931
movq %rbx, %rdi
callq 0x7103f
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
popq %rbx
popq %r14
popq %r15
jmp 0x85d59