// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x62c6(%rip), %rdx      # 0x10e90
pushq $0x1
popq %rsi
callq 0x66f0
movq %rax, %r12
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x68d0
movl %eax, %ebp
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6250
testl %ebp, %ebp
jle 0xac42
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x6750
movl %eax, %ebp
movq %r12, %r13
movq %r12, %rdi
movl %eax, %esi
callq 0x67b0
movl %eax, %r14d
xorl %r15d, %r15d
pushq $-0x2
popq %r12
cmpq %r15, %r14
je 0xaf78
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xb121
incq %r15
movq %rbx, %rdi
movl %r12d, %esi
movq %r15, %rdx
callq 0x6470
jmp 0xac16
pushq $0x1
popq %rbp
movq %r12, %rdi
movl %ebp, %esi
callq 0x67b0
movl %eax, %r14d
xorl %r15d, %r15d
pushq $-0x2
popq %r13
cmpq %r15, %r14
je 0xac81
movq %rbx, %rdi
movq %r12, %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xb121
incq %r15
movq %rbx, %rdi
movl %r13d, %esi
movq %r15, %rdx
callq 0x6470
jmp 0xac59
pushq $0x2
popq %rbp
movq %r12, (%rsp)
movq %r12, %rdi
movl %ebp, %esi
callq 0x67b0
movl %eax, %r15d
incl %r14d
xorl %r12d, %r12d
pushq $-0x2
popq %r13
cmpl %r12d, %r15d
je 0xaccb
movq %rbx, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
movl %r12d, %ecx
callq 0xb121
movl %r14d, %edx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x6470
incl %r12d
incl %r14d
jmp 0xac9f
pushq $0x3
popq %rbp
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x67b0
movl %eax, %r12d
xorl %r15d, %r15d
pushq $-0x2
popq %r13
cmpl %r15d, %r12d
je 0xad0d
movq %rbx, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xb121
leal (%r14,%r15), %edx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x6470
incl %r15d
jmp 0xace3
pushq $0x4
popq %rbp
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x67b0
movl %eax, %r12d
addl %r15d, %r14d
xorl %r15d, %r15d
pushq $-0x2
popq %r13
cmpl %r15d, %r12d
je 0xad54
movq %rbx, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xb121
movl %r14d, %edx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x6470
incl %r15d
incl %r14d
jmp 0xad28
pushq $0x5
popq %rbp
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x67b0
movl %eax, %r12d
xorl %r15d, %r15d
pushq $-0x2
popq %r13
cmpl %r15d, %r12d
je 0xad96
movq %rbx, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xb121
leal (%r14,%r15), %edx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x6470
incl %r15d
jmp 0xad6c
pushq $0x6
popq %rbp
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x67b0
movl %eax, %r12d
addl %r15d, %r14d
xorl %r15d, %r15d
pushq $-0x2
popq %r13
cmpl %r15d, %r12d
je 0xaddd
movq %rbx, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xb121
movl %r14d, %edx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x6470
incl %r15d
incl %r14d
jmp 0xadb1
pushq $0x7
popq %rbp
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x67b0
movl %eax, %r12d
xorl %r15d, %r15d
pushq $-0x2
popq %r13
cmpl %r15d, %r12d
je 0xae1f
movq %rbx, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xb121
leal (%r14,%r15), %edx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x6470
incl %r15d
jmp 0xadf5
pushq $0x8
popq %rbp
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x67b0
movl %eax, %r12d
addl %r15d, %r14d
xorl %r15d, %r15d
pushq $-0x2
popq %r13
cmpl %r15d, %r12d
je 0xae66
movq %rbx, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xb121
movl %r14d, %edx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x6470
incl %r15d
incl %r14d
jmp 0xae3a
pushq $0x9
popq %rbp
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x67b0
movl %eax, %r12d
xorl %r15d, %r15d
pushq $-0x2
popq %r13
cmpl %r15d, %r12d
je 0xaea8
movq %rbx, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xb121
leal (%r14,%r15), %edx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x6470
incl %r15d
jmp 0xae7e
pushq $0xa
popq %rbp
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x67b0
movl %eax, %r12d
addl %r15d, %r14d
xorl %r15d, %r15d
pushq $-0x2
popq %r13
cmpl %r15d, %r12d
je 0xaeef
movq %rbx, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xb121
movl %r14d, %edx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x6470
incl %r15d
incl %r14d
jmp 0xaec3
pushq $0xb
popq %rbp
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x67b0
movl %eax, %r12d
xorl %r15d, %r15d
pushq $-0x2
popq %r13
cmpl %r15d, %r12d
je 0xaf31
movq %rbx, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xb121
leal (%r14,%r15), %edx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x6470
incl %r15d
jmp 0xaf07
pushq $0x12
popq %rbp
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x67b0
movl %eax, %r12d
addl %r15d, %r14d
xorl %r15d, %r15d
pushq $-0x2
popq %r13
cmpl %r15d, %r12d
je 0xaf78
movq %rbx, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xb121
movl %r14d, %edx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x6470
incl %r15d
incl %r14d
jmp 0xaf4c
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq