// File: /workspace/github_c_makefile_star2_O0/derhass[P]glx_hook/glx_hook.c
// Function: GH_get_interceptor
static void* GH_get_interceptor(const char *name, GH_resolve_func query,
				const char *query_name )
{
#define GH_INTERCEPT(func) \
       	if (!strcmp(#func, name)) {\
		pthread_mutex_lock(&GH_fptr_mutex); \
		if ( (GH_ ##func == NULL) && query) { \
			GH_ ##func = query(#func); \
			GH_verbose(GH_MSG_DEBUG,"queried internal %s via %s: %p\n", \
				name,query_name, GH_ ##func); \
		} \
		pthread_mutex_unlock(&GH_fptr_mutex); \
		return func; \
	}

#ifdef GH_SWAPBUFFERS_INTERCEPT
	static int do_swapbuffers=0;
#endif
	static int do_dlsym = 0;
#if (GH_DLSYM_METHOD != 2)
	static int do_dlvsym = 0;
#endif
	static int inited = 0;

	if (!inited) {
#ifdef GH_SWAPBUFFERS_INTERCEPT
		do_swapbuffers =get_envi("GH_SWAPBUFFERS", 0) ||
				get_envi("GH_FRAMETIME", 0) ||
				get_envi("GH_SWAP_SLEEP_USECS", 0) ||
				(get_envi("GH_LATENCY", GH_LATENCY_NOP) != GH_LATENCY_NOP);
#endif
		do_dlsym = get_envi("GH_HOOK_DLSYM_DYNAMICALLY", 0);
#if (GH_DLSYM_METHOD != 2)
		do_dlvsym = get_envi("GH_HOOK_DLVSYM_DYNAMICALLY", 0);
#endif
		inited = 1;
	}

	if (do_dlsym) {
		GH_INTERCEPT(dlsym);
	}
#if (GH_DLSYM_METHOD != 2)
	if (do_dlvsym) {
		GH_INTERCEPT(dlvsym);
	}
#endif
	GH_INTERCEPT(glXGetProcAddress);
	GH_INTERCEPT(glXGetProcAddressARB);
	GH_INTERCEPT(glXSwapIntervalEXT);
	GH_INTERCEPT(glXSwapIntervalSGI);
	GH_INTERCEPT(glXSwapIntervalMESA);
#ifdef GH_CONTEXT_TRACKING
	GH_INTERCEPT(glXCreateContext);
	GH_INTERCEPT(glXCreateNewContext);
	GH_INTERCEPT(glXCreateContextAttribsARB);
	GH_INTERCEPT(glXImportContextEXT);
	GH_INTERCEPT(glXCreateContextWithConfigSGIX);
	GH_INTERCEPT(glXDestroyContext);
	GH_INTERCEPT(glXFreeContextEXT);
	GH_INTERCEPT(glXMakeCurrent);
	GH_INTERCEPT(glXMakeContextCurrent);
	GH_INTERCEPT(glXMakeCurrentReadSGI);
	GH_INTERCEPT(glDebugMessageCallback);
	GH_INTERCEPT(glDebugMessageCallbackARB);
	GH_INTERCEPT(glDebugMessageCallbackKHR);
	GH_INTERCEPT(glDebugMessageCallbackAMD);
#endif
#ifdef GH_SWAPBUFFERS_INTERCEPT
	if (do_swapbuffers) {
		if (do_swapbuffers < 0) {
			do_swapbuffers =get_envi("GH_SWAPBUFFERS", 0) ||
					get_envi("GH_FRAMETIME", 0) ||
					get_envi("GH_SWAP_SLEEP_USECS", 0) ||
					(get_envi("GH_LATENCY", GH_LATENCY_NOP) != GH_LATENCY_NOP);
		}
		if (do_swapbuffers)
			GH_INTERCEPT(glXSwapBuffers);
	}
#endif
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpl $0x0, 0x3f29(%rip)      # 0x5224
jne 0x131b
leaq 0x2127(%rip), %rdi      # 0x342b
xorl %esi, %esi
callq 0x1f10
movl %eax, 0x3f0f(%rip)      # 0x5220
movl $0x1, 0x3f09(%rip)      # 0x5224
cmpl $0x0, 0x3efe(%rip)      # 0x5220
je 0x13ae
movq -0x10(%rbp), %rsi
leaq 0x1cf9(%rip), %rdi      # 0x302c
callq 0x10a0
cmpl $0x0, %eax
jne 0x13ac
leaq 0x3e3c(%rip), %rdi      # 0x5180
callq 0x1130
movq 0x3e58(%rip), %rax      # 0x51a8
cmpq $0x0, %rax
jne 0x1390
cmpq $0x0, -0x18(%rbp)
je 0x1390
leaq 0x1cc8(%rip), %rdi      # 0x302c
callq *-0x18(%rbp)
movq %rax, 0x3e3a(%rip)      # 0x51a8
movq -0x10(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq 0x3e2b(%rip), %r8       # 0x51a8
movl $0x4, %edi
leaq 0x20bc(%rip), %rsi      # 0x3445
movb $0x0, %al
callq 0x16c0
leaq 0x3de9(%rip), %rdi      # 0x5180
callq 0x10e0
movq 0x3c2d(%rip), %rax      # 0x4fd0
movq %rax, -0x8(%rbp)
jmp 0x1647
jmp 0x13ae
movq -0x10(%rbp), %rsi
leaq 0x1c9e(%rip), %rdi      # 0x3057
callq 0x10a0
cmpl $0x0, %eax
jne 0x1432
leaq 0x3db6(%rip), %rdi      # 0x5180
callq 0x1130
movq 0x3dda(%rip), %rax      # 0x51b0
cmpq $0x0, %rax
jne 0x1416
cmpq $0x0, -0x18(%rbp)
je 0x1416
leaq 0x1c6d(%rip), %rdi      # 0x3057
callq *-0x18(%rbp)
movq %rax, 0x3dbc(%rip)      # 0x51b0
movq -0x10(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq 0x3dad(%rip), %r8       # 0x51b0
movl $0x4, %edi
leaq 0x2036(%rip), %rsi      # 0x3445
movb $0x0, %al
callq 0x16c0
leaq 0x3d63(%rip), %rdi      # 0x5180
callq 0x10e0
movq 0x3b8f(%rip), %rax      # 0x4fb8
movq %rax, -0x8(%rbp)
jmp 0x1647
movq -0x10(%rbp), %rsi
leaq 0x1c4a(%rip), %rdi      # 0x3087
callq 0x10a0
cmpl $0x0, %eax
jne 0x14b6
leaq 0x3d32(%rip), %rdi      # 0x5180
callq 0x1130
movq 0x3d5e(%rip), %rax      # 0x51b8
cmpq $0x0, %rax
jne 0x149a
cmpq $0x0, -0x18(%rbp)
je 0x149a
leaq 0x1c19(%rip), %rdi      # 0x3087
callq *-0x18(%rbp)
movq %rax, 0x3d40(%rip)      # 0x51b8
movq -0x10(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq 0x3d31(%rip), %r8       # 0x51b8
movl $0x4, %edi
leaq 0x1fb2(%rip), %rsi      # 0x3445
movb $0x0, %al
callq 0x16c0
leaq 0x3cdf(%rip), %rdi      # 0x5180
callq 0x10e0
movq 0x3b3b(%rip), %rax      # 0x4fe8
movq %rax, -0x8(%rbp)
jmp 0x1647
movq -0x10(%rbp), %rsi
leaq 0x1bfc(%rip), %rdi      # 0x30bd
callq 0x10a0
cmpl $0x0, %eax
jne 0x153a
leaq 0x3cae(%rip), %rdi      # 0x5180
callq 0x1130
movq 0x3ce2(%rip), %rax      # 0x51c0
cmpq $0x0, %rax
jne 0x151e
cmpq $0x0, -0x18(%rbp)
je 0x151e
leaq 0x1bcb(%rip), %rdi      # 0x30bd
callq *-0x18(%rbp)
movq %rax, 0x3cc4(%rip)      # 0x51c0
movq -0x10(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq 0x3cb5(%rip), %r8       # 0x51c0
movl $0x4, %edi
leaq 0x1f2e(%rip), %rsi      # 0x3445
movb $0x0, %al
callq 0x16c0
leaq 0x3c5b(%rip), %rdi      # 0x5180
callq 0x10e0
movq 0x3a8f(%rip), %rax      # 0x4fc0
movq %rax, -0x8(%rbp)
jmp 0x1647
movq -0x10(%rbp), %rsi
leaq 0x1b8b(%rip), %rdi      # 0x30d0
callq 0x10a0
cmpl $0x0, %eax
jne 0x15be
leaq 0x3c2a(%rip), %rdi      # 0x5180
callq 0x1130
movq 0x3c66(%rip), %rax      # 0x51c8
cmpq $0x0, %rax
jne 0x15a2
cmpq $0x0, -0x18(%rbp)
je 0x15a2
leaq 0x1b5a(%rip), %rdi      # 0x30d0
callq *-0x18(%rbp)
movq %rax, 0x3c48(%rip)      # 0x51c8
movq -0x10(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq 0x3c39(%rip), %r8       # 0x51c8
movl $0x4, %edi
leaq 0x1eaa(%rip), %rsi      # 0x3445
movb $0x0, %al
callq 0x16c0
leaq 0x3bd7(%rip), %rdi      # 0x5180
callq 0x10e0
movq 0x39fb(%rip), %rax      # 0x4fb0
movq %rax, -0x8(%rbp)
jmp 0x1647
movq -0x10(%rbp), %rsi
leaq 0x1b58(%rip), %rdi      # 0x3121
callq 0x10a0
cmpl $0x0, %eax
jne 0x163f
leaq 0x3ba6(%rip), %rdi      # 0x5180
callq 0x1130
movq 0x3bea(%rip), %rax      # 0x51d0
cmpq $0x0, %rax
jne 0x1626
cmpq $0x0, -0x18(%rbp)
je 0x1626
leaq 0x1b27(%rip), %rdi      # 0x3121
callq *-0x18(%rbp)
movq %rax, 0x3bcc(%rip)      # 0x51d0
movq -0x10(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq 0x3bbd(%rip), %r8       # 0x51d0
movl $0x4, %edi
leaq 0x1e26(%rip), %rsi      # 0x3445
movb $0x0, %al
callq 0x16c0
leaq 0x3b53(%rip), %rdi      # 0x5180
callq 0x10e0
movq 0x399f(%rip), %rax      # 0x4fd8
movq %rax, -0x8(%rbp)
jmp 0x1647
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)