// File: stetre[P]moonvulkan/src/flags.c
// Function: checkimagecreateflags
static VkFlags checkimagecreateflags(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_CREATE_SPARSE_BINDING_BIT, "sparse binding");
        CASE(VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT, "sparse residency");
        CASE(VK_IMAGE_CREATE_SPARSE_ALIASED_BIT, "sparse aliased");
        CASE(VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT, "mutable format");
        CASE(VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, "cube compatible");
        CASE(VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT, "block texel view compatible");
        CASE(VK_IMAGE_CREATE_EXTENDED_USAGE_BIT, "extended usage");
        CASE(VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT, "sample locations compatible depth");
        CASE(VK_IMAGE_CREATE_DISJOINT_BIT, "disjoint");
        CASE(VK_IMAGE_CREATE_ALIAS_BIT, "alias");
        CASE(VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT,"split instance bind regions");
        CASE(VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT,"2d array compatible");
        CASE(VK_IMAGE_CREATE_PROTECTED_BIT, "protected");
        CASE(VK_IMAGE_CREATE_SUBSAMPLED_BIT, "subsampled");
#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 0x4c861
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 0x91c54(%rip), %rsi     # 0xde23c
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c604
jmp 0x4c5f4
movl 0x14(%rsp), %eax
orl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x4c85c
movq 0x18(%rsp), %rdi
leaq 0x91c3b(%rip), %rsi     # 0xde24b
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c62c
jmp 0x4c61c
movl 0x14(%rsp), %eax
orl $0x2, %eax
movl %eax, 0x14(%rsp)
jmp 0x4c85c
movq 0x18(%rsp), %rdi
leaq 0x91c24(%rip), %rsi     # 0xde25c
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c654
jmp 0x4c644
movl 0x14(%rsp), %eax
orl $0x4, %eax
movl %eax, 0x14(%rsp)
jmp 0x4c85c
movq 0x18(%rsp), %rdi
leaq 0x92004(%rip), %rsi     # 0xde664
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c67c
jmp 0x4c66c
movl 0x14(%rsp), %eax
orl $0x8, %eax
movl %eax, 0x14(%rsp)
jmp 0x4c85c
movq 0x18(%rsp), %rdi
leaq 0x91feb(%rip), %rsi     # 0xde673
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c6a4
jmp 0x4c694
movl 0x14(%rsp), %eax
orl $0x10, %eax
movl %eax, 0x14(%rsp)
jmp 0x4c85c
movq 0x18(%rsp), %rdi
leaq 0x91fd3(%rip), %rsi     # 0xde683
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c6ce
jmp 0x4c6bc
movl 0x14(%rsp), %eax
orl $0x80, %eax
movl %eax, 0x14(%rsp)
jmp 0x4c85c
movq 0x18(%rsp), %rdi
leaq 0x91fc5(%rip), %rsi     # 0xde69f
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c6f8
jmp 0x4c6e6
movl 0x14(%rsp), %eax
orl $0x100, %eax            # imm = 0x100
movl %eax, 0x14(%rsp)
jmp 0x4c85c
movq 0x18(%rsp), %rdi
leaq 0x91faa(%rip), %rsi     # 0xde6ae
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c722
jmp 0x4c710
movl 0x14(%rsp), %eax
orl $0x1000, %eax           # imm = 0x1000
movl %eax, 0x14(%rsp)
jmp 0x4c85c
movq 0x18(%rsp), %rdi
leaq 0x8b629(%rip), %rsi     # 0xd7d57
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c74c
jmp 0x4c73a
movl 0x14(%rsp), %eax
orl $0x200, %eax            # imm = 0x200
movl %eax, 0x14(%rsp)
jmp 0x4c85c
movq 0x18(%rsp), %rdi
leaq 0x91766(%rip), %rsi     # 0xddebe
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c776
jmp 0x4c764
movl 0x14(%rsp), %eax
orl $0x400, %eax            # imm = 0x400
movl %eax, 0x14(%rsp)
jmp 0x4c85c
movq 0x18(%rsp), %rdi
leaq 0x91f4e(%rip), %rsi     # 0xde6d0
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c79e
jmp 0x4c78e
movl 0x14(%rsp), %eax
orl $0x40, %eax
movl %eax, 0x14(%rsp)
jmp 0x4c85c
movq 0x18(%rsp), %rdi
leaq 0x91f42(%rip), %rsi     # 0xde6ec
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c7c6
jmp 0x4c7b6
movl 0x14(%rsp), %eax
orl $0x20, %eax
movl %eax, 0x14(%rsp)
jmp 0x4c85c
movq 0x18(%rsp), %rdi
leaq 0x9d301(%rip), %rsi     # 0xe9ad3
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c7ed
jmp 0x4c7de
movl 0x14(%rsp), %eax
orl $0x800, %eax            # imm = 0x800
movl %eax, 0x14(%rsp)
jmp 0x4c85c
movq 0x18(%rsp), %rdi
leaq 0x91f07(%rip), %rsi     # 0xde700
callq 0x190a0
cmpl $0x0, %eax
jne 0x4c814
jmp 0x4c805
movl 0x14(%rsp), %eax
orl $0x4000, %eax           # imm = 0x4000
movl %eax, 0x14(%rsp)
jmp 0x4c85c
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 0x85192(%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 0x4c869
jmp 0x4c5a5
movl 0x14(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)