// File: /workspace/github_c_makefile_star2_O3/stetre[P]moongl/src/sync.c
// Function: FenceSync
static int FenceSync(lua_State *L)
    {
    node_t *node;
    GLsync sync; 
    GLbitfield flags = 0;
    GLenum condition = checkcondition(L, 1);
    sync = glFenceSync(condition, flags);
    CheckError(L);
    if(sync==0) /* paranoia... */
        return luaL_error(L, "cannot create sync");
    if((node=node_new(sync))==NULL)
        {
        glDeleteSync(sync);
        CheckError(L);
        return luaL_error(L, "cannot create sync");
        }
    lua_pushinteger(L, node->id);
    return 1;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x3d, %esi
movl $0x1, %edx
callq 0x11150
movq 0x1fcb5(%rip), %rcx     # 0x563e0
movl %eax, %edi
xorl %esi, %esi
callq *(%rcx)
movq %rax, %r14
movq %rbx, %rdi
callq 0x11870
testq %r14, %r14
je 0x36a0c
movl 0x2122c(%rip), %r15d    # 0x57978
leal 0x1(%r15), %eax
cmpl $0x2, %eax
ja 0x3676c
movl $0x1, 0x21219(%rip)     # 0x57978
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x1, %r15d
jmp 0x36770
leal -0x1(%r15), %eax
movq 0x21209(%rip), %r12     # 0x57980
cmpl $-0x1, %r15d
jne 0x3678d
movl $0x1, 0x211f1(%rip)     # 0x57978
movl $0x1, %r15d
movq %r12, %rcx
testq %r12, %r12
je 0x36a59
cmpl %r15d, 0x20(%rcx)
jg 0x367a5
jge 0x367af
addq $0x8, %rcx
movq (%rcx), %rcx
testq %rcx, %rcx
jne 0x36799
jmp 0x367c3
incl %r15d
movl %r15d, 0x211bf(%rip)    # 0x57978
cmpl %eax, %r15d
jne 0x36777
jmp 0x369f8
movl %r15d, %eax
incl %eax
movl %eax, 0x211aa(%rip)     # 0x57978
je 0x369f8
movl $0x1, %edi
movl $0x30, %esi
callq 0x11970
testq %rax, %rax
je 0x369f8
movl %r15d, 0x20(%rax)
movq %r14, 0x28(%rax)
testq %r12, %r12
je 0x36a28
movq %r12, %rcx
movl 0x20(%r12), %edx
movq %r12, %rsi
cmpl %edx, %r15d
jl 0x36817
jle 0x36a3d
leaq 0x8(%rcx), %rsi
movq (%rsi), %r12
testq %r12, %r12
jne 0x367fd
xorl %esi, %esi
cmpl %edx, %r15d
setge %sil
movq %rcx, 0x10(%rax)
movl $0x1, 0x18(%rax)
movq %rax, (%rcx,%rsi,8)
leaq 0x21142(%rip), %rdx     # 0x57980
xorl %esi, %esi
cmpl $0x1, 0x18(%rcx)
jne 0x369ef
movq 0x10(%rcx), %rdi
movq (%rdi), %r8
cmpq %r8, %rcx
je 0x3687b
testq %r8, %r8
je 0x36868
cmpl $0x1, 0x18(%r8)
jne 0x36868
movl %esi, 0x18(%r8)
jmp 0x3688f
movq (%rcx), %r8
cmpq %rax, %r8
je 0x368b5
movq %rcx, %r8
movq %rax, %rcx
jmp 0x36924
movq 0x8(%rdi), %r9
testq %r9, %r9
je 0x368a1
cmpl $0x1, 0x18(%r9)
jne 0x368a1
movl %esi, 0x18(%r9)
movl %esi, 0x18(%rcx)
movl $0x1, 0x18(%rdi)
movq %rdi, %rcx
jmp 0x369df
movq 0x8(%rcx), %r9
cmpq %rax, %r9
je 0x368d7
movq %rcx, %r9
movq %rax, %rcx
jmp 0x36997
movq 0x8(%r8), %r9
movq %r9, (%rcx)
testq %r9, %r9
je 0x36900
movq %rcx, 0x10(%r9)
movq 0x10(%rcx), %r9
movq %r9, 0x10(%r8)
movq %rdx, %r10
testq %r9, %r9
jne 0x36908
jmp 0x36916
movq (%r9), %r8
movq %r8, 0x8(%rcx)
testq %r8, %r8
je 0x36971
movq %rcx, 0x10(%r8)
movq 0x10(%rcx), %r8
movq %r8, 0x10(%r9)
movq %rdx, %r10
testq %r8, %r8
jne 0x36979
jmp 0x36987
movq %rdi, 0x10(%r8)
movq 0x10(%rcx), %r9
xorl %r10d, %r10d
cmpq (%r9), %rcx
setne %r10b
leaq (%r9,%r10,8), %r10
movq %r8, (%r10)
movq %rcx, 0x8(%r8)
movq %r8, 0x10(%rcx)
movq %rax, %r8
movl $0x0, 0x18(%r8)
movl $0x1, 0x18(%rdi)
movq 0x8(%rdi), %rax
movq (%rax), %r8
movq %r8, 0x8(%rdi)
testq %r8, %r8
je 0x36947
movq %rdi, 0x10(%r8)
movq 0x10(%rdi), %r8
movq %r8, 0x10(%rax)
movq %rdx, %r9
testq %r8, %r8
je 0x36965
xorl %r9d, %r9d
cmpq (%r8), %rdi
setne %r9b
leaq (%r8,%r9,8), %r9
movq %rax, (%r9)
movq %rdi, (%rax)
movq %rax, 0x10(%rdi)
jmp 0x369df
movq %rdi, 0x10(%r9)
movq 0x10(%rcx), %r8
xorl %r10d, %r10d
cmpq (%r8), %rcx
setne %r10b
leaq (%r8,%r10,8), %r10
movq %r9, (%r10)
movq %rcx, (%r9)
movq %r9, 0x10(%rcx)
movq (%rdi), %r8
movq %rax, %r9
movl $0x0, 0x18(%r9)
movl $0x1, 0x18(%rdi)
movq 0x8(%r8), %rax
movq %rax, (%rdi)
testq %rax, %rax
je 0x369b6
movq %rdi, 0x10(%rax)
movq 0x10(%rdi), %rax
movq %rax, 0x10(%r8)
movq %rdx, %r9
testq %rax, %rax
je 0x369d4
xorl %r9d, %r9d
cmpq (%rax), %rdi
setne %r9b
leaq (%rax,%r9,8), %r9
movq %r8, (%r9)
movq %rdi, 0x8(%r8)
movq %r8, 0x10(%rdi)
movq %rcx, %rax
movq 0x10(%rcx), %rcx
testq %rcx, %rcx
jne 0x36840
movq 0x20f8a(%rip), %rax     # 0x57980
jmp 0x36a36
movq 0x204f1(%rip), %rax     # 0x56ef0
movq %r14, %rdi
callq *(%rax)
movq %rbx, %rdi
callq 0x11870
leaq 0x14b0f(%rip), %rsi     # 0x4b522
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x11ae0
movl $0x1, 0x18(%rax)
movq %rax, 0x20f4a(%rip)     # 0x57980
movl $0x0, 0x18(%rax)
movslq %r15d, %rsi
movq %rbx, %rdi
callq 0x113b0
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leal 0x1(%r15), %eax
movl %eax, 0x20f15(%rip)     # 0x57978
jmp 0x367d4