// File: /workspace/github_c_makefile_star2_O3/stetre[P]moonassimp/src/material.c
// Function: PushTexture
static int PushTexture(lua_State *L, material_t *material, unsigned int type, unsigned int index)
/* Pushes a table with all the texture properties */
    {
    int val;
    float floatval;
    vector3_t vec;
    struct aiUVTransform trafo;
    unsigned int max = sizeof(vector3_t);

    lua_newtable(L);
    pushtexturetype(L, type);
    lua_setfield(L, -2, "type");

    if(aiGetMaterialIntegerArray(material, _AI_MATKEY_TEXFLAGS_BASE, type, index, &val, NULL)
        != AI_SUCCESS) val = 0;
    pushtextureflags(L, val, 1);
    lua_setfield(L, -2, "flags");

    if(GetString(L, material, _AI_MATKEY_TEXTURE_BASE, type, index)==1)
        lua_setfield(L, -2, "path");

    if(aiGetMaterialIntegerArray(material, _AI_MATKEY_UVWSRC_BASE, type, index, &val, NULL)
        == AI_SUCCESS)
        {
        pushindex(L, val);
        lua_setfield(L, -2, "channel");
        }

    if(aiGetMaterialIntegerArray(material, _AI_MATKEY_TEXOP_BASE, type, index, &val, NULL)
        == AI_SUCCESS)
        {
        pushtextureop(L, val);
        lua_setfield(L, -2, "op");
        }

    if(aiGetMaterialIntegerArray(material, _AI_MATKEY_MAPPING_BASE, type, index, &val, NULL)
        == AI_SUCCESS)
        {
        pushtexturemapping(L, val);
        lua_setfield(L, -2, "mapping");
        }

    if(aiGetMaterialFloatArray(material, _AI_MATKEY_TEXBLEND_BASE, type, index, &floatval, NULL)
        == AI_SUCCESS)
        {
        lua_pushnumber(L, floatval);
        lua_setfield(L, -2, "blend");
        }

    if(aiGetMaterialIntegerArray(material, _AI_MATKEY_MAPPINGMODE_U_BASE, type, index, &val, NULL)
        == AI_SUCCESS)
        {
        pushtexturemapmode(L, val);
        lua_setfield(L, -2, "mapmode_u");
        }
    if(aiGetMaterialIntegerArray(material, _AI_MATKEY_MAPPINGMODE_V_BASE, type, index, &val, NULL)
        == AI_SUCCESS)
        {
        pushtexturemapmode(L, val);
        lua_setfield(L, -2, "mapmode_v");
        }

    max = sizeof(vector3_t);
    if(AI_SUCCESS == aiGetMaterialFloatArray(material, _AI_MATKEY_TEXMAP_AXIS_BASE, type, index,
        (float*)&vec, &max) && sizeof(vector3_t) == max)
        {
        pushvector3(L, &vec, 1);
        lua_setfield(L, -2, "axis");
        }

    max = sizeof(struct aiUVTransform);
    if(AI_SUCCESS ==
        aiGetMaterialFloatArray(material, _AI_MATKEY_UVTRANSFORM_BASE, type, index,
        (float*)&trafo, &max) && sizeof(struct aiUVTransform) == max)
        {
        pushvector2(L, &(trafo.mTranslation), 1);
        lua_setfield(L, -2, "translation");
        pushvector2(L, &(trafo.mScaling), 1);
        lua_setfield(L, -2, "scaling");
        lua_pushnumber(L, trafo.mRotation);
        lua_setfield(L, -2, "rotation");
        }

    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
movl $0xc, 0x8(%rsp)
xorl %r12d, %r12d
xorl %esi, %esi
xorl %edx, %edx
callq 0x6250
movq %rbx, %rdi
movl %r14d, %esi
callq 0x64c0
leaq 0x4fe4(%rip), %rdx      # 0x103c1
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x62e0
leaq 0x5d56(%rip), %rsi      # 0x11147
leaq 0x4(%rsp), %r8
movq %r15, %rdi
movl %r14d, %edx
movl %ebp, %ecx
xorl %r9d, %r9d
callq 0x6290
testl %eax, %eax
je 0xb414
movl $0x0, 0x4(%rsp)
jmp 0xb419
movl 0x4(%rsp), %r12d
movq %rbx, %rdi
movl %r12d, %esi
movl $0x1, %edx
callq 0x6200
leaq 0x4e6d(%rip), %rdx      # 0x1029d
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x62e0
leaq 0x5c97(%rip), %rdx      # 0x110db
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %ecx
movl %ebp, %r8d
callq 0xb1fa
testl %eax, %eax
je 0xb46d
leaq 0x5abd(%rip), %rdx      # 0x10f1d
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x62e0
leaq 0x5c71(%rip), %rsi      # 0x110e5
leaq 0x4(%rsp), %r8
movq %r15, %rdi
movl %r14d, %edx
movl %ebp, %ecx
xorl %r9d, %r9d
callq 0x6290
testl %eax, %eax
jne 0xb4ad
movl 0x4(%rsp), %esi
movq %rbx, %rdi
callq 0x64e0
leaq 0x5a8a(%rip), %rdx      # 0x10f2a
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x62e0
leaq 0x5c3d(%rip), %rsi      # 0x110f1
leaq 0x4(%rsp), %r8
movq %r15, %rdi
movl %r14d, %edx
movl %ebp, %ecx
xorl %r9d, %r9d
callq 0x6290
testl %eax, %eax
jne 0xb4ed
movl 0x4(%rsp), %esi
movq %rbx, %rdi
callq 0x6360
leaq 0x5c16(%rip), %rdx      # 0x110f6
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x62e0
leaq 0x5c05(%rip), %rsi      # 0x110f9
leaq 0x4(%rsp), %r8
movq %r15, %rdi
movl %r14d, %edx
movl %ebp, %ecx
xorl %r9d, %r9d
callq 0x6290
testl %eax, %eax
jne 0xb52d
movl 0x4(%rsp), %esi
movq %rbx, %rdi
callq 0x6930
leaq 0x5bde(%rip), %rdx      # 0x110fe
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x62e0
leaq 0x5bd2(%rip), %rsi      # 0x11106
leaq 0xc(%rsp), %r8
movq %r15, %rdi
movl %r14d, %edx
movl %ebp, %ecx
xorl %r9d, %r9d
callq 0x67c0
testl %eax, %eax
jne 0xb56f
cvtss2sd 0xc(%rsp), %xmm0
movq %rbx, %rdi
callq 0x6500
leaq 0x5ab3(%rip), %rdx      # 0x11015
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x62e0
leaq 0x5b9b(%rip), %rsi      # 0x11111
leaq 0x4(%rsp), %r8
movq %r15, %rdi
movl %r14d, %edx
movl %ebp, %ecx
xorl %r9d, %r9d
callq 0x6290
testl %eax, %eax
jne 0xb5af
movl 0x4(%rsp), %esi
movq %rbx, %rdi
callq 0x66b0
leaq 0x5bb0(%rip), %rdx      # 0x11152
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x62e0
leaq 0x5b69(%rip), %rsi      # 0x1111f
leaq 0x4(%rsp), %r8
movq %r15, %rdi
movl %r14d, %edx
movl %ebp, %ecx
xorl %r9d, %r9d
callq 0x6290
testl %eax, %eax
jne 0xb5ef
movl 0x4(%rsp), %esi
movq %rbx, %rdi
callq 0x66b0
leaq 0x5b7a(%rip), %rdx      # 0x1115c
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x62e0
leaq 0x8(%rsp), %r9
movl $0xc, (%r9)
leaq 0x5b2b(%rip), %rsi      # 0x1112d
leaq 0x10(%rsp), %r8
movq %r15, %rdi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x67c0
testl %eax, %eax
jne 0xb645
cmpl $0xc, 0x8(%rsp)
jne 0xb645
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x6600
leaq 0x593b(%rip), %rdx      # 0x10f73
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x62e0
leaq 0x8(%rsp), %r9
movl $0x14, (%r9)
leaq 0x5ae2(%rip), %rsi      # 0x1113a
leaq 0x1c(%rsp), %r8
movq %r15, %rdi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x67c0
testl %eax, %eax
jne 0xb6e6
cmpl $0x14, 0x8(%rsp)
jne 0xb6e6
leaq 0x1c(%rsp), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x6170
leaq 0x58f2(%rip), %rdx      # 0x10f80
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x62e0
leaq 0x24(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x6170
leaq 0x58dd(%rip), %rdx      # 0x10f94
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x62e0
cvtss2sd 0x8(%r14), %xmm0
movq %rbx, %rdi
callq 0x6500
leaq 0x58cb(%rip), %rdx      # 0x10fa4
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x62e0
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop