// File: /workspace/github_c_makefile_star2_O2/derhass[P]glx_hook/glx_hook.c
// Function: create_context
static void
create_context(GLXContext ctx)
{
	gl_context_t *glc;
	unsigned int ctx_num;

	GH_verbose(GH_MSG_DEBUG, "created ctx %p\n",ctx);

	pthread_mutex_lock(&ctx_mutex);
	ctx_num=ctx_counter++;
	if (!ctx_num) {
		pthread_key_create(&ctx_current, NULL);
		pthread_setspecific(ctx_current, NULL);
		/* query the function pointers for the standard functions
		 * which might be often called ... */
		GH_GET_PTR_GL(glXSwapBuffers);
		GH_GET_PTR_GL(glXMakeCurrent);
		GH_GET_PTR_GL(glXMakeContextCurrent);
		GH_GET_PTR_GL(glXMakeCurrentReadSGI);
		GH_GET_PTR_GL(glFlush);
		GH_GET_PTR_GL(glFinish);
	}
	pthread_mutex_unlock(&ctx_mutex);
	
	glc=create_ctx(ctx, ctx_num);
	if (glc) {
		read_config(glc);
		/* add to our list */
		add_ctx(glc);
	} else {
		GH_verbose(GH_MSG_ERROR, "out of memory\n");
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x4264(%rip), %rsi      # 0x7ce9
pushq $0x4
popq %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2c49
leaq 0x77f7(%rip), %rdi      # 0xb290
callq 0x21a0
movl 0x7813(%rip), %r15d     # 0xb2b8
leal 0x1(%r15), %eax
movl %eax, 0x7809(%rip)      # 0xb2b8
testl %r15d, %r15d
jne 0x3c0c
leaq 0x7749(%rip), %rdi      # 0xb208
xorl %esi, %esi
callq 0x20c0
movl 0x773c(%rip), %edi      # 0xb208
xorl %esi, %esi
callq 0x21b0
leaq 0x7696(%rip), %rdi      # 0xb170
callq 0x21a0
cmpq $0x0, 0x7759(%rip)      # 0xb240
jne 0x3afc
leaq 0x3855(%rip), %rdi      # 0x7345
callq 0x3991
movq %rax, 0x7744(%rip)      # 0xb240
leaq 0x766d(%rip), %rbx      # 0xb170
movq %rbx, %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x21a0
cmpq $0x0, 0x76cd(%rip)      # 0xb1e8
jne 0x3b30
leaq 0x41d5(%rip), %rdi      # 0x7cf9
callq 0x3991
movq %rax, 0x76b8(%rip)      # 0xb1e8
leaq 0x7639(%rip), %rbx      # 0xb170
movq %rbx, %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x21a0
cmpq $0x0, 0x76a1(%rip)      # 0xb1f0
jne 0x3b64
leaq 0x41b0(%rip), %rdi      # 0x7d08
callq 0x3991
movq %rax, 0x768c(%rip)      # 0xb1f0
leaq 0x7605(%rip), %rbx      # 0xb170
movq %rbx, %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x21a0
cmpq $0x0, 0x7675(%rip)      # 0xb1f8
jne 0x3b98
leaq 0x4192(%rip), %rdi      # 0x7d1e
callq 0x3991
movq %rax, 0x7660(%rip)      # 0xb1f8
leaq 0x75d1(%rip), %rbx      # 0xb170
movq %rbx, %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x21a0
cmpq $0x0, 0x7709(%rip)      # 0xb2c0
jne 0x3bcc
leaq 0x4174(%rip), %rdi      # 0x7d34
callq 0x3991
movq %rax, 0x76f4(%rip)      # 0xb2c0
leaq 0x759d(%rip), %rbx      # 0xb170
movq %rbx, %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x21a0
cmpq $0x0, 0x76dd(%rip)      # 0xb2c8
jne 0x3c00
leaq 0x4148(%rip), %rdi      # 0x7d3c
callq 0x3991
movq %rax, 0x76c8(%rip)      # 0xb2c8
leaq 0x7569(%rip), %rdi      # 0xb170
callq 0x2120
leaq 0x767d(%rip), %rdi      # 0xb290
callq 0x2120
movl $0x838, %edi            # imm = 0x838
callq 0x2130
testq %rax, %rax
je 0x3da3
movq %rax, %rbx
movq %r14, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movabsq $-0x7ffffffffffffffe, %rax # imm = 0x8000000000000002
movq %rax, 0x18(%rbx)
movl %r15d, 0x20(%rbx)
andl $0x0, 0x810(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x3c(%rbx)
andq $0x0, 0x60(%rbx)
leaq 0x68(%rbx), %rdi
movups %xmm0, 0x50(%rbx)
movups %xmm0, 0x818(%rbx)
movups %xmm0, 0x828(%rbx)
pushq $-0x2
popq %rsi
xorl %edx, %edx
movl $0xf4240, %ecx          # imm = 0xF4240
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x5f32
leaq 0x438e(%rip), %rdi      # 0x801e
xorl %esi, %esi
callq 0x5c27
movl %eax, %ebp
leaq 0x4390(%rip), %rdi      # 0x8030
xorl %esi, %esi
callq 0x5c27
movl %eax, 0x98(%rbx)
andq $0x0, 0xb8(%rbx)
testl %ebp, %ebp
jle 0x3cd3
movl $0x1, 0x98(%rbx)
movl %ebp, %eax
imulq $0x3e8, %rax, %rax      # imm = 0x3E8
movq %rax, 0xb8(%rbx)
leaq 0x4365(%rip), %rdi      # 0x803f
xorl %esi, %esi
callq 0x5c27
movl %eax, 0xa0(%rbx)
leaq 0x436a(%rip), %rdi      # 0x8058
pushq $0x1
popq %rbp
movl %ebp, %esi
callq 0x5c27
movl %eax, 0xa4(%rbx)
leaq 0x436a(%rip), %rdi      # 0x806f
pushq $0x3
popq %rsi
callq 0x5c27
movl %eax, 0xa8(%rbx)
leaq 0x436e(%rip), %rdi      # 0x8088
movl %ebp, %esi
callq 0x5c27
movl %eax, %r14d
movl %eax, 0xac(%rbx)
leaq 0x436c(%rip), %rdi      # 0x809d
pushq $0x4
popq %rsi
callq 0x5c27
movl %eax, 0xb0(%rbx)
testl %r14d, %r14d
jg 0x3d52
movl $0x1, 0xac(%rbx)
pushq $0x1
popq %r14
cmpl %r14d, %eax
jge 0x3d5e
movl %r14d, 0xb0(%rbx)
andl $0x0, 0x9c(%rbx)
andl $0x0, 0x800(%rbx)
leaq 0x433f(%rip), %rdi      # 0x80b2
pushq $0x6
popq %rsi
callq 0x6227
movl %eax, %r14d
movl %eax, 0x804(%rbx)
leaq 0x4344(%rip), %rdi      # 0x80cf
pushq $0x4
popq %rsi
callq 0x6227
movl %eax, 0x808(%rbx)
cmpl $0x10, %r14d
jbe 0x3dbe
pushq $0x10
jmp 0x3dc6
leaq 0x3dce(%rip), %rsi      # 0x7b78
pushq $0x1
popq %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2c49
cmpl $0x1, %r14d
ja 0x3dcf
pushq $0x2
popq %r14
movl %r14d, 0x804(%rbx)
cmpl %r14d, %eax
jae 0x3dda
testl %eax, %eax
jne 0x3de6
jmp 0x3de0
decl %r14d
movl %r14d, %ebp
movl %ebp, 0x808(%rbx)
leaq 0x4c0(%rbx), %rax
movq %rbx, %rcx
addq $0x7c0, %rcx            # imm = 0x7C0
pushq $0x38
popq %rdx
xorps %xmm0, %xmm0
cmpq $0x138, %rdx            # imm = 0x138
je 0x3e38
movups %xmm0, -0x14(%rbx,%rdx,4)
movups %xmm0, -0x20(%rbx,%rdx,4)
movups %xmm0, (%rbx,%rdx,4)
movups %xmm0, 0xc(%rbx,%rdx,4)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movl $0x1, (%rcx)
addq $0x4, %rcx
addq $0x30, %rax
addq $0x10, %rdx
jmp 0x3dfd
leaq 0x42ad(%rip), %rdi      # 0x80ec
movl $0x80000000, %esi       # imm = 0x80000000
callq 0x5c27
movl %eax, 0x1c(%rbx)
leaq 0x42b0(%rip), %rdi      # 0x8103
xorl %esi, %esi
callq 0x5c27
testl %eax, %eax
je 0x3e62
orb $0x4, 0x18(%rbx)
leaq 0x42ad(%rip), %rdi      # 0x8116
xorl %esi, %esi
callq 0x5c27
testl %eax, %eax
je 0x3e78
orb $0x8, 0x18(%rbx)
leaq 0x7411(%rip), %r14      # 0xb290
movq %r14, %rdi
callq 0x21a0
movq 0x7482(%rip), %rax      # 0xb310
movq %rax, 0x28(%rbx)
movq %rbx, 0x7477(%rip)      # 0xb310
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2120