// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/scripting.c
// Function: ldbCatStackValueRec
sds ldbCatStackValueRec(sds s, lua_State *lua, int idx, int level) {
    int t = lua_type(lua,idx);

    if (level++ == LDB_MAX_VALUES_DEPTH)
        return sdscat(s,"<max recursion level reached! Nested table?>");

    switch(t) {
    case LUA_TSTRING:
        {
        size_t strl;
        char *strp = (char*)lua_tolstring(lua,idx,&strl);
        s = sdscatrepr(s,strp,strl);
        }
        break;
    case LUA_TBOOLEAN:
        s = sdscat(s,lua_toboolean(lua,idx) ? "true" : "false");
        break;
    case LUA_TNUMBER:
        s = sdscatprintf(s,"%g",(double)lua_tonumber(lua,idx));
        break;
    case LUA_TNIL:
        s = sdscatlen(s,"nil",3);
        break;
    case LUA_TTABLE:
        {
        int expected_index = 1; /* First index we expect in an array. */
        int is_array = 1; /* Will be set to null if check fails. */
        /* Note: we create two representations at the same time, one
         * assuming the table is an array, one assuming it is not. At the
         * end we know what is true and select the right one. */
        sds repr1 = sdsempty();
        sds repr2 = sdsempty();
        lua_pushnil(lua); /* The first key to start the iteration is nil. */
        while (lua_next(lua,idx-1)) {
            /* Test if so far the table looks like an array. */
            if (is_array &&
                (lua_type(lua,-2) != LUA_TNUMBER ||
                 lua_tonumber(lua,-2) != expected_index)) is_array = 0;
            /* Stack now: table, key, value */
            /* Array repr. */
            repr1 = ldbCatStackValueRec(repr1,lua,-1,level);
            repr1 = sdscatlen(repr1,"; ",2);
            /* Full repr. */
            repr2 = sdscatlen(repr2,"[",1);
            repr2 = ldbCatStackValueRec(repr2,lua,-2,level);
            repr2 = sdscatlen(repr2,"]=",2);
            repr2 = ldbCatStackValueRec(repr2,lua,-1,level);
            repr2 = sdscatlen(repr2,"; ",2);
            lua_pop(lua,1); /* Stack: table, key. Ready for next iteration. */
            expected_index++;
        }
        /* Strip the last " ;" from both the representations. */
        if (sdslen(repr1)) sdsrange(repr1,0,-3);
        if (sdslen(repr2)) sdsrange(repr2,0,-3);
        /* Select the right one and discard the other. */
        s = sdscatlen(s,"{",1);
        s = sdscatsds(s,is_array ? repr1 : repr2);
        s = sdscatlen(s,"}",1);
        sdsfree(repr1);
        sdsfree(repr2);
        }
        break;
    case LUA_TFUNCTION:
    case LUA_TUSERDATA:
    case LUA_TTHREAD:
    case LUA_TLIGHTUSERDATA:
        {
        const void *p = lua_topointer(lua,idx);
        char *typename = "unknown";
        if (t == LUA_TFUNCTION) typename = "function";
        else if (t == LUA_TUSERDATA) typename = "userdata";
        else if (t == LUA_TTHREAD) typename = "thread";
        else if (t == LUA_TLIGHTUSERDATA) typename = "light-userdata";
        s = sdscatprintf(s,"\"%s@%p\"",typename,p);
        }
        break;
    default:
        s = sdscat(s,"\"<unknown-lua-type>\"");
        break;
    }
    return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xacaa0
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x20(%rbp)
cmpl $0xa, %eax
jne 0x8c8e1
movq -0x10(%rbp), %rdi
leaq 0xb7db5(%rip), %rsi     # 0x144688
callq 0x390d0
movq %rax, -0x8(%rbp)
jmp 0x8cc6f
movl -0x24(%rbp), %eax
movq %rax, -0x68(%rbp)
subq $0x8, %rax
ja 0x8cc53
movq -0x68(%rbp), %rax
leaq 0xb6ec7(%rip), %rcx     # 0x1437c4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq -0x30(%rbp), %rdx
callq 0xacf60
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x3a2c0
movq %rax, -0x10(%rbp)
jmp 0x8cc67
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xacf00
movq -0x70(%rbp), %rdi
movl %eax, %ecx
leaq 0xb7d60(%rip), %rsi     # 0x1446b5
leaq 0xb439d(%rip), %rax     # 0x140cf9
cmpl $0x0, %ecx
cmovneq %rax, %rsi
callq 0x390d0
movq %rax, -0x10(%rbp)
jmp 0x8cc67
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xace10
movq -0x78(%rbp), %rdi
leaq 0xb7d2b(%rip), %rsi     # 0x1446bb
movb $0x1, %al
callq 0x395b0
movq %rax, -0x10(%rbp)
jmp 0x8cc67
movq -0x10(%rbp), %rdi
leaq 0xbde44(%rip), %rsi     # 0x14a7ef
movl $0x3, %edx
callq 0x39040
movq %rax, -0x10(%rbp)
jmp 0x8cc67
movl $0x1, -0x3c(%rbp)
movl $0x1, -0x40(%rbp)
callq 0x384f0
movq %rax, -0x48(%rbp)
callq 0x384f0
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
callq 0xad2c0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
subl $0x1, %esi
callq 0xae690
cmpl $0x0, %eax
je 0x8cb07
cmpl $0x0, -0x40(%rbp)
je 0x8ca3c
movq -0x18(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0xacaa0
cmpl $0x3, %eax
jne 0x8ca35
movq -0x18(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0xace10
cvtsi2sdl -0x3c(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jne 0x8ca35
jp 0x8ca35
jmp 0x8ca3c
movl $0x0, -0x40(%rbp)
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x20(%rbp), %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x8c890
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
leaq 0xb7c5e(%rip), %rsi     # 0x1446be
movl $0x2, %edx
callq 0x39040
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rdi
leaq 0xb7c48(%rip), %rsi     # 0x1446c1
movl $0x1, %edx
callq 0x39040
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x20(%rbp), %ecx
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
callq 0x8c890
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
leaq 0xb7c18(%rip), %rsi     # 0x1446c3
movl $0x2, %edx
callq 0x39040
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x20(%rbp), %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x8c890
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
leaq 0xb7be1(%rip), %rsi     # 0x1446be
movl $0x2, %edx
callq 0x39040
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0xac570
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x8c9e7
movq -0x48(%rbp), %rdi
callq 0x895c0
cmpq $0x0, %rax
je 0x8cb26
movq -0x48(%rbp), %rdi
xorl %esi, %esi
movl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
callq 0x39db0
movq -0x50(%rbp), %rdi
callq 0x895c0
cmpq $0x0, %rax
je 0x8cb45
movq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
callq 0x39db0
movq -0x10(%rbp), %rdi
leaq 0xb7b76(%rip), %rsi     # 0x1446c6
movl $0x1, %edx
callq 0x39040
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
cmpl $0x0, -0x40(%rbp)
je 0x8cb79
movq -0x48(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x8cb84
movq -0x50(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x39110
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xb7b25(%rip), %rsi     # 0x1446c8
movl $0x1, %edx
callq 0x39040
movq %rax, -0x10(%rbp)
movq -0x48(%rbp), %rdi
callq 0x38620
movq -0x50(%rbp), %rdi
callq 0x38620
jmp 0x8cc67
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xad220
movq %rax, -0x58(%rbp)
leaq 0xaec3e(%rip), %rax     # 0x13b81d
movq %rax, -0x60(%rbp)
cmpl $0x6, -0x24(%rbp)
jne 0x8cbf6
leaq 0xb4845(%rip), %rax     # 0x141435
movq %rax, -0x60(%rbp)
jmp 0x8cc33
cmpl $0x7, -0x24(%rbp)
jne 0x8cc09
leaq 0xb7ad4(%rip), %rax     # 0x1446d7
movq %rax, -0x60(%rbp)
jmp 0x8cc31
cmpl $0x8, -0x24(%rbp)
jne 0x8cc1c
leaq 0xb7ab4(%rip), %rax     # 0x1446ca
movq %rax, -0x60(%rbp)
jmp 0x8cc2f
cmpl $0x2, -0x24(%rbp)
jne 0x8cc2d
leaq 0xb7aa8(%rip), %rax     # 0x1446d1
movq %rax, -0x60(%rbp)
jmp 0x8cc2f
jmp 0x8cc31
jmp 0x8cc33
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rdx
movq -0x58(%rbp), %rcx
leaq 0xb7a9a(%rip), %rsi     # 0x1446e0
movb $0x0, %al
callq 0x395b0
movq %rax, -0x10(%rbp)
jmp 0x8cc67
movq -0x10(%rbp), %rdi
leaq 0xb7a8a(%rip), %rsi     # 0x1446e8
callq 0x390d0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)