// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/polymost.c
// Function: polymost_loadshaders
static void polymost_loadshaders(void)
{
	extern const char default_polymost_fs_glsl[];
	extern const char default_polymost_vs_glsl[];

	extern const char default_polymostaux_fs_glsl[];
	extern const char default_polymostaux_vs_glsl[];

	GLuint shader[2] = {0,0};

	// General texture rendering shader.
	if (polymostglsl.program) {
		glfunc.glDeleteProgram(polymostglsl.program);
		polymostglsl.program = 0;
	}

	shader[0] = polymost_load_shader(GL_VERTEX_SHADER, default_polymost_vs_glsl, "polymost_vs.glsl");
	shader[1] = polymost_load_shader(GL_FRAGMENT_SHADER, default_polymost_fs_glsl, "polymost_fs.glsl");
	if (shader[0] && shader[1]) {
		polymostglsl.program = glbuild_link_program(2, shader);
	}
	if (shader[0]) glfunc.glDeleteShader(shader[0]);
	if (shader[1]) glfunc.glDeleteShader(shader[1]);

	if (polymostglsl.program) {
		polymostglsl.attrib_vertex       = polymost_get_attrib(polymostglsl.program, "a_vertex");
		polymostglsl.attrib_texcoord     = polymost_get_attrib(polymostglsl.program, "a_texcoord");
		polymostglsl.uniform_modelview   = polymost_get_uniform(polymostglsl.program, "u_modelview");
		polymostglsl.uniform_projection  = polymost_get_uniform(polymostglsl.program, "u_projection");
		polymostglsl.uniform_texture     = polymost_get_uniform(polymostglsl.program, "u_texture");
		polymostglsl.uniform_glowtexture = polymost_get_uniform(polymostglsl.program, "u_glowtexture");
		polymostglsl.uniform_alphacut    = polymost_get_uniform(polymostglsl.program, "u_alphacut");
		polymostglsl.uniform_colour      = polymost_get_uniform(polymostglsl.program, "u_colour");
		polymostglsl.uniform_fogcolour   = polymost_get_uniform(polymostglsl.program, "u_fogcolour");
		polymostglsl.uniform_fogdensity  = polymost_get_uniform(polymostglsl.program, "u_fogdensity");
		polymostglsl.uniform_gamma       = polymost_get_uniform(polymostglsl.program, "u_gamma");

#if (USE_OPENGL == USE_GL3)
		glfunc.glGenVertexArrays(1, &polymostglsl.vao);
        glfunc.glBindVertexArray(polymostglsl.vao);
        glfunc.glEnableVertexAttribArray(polymostglsl.attrib_vertex);
        glfunc.glEnableVertexAttribArray(polymostglsl.attrib_texcoord);
#endif

		glfunc.glUseProgram(polymostglsl.program);
		glfunc.glUniform1i(polymostglsl.uniform_texture, 0);		//GL_TEXTURE0
		glfunc.glUniform1i(polymostglsl.uniform_glowtexture, 1);	//GL_TEXTURE1

		// Generate a buffer object for vertex/colour elements.
		glfunc.glGenBuffers(1, &polymostglsl.elementbuffer);
	}

	// A fully transparent texture for the case when a glow texture is not needed.
	if (!nulltexture) {
		const char pix[4] = {0,0,0,0};
		glfunc.glGenTextures(1, &nulltexture);
		glfunc.glBindTexture(GL_TEXTURE_2D, nulltexture);
		glfunc.glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,1,1,0,GL_RGBA,GL_UNSIGNED_BYTE,(GLvoid*)&pix);
		glfunc.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
		glfunc.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
	}

	// Engine auxiliary shader.
	if (polymostauxglsl.program) {
		glfunc.glDeleteProgram(polymostauxglsl.program);
		polymostauxglsl.program = 0;
	}

	shader[0] = polymost_load_shader(GL_VERTEX_SHADER, default_polymostaux_vs_glsl, "polymostaux_vs.glsl");
	shader[1] = polymost_load_shader(GL_FRAGMENT_SHADER, default_polymostaux_fs_glsl, "polymostaux_fs.glsl");
	if (shader[0] && shader[1]) {
		polymostauxglsl.program = glbuild_link_program(2, shader);
	}
	if (shader[0]) glfunc.glDeleteShader(shader[0]);
	if (shader[1]) glfunc.glDeleteShader(shader[1]);

	if (polymostauxglsl.program) {
		polymostauxglsl.attrib_vertex    = polymost_get_attrib(polymostauxglsl.program, "a_vertex");
		polymostauxglsl.attrib_texcoord  = polymost_get_attrib(polymostauxglsl.program, "a_texcoord");
		polymostauxglsl.uniform_projection = polymost_get_uniform(polymostauxglsl.program, "u_projection");
		polymostauxglsl.uniform_texture  = polymost_get_uniform(polymostauxglsl.program, "u_texture");
		polymostauxglsl.uniform_colour   = polymost_get_uniform(polymostauxglsl.program, "u_colour");
		polymostauxglsl.uniform_bgcolour = polymost_get_uniform(polymostauxglsl.program, "u_bgcolour");
		polymostauxglsl.uniform_mode     = polymost_get_uniform(polymostauxglsl.program, "u_mode");
		polymostauxglsl.uniform_gamma    = polymost_get_uniform(polymostauxglsl.program, "u_gamma");

#if (USE_OPENGL == USE_GL3)
		glfunc.glGenVertexArrays(1, &polymostauxglsl.vao);
        glfunc.glBindVertexArray(polymostauxglsl.vao);
        glfunc.glEnableVertexAttribArray(polymostauxglsl.attrib_vertex);
        glfunc.glEnableVertexAttribArray(polymostauxglsl.attrib_texcoord);
#endif

		glfunc.glUseProgram(polymostauxglsl.program);
		glfunc.glUniform1i(polymostauxglsl.uniform_texture, 0);	//GL_TEXTURE0

		// Generate a buffer object for vertex/colour elements and pre-allocate its memory.
		glfunc.glGenBuffers(1, &polymostauxglsl.elementbuffer);

		// Generate a buffer object for ad-hoc indexes.
		glfunc.glGenBuffers(1, &polymostauxglsl.indexbuffer);
	}

	// Generate a buffer object for element indexes and populate it with an
	// initial set of ascending indices, the way drawpoly() will generate points.
	glfunc.glGenBuffers(1, &elementindexbuffer);
	checkindexbuffer(MINVBOINDEXES);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x62d0
