// File: stetre[P]moonvulkan/src/flags.c
// Function: checkimageaspectflags
static VkFlags checkimageaspectflags(lua_State *L, int arg)
    {
    const char *s;
    VkFlags flags = 0;

    while(lua_isstring(L, arg))
        {
        s = lua_tostring(L, arg++);
#define CASE(CODE,str) if((strcmp(s, str)==0)) do { flags |= CODE; goto done; } while(0)
    CASE(VK_IMAGE_ASPECT_COLOR_BIT, "color");
    CASE(VK_IMAGE_ASPECT_DEPTH_BIT, "depth");
    CASE(VK_IMAGE_ASPECT_STENCIL_BIT, "stencil");
    CASE(VK_IMAGE_ASPECT_METADATA_BIT, "metadata");
    CASE(VK_IMAGE_ASPECT_PLANE_0_BIT, "plane 0");
    CASE(VK_IMAGE_ASPECT_PLANE_1_BIT, "plane 1");
    CASE(VK_IMAGE_ASPECT_PLANE_2_BIT, "plane 2");
    CASE(VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT, "memory plane 0");
    CASE(VK_IMAGE_ASPECT_MEMORY_PLANE_1_BIT, "memory plane 1");
    CASE(VK_IMAGE_ASPECT_MEMORY_PLANE_2_BIT, "memory plane 2");
    CASE(VK_IMAGE_ASPECT_MEMORY_PLANE_3_BIT, "memory plane 3");
#undef CASE
        return (VkFlags)luaL_argerror(L, --arg, badvalue(L,s));
        done: ;
        }

    return flags;
    }

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movl $0x0, 0x14(%rsp)
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x1a7a0
cmpl $0x0, %eax
je 0x4acb3
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
xorl %eax, %eax
movl %eax, %edx
callq 0x186d0
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
leaq 0x8b36f(%rip), %rsi     # 0xd5e27
callq 0x190a0
cmpl $0x0, %eax
jne 0x4aad4
jmp 0x4aac4
movl 0x14(%rsp), %eax
orl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x4acae
movq 0x18(%rsp), %rdi
leaq 0x93bea(%rip), %rsi     # 0xde6ca
callq 0x190a0
cmpl $0x0, %eax
jne 0x4aafc
jmp 0x4aaec
movl 0x14(%rsp), %eax
orl $0x2, %eax
movl %eax, 0x14(%rsp)
jmp 0x4acae
movq 0x18(%rsp), %rdi
leaq 0x9390d(%rip), %rsi     # 0xde415
callq 0x190a0
cmpl $0x0, %eax
jne 0x4ab24
jmp 0x4ab14
movl 0x14(%rsp), %eax
orl $0x4, %eax
movl %eax, 0x14(%rsp)
jmp 0x4acae
movq 0x18(%rsp), %rdi
leaq 0x98ceb(%rip), %rsi     # 0xe381b
callq 0x190a0
cmpl $0x0, %eax
jne 0x4ab4c
jmp 0x4ab3c
movl 0x14(%rsp), %eax
orl $0x8, %eax
movl %eax, 0x14(%rsp)
jmp 0x4acae
movq 0x18(%rsp), %rdi
leaq 0x938cc(%rip), %rsi     # 0xde424
callq 0x190a0
cmpl $0x0, %eax
jne 0x4ab74
jmp 0x4ab64
movl 0x14(%rsp), %eax
orl $0x10, %eax
movl %eax, 0x14(%rsp)
jmp 0x4acae
movq 0x18(%rsp), %rdi
leaq 0x938b3(%rip), %rsi     # 0xde433
callq 0x190a0
cmpl $0x0, %eax
jne 0x4ab9c
jmp 0x4ab8c
movl 0x14(%rsp), %eax
orl $0x20, %eax
movl %eax, 0x14(%rsp)
jmp 0x4acae
movq 0x18(%rsp), %rdi
leaq 0x9389a(%rip), %rsi     # 0xde442
callq 0x190a0
cmpl $0x0, %eax
jne 0x4abc4
jmp 0x4abb4
movl 0x14(%rsp), %eax
orl $0x40, %eax
movl %eax, 0x14(%rsp)
jmp 0x4acae
movq 0x18(%rsp), %rdi
leaq 0x9384d(%rip), %rsi     # 0xde41d
callq 0x190a0
cmpl $0x0, %eax
jne 0x4abee
jmp 0x4abdc
movl 0x14(%rsp), %eax
orl $0x80, %eax
movl %eax, 0x14(%rsp)
jmp 0x4acae
movq 0x18(%rsp), %rdi
leaq 0x93832(%rip), %rsi     # 0xde42c
callq 0x190a0
cmpl $0x0, %eax
jne 0x4ac18
jmp 0x4ac06
movl 0x14(%rsp), %eax
orl $0x100, %eax            # imm = 0x100
movl %eax, 0x14(%rsp)
jmp 0x4acae
movq 0x18(%rsp), %rdi
leaq 0x93817(%rip), %rsi     # 0xde43b
callq 0x190a0
cmpl $0x0, %eax
jne 0x4ac3f
jmp 0x4ac30
movl 0x14(%rsp), %eax
orl $0x200, %eax            # imm = 0x200
movl %eax, 0x14(%rsp)
jmp 0x4acae
movq 0x18(%rsp), %rdi
leaq 0x937ff(%rip), %rsi     # 0xde44a
callq 0x190a0
cmpl $0x0, %eax
jne 0x4ac66
jmp 0x4ac57
movl 0x14(%rsp), %eax
orl $0x400, %eax            # imm = 0x400
movl %eax, 0x14(%rsp)
jmp 0x4acae
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movl 0x24(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
movl %eax, 0x24(%rsp)
movq 0x28(%rsp), %rdi
movq 0x18(%rsp), %rdx
leaq 0x86d40(%rip), %rsi     # 0xd19d0
movb $0x0, %al
callq 0x18f50
movq 0x8(%rsp), %rdi
movl 0x10(%rsp), %esi
movq %rax, %rdx
callq 0x18460
movl %eax, 0x34(%rsp)
jmp 0x4acbb
jmp 0x4aa75
movl 0x14(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)