// File: stetre[P]moonvulkan/src/flags.c
// Function: checkbufferusageflags
static VkFlags checkbufferusageflags(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_BUFFER_USAGE_TRANSFER_SRC_BIT, "transfer src");
    CASE(VK_BUFFER_USAGE_TRANSFER_DST_BIT, "transfer dst");
    CASE(VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT, "uniform texel buffer");
    CASE(VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT, "storage texel buffer");
    CASE(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, "uniform buffer");
    CASE(VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, "storage buffer");
    CASE(VK_BUFFER_USAGE_INDEX_BUFFER_BIT, "index buffer");
    CASE(VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, "vertex buffer");
    CASE(VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT, "indirect buffer");
    CASE(VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT, "conditional rendering");
    CASE(VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT, "transform feedback buffer");
    CASE(VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT, "transform feedback counter buffer");
    CASE(VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, "shader device address");
    CASE(VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT, "acceleration structure build input read only");
    CASE(VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT, "acceleration structure storage");
    CASE(VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT, "shader binding table");
#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 0x49b25
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 0x948e4(%rip), %rsi     # 0xde13c
callq 0x190a0
cmpl $0x0, %eax
jne 0x49874
jmp 0x49864
movl 0x14(%rsp), %eax
orl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x948c9(%rip), %rsi     # 0xde149
callq 0x190a0
cmpl $0x0, %eax
jne 0x4989c
jmp 0x4988c
movl 0x14(%rsp), %eax
orl $0x2, %eax
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x8d4cc(%rip), %rsi     # 0xd6d74
callq 0x190a0
cmpl $0x0, %eax
jne 0x498c4
jmp 0x498b4
movl 0x14(%rsp), %eax
orl $0x4, %eax
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x8d4de(%rip), %rsi     # 0xd6dae
callq 0x190a0
cmpl $0x0, %eax
jne 0x498ec
jmp 0x498dc
movl 0x14(%rsp), %eax
orl $0x8, %eax
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x8d4f0(%rip), %rsi     # 0xd6de8
callq 0x190a0
cmpl $0x0, %eax
jne 0x49914
jmp 0x49904
movl 0x14(%rsp), %eax
orl $0x10, %eax
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x8d4f6(%rip), %rsi     # 0xd6e16
callq 0x190a0
cmpl $0x0, %eax
jne 0x4993c
jmp 0x4992c
movl 0x14(%rsp), %eax
orl $0x20, %eax
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x9480e(%rip), %rsi     # 0xde156
callq 0x190a0
cmpl $0x0, %eax
jne 0x49964
jmp 0x49954
movl 0x14(%rsp), %eax
orl $0x40, %eax
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x94fd3(%rip), %rsi     # 0xde943
callq 0x190a0
cmpl $0x0, %eax
jne 0x4998e
jmp 0x4997c
movl 0x14(%rsp), %eax
orl $0x80, %eax
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x947c9(%rip), %rsi     # 0xde163
callq 0x190a0
cmpl $0x0, %eax
jne 0x499b8
jmp 0x499a6
movl 0x14(%rsp), %eax
orl $0x100, %eax            # imm = 0x100
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x947af(%rip), %rsi     # 0xde173
callq 0x190a0
cmpl $0x0, %eax
jne 0x499e2
jmp 0x499d0
movl 0x14(%rsp), %eax
orl $0x200, %eax            # imm = 0x200
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x9479b(%rip), %rsi     # 0xde189
callq 0x190a0
cmpl $0x0, %eax
jne 0x49a0c
jmp 0x499fa
movl 0x14(%rsp), %eax
orl $0x800, %eax            # imm = 0x800
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x9478b(%rip), %rsi     # 0xde1a3
callq 0x190a0
cmpl $0x0, %eax
jne 0x49a36
jmp 0x49a24
movl 0x14(%rsp), %eax
orl $0x1000, %eax           # imm = 0x1000
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x94783(%rip), %rsi     # 0xde1c5
callq 0x190a0
cmpl $0x0, %eax
jne 0x49a60
jmp 0x49a4e
movl 0x14(%rsp), %eax
orl $0x20000, %eax          # imm = 0x20000
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x9476f(%rip), %rsi     # 0xde1db
callq 0x190a0
cmpl $0x0, %eax
jne 0x49a8a
jmp 0x49a78
movl 0x14(%rsp), %eax
orl $0x80000, %eax          # imm = 0x80000
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x94772(%rip), %rsi     # 0xde208
callq 0x190a0
cmpl $0x0, %eax
jne 0x49ab1
jmp 0x49aa2
movl 0x14(%rsp), %eax
orl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x14(%rsp)
jmp 0x49b20
movq 0x18(%rsp), %rdi
leaq 0x9476a(%rip), %rsi     # 0xde227
callq 0x190a0
cmpl $0x0, %eax
jne 0x49ad8
jmp 0x49ac9
movl 0x14(%rsp), %eax
orl $0x400, %eax            # imm = 0x400
movl %eax, 0x14(%rsp)
jmp 0x49b20
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 0x87ece(%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 0x49b2d
jmp 0x49815
movl 0x14(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)