cmpl $0x0, 0x57ad21(%rip)    # 0x5ed9b0
je 0x72cb1
leaq 0x57aa78(%rip), %rax    # 0x5ed710
movq 0x168(%rax), %rax
movl 0x57ad0b(%rip), %edi    # 0x5ed9b0
callq *%rax
movl $0x0, 0x57acff(%rip)    # 0x5ed9b0
movl $0x8b31, %edi           # imm = 0x8B31
leaq 0x44a63(%rip), %rsi     # 0xb7720
leaq 0x440b9(%rip), %rdx     # 0xb6d7d
callq 0x8c1b0
movl %eax, -0x8(%rbp)
movl $0x8b30, %edi           # imm = 0x8B30
leaq 0x44568(%rip), %rsi     # 0xb7240
leaq 0x440af(%rip), %rdx     # 0xb6d8e
callq 0x8c1b0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x72d07
cmpl $0x0, -0x4(%rbp)
je 0x72d07
leaq -0x8(%rbp), %rsi
movl $0x2, %edi
callq 0x71490
movl %eax, 0x57aca9(%rip)    # 0x5ed9b0
cmpl $0x0, -0x8(%rbp)
je 0x72d20
leaq 0x57a9fc(%rip), %rax    # 0x5ed710
movq 0x170(%rax), %rax
movl -0x8(%rbp), %edi
callq *%rax
cmpl $0x0, -0x4(%rbp)
je 0x72d39
leaq 0x57a9e3(%rip), %rax    # 0x5ed710
movq 0x170(%rax), %rax
movl -0x4(%rbp), %edi
callq *%rax
cmpl $0x0, 0x57ac70(%rip)    # 0x5ed9b0
je 0x72eb4
movl 0x57ac64(%rip), %edi    # 0x5ed9b0
leaq 0x42e98(%rip), %rsi     # 0xb5beb
callq 0x8c2d0
movl %eax, 0x57ac5a(%rip)    # 0x5ed9b8
movl 0x57ac4c(%rip), %edi    # 0x5ed9b0
leaq 0x42e89(%rip), %rsi     # 0xb5bf4
callq 0x8c2d0
movl %eax, 0x57ac46(%rip)    # 0x5ed9bc
movl 0x57ac34(%rip), %edi    # 0x5ed9b0
leaq 0x4401c(%rip), %rsi     # 0xb6d9f
callq 0x8c320
movl %eax, 0x57ac32(%rip)    # 0x5ed9c0
movl 0x57ac1c(%rip), %edi    # 0x5ed9b0
leaq 0x44010(%rip), %rsi     # 0xb6dab
callq 0x8c320
movl %eax, 0x57ac1e(%rip)    # 0x5ed9c4
movl 0x57ac04(%rip), %edi    # 0x5ed9b0
leaq 0x44005(%rip), %rsi     # 0xb6db8
callq 0x8c320
movl %eax, 0x57ac0a(%rip)    # 0x5ed9c8
movl 0x57abec(%rip), %edi    # 0x5ed9b0
leaq 0x43ff7(%rip), %rsi     # 0xb6dc2
callq 0x8c320
movl %eax, 0x57abf6(%rip)    # 0x5ed9cc
movl 0x57abd4(%rip), %edi    # 0x5ed9b0
leaq 0x43fed(%rip), %rsi     # 0xb6dd0
callq 0x8c320
movl %eax, 0x57abe2(%rip)    # 0x5ed9d0
movl 0x57abbc(%rip), %edi    # 0x5ed9b0
leaq 0x43fe0(%rip), %rsi     # 0xb6ddb
callq 0x8c320
movl %eax, 0x57abce(%rip)    # 0x5ed9d4
movl 0x57aba4(%rip), %edi    # 0x5ed9b0
leaq 0x43fd1(%rip), %rsi     # 0xb6de4
callq 0x8c320
movl %eax, 0x57abba(%rip)    # 0x5ed9d8
movl 0x57ab8c(%rip), %edi    # 0x5ed9b0
leaq 0x43fc5(%rip), %rsi     # 0xb6df0
callq 0x8c320
movl %eax, 0x57aba6(%rip)    # 0x5ed9dc
movl 0x57ab74(%rip), %edi    # 0x5ed9b0
leaq 0x42dbc(%rip), %rsi     # 0xb5bff
callq 0x8c320
movl %eax, 0x57ab92(%rip)    # 0x5ed9e0
leaq 0x57a8bb(%rip), %rax    # 0x5ed710
movq 0x1f0(%rax), %rax
movl 0x57ab4e(%rip), %edi    # 0x5ed9b0
callq *%rax
leaq 0x57a8a5(%rip), %rax    # 0x5ed710
movq 0x1c0(%rax), %rax
movl 0x57ab50(%rip), %edi    # 0x5ed9c8
xorl %esi, %esi
callq *%rax
leaq 0x57a88d(%rip), %rax    # 0x5ed710
movq 0x1c0(%rax), %rax
movl 0x57ab3c(%rip), %edi    # 0x5ed9cc
movl $0x1, %esi
callq *%rax
movl $0x1, %edi
leaq 0x57ab09(%rip), %rsi    # 0x5ed9ac
addq $0x8, %rsi
leaq 0x57a862(%rip), %rax    # 0x5ed710
callq *0x118(%rax)
cmpl $0x0, 0x57ab5d(%rip)    # 0x5eda18
jne 0x72f7b
leaq -0xc(%rbp), %rdi
xorl %esi, %esi
movl $0x4, %edx
callq 0x62d0
movl $0x1, %edi
leaq 0x57ab3b(%rip), %rsi    # 0x5eda18
leaq 0x57a82c(%rip), %rax    # 0x5ed710
callq *0xb8(%rax)
leaq 0x57a81f(%rip), %rax    # 0x5ed710
movq 0xc8(%rax), %rax
movl 0x57ab1a(%rip), %esi    # 0x5eda18
movl $0xde1, %edi            # imm = 0xDE1
callq *%rax
movl $0xde1, %edi            # imm = 0xDE1
xorl %r9d, %r9d
movl $0x1908, %edx           # imm = 0x1908
movl $0x1, %r8d
leaq -0xc(%rbp), %r10
leaq 0x57a7ed(%rip), %rax    # 0x5ed710
movl %r9d, %esi
movl %r8d, %ecx
movl $0x1908, (%rsp)         # imm = 0x1908
movl $0x1401, 0x8(%rsp)      # imm = 0x1401
movq %r10, 0x10(%rsp)
callq *0xd0(%rax)
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2800, %esi           # imm = 0x2800
movl $0x2600, %edx           # imm = 0x2600
leaq 0x57a7b7(%rip), %rax    # 0x5ed710
callq *0xe8(%rax)
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2801, %esi           # imm = 0x2801
movl $0x2600, %edx           # imm = 0x2600
leaq 0x57a79b(%rip), %rax    # 0x5ed710
callq *0xe8(%rax)
cmpl $0x0, 0x57aa66(%rip)    # 0x5ed9e8
je 0x72fa4
leaq 0x57a785(%rip), %rax    # 0x5ed710
movq 0x168(%rax), %rax
movl 0x57aa50(%rip), %edi    # 0x5ed9e8
callq *%rax
movl $0x0, 0x57aa44(%rip)    # 0x5ed9e8
movl $0x8b31, %edi           # imm = 0x8B31
leaq 0x44d40(%rip), %rsi     # 0xb7cf0
leaq 0x43e46(%rip), %rdx     # 0xb6dfd
callq 0x8c1b0
movl %eax, -0x8(%rbp)
movl $0x8b30, %edi           # imm = 0x8B30
leaq 0x44935(%rip), %rsi     # 0xb7900
leaq 0x43e3f(%rip), %rdx     # 0xb6e11
callq 0x8c1b0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x72ffa
cmpl $0x0, -0x4(%rbp)
je 0x72ffa
leaq -0x8(%rbp), %rsi
movl $0x2, %edi
callq 0x71490
movl %eax, 0x57a9ee(%rip)    # 0x5ed9e8
cmpl $0x0, -0x8(%rbp)
je 0x73013
leaq 0x57a709(%rip), %rax    # 0x5ed710
movq 0x170(%rax), %rax
movl -0x8(%rbp), %edi
callq *%rax
cmpl $0x0, -0x4(%rbp)
je 0x7302c
leaq 0x57a6f0(%rip), %rax    # 0x5ed710
movq 0x170(%rax), %rax
movl -0x4(%rbp), %edi
callq *%rax
cmpl $0x0, 0x57a9b5(%rip)    # 0x5ed9e8
je 0x73161
movl 0x57a9a9(%rip), %edi    # 0x5ed9e8
leaq 0x42ba5(%rip), %rsi     # 0xb5beb
callq 0x8c2d0
movl %eax, 0x57a9a3(%rip)    # 0x5ed9f4
movl 0x57a991(%rip), %edi    # 0x5ed9e8
leaq 0x42b96(%rip), %rsi     # 0xb5bf4
callq 0x8c2d0
movl %eax, 0x57a98f(%rip)    # 0x5ed9f8
movl 0x57a979(%rip), %edi    # 0x5ed9e8
leaq 0x43d35(%rip), %rsi     # 0xb6dab
callq 0x8c320
movl %eax, 0x57a97b(%rip)    # 0x5ed9fc
movl 0x57a961(%rip), %edi    # 0x5ed9e8
leaq 0x43d2a(%rip), %rsi     # 0xb6db8
callq 0x8c320
movl %eax, 0x57a967(%rip)    # 0x5eda00
movl 0x57a949(%rip), %edi    # 0x5ed9e8
leaq 0x43d35(%rip), %rsi     # 0xb6ddb
callq 0x8c320
movl %eax, 0x57a953(%rip)    # 0x5eda04
movl 0x57a931(%rip), %edi    # 0x5ed9e8
leaq 0x43d67(%rip), %rsi     # 0xb6e25
callq 0x8c320
movl %eax, 0x57a93f(%rip)    # 0x5eda08
movl 0x57a919(%rip), %edi    # 0x5ed9e8
leaq 0x43d5a(%rip), %rsi     # 0xb6e30
callq 0x8c320
movl %eax, 0x57a92b(%rip)    # 0x5eda0c
movl 0x57a901(%rip), %edi    # 0x5ed9e8
leaq 0x42b11(%rip), %rsi     # 0xb5bff
callq 0x8c320
movl %eax, 0x57a917(%rip)    # 0x5eda10
leaq 0x57a610(%rip), %rax    # 0x5ed710
movq 0x1f0(%rax), %rax
movl 0x57a8db(%rip), %edi    # 0x5ed9e8
callq *%rax
leaq 0x57a5fa(%rip), %rax    # 0x5ed710
movq 0x1c0(%rax), %rax
movl 0x57a8dd(%rip), %edi    # 0x5eda00
xorl %esi, %esi
callq *%rax
movl $0x1, %edi
leaq 0x57a8b1(%rip), %rsi    # 0x5ed9e4
addq $0x8, %rsi
leaq 0x57a5d2(%rip), %rax    # 0x5ed710
callq *0x118(%rax)
movl $0x1, %edi
leaq 0x57a894(%rip), %rsi    # 0x5ed9e4
addq $0xc, %rsi
leaq 0x57a5b5(%rip), %rax    # 0x5ed710
callq *0x118(%rax)
movl $0x1, %edi
leaq 0x57a837(%rip), %rsi    # 0x5ed9a4
leaq 0x57a59c(%rip), %rax    # 0x5ed710
callq *0x118(%rax)
movl $0x10, %edi
callq 0x73910
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)