// File: /workspace/github_c_makefile_star2_O1/stetre[P]moonassimp/src/material.c
// Function: AllTextures
static int AllTextures(lua_State *L)
    {
    unsigned int count, i, tot;
    unsigned int type;
    material_t *material = checkmaterial(L, 1);
#define ADD(t) do {                                     \
    count = aiGetMaterialTextureCount(material, t);     \
    for(i=0; i < count; i++)                            \
        {                                               \
        PushTexture(L, material, t, i);                 \
        lua_rawseti(L, -2, ++tot);                      \
        }                                               \
} while(0)

    tot = 0;
    if(!lua_isnoneornil(L, 2))
        {
        lua_newtable(L);
        type = checktexturetype(L, 2);
        ADD((enum aiTextureType)type);
        }
    else
        {
        lua_newtable(L);
//      ADD(aiTextureType_NONE);
        ADD(aiTextureType_DIFFUSE);
        ADD(aiTextureType_SPECULAR);
        ADD(aiTextureType_AMBIENT);
        ADD(aiTextureType_EMISSIVE);
        ADD(aiTextureType_HEIGHT);
        ADD(aiTextureType_NORMALS);
        ADD(aiTextureType_SHININESS);
        ADD(aiTextureType_OPACITY);
        ADD(aiTextureType_DISPLACEMENT);
        ADD(aiTextureType_LIGHTMAP);
        ADD(aiTextureType_REFLECTION);
        ADD(aiTextureType_UNKNOWN);
        }
#undef ADD
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x5fe7(%rip), %rdx      # 0x10e90
movl $0x1, %esi
callq 0x66f0
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
callq 0x68d0
movl %eax, %ebp
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6250
testl %ebp, %ebp
jle 0xaf2c
movq %rbx, %rdi
movl $0x2, %esi
callq 0x6750
movl %eax, %ebp
movq %r14, %rdi
movl %eax, %esi
callq 0x67b0
testl %eax, %eax
je 0xb279
movl %eax, %r12d
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xb42d
incq %r15
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r15, %rdx
callq 0x6460
cmpq %r15, %r12
jne 0xaeff
jmp 0xb279
movq %r14, %rdi
movl $0x1, %esi
callq 0x67b0
testl %eax, %eax
je 0xaf6e
movl %eax, %r12d
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
movl %r15d, %ecx
callq 0xb42d
incq %r15
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r15, %rdx
callq 0x6460
cmpq %r15, %r12
jne 0xaf43
movq %r14, %rdi
movl $0x2, %esi
callq 0x67b0
testl %eax, %eax
je 0xafb5
movl %eax, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movl $0x2, %edx
movl %r12d, %ecx
callq 0xb42d
leal (%r12,%r15), %edx
incl %edx
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x6460
incl %r12d
cmpl %r12d, %ebp
jne 0xaf84
addl %r12d, %r15d
movq %r14, %rdi
movl $0x3, %esi
callq 0x67b0
testl %eax, %eax
je 0xaffc
movl %eax, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movl $0x3, %edx
movl %r12d, %ecx
callq 0xb42d
leal (%r12,%r15), %edx
incl %edx
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x6460
incl %r12d
cmpl %r12d, %ebp
jne 0xafcb
addl %r12d, %r15d
movq %r14, %rdi
movl $0x4, %esi
callq 0x67b0
testl %eax, %eax
je 0xb043
movl %eax, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movl $0x4, %edx
movl %r12d, %ecx
callq 0xb42d
leal (%r12,%r15), %edx
incl %edx
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x6460
incl %r12d
cmpl %r12d, %ebp
jne 0xb012
addl %r12d, %r15d
movq %r14, %rdi
movl $0x5, %esi
callq 0x67b0
testl %eax, %eax
je 0xb08a
movl %eax, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movl $0x5, %edx
movl %r12d, %ecx
callq 0xb42d
leal (%r12,%r15), %edx
incl %edx
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x6460
incl %r12d
cmpl %r12d, %ebp
jne 0xb059
addl %r12d, %r15d
movq %r14, %rdi
movl $0x6, %esi
callq 0x67b0
testl %eax, %eax
je 0xb0d1
movl %eax, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movl $0x6, %edx
movl %r12d, %ecx
callq 0xb42d
leal (%r12,%r15), %edx
incl %edx
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x6460
incl %r12d
cmpl %r12d, %ebp
jne 0xb0a0
addl %r12d, %r15d
movq %r14, %rdi
movl $0x7, %esi
callq 0x67b0
testl %eax, %eax
je 0xb118
movl %eax, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movl $0x7, %edx
movl %r12d, %ecx
callq 0xb42d
leal (%r12,%r15), %edx
incl %edx
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x6460
incl %r12d
cmpl %r12d, %ebp
jne 0xb0e7
addl %r12d, %r15d
movq %r14, %rdi
movl $0x8, %esi
callq 0x67b0
testl %eax, %eax
je 0xb15f
movl %eax, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movl $0x8, %edx
movl %r12d, %ecx
callq 0xb42d
leal (%r12,%r15), %edx
incl %edx
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x6460
incl %r12d
cmpl %r12d, %ebp
jne 0xb12e
addl %r12d, %r15d
movq %r14, %rdi
movl $0x9, %esi
callq 0x67b0
testl %eax, %eax
je 0xb1a6
movl %eax, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movl $0x9, %edx
movl %r12d, %ecx
callq 0xb42d
leal (%r12,%r15), %edx
incl %edx
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x6460
incl %r12d
cmpl %r12d, %ebp
jne 0xb175
addl %r12d, %r15d
movq %r14, %rdi
movl $0xa, %esi
callq 0x67b0
testl %eax, %eax
je 0xb1ed
movl %eax, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movl $0xa, %edx
movl %r12d, %ecx
callq 0xb42d
leal (%r12,%r15), %edx
incl %edx
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x6460
incl %r12d
cmpl %r12d, %ebp
jne 0xb1bc
addl %r12d, %r15d
movq %r14, %rdi
movl $0xb, %esi
callq 0x67b0
testl %eax, %eax
je 0xb234
movl %eax, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movl $0xb, %edx
movl %r12d, %ecx
callq 0xb42d
leal (%r12,%r15), %edx
incl %edx
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x6460
incl %r12d
cmpl %r12d, %ebp
jne 0xb203
addl %r12d, %r15d
movq %r14, %rdi
movl $0x12, %esi
callq 0x67b0
testl %eax, %eax
je 0xb279
movl %eax, %ebp
incl %r15d
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movl $0x12, %edx
movl %r12d, %ecx
callq 0xb42d
leal (%r15,%r12), %edx
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x6460
incl %r12d
cmpl %r12d, %ebp
jne 0xb24d
movl $0x1, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq