// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/scripting.c
// Function: scriptingEnableGlobalsProtection
void scriptingEnableGlobalsProtection(lua_State *lua) {
    char *s[32];
    sds code = sdsempty();
    int j = 0;

    /* strict.lua from: http://metalua.luaforge.net/src/lib/strict.lua.html.
     * Modified to be adapted to Redis. */
    s[j++]="local dbg=debug\n";
    s[j++]="local mt = {}\n";
    s[j++]="setmetatable(_G, mt)\n";
    s[j++]="mt.__newindex = function (t, n, v)\n";
    s[j++]="  if dbg.getinfo(2) then\n";
    s[j++]="    local w = dbg.getinfo(2, \"S\").what\n";
    s[j++]="    if w ~= \"main\" and w ~= \"C\" then\n";
    s[j++]="      error(\"Script attempted to create global variable '\"..tostring(n)..\"'\", 2)\n";
    s[j++]="    end\n";
    s[j++]="  end\n";
    s[j++]="  rawset(t, n, v)\n";
    s[j++]="end\n";
    s[j++]="mt.__index = function (t, n)\n";
    s[j++]="  if dbg.getinfo(2) and dbg.getinfo(2, \"S\").what ~= \"C\" then\n";
    s[j++]="    error(\"Script attempted to access unexisting global variable '\"..tostring(n)..\"'\", 2)\n";
    s[j++]="  end\n";
    s[j++]="  return rawget(t, n)\n";
    s[j++]="end\n";
    s[j++]="debug = nil\n";
    s[j++]=NULL;

    for (j = 0; s[j] != NULL; j++) code = sdscatlen(code,s[j],strlen(s[j]));
    luaL_loadbuffer(lua,code,sdslen(code),"@enable_strict_lua");
    lua_pcall(lua,0,0,0);
    sdsfree(code);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
callq 0x384f0
movq %rax, -0x118(%rbp)
movl $0x0, -0x11c(%rbp)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e6e(%rip), %rcx     # 0x143ccd
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e5d(%rip), %rcx     # 0x143cde
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e4a(%rip), %rcx     # 0x143ced
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e3e(%rip), %rcx     # 0x143d03
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e40(%rip), %rcx     # 0x143d27
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e38(%rip), %rcx     # 0x143d41
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e3e(%rip), %rcx     # 0x143d69
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e42(%rip), %rcx     # 0x143d8f
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e72(%rip), %rcx     # 0x143de1
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e52(%rip), %rcx     # 0x143de3
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e37(%rip), %rcx     # 0x143dea
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xba030(%rip), %rcx     # 0x144005
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e06(%rip), %rcx     # 0x143dfd
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e02(%rip), %rcx     # 0x143e1b
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e1e(%rip), %rcx     # 0x143e59
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9d86(%rip), %rcx     # 0x143de3
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e35(%rip), %rcx     # 0x143eb4
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9f64(%rip), %rcx     # 0x144005
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
leaq 0xb9e08(%rip), %rcx     # 0x143ecb
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x11c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x11c(%rbp)
cltq
movq $0x0, -0x110(%rbp,%rax,8)
movl $0x0, -0x11c(%rbp)
movslq -0x11c(%rbp), %rax
cmpq $0x0, -0x110(%rbp,%rax,8)
je 0x8a16c
movq -0x118(%rbp), %rax
movq %rax, -0x130(%rbp)
movslq -0x11c(%rbp), %rax
movq -0x110(%rbp,%rax,8), %rax
movq %rax, -0x128(%rbp)
movslq -0x11c(%rbp), %rax
movq -0x110(%rbp,%rax,8), %rdi
callq 0x264f0
movq -0x130(%rbp), %rdi
movq -0x128(%rbp), %rsi
movq %rax, %rdx
callq 0x39040
movq %rax, -0x118(%rbp)
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0x8a0f4
movq -0x8(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x118(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x118(%rbp), %rdi
callq 0x895c0
movq -0x140(%rbp), %rdi
movq -0x138(%rbp), %rsi
movq %rax, %rdx
leaq 0xb9d2f(%rip), %rcx     # 0x143ed8
callq 0xc18f0
movq -0x8(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
movl %ecx, %edx
callq 0xae1c0
movq -0x118(%rbp), %rdi
callq 0x38620
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)