// File: FreeSlave[P]vhlt/hlcsg/brush.cpp
// Function: TextureContents(char const*)
static contents_t TextureContents(const char* const name)
{
#ifdef HLCSG_CUSTOMCONTENT
	if (!strncasecmp(name, "contentsolid", 12))
		return CONTENTS_SOLID;
	if (!strncasecmp(name, "contentwater", 12))
		return CONTENTS_WATER;
	if (!strncasecmp(name, "contentempty", 12))
		return CONTENTS_TOEMPTY;
	if (!strncasecmp(name, "contentsky", 10))
		return CONTENTS_SKY;
#endif
    if (!strncasecmp(name, "sky", 3))
        return CONTENTS_SKY;

// =====================================================================================
//Cpt_Andrew - Env_Sky Check
// =====================================================================================
#ifdef HLCSG_TextureContents_FIX
    if (!strncasecmp(name, "env_sky", 7))
#else
    if (!strncasecmp(name, "env_sky", 3))
#endif
        return CONTENTS_SKY;
// =====================================================================================

    if (!strncasecmp(name + 1, "!lava", 5))
        return CONTENTS_LAVA;

    if (!strncasecmp(name + 1, "!slime", 6))
        return CONTENTS_SLIME;
#ifdef HLCSG_TextureContents_FIX
    if (!strncasecmp(name, "!lava", 5))
        return CONTENTS_LAVA;

    if (!strncasecmp(name, "!slime", 6))
        return CONTENTS_SLIME;
#endif

    if (name[0] == '!') //optimized -- don't check for current unless it's liquid (KGP)
	{
		if (!strncasecmp(name, "!cur_90", 7))
			return CONTENTS_CURRENT_90;
		if (!strncasecmp(name, "!cur_0", 6))
			return CONTENTS_CURRENT_0;
		if (!strncasecmp(name, "!cur_270", 8))
			return CONTENTS_CURRENT_270;
		if (!strncasecmp(name, "!cur_180", 8))
			return CONTENTS_CURRENT_180;
		if (!strncasecmp(name, "!cur_up", 7))
			return CONTENTS_CURRENT_UP;
		if (!strncasecmp(name, "!cur_dwn", 8))
			return CONTENTS_CURRENT_DOWN;
        return CONTENTS_WATER; //default for liquids
	}

    if (!strncasecmp(name, "origin", 6))
        return CONTENTS_ORIGIN;
#ifdef HLCSG_HLBSP_CUSTOMBOUNDINGBOX
	if (!strncasecmp(name, "boundingbox", 11))
		return CONTENTS_BOUNDINGBOX;
#endif

#ifndef HLCSG_CUSTOMHULL
    if (!strncasecmp(name, "clip", 4))
        return CONTENTS_CLIP;
#endif

#ifdef HLCSG_HLBSP_SOLIDHINT
	if (!strncasecmp(name, "solidhint", 9))
		return CONTENTS_NULL;
#endif
#ifdef HLCSG_NOSPLITBYHINT
	if (!strncasecmp(name, "splitface", 9))
		return CONTENTS_HINT;
	if (!strncasecmp(name, "hint", 4))
		return CONTENTS_TOEMPTY;
	if (!strncasecmp(name, "skip", 4))
		return CONTENTS_TOEMPTY;
#else
    if (!strncasecmp(name, "hint", 4))
        return CONTENTS_HINT;
    if (!strncasecmp(name, "skip", 4))
        return CONTENTS_HINT;
#endif

    if (!strncasecmp(name, "translucent", 11))
        return CONTENTS_TRANSLUCENT;

    if (name[0] == '@')
        return CONTENTS_TRANSLUCENT;

#ifdef ZHLT_NULLTEX // AJM:
	if (!strncasecmp(name, "null", 4))
        return CONTENTS_NULL;
#ifdef HLCSG_PRECISIONCLIP // KGP
	if(!strncasecmp(name,"bevel",5))
		return CONTENTS_NULL;
#endif //precisionclip
#endif //nulltex

    return CONTENTS_SOLID;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x174a1(%rip), %rsi     # 0x2dc56
movl $0xc, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x167d1
movl $0xfffffffe, 0x14(%rsp) # imm = 0xFFFFFFFE
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x17486(%rip), %rsi     # 0x2dc63
movl $0xc, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x167f9
movl $0xfffffffd, 0x14(%rsp) # imm = 0xFFFFFFFD
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x1746b(%rip), %rsi     # 0x2dc70
movl $0xc, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16821
movl $0xffffffe0, 0x14(%rsp) # imm = 0xFFFFFFE0
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x17450(%rip), %rsi     # 0x2dc7d
movl $0xa, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16849
movl $0xfffffffa, 0x14(%rsp) # imm = 0xFFFFFFFA
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x17437(%rip), %rsi     # 0x2dc8c
movl $0x3, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16871
movl $0xfffffffa, 0x14(%rsp) # imm = 0xFFFFFFFA
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x1740b(%rip), %rsi     # 0x2dc88
movl $0x7, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16899
movl $0xfffffffa, 0x14(%rsp) # imm = 0xFFFFFFFA
jmp 0x16bcd
movq 0x8(%rsp), %rdi
addq $0x1, %rdi
leaq 0x173e7(%rip), %rsi     # 0x2dc90
movl $0x5, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x168c5
movl $0xfffffffb, 0x14(%rsp) # imm = 0xFFFFFFFB
jmp 0x16bcd
movq 0x8(%rsp), %rdi
addq $0x1, %rdi
leaq 0x173c1(%rip), %rsi     # 0x2dc96
movl $0x6, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x168f1
movl $0xfffffffc, 0x14(%rsp) # imm = 0xFFFFFFFC
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x17393(%rip), %rsi     # 0x2dc90
movl $0x5, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16919
movl $0xfffffffb, 0x14(%rsp) # imm = 0xFFFFFFFB
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x17371(%rip), %rsi     # 0x2dc96
movl $0x6, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16941
movl $0xfffffffc, 0x14(%rsp) # imm = 0xFFFFFFFC
jmp 0x16bcd
movq 0x8(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x21, %eax
jne 0x16a4f
movq 0x8(%rsp), %rdi
leaq 0x1733f(%rip), %rsi     # 0x2dc9d
movl $0x7, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x1697a
movl $0xfffffff6, 0x14(%rsp) # imm = 0xFFFFFFF6
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x1731f(%rip), %rsi     # 0x2dca5
movl $0x6, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x169a2
movl $0xfffffff7, 0x14(%rsp) # imm = 0xFFFFFFF7
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x172fe(%rip), %rsi     # 0x2dcac
movl $0x8, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x169ca
movl $0xfffffff4, 0x14(%rsp) # imm = 0xFFFFFFF4
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x172df(%rip), %rsi     # 0x2dcb5
movl $0x8, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x169f2
movl $0xfffffff5, 0x14(%rsp) # imm = 0xFFFFFFF5
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x172c0(%rip), %rsi     # 0x2dcbe
movl $0x7, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16a1a
movl $0xfffffff3, 0x14(%rsp) # imm = 0xFFFFFFF3
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x172a0(%rip), %rsi     # 0x2dcc6
movl $0x8, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16a42
movl $0xfffffff2, 0x14(%rsp) # imm = 0xFFFFFFF2
jmp 0x16bcd
movl $0xfffffffd, 0x14(%rsp) # imm = 0xFFFFFFFD
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x19165(%rip), %rsi     # 0x2fbc0
movl $0x6, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16a77
movl $0xfffffff9, 0x14(%rsp) # imm = 0xFFFFFFF9
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x1724c(%rip), %rsi     # 0x2dccf
movl $0xb, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16a9f
movl $0xffffffed, 0x14(%rsp) # imm = 0xFFFFFFED
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x17230(%rip), %rsi     # 0x2dcdb
movl $0x9, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16ac7
movl $0xffffffef, 0x14(%rsp) # imm = 0xFFFFFFEF
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x17212(%rip), %rsi     # 0x2dce5
movl $0x9, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16aef
movl $0xfffffff0, 0x14(%rsp) # imm = 0xFFFFFFF0
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x171e5(%rip), %rsi     # 0x2dce0
movl $0x4, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16b17
movl $0xffffffe0, 0x14(%rsp) # imm = 0xFFFFFFE0
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x16ead(%rip), %rsi     # 0x2d9d0
movl $0x4, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16b3f
movl $0xffffffe0, 0x14(%rsp) # imm = 0xFFFFFFE0
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x171a4(%rip), %rsi     # 0x2dcef
movl $0xb, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16b64
movl $0xfffffff1, 0x14(%rsp) # imm = 0xFFFFFFF1
jmp 0x16bcd
movq 0x8(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x40, %eax
jne 0x16b7b
movl $0xfffffff1, 0x14(%rsp) # imm = 0xFFFFFFF1
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x17174(%rip), %rsi     # 0x2dcfb
movl $0x4, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16ba0
movl $0xffffffef, 0x14(%rsp) # imm = 0xFFFFFFEF
jmp 0x16bcd
movq 0x8(%rsp), %rdi
leaq 0x17154(%rip), %rsi     # 0x2dd00
movl $0x5, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x16bc5
movl $0xffffffef, 0x14(%rsp) # imm = 0xFFFFFFEF
jmp 0x16bcd
movl $0xfffffffe, 0x14(%rsp) # imm = 0xFFFFFFFE
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)