// File: /workspace/github_c_makefile_star2_O3/derhass[P]glx_hook/glx_hook.c
// Function: glXSwapBuffers
extern void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
{
#ifdef GH_CONTEXT_TRACKING
	gl_context_t *glc=(gl_context_t*)pthread_getspecific(ctx_current);

	if (glc) {
		frametimes_before_swap(&glc->frametimes);
		if (glc->swapbuffer_omission.swapbuffers > 0) {
			int do_swap;
			if (glc->swapbuffer_omission.latency_mode > 0) {
				latency_before_swap(&glc->latency);
			}
			do_swap = swapbuffer_omission_do_swap(&glc->swapbuffer_omission);
			if (do_swap) {
				if (glc->swapbuffer_omission.latency_mode < 1) {
					latency_before_swap(&glc->latency);
					GH_glXSwapBuffers(dpy, drawable);
					latency_after_swap(&glc->latency);
				} else {
					GH_glXSwapBuffers(dpy, drawable);
				}
			} else {
				swapbuffer_omission_swap_skipped(&glc->swapbuffer_omission);
			}
			if (glc->swapbuffer_omission.latency_mode > 0) {
				latency_after_swap(&glc->latency);
			}
			swapbuffer_omission_swap_finished(&glc->swapbuffer_omission, do_swap);
		} else {
			latency_before_swap(&glc->latency);
			GH_glXSwapBuffers(dpy, drawable);
			latency_after_swap(&glc->latency);
		}
		frametimes_after_swap(&glc->frametimes);
		if (glc->swap_sleep_usecs) {
			usleep(glc->swap_sleep_usecs);
		}
	} else {
		GH_verbose(GH_MSG_WARNING,"SwapBuffers called without a context\n");
		GH_GET_PTR_GL(glXSwapBuffers);
		GH_glXSwapBuffers(dpy, drawable);
	}
#else /* GH_CONTEXT_TRACKING */
	GH_GET_PTR_GL(glXSwapBuffers);
	GH_glXSwapBuffers(dpy, drawable);
#endif /* GH_CONTEXT_TRACKING */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r12
movl 0x587c(%rip), %edi      # 0xb208
callq 0x2070
testq %rax, %rax
je 0x5a9b
movq %rax, %rbx
movl 0x30(%rax), %edx
testl %edx, %edx
je 0x59ca
movl 0x38(%rbx), %eax
movl 0x48(%rbx), %edi
imull %eax, %edi
imull 0x58(%rbx), %eax
shlq $0x5, %rdi
addq 0x40(%rbx), %rdi
leaq (%rax,%rax,2), %rsi
shlq $0x3, %rsi
addq 0x50(%rbx), %rsi
callq 0x6842
leaq 0x30(%rbx), %r13
cmpl $0x0, 0x98(%rbx)
jle 0x5b00
cmpl $0x0, 0xa0(%rbx)
jle 0x59ed
leaq 0x68(%rbx), %rdi
callq 0x5d5d
cmpq $0x0, 0xb8(%rbx)
je 0x5b31
movl 0x800(%rbx), %eax
leaq (%rax,%rax,2), %rcx
shlq $0x6, %rax
leaq (%rbx,%rax), %rdi
addq $0xe0, %rdi
shlq $0x4, %rcx
leaq (%rbx,%rcx), %rsi
addq $0x4d8, %rsi            # imm = 0x4D8
movl $0x2, %edx
callq 0x6842
movl 0x800(%rbx), %edi
movl 0x804(%rbx), %edx
incl %edi
xorl %esi, %esi
cmpl %edx, %edi
cmovael %esi, %edi
movl %edi, 0x800(%rbx)
movl 0x808(%rbx), %r8d
testq %r8, %r8
je 0x5b3c
leaq 0x4c0(%rbx), %r9
movl %r8d, %r10d
xorl %ecx, %ecx
xorl %eax, %eax
movl %edi, %r11d
movl %r11d, %r14d
leaq (%r14,%r14,2), %r14
shlq $0x4, %r14
addq 0x18(%r9,%r14), %rax
subq (%r9,%r14), %rax
addq 0x28(%r9,%r14), %rcx
subq 0x10(%r9,%r14), %rcx
incl %r11d
cmpl %edx, %r11d
cmovael %esi, %r11d
decl %r10d
jne 0x5a69
jmp 0x5b40
leaq 0x187d(%rip), %rsi      # 0x731f
movl $0x2, %edi
xorl %eax, %eax
callq 0x2cac
leaq 0x56bb(%rip), %rdi      # 0xb170
callq 0x21a0
cmpq $0x0, 0x577e(%rip)      # 0xb240
jne 0x5ad7
leaq 0x187a(%rip), %rdi      # 0x7345
callq 0x3b35
movq %rax, 0x5769(%rip)      # 0xb240
leaq 0x5692(%rip), %rdi      # 0xb170
callq 0x2120
movq 0x5756(%rip), %rax      # 0xb240
movq %r12, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq %r13, %r14
movq %rbx, %r13
addq $0x68, %r13
movq %r13, %rdi
callq 0x5d5d
movq 0x5727(%rip), %rax      # 0xb240
movq %r12, %rdi
movq %r15, %rsi
callq *%rax
movq %r13, %rdi
movq %r14, %r13
callq 0x5de0
jmp 0x5cd0
movl 0x98(%rbx), %ebp
jmp 0x5bf1
xorl %eax, %eax
xorl %ecx, %ecx
xorl %edx, %edx
divq %r8
movq %rax, %rsi
movq %rcx, %rax
xorl %edx, %edx
divq %r8
movl 0xa8(%rbx), %ecx
cmpl $0x1, %ecx
je 0x5b6c
cmpl $0x2, %ecx
jne 0x5b65
movq %rax, %rsi
jmp 0x5b6c
cmpq %rax, %rsi
cmovbeq %rax, %rsi
cmpq $0x3e9, %rsi            # imm = 0x3E9
movl $0x3e8, %r8d            # imm = 0x3E8
cmovaeq %rsi, %r8
movq 0xb8(%rbx), %rax
xorl %ecx, %ecx
xorl %edx, %edx
divq %r8
movl 0xac(%rbx), %edx
movl 0xb0(%rbx), %esi
cmpl %eax, %edx
cmovgl %edx, %eax
cmpl %esi, %eax
cmovgel %esi, %eax
movl %edi, %edx
movl %eax, 0x7c0(%rbx,%rdx,4)
movl 0x808(%rbx), %esi
movl %esi, %edx
decl %edx
je 0x5be5
movl 0x804(%rbx), %edi
movl %edi, %r8d
subl %esi, %r8d
addl 0x800(%rbx), %r8d
incl %r8d
cmpl %edi, %r8d
movl %edi, %r9d
cmovbl %ecx, %r9d
subl %r9d, %r8d
addl 0x7c0(%rbx,%r8,4), %eax
decl %edx
jne 0x5bc9
xorl %edx, %edx
divl %esi
movl %eax, %ebp
movl %eax, 0x98(%rbx)
movl 0x9c(%rbx), %r14d
incl %r14d
movl %r14d, 0x9c(%rbx)
cmpl %ebp, %r14d
jge 0x5c20
movl 0xa4(%rbx), %eax
cmpl $0x1, %eax
je 0x5c67
cmpl $0x2, %eax
jne 0x5c73
leaq 0x56aa(%rip), %rax      # 0xb2c8
jmp 0x5c6e
cmpl $0x0, 0xa0(%rbx)
jle 0x5c3a
movq 0x5610(%rip), %rax      # 0xb240
movq %r12, %rdi
movq %r15, %rsi
callq *%rax
jmp 0x5c73
movq %r13, (%rsp)
leaq 0x68(%rbx), %r13
movq %r13, %rdi
callq 0x5d5d
movq 0x55ef(%rip), %rax      # 0xb240
movq %r12, %rdi
movq %r15, %rsi
callq *%rax
movq %r13, %rdi
movq (%rsp), %r13
callq 0x5de0
jmp 0x5c73
leaq 0x5652(%rip), %rax      # 0xb2c0
movq (%rax), %rax
callq *%rax
cmpl $0x0, 0xa0(%rbx)
jle 0x5c85
leaq 0x68(%rbx), %rdi
callq 0x5de0
cmpl %ebp, %r14d
jl 0x5c94
movl $0x0, 0x9c(%rbx)
cmpq $0x0, 0xb8(%rbx)
je 0x5cd0
movl 0x800(%rbx), %eax
leaq (%rax,%rax,2), %rcx
shlq $0x6, %rax
leaq (%rbx,%rax), %rdi
addq $0xc0, %rdi
shlq $0x4, %rcx
leaq (%rbx,%rcx), %rsi
addq $0x4c0, %rsi            # imm = 0x4C0
movl $0x2, %edx
callq 0x6842
movl (%r13), %edx
testl %edx, %edx
je 0x5d35
movl 0x38(%rbx), %eax
movl 0x48(%rbx), %edi
imull %eax, %edi
incl %edi
imull 0x58(%rbx), %eax
incl %eax
shlq $0x5, %rdi
addq 0x40(%rbx), %rdi
leaq (%rax,%rax,2), %rsi
shlq $0x3, %rsi
addq 0x50(%rbx), %rsi
callq 0x6842
movl 0x48(%rbx), %eax
incl %eax
xorl %ecx, %ecx
cmpl 0x34(%rbx), %eax
cmovnel %eax, %ecx
movl %ecx, 0x48(%rbx)
movq 0x58(%rbx), %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, 0x58(%rbx)
movd %xmm0, %eax
cmpl 0x3c(%rbx), %eax
jb 0x5d35
movq %r13, %rdi
callq 0x66a8
movl 0x810(%rbx), %edi
addq $0x8, %rsp
testl %edi, %edi
je 0x5d52
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21d0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq