// File: stetre[P]moonvulkan/src/flags.c
// Function: checksurfacetransformflags
static VkFlags checksurfacetransformflags(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_SURFACE_TRANSFORM_IDENTITY_BIT, "identity");
    CASE(VK_SURFACE_TRANSFORM_ROTATE_90_BIT, "rotate 90");
    CASE(VK_SURFACE_TRANSFORM_ROTATE_180_BIT, "rotate 180");
    CASE(VK_SURFACE_TRANSFORM_ROTATE_270_BIT, "rotate 270");
    CASE(VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT, "horizontal mirror");
    CASE(VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT, "horizontal mirror rotate 90");
    CASE(VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT, "horizontal mirror rotate 180");
    CASE(VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT, "horizontal mirror rotate 270");
    CASE(VK_SURFACE_TRANSFORM_INHERIT_BIT, "inherit");
#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 0x4fd1f
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 0x883bc(%rip), %rsi     # 0xd7f34
callq 0x190a0
cmpl $0x0, %eax
jne 0x4fb94
jmp 0x4fb84
movl 0x14(%rsp), %eax
orl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x4fd1a
movq 0x18(%rsp), %rdi
leaq 0x8f0e6(%rip), %rsi     # 0xdec86
callq 0x190a0
cmpl $0x0, %eax
jne 0x4fbbc
jmp 0x4fbac
movl 0x14(%rsp), %eax
orl $0x2, %eax
movl %eax, 0x14(%rsp)
jmp 0x4fd1a
movq 0x18(%rsp), %rdi
leaq 0x8f0da(%rip), %rsi     # 0xdeca2
callq 0x190a0
cmpl $0x0, %eax
jne 0x4fbe4
jmp 0x4fbd4
movl 0x14(%rsp), %eax
orl $0x4, %eax
movl %eax, 0x14(%rsp)
jmp 0x4fd1a
movq 0x18(%rsp), %rdi
leaq 0x8f0cf(%rip), %rsi     # 0xdecbf
callq 0x190a0
cmpl $0x0, %eax
jne 0x4fc0c
jmp 0x4fbfc
movl 0x14(%rsp), %eax
orl $0x8, %eax
movl %eax, 0x14(%rsp)
jmp 0x4fd1a
movq 0x18(%rsp), %rdi
leaq 0x8f04a(%rip), %rsi     # 0xdec62
callq 0x190a0
cmpl $0x0, %eax
jne 0x4fc34
jmp 0x4fc24
movl 0x14(%rsp), %eax
orl $0x10, %eax
movl %eax, 0x14(%rsp)
jmp 0x4fd1a
movq 0x18(%rsp), %rdi
leaq 0x8f034(%rip), %rsi     # 0xdec74
callq 0x190a0
cmpl $0x0, %eax
jne 0x4fc5c
jmp 0x4fc4c
movl 0x14(%rsp), %eax
orl $0x20, %eax
movl %eax, 0x14(%rsp)
jmp 0x4fd1a
movq 0x18(%rsp), %rdi
leaq 0x8f028(%rip), %rsi     # 0xdec90
callq 0x190a0
cmpl $0x0, %eax
jne 0x4fc84
jmp 0x4fc74
movl 0x14(%rsp), %eax
orl $0x40, %eax
movl %eax, 0x14(%rsp)
jmp 0x4fd1a
movq 0x18(%rsp), %rdi
leaq 0x8f01d(%rip), %rsi     # 0xdecad
callq 0x190a0
cmpl $0x0, %eax
jne 0x4fcab
jmp 0x4fc9c
movl 0x14(%rsp), %eax
orl $0x80, %eax
movl %eax, 0x14(%rsp)
jmp 0x4fd1a
movq 0x18(%rsp), %rdi
leaq 0x8f013(%rip), %rsi     # 0xdecca
callq 0x190a0
cmpl $0x0, %eax
jne 0x4fcd2
jmp 0x4fcc3
movl 0x14(%rsp), %eax
orl $0x100, %eax            # imm = 0x100
movl %eax, 0x14(%rsp)
jmp 0x4fd1a
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 0x81cd4(%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 0x4fd27
jmp 0x4fb35
movl 0x14(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq