// File: stetre[P]moonvulkan/src/flags.c
// Function: pushshaderstageflags
static int pushshaderstageflags(lua_State *L, VkFlags flags)
    {
    int n = 0;

#define CASE(CODE,str) do { if( flags & CODE) { lua_pushstring(L, str); n++; } } while(0)
    CASE(VK_SHADER_STAGE_VERTEX_BIT, "vertex");
    CASE(VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT, "tessellation control");
    CASE(VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, "tessellation evaluation");
    CASE(VK_SHADER_STAGE_GEOMETRY_BIT, "geometry");
    CASE(VK_SHADER_STAGE_FRAGMENT_BIT, "fragment");
    CASE(VK_SHADER_STAGE_COMPUTE_BIT, "compute");
    CASE(VK_SHADER_STAGE_RAYGEN_BIT, "raygen");
    CASE(VK_SHADER_STAGE_ANY_HIT_BIT, "any hit");
    CASE(VK_SHADER_STAGE_CLOSEST_HIT_BIT, "closest hit");
    CASE(VK_SHADER_STAGE_MISS_BIT, "miss");
    CASE(VK_SHADER_STAGE_INTERSECTION_BIT, "intersection");
    CASE(VK_SHADER_STAGE_CALLABLE_BIT, "callable");
    // These are not individual bits:
    CASE(VK_SHADER_STAGE_ALL_GRAPHICS, "all graphics"); 
    CASE(VK_SHADER_STAGE_ALL, "all");
#undef CASE

    return n;
    }

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movl %esi, 0xc(%rsp)
movl $0x0, 0x8(%rsp)
movl 0xc(%rsp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x4892d
movq 0x10(%rsp), %rdi
leaq 0x90876(%rip), %rsi     # 0xd9193
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x4892f
jmp 0x48931
movl 0xc(%rsp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x48959
movq 0x10(%rsp), %rdi
leaq 0x955c8(%rip), %rsi     # 0xddf11
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x4895b
jmp 0x4895d
movl 0xc(%rsp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x48985
movq 0x10(%rsp), %rdi
leaq 0x955b1(%rip), %rsi     # 0xddf26
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x48987
jmp 0x48989
movl 0xc(%rsp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x489b1
movq 0x10(%rsp), %rdi
leaq 0x9559d(%rip), %rsi     # 0xddf3e
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x489b3
jmp 0x489b5
movl 0xc(%rsp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x489dd
movq 0x10(%rsp), %rdi
leaq 0x9557a(%rip), %rsi     # 0xddf47
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x489df
jmp 0x489e1
movl 0xc(%rsp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x48a09
movq 0x10(%rsp), %rdi
leaq 0x8e65a(%rip), %rsi     # 0xd7053
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x48a0b
jmp 0x48a0d
movl 0xc(%rsp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x48a37
movq 0x10(%rsp), %rdi
leaq 0x95529(%rip), %rsi     # 0xddf50
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x48a39
jmp 0x48a3b
movl 0xc(%rsp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x48a65
movq 0x10(%rsp), %rdi
leaq 0x90abf(%rip), %rsi     # 0xd9514
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x48a67
jmp 0x48a69
movl 0xc(%rsp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x48a93
movq 0x10(%rsp), %rdi
leaq 0x90a65(%rip), %rsi     # 0xd94e8
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x48a95
jmp 0x48a97
movl 0xc(%rsp), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x48ac1
movq 0x10(%rsp), %rdi
leaq 0x954a6(%rip), %rsi     # 0xddf57
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x48ac3
jmp 0x48ac5
movl 0xc(%rsp), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x48aef
movq 0x10(%rsp), %rdi
leaq 0x90a59(%rip), %rsi     # 0xd9538
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x48af1
jmp 0x48af3
movl 0xc(%rsp), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x48b1d
movq 0x10(%rsp), %rdi
leaq 0x9544f(%rip), %rsi     # 0xddf5c
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x48b1f
jmp 0x48b21
movl 0xc(%rsp), %eax
andl $0x1f, %eax
cmpl $0x0, %eax
je 0x48b49
movq 0x10(%rsp), %rdi
leaq 0x9542c(%rip), %rsi     # 0xddf65
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x48b4b
jmp 0x48b4d
movl 0xc(%rsp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x0, %eax
je 0x48b77
movq 0x10(%rsp), %rdi
leaq 0x8f008(%rip), %rsi     # 0xd7b6f
callq 0x1a420
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x48b79
movl 0x8(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)