// File: /workspace/github_cpp_makefile_star2_O1/gatecat[P]subprime/subprime.cpp
// Function: (anonymous namespace)::glx_choose_fb_config(_XDisplay*, int, int const*, int*)
GLXFBConfig *glx_choose_fb_config(Display *dpy, int screen, const int *attrib_list, int *nelements) {
	SP_TRACE("");
	auto conv_attrs = convert_attribute_list(attrib_list);
	std::array<EGLConfig, 256> configs_out;
	int config_count = 0;
	SP_CHECK(fn_eglChooseConfig(disp(), conv_attrs.data(), configs_out.data(), 256, &config_count));

	GLXFBConfig *result = reinterpret_cast<GLXFBConfig*>(malloc(sizeof(GLXFBConfig) * config_count));
	SP_TRACE("count=%d", config_count);
	for (int i = 0; i < config_count; i++) {
		config_store.emplace_back(std::make_unique<EGLConfig>(configs_out.at(i)));
		result[i] = reinterpret_cast<GLXFBConfig>(config_store.back().get());
	}

	*nelements = config_count;

	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x838, %rsp            # imm = 0x838
movq %rcx, 0x30(%rsp)
movq %rdx, %r14
cmpb $0x1, 0x720b(%rip)      # 0xd398
je 0x63fc
movabsq $0x100003033, %rax      # imm = 0x100003033
leaq 0x38(%rsp), %r15
movq %rax, (%r15)
leaq 0x18(%rsp), %r12
leaq 0x10(%rsp), %rcx
movl $0x2, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x4510
xorl %ebx, %ebx
leal 0x1(%rbx), %eax
movslq %ebx, %rcx
movslq (%r14,%rcx,4), %r13
testq %r13, %r13
je 0x62b0
cltq
movl (%r14,%rax,4), %eax
movl %eax, 0x38(%rsp)
movq 0x70f3(%rip), %rdi      # 0xd2d8
movq %r13, %rax
xorl %edx, %edx
divq %rdi
movq %rdx, %rcx
movq 0x70d9(%rip), %rax      # 0xd2d0
movq (%rax,%rdx,8), %rdx
movl $0x0, %eax
testq %rdx, %rdx
je 0x623e
movq (%rdx), %r8
movq %rdx, %rax
cmpl 0x8(%r8), %r13d
je 0x623e
movq %r8, %r9
movq (%r8), %r8
testq %r8, %r8
je 0x623c
movslq 0x8(%r8), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %rdi
movl $0x0, %eax
cmpq %rcx, %rdx
jne 0x623e
movq %r9, %rax
cmpl %esi, %r13d
jne 0x6211
jmp 0x623e
xorl %eax, %eax
testq %rax, %rax
je 0x6248
movq (%rax), %rbp
jmp 0x624a
xorl %ebp, %ebp
cmpb $0x1, 0x7147(%rip)      # 0xd398
je 0x62bd
testq %rbp, %rbp
je 0x62ab
addq $0xc, %rbp
movq 0x20(%rsp), %rsi
cmpq 0x28(%rsp), %rsi
je 0x6278
movl (%rbp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x20(%rsp)
jmp 0x6283
movq %r12, %rdi
movq %rbp, %rdx
callq 0x40f0
movq 0x20(%rsp), %rsi
cmpq 0x28(%rsp), %rsi
je 0x62a0
movl 0x38(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x20(%rsp)
jmp 0x62ab
movq %r12, %rdi
movq %r15, %rdx
callq 0x40f0
addl $0x2, %ebx
movl %ebx, %eax
movl %eax, %ebx
testl %r13d, %r13d
jne 0x61c1
jmp 0x62ca
movq %r15, %rdi
movl %r13d, %esi
callq 0x4923
jmp 0x6253
movl $0x3038, 0x38(%rsp)     # imm = 0x3038
movq 0x20(%rsp), %rsi
cmpq 0x28(%rsp), %rsi
je 0x62ef
movl $0x3038, (%rsi)         # imm = 0x3038
addq $0x4, %rsi
movq %rsi, 0x20(%rsp)
jmp 0x62fe
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x4430
movl $0x0, 0xc(%rsp)
movq 0x715b(%rip), %rbx      # 0xd468
callq 0x6ca2
movq 0x18(%rsp), %rsi
leaq 0x38(%rsp), %rdx
leaq 0xc(%rsp), %r8
movq %rax, %rdi
movl $0x100, %ecx            # imm = 0x100
callq *%rbx
movl %eax, %ebp
cmpl $0x1, %eax
jne 0x642d
movslq 0xc(%rsp), %rdi
shlq $0x3, %rdi
callq 0x4330
movq %rax, %r14
cmpb $0x1, 0x704a(%rip)      # 0xd398
je 0x6406
movl 0xc(%rsp), %eax
testl %eax, %eax
jle 0x63c9
xorl %ebx, %ebx
leaq 0x6fdb(%rip), %r15      # 0xd340
leaq 0x10(%rsp), %r12
cmpq $0x100, %rbx            # imm = 0x100
je 0x6415
movl $0x8, %edi
callq 0x4280
movq 0x38(%rsp,%rbx,8), %rcx
movq %rcx, (%rax)
movq %rax, 0x10(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x4340
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x63ad
movl $0x8, %esi
callq 0x42a0
movq 0x6f94(%rip), %rax      # 0xd348
movq -0x8(%rax), %rax
movq %rax, (%r14,%rbx,8)
incq %rbx
movslq 0xc(%rsp), %rax
cmpq %rax, %rbx
jl 0x636a
movq 0x30(%rsp), %rcx
movl %eax, (%rcx)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x63e7
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq %r14, %rax
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x48f7
jmp 0x6193
leaq 0xc(%rsp), %rdi
callq 0x4973
jmp 0x6354
leaq 0x34a1(%rip), %rdi      # 0x98bd
movl $0x100, %esi            # imm = 0x100
movl $0x100, %edx            # imm = 0x100
xorl %eax, %eax
callq 0x4400
movq 0x6bac(%rip), %rax      # 0xcfe0
movq (%rax), %rbx
callq *0x7043(%rip)           # 0xd480
leaq 0x3050(%rip), %rsi      # 0x9494
leaq 0x33d6(%rip), %rdx      # 0x9821
movq %rbx, %rdi
movl %ebp, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x4380
callq 0x40a0
jmp 0x6489
jmp 0x6489
jmp 0x6489
jmp 0x6489
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x647e
movl $0x8, %esi
callq 0x42a0
movq $0x0, 0x10(%rsp)
jmp 0x648c
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x64a3
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq %rbx, %rdi
callq 0x44d0