// File: FreeSlave[P]vhlt/hlrad/qrad.cpp
// Function: ReadCustomSmoothValue()
void ReadCustomSmoothValue()
{
	int num;
	int i, k;
	entity_t *mapent;
	epair_t *ep;

	num = ((dmiptexlump_t *)g_dtexdata)->nummiptex;
	g_smoothvalues = (vec_t *)malloc (num * sizeof(vec_t));
	for (i = 0; i < num; i++)
	{
		g_smoothvalues[i] = g_smoothing_threshold;
	}
	for (k = 0; k < g_numentities; k++)
	{
		mapent = &g_entities[k];
		if (strcmp(ValueForKey(mapent, "classname"), "info_smoothvalue"))
			continue;
		Developer (DEVELOPER_LEVEL_MESSAGE, "info_smoothvalue entity detected.\n");
		for (i = 0; i < num; i++)
		{
			const char *texname = ((miptex_t*)(g_dtexdata+((dmiptexlump_t*)g_dtexdata)->dataofs[i]))->name;
			for (ep = mapent->epairs; ep; ep = ep->next)
			{
				if (strcasecmp (ep->key, texname))
					continue;
				if (!strcasecmp (ep->key, "origin"))
					continue;
				g_smoothvalues[i] = cos(atof (ep->value) * (Q_PI / 180.0));
				Developer (DEVELOPER_LEVEL_MESSAGE, "info_smoothvalue: %s = %f\n", texname, atof (ep->value));
			}
		}
	}
}

// Assembly:
subq $0x38, %rsp
leaq 0x837cbd(%rip), %rax    # 0x8864a8
movq (%rax), %rax
movl (%rax), %eax
movl %eax, 0x34(%rsp)
movslq 0x34(%rsp), %rdi
shlq $0x2, %rdi
callq 0x4430
movq %rax, 0x5521397(%rip)   # 0x556fba0
movl $0x0, 0x30(%rsp)
movl 0x30(%rsp), %eax
cmpl 0x34(%rsp), %eax
jge 0x4e841
movss 0x54e1201(%rip), %xmm0  # 0x552fa24
movq 0x5521376(%rip), %rax   # 0x556fba0
movslq 0x30(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x4e811
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
leaq 0x2025be0(%rip), %rcx   # 0x2074434
cmpl (%rcx), %eax
jge 0x4e9da
movslq 0x2c(%rsp), %rcx
leaq 0x2025bd8(%rip), %rax   # 0x2074440
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x1bcd7(%rip), %rsi     # 0x6a557
callq 0x7d50
movq %rax, %rdi
leaq 0x2092c(%rip), %rsi     # 0x6f1bb
callq 0x4480
cmpl $0x0, %eax
je 0x4e89e
jmp 0x4e9ca
movl $0x3, %edi
leaq 0x20922(%rip), %rsi     # 0x6f1cc
movb $0x0, %al
callq 0xbbf0
movl $0x0, 0x30(%rsp)
movl 0x30(%rsp), %eax
cmpl 0x34(%rsp), %eax
jge 0x4e9c8
leaq 0x837bda(%rip), %rax    # 0x8864a8
movq (%rax), %rax
leaq 0x837bd0(%rip), %rcx    # 0x8864a8
movq (%rcx), %rcx
movslq 0x30(%rsp), %rdx
movslq 0x4(%rcx,%rdx,4), %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x4e9b6
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0x4350
cmpl $0x0, %eax
je 0x4e924
jmp 0x4e9a4
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x22c80(%rip), %rsi     # 0x715b4
callq 0x4350
cmpl $0x0, %eax
jne 0x4e940
jmp 0x4e9a4
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x43e0
movsd 0x1eeea(%rip), %xmm1    # 0x6d840
mulsd %xmm1, %xmm0
callq 0x4620
cvtsd2ss %xmm0, %xmm0
movq 0x5521236(%rip), %rax   # 0x556fba0
movslq 0x30(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x43e0
movq 0x8(%rsp), %rdx
movl $0x3, %edi
leaq 0x20852(%rip), %rsi     # 0x6f1ef
movb $0x1, %al
callq 0xbbf0
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
jmp 0x4e8fb
jmp 0x4e9b8
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x4e8b9
jmp 0x4e9ca
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x4e849
addq $0x38, %rsp
retq
nop