// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/polymosttex.c
// Function: ptm_uploadtexture
static void ptm_uploadtexture(PTMHead * ptm, unsigned short flags, PTTexture * tex, PTCacheTile * tdef)
{
	GLint mipmap;
	GLint intexfmt;
	int compress = PTCOMPRESS_NONE;
	unsigned char * comprdata = 0;
	int tdefmip = 0, comprsize = 0;
	int starttime;

	detect_texture_size();

#if USE_OPENGL == USE_GLES2
	// GLES permits BGRA as an internal format.
    intexfmt = tex->rawfmt;
#else
    intexfmt = GL_RGBA;
#endif
	if (!(flags & PTH_NOCOMPRESS) && glusetexcompr) {
#if GL_EXT_texture_compression_dxt1 || GL_EXT_texture_compression_s3tc
		if (!compress && !tex->hasalpha && glinfo.texcomprdxt1) {
			intexfmt = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
			compress = PTCOMPRESS_DXT1;
		}
#endif
#if GL_OES_compressed_ETC1_RGB8_texture
		if (!compress && !tex->hasalpha && glinfo.texcompretc1) {
			intexfmt = GL_ETC1_RGB8_OES;
			compress = PTCOMPRESS_ETC1;
		}
#endif
#if GL_EXT_texture_compression_s3tc
		if (!compress && tex->hasalpha && glinfo.texcomprdxt5) {
			intexfmt = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
			compress = PTCOMPRESS_DXT5;
		}
#endif
	}

	if (compress && tdef) {
		tdef->format = intexfmt;
		tdef->tsizx  = tex->tsizx;
		tdef->tsizy  = tex->tsizy;
	}

	if (ptm->glpic == 0) {
		glfunc.glGenTextures(1, &ptm->glpic);
	}
	glfunc.glBindTexture(GL_TEXTURE_2D, ptm->glpic);

	ptm_fixtransparency(tex, (flags & PTH_CLAMPED));

	mipmap = 0;
	if (! (flags & PTH_NOMIPLEVEL)) {
		// if we aren't instructed to preserve all mipmap levels,
		// immediately throw away gltexmiplevel mipmaps
		mipmap = max(0, gltexmiplevel);
	}
	while ((tex->sizx >> mipmap) > (1 << gltexmaxsize) ||
	       (tex->sizy >> mipmap) > (1 << gltexmaxsize)) {
		// throw away additional mipmaps until the texture fits within
		// the maximum size permitted by the GL driver
		mipmap++;
	}

	for ( ;
	     mipmap > 0 && (tex->sizx > 1 || tex->sizy > 1);
	     mipmap--) {
		if (compress && tdef) {
			comprsize = ptcompress_getstorage(tex->sizx, tex->sizy, compress);
			comprdata = (unsigned char *) malloc(comprsize);

			starttime = getticks();
			ptcompress_compress(tex->pic, tex->sizx, tex->sizy, comprdata, compress);
			if (polymosttexverbosity >= 2) {
				buildprintf("PolymostTex: ptcompress_compress (%dx%d, %s) took %f sec\n",
					   tex->sizx, tex->sizy, compressfourcc[compress],
					   (float)(getticks() - starttime) / 1000.f);
			}

			tdef->mipmap[tdefmip].sizx = tex->sizx;
			tdef->mipmap[tdefmip].sizy = tex->sizy;
			tdef->mipmap[tdefmip].length = comprsize;
			tdef->mipmap[tdefmip].data = comprdata;
			tdefmip++;

			comprdata = 0;
		}

		ptm_mipscale(tex);
		ptm_fixtransparency(tex, (flags & PTH_CLAMPED));
	}

	if (compress) {
		comprsize = ptcompress_getstorage(tex->sizx, tex->sizy, compress);
		comprdata = (unsigned char *) malloc(comprsize);

		starttime = getticks();
		ptcompress_compress(tex->pic, tex->sizx, tex->sizy, comprdata, compress);
		if (polymosttexverbosity >= 2) {
			buildprintf("PolymostTex: ptcompress_compress (%dx%d, %s) took %f sec\n",
				   tex->sizx, tex->sizy, compressfourcc[compress],
				   (float)(getticks() - starttime) / 1000.f);
		}

		if (tdef) {
			tdef->mipmap[tdefmip].sizx = tex->sizx;
			tdef->mipmap[tdefmip].sizy = tex->sizy;
			tdef->mipmap[tdefmip].length = comprsize;
			tdef->mipmap[tdefmip].data = comprdata;
			tdefmip++;
		}

		glfunc.glCompressedTexImage2D(GL_TEXTURE_2D, 0,
			intexfmt, tex->sizx, tex->sizy, 0,
			comprsize, (const GLvoid *) comprdata);

		if (tdef) {
			// we need to retain each mipmap for the tdef struct, so
			// force each mipmap to be allocated afresh in the loop below
			comprdata = 0;
		}
	} else {
		glfunc.glTexImage2D(GL_TEXTURE_2D, 0,
			intexfmt, tex->sizx, tex->sizy, 0, tex->rawfmt,
			GL_UNSIGNED_BYTE, (const GLvoid *) tex->pic);
	}

	for (mipmap = 1; tex->sizx > 1 || tex->sizy > 1; mipmap++) {
		ptm_mipscale(tex);
		ptm_fixtransparency(tex, (flags & PTH_CLAMPED));

		if (compress) {
			comprsize = ptcompress_getstorage(tex->sizx, tex->sizy, compress);
			if (tdef) {
				comprdata = (unsigned char *) malloc(comprsize);
			}

			starttime = getticks();
			ptcompress_compress(tex->pic, tex->sizx, tex->sizy, comprdata, compress);
			if (polymosttexverbosity >= 2) {
				buildprintf("PolymostTex: ptcompress_compress (%dx%d, %s) took %f sec\n",
					   tex->sizx, tex->sizy, compressfourcc[compress],
					   (float)(getticks() - starttime) / 1000.f);
			}

			if (tdef) {
				tdef->mipmap[tdefmip].sizx = tex->sizx;
				tdef->mipmap[tdefmip].sizy = tex->sizy;
				tdef->mipmap[tdefmip].length = comprsize;
				tdef->mipmap[tdefmip].data = comprdata;
				tdefmip++;
			}

			glfunc.glCompressedTexImage2D(GL_TEXTURE_2D, mipmap,
						intexfmt, tex->sizx, tex->sizy, 0,
						comprsize, (const GLvoid *) comprdata);

			if (tdef) {
				// we need to retain each mipmap for the tdef struct, so
				// force each mipmap to be allocated afresh in this loop
				comprdata = 0;
			}
		} else {
			glfunc.glTexImage2D(GL_TEXTURE_2D, mipmap,
				intexfmt, tex->sizx, tex->sizy, 0, tex->rawfmt,
				GL_UNSIGNED_BYTE, (const GLvoid *) tex->pic);
		}
	}

	ptm->flags = 0;
	ptm->flags |= (tex->hasalpha ? PTH_HASALPHA : 0);

	if (comprdata) {
		free(comprdata);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movw %si, %ax
movq %rdi, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
callq 0x9aae0
movl $0x1908, -0x28(%rbp)    # imm = 0x1908
movzwl -0xa(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x998ad
leaq 0x48376(%rip), %rax     # 0xe1bc0
cmpl $0x0, (%rax)
je 0x998ad
cmpl $0x0, -0x2c(%rbp)
jne 0x9987d
movq -0x18(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x9987d
leaq 0x12154a(%rip), %rax    # 0x1badb0
movsbl 0x1a(%rax), %eax
cmpl $0x0, %eax
je 0x9987d
movl $0x83f1, -0x28(%rbp)    # imm = 0x83F1
movl $0x1, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x998ab
movq -0x18(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0x998ab
leaq 0x12151c(%rip), %rax    # 0x1badb0
movsbl 0x1b(%rax), %eax
cmpl $0x0, %eax
je 0x998ab
movl $0x83f3, -0x28(%rbp)    # imm = 0x83F3
movl $0x2, -0x2c(%rbp)
jmp 0x998ad
cmpl $0x0, -0x2c(%rbp)
je 0x998e0
cmpq $0x0, -0x20(%rbp)
je 0x998e0
movl -0x28(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x18(%rbp), %rax
movl 0x14(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x99902
leaq 0x553e20(%rip), %rax    # 0x5ed710
movq 0xb8(%rax), %rax
movq -0x8(%rbp), %rsi
movl $0x1, %edi
callq *%rax
leaq 0x553e07(%rip), %rax    # 0x5ed710
movq 0xc8(%rax), %rax
movq -0x8(%rbp), %rcx
movl (%rcx), %esi
movl $0xde1, %edi            # imm = 0xDE1
callq *%rax
movq -0x18(%rbp), %rdi
movzwl -0xa(%rbp), %esi
andl $0x1, %esi
callq 0x9ab50
movl $0x0, -0x24(%rbp)
movzwl -0xa(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x99966
xorl %eax, %eax
leaq 0x554023(%rip), %rcx    # 0x5ed96c
cmpl (%rcx), %eax
jle 0x99954
xorl %eax, %eax
movl %eax, -0x48(%rbp)
jmp 0x99960
leaq 0x554011(%rip), %rax    # 0x5ed96c
movl (%rax), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x99968
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl -0x24(%rbp), %ecx
sarl %cl, %eax
movl %eax, -0x50(%rbp)
leaq 0x553fea(%rip), %rax    # 0x5ed968
movl (%rax), %ecx
movl $0x1, %edx
shll %cl, %edx
movl -0x50(%rbp), %ecx
movb $0x1, %al
cmpl %edx, %ecx
movb %al, -0x49(%rbp)
jg 0x999b9
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
movl -0x24(%rbp), %ecx
sarl %cl, %eax
leaq 0x553fc2(%rip), %rcx    # 0x5ed968
movl (%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
setg %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
testb $0x1, %al
jne 0x999c2
jmp 0x999cd
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x99968
jmp 0x999cf
xorl %eax, %eax
cmpl $0x0, -0x24(%rbp)
movb %al, -0x51(%rbp)
jle 0x999fd
movq -0x18(%rbp), %rcx
movb $0x1, %al
cmpl $0x1, 0x8(%rcx)
movb %al, -0x52(%rbp)
jg 0x999f7
movq -0x18(%rbp), %rax
cmpl $0x1, 0xc(%rax)
setg %al
movb %al, -0x52(%rbp)
movb -0x52(%rbp), %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x99a09
jmp 0x99b76
cmpl $0x0, -0x2c(%rbp)
je 0x99b4f
cmpq $0x0, -0x20(%rbp)
je 0x99b4f
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x18(%rbp), %rax
movl 0xc(%rax), %esi
movl -0x2c(%rbp), %edx
callq 0x9d040
movl %eax, -0x40(%rbp)
movslq -0x40(%rbp), %rdi
callq 0x68f0
movq %rax, -0x38(%rbp)
callq 0xa56e0
movl %eax, -0x44(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x18(%rbp), %rax
movl 0xc(%rax), %edx
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %r8d
callq 0x9d140
cmpl $0x2, 0x4815b(%rip)     # 0xe1bd0
jl 0x99ad1
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
movl %ecx, -0x68(%rbp)
movl 0xc(%rax), %eax
movl %eax, -0x64(%rbp)
movslq -0x2c(%rbp), %rcx
leaq 0x4814e(%rip), %rax     # 0xe1be0
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
callq 0xa56e0
movl -0x68(%rbp), %esi
movl -0x64(%rbp), %edx
movq -0x60(%rbp), %rcx
movl -0x44(%rbp), %edi
subl %edi, %eax
cvtsi2ss %rax, %xmm0
movss 0x1e3fd(%rip), %xmm1    # 0xb7eb8
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1e5ab(%rip), %rdi     # 0xb8075
movb $0x1, %al
callq 0x37c90
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x20(%rbp), %rax
addq $0x20, %rax
movslq -0x3c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x20(%rbp), %rax
addq $0x20, %rax
movslq -0x3c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x40(%rbp), %ecx
movq -0x20(%rbp), %rax
addq $0x20, %rax
movslq -0x3c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
addq $0x20, %rax
movslq -0x3c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9aee0
movq -0x18(%rbp), %rdi
movzwl -0xa(%rbp), %esi
andl $0x1, %esi
callq 0x9ab50
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x999cf
cmpl $0x0, -0x2c(%rbp)
je 0x99cff
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x18(%rbp), %rax
movl 0xc(%rax), %esi
movl -0x2c(%rbp), %edx
callq 0x9d040
movl %eax, -0x40(%rbp)
movslq -0x40(%rbp), %rdi
callq 0x68f0
movq %rax, -0x38(%rbp)
callq 0xa56e0
movl %eax, -0x44(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x18(%rbp), %rax
movl 0xc(%rax), %edx
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %r8d
callq 0x9d140
cmpl $0x2, 0x47ff9(%rip)     # 0xe1bd0
jl 0x99c33
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
movl %ecx, -0x78(%rbp)
movl 0xc(%rax), %eax
movl %eax, -0x74(%rbp)
movslq -0x2c(%rbp), %rcx
leaq 0x47fec(%rip), %rax     # 0xe1be0
movq (%rax,%rcx,8), %rax
movq %rax, -0x70(%rbp)
callq 0xa56e0
movl -0x78(%rbp), %esi
movl -0x74(%rbp), %edx
movq -0x70(%rbp), %rcx
movl -0x44(%rbp), %edi
subl %edi, %eax
cvtsi2ss %rax, %xmm0
movss 0x1e29b(%rip), %xmm1    # 0xb7eb8
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1e449(%rip), %rdi     # 0xb8075
movb $0x1, %al
callq 0x37c90
cmpq $0x0, -0x20(%rbp)
je 0x99cb0
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x20(%rbp), %rax
addq $0x20, %rax
movslq -0x3c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x20(%rbp), %rax
addq $0x20, %rax
movslq -0x3c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x40(%rbp), %ecx
movq -0x20(%rbp), %rax
addq $0x20, %rax
movslq -0x3c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
addq $0x20, %rax
movslq -0x3c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
leaq 0x553a59(%rip), %rax    # 0x5ed710
movq 0xf0(%rax), %rax
movl -0x28(%rbp), %edx
movq -0x18(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq -0x18(%rbp), %rsi
movl 0xc(%rsi), %r8d
movl -0x40(%rbp), %r11d
movq -0x38(%rbp), %r10
movl $0xde1, %edi            # imm = 0xDE1
xorl %r9d, %r9d
movl %r9d, %esi
movl %r11d, (%rsp)
movq %r10, 0x8(%rsp)
callq *%rax
cmpq $0x0, -0x20(%rbp)
je 0x99cfd
movq $0x0, -0x38(%rbp)
jmp 0x99d4c
leaq 0x553a0a(%rip), %rax    # 0x5ed710
movq 0xd0(%rax), %rax
movl -0x28(%rbp), %edx
movq -0x18(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq -0x18(%rbp), %rsi
movl 0xc(%rsi), %r8d
movq -0x18(%rbp), %rsi
movl 0x18(%rsi), %r11d
movq -0x18(%rbp), %rsi
movq (%rsi), %r10
movl $0xde1, %edi            # imm = 0xDE1
xorl %r9d, %r9d
movl %r9d, %esi
movl %r11d, (%rsp)
movl $0x1401, 0x8(%rsp)      # imm = 0x1401
movq %r10, 0x10(%rsp)
callq *%rax
movl $0x1, -0x24(%rbp)
movq -0x18(%rbp), %rcx
movb $0x1, %al
cmpl $0x1, 0x8(%rcx)
movb %al, -0x79(%rbp)
jg 0x99d70
movq -0x18(%rbp), %rax
cmpl $0x1, 0xc(%rax)
setg %al
movb %al, -0x79(%rbp)
movb -0x79(%rbp), %al
testb $0x1, %al
jne 0x99d7c
jmp 0x99f94
movq -0x18(%rbp), %rdi
callq 0x9aee0
movq -0x18(%rbp), %rdi
movzwl -0xa(%rbp), %esi
andl $0x1, %esi
callq 0x9ab50
cmpl $0x0, -0x2c(%rbp)
je 0x99f37
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x18(%rbp), %rax
movl 0xc(%rax), %esi
movl -0x2c(%rbp), %edx
callq 0x9d040
movl %eax, -0x40(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x99dcc
movslq -0x40(%rbp), %rdi
callq 0x68f0
movq %rax, -0x38(%rbp)
callq 0xa56e0
movl %eax, -0x44(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x18(%rbp), %rax
movl 0xc(%rax), %edx
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %r8d
callq 0x9d140
cmpl $0x2, 0x47dd3(%rip)     # 0xe1bd0
jl 0x99e6b
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
movl %ecx, -0x90(%rbp)
movl 0xc(%rax), %eax
movl %eax, -0x8c(%rbp)
movslq -0x2c(%rbp), %rcx
leaq 0x47dc0(%rip), %rax     # 0xe1be0
movq (%rax,%rcx,8), %rax
movq %rax, -0x88(%rbp)
callq 0xa56e0
movl -0x90(%rbp), %esi
movl -0x8c(%rbp), %edx
movq -0x88(%rbp), %rcx
movl -0x44(%rbp), %edi
subl %edi, %eax
cvtsi2ss %rax, %xmm0
movss 0x1e063(%rip), %xmm1    # 0xb7eb8
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1e211(%rip), %rdi     # 0xb8075
movb $0x1, %al
callq 0x37c90
cmpq $0x0, -0x20(%rbp)
je 0x99ee8
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x20(%rbp), %rax
addq $0x20, %rax
movslq -0x3c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x20(%rbp), %rax
addq $0x20, %rax
movslq -0x3c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x40(%rbp), %ecx
movq -0x20(%rbp), %rax
addq $0x20, %rax
movslq -0x3c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
addq $0x20, %rax
movslq -0x3c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
leaq 0x553821(%rip), %rax    # 0x5ed710
movq 0xf0(%rax), %rax
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
movq -0x18(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq -0x18(%rbp), %rdi
movl 0xc(%rdi), %r8d
movl -0x40(%rbp), %r11d
movq -0x38(%rbp), %r10
movl $0xde1, %edi            # imm = 0xDE1
xorl %r9d, %r9d
movl %r11d, (%rsp)
movq %r10, 0x8(%rsp)
callq *%rax
cmpq $0x0, -0x20(%rbp)
je 0x99f35
movq $0x0, -0x38(%rbp)
jmp 0x99f84
leaq 0x5537d2(%rip), %rax    # 0x5ed710
movq 0xd0(%rax), %rax
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
movq -0x18(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq -0x18(%rbp), %rdi
movl 0xc(%rdi), %r8d
movq -0x18(%rbp), %rdi
movl 0x18(%rdi), %r11d
movq -0x18(%rbp), %rdi
movq (%rdi), %r10
movl $0xde1, %edi            # imm = 0xDE1
xorl %r9d, %r9d
movl %r11d, (%rsp)
movl $0x1401, 0x8(%rsp)      # imm = 0x1401
movq %r10, 0x10(%rsp)
callq *%rax
jmp 0x99f86
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x99d53
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %edx
xorl %ecx, %ecx
movl $0x8, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x8(%rbp), %rax
orl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
cmpq $0x0, -0x38(%rbp)
je 0x99fcd
movq -0x38(%rbp), %rdi
callq 0x61c0
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)