// File: /workspace/github_cpp_makefile_star2_O3/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, 0x721c(%rip)      # 0xd398
je 0x63a3
movabsq $0x100003033, %rax      # imm = 0x100003033
leaq 0x38(%rsp), %rbx
movq %rax, (%rbx)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rcx
movl $0x2, %edx
movq %rbx, %rsi
callq 0x4510
movl (%r14), %eax
movl %eax, (%rbx)
testl %eax, %eax
je 0x6270
addq $0x8, %r14
leaq 0x710d(%rip), %r15      # 0xd2d0
leaq 0x38(%rsp), %r12
leaq 0x10(%rsp), %r13
leaq 0x18(%rsp), %rbp
movl -0x4(%r14), %eax
movl %eax, 0x10(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x42f0
movq %rax, %rbx
cmpb $0x1, 0x71a9(%rip)      # 0xd398
je 0x6263
testq %rbx, %rbx
je 0x624e
addq $0xc, %rbx
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rax
cmpq %rax, %rsi
je 0x6218
movl (%rbx), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x20(%rsp)
jmp 0x622d
movq %rbp, %rdi
movq %rbx, %rdx
callq 0x40f0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rax
cmpq %rax, %rsi
je 0x6243
movl 0x10(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x20(%rsp)
jmp 0x624e
movq %rbp, %rdi
movq %r13, %rdx
callq 0x40f0
movl (%r14), %eax
movl %eax, 0x38(%rsp)
addq $0x8, %r14
testl %eax, %eax
jne 0x61d2
jmp 0x6270
movq %r12, %rdi
movq %r13, %rsi
callq 0x4923
jmp 0x61f1
movl $0x3038, 0x38(%rsp)     # imm = 0x3038
movq 0x20(%rsp), %rsi
cmpq 0x28(%rsp), %rsi
je 0x6295
movl $0x3038, (%rsi)         # imm = 0x3038
addq $0x4, %rsi
movq %rsi, 0x20(%rsp)
jmp 0x62a4
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x4440
movl $0x0, 0xc(%rsp)
movq 0x71b5(%rip), %rbx      # 0xd468
callq 0x6bef
movq 0x18(%rsp), %rsi
leaq 0x38(%rsp), %rdx
leaq 0xc(%rsp), %r8
movq %rax, %rdi
movl $0x100, %ecx            # imm = 0x100
callq *%rbx
movl %eax, %ebx
cmpl $0x1, %eax
jne 0x63df
movslq 0xc(%rsp), %r13
movq %r13, %rdi
shlq $0x3, %rdi
callq 0x4340
movq %rax, %r14
cmpb $0x1, 0x70a1(%rip)      # 0xd398
je 0x63ad
testl %r13d, %r13d
jle 0x636f
xorl %ebx, %ebx
leaq 0x7035(%rip), %r15      # 0xd340
leaq 0x10(%rsp), %r12
cmpq $0x100, %rbx            # imm = 0x100
je 0x63c7
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 0x4350
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6353
movl $0x8, %esi
callq 0x42a0
movq 0x6fee(%rip), %rax      # 0xd348
movq -0x8(%rax), %rax
movq %rax, (%r14,%rbx,8)
incq %rbx
movslq 0xc(%rsp), %r13
cmpq %r13, %rbx
jl 0x6310
movq 0x30(%rsp), %rax
movl %r13d, (%rax)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x638e
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 0x6182
leaq 0xc(%rsp), %rdi
leaq 0x10(%rsp), %rbx
movq %rbx, %rsi
callq 0x4974
movl (%rbx), %r13d
jmp 0x62fd
leaq 0x34ef(%rip), %rdi      # 0x98bd
movl $0x100, %esi            # imm = 0x100
movl $0x100, %edx            # imm = 0x100
xorl %eax, %eax
callq 0x4410
movq 0x6bfa(%rip), %rax      # 0xcfe0
movq (%rax), %r14
callq *0x7091(%rip)           # 0xd480
leaq 0x309e(%rip), %rsi      # 0x9494
leaq 0x3424(%rip), %rdx      # 0x9821
movq %r14, %rdi
movl %ebx, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x4390
callq 0x40a0
jmp 0x6432
jmp 0x6432
jmp 0x6432
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6435
movl $0x8, %esi
callq 0x42a0
jmp 0x6435
jmp 0x6432
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x644c
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq %rbx, %rdi
callq 0x44e0