// File: stetre[P]moonvulkan/src/cmd.c
// Function: CmdPipelineBarrier1
static int CmdPipelineBarrier1(lua_State *L)
    {
    int err;
    ud_t *ud;
    uint32_t mCount=0, bCount=0, iCount=0;
    VkMemoryBarrier* pMemoryBarriers = NULL;
    VkBufferMemoryBarrier* pBufferMemoryBarriers = NULL;
    VkImageMemoryBarrier* pImageMemoryBarriers = NULL;
    VkCommandBuffer cb = checkcommand_buffer(L, 1, &ud);
    VkPipelineStageFlags srcStageMask = checkflags(L, 2);
    VkPipelineStageFlags dstStageMask = checkflags(L, 3);
    VkDependencyFlags dependencyFlags = checkflags(L, 4);
#define CLEANUP do {                                                        \
    zfreearrayVkMemoryBarrier(L, pMemoryBarriers, mCount, 1);               \
    zfreearrayVkBufferMemoryBarrier(L, pBufferMemoryBarriers, bCount, 1);   \
    zfreearrayVkImageMemoryBarrier(L, pImageMemoryBarriers, iCount, 1);     \
} while(0)
    pMemoryBarriers = zcheckarrayVkMemoryBarrier(L, 5, &mCount, &err);
    if(err < 0) { CLEANUP; return argerror(L, 5); }
    if(err) lua_pop(L, 1);

    pBufferMemoryBarriers = zcheckarrayVkBufferMemoryBarrier(L, 6, &bCount, &err);
    if(err < 0) { CLEANUP; return argerror(L, 6); }
    if(err) lua_pop(L, 1);

    pImageMemoryBarriers = zcheckarrayVkImageMemoryBarrier(L, 7, &iCount, &err);
    if(err < 0) { CLEANUP; return argerror(L, 7); }
    if(err) lua_pop(L, 1);

    ud->ddt->CmdPipelineBarrier(cb, srcStageMask, dstStageMask, dependencyFlags, 
        mCount, pMemoryBarriers, bCount, pBufferMemoryBarriers, 
        iCount, pImageMemoryBarriers);
    CLEANUP;
#undef CLEANUP
    return 0;
    }

// Assembly:
pushq %rbp
pushq %rbx
subq $0x98, %rsp
movq %rdi, 0x88(%rsp)
movl $0x0, 0x74(%rsp)
movl $0x0, 0x70(%rsp)
movl $0x0, 0x6c(%rsp)
movq $0x0, 0x60(%rsp)
movq $0x0, 0x58(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x88(%rsp), %rdi
movl $0x1, %esi
leaq 0x78(%rsp), %rdx
leaq 0xad6cc(%rip), %rcx     # 0xcf909
callq 0x1a640
movq %rax, 0x48(%rsp)
movq 0x88(%rsp), %rdi
movl $0x2, %esi
callq 0x19010
movl %eax, 0x44(%rsp)
movq 0x88(%rsp), %rdi
movl $0x3, %esi
callq 0x19010
movl %eax, 0x40(%rsp)
movq 0x88(%rsp), %rdi
movl $0x4, %esi
callq 0x19010
movl %eax, 0x3c(%rsp)
movq 0x88(%rsp), %rdi
movl $0x5, %esi
leaq 0x74(%rsp), %rdx
leaq 0x84(%rsp), %rcx
callq 0x1a4b0
movq %rax, 0x60(%rsp)
cmpl $0x0, 0x84(%rsp)
jge 0x22361
jmp 0x222bd
movq 0x88(%rsp), %rdi
movq 0x60(%rsp), %rsi
movl 0x74(%rsp), %ecx
movl $0x18, %edx
movl $0x1, %r8d
callq 0x198d0
movq 0x88(%rsp), %rdi
movq 0x58(%rsp), %rsi
movl 0x70(%rsp), %ecx
movl $0x38, %edx
movl $0x1, %r8d
callq 0x198d0
movq 0x88(%rsp), %rdi
movq 0x50(%rsp), %rsi
movl 0x6c(%rsp), %ecx
movl $0x48, %edx
movl $0x1, %r8d
callq 0x198d0
movq 0x88(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x88(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x186d0
movq 0x30(%rsp), %rdi
movq %rax, %rdx
movl $0x5, %esi
callq 0x18460
movl %eax, 0x94(%rsp)
jmp 0x22625
cmpl $0x0, 0x84(%rsp)
je 0x2237d
movq 0x88(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18170
movq 0x88(%rsp), %rdi
movl $0x6, %esi
leaq 0x70(%rsp), %rdx
leaq 0x84(%rsp), %rcx
callq 0x18ed0
movq %rax, 0x58(%rsp)
cmpl $0x0, 0x84(%rsp)
jge 0x22455
jmp 0x223b1
movq 0x88(%rsp), %rdi
movq 0x60(%rsp), %rsi
movl 0x74(%rsp), %ecx
movl $0x18, %edx
movl $0x1, %r8d
callq 0x198d0
movq 0x88(%rsp), %rdi
movq 0x58(%rsp), %rsi
movl 0x70(%rsp), %ecx
movl $0x38, %edx
movl $0x1, %r8d
callq 0x198d0
movq 0x88(%rsp), %rdi
movq 0x50(%rsp), %rsi
movl 0x6c(%rsp), %ecx
movl $0x48, %edx
movl $0x1, %r8d
callq 0x198d0
movq 0x88(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x88(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x186d0
movq 0x28(%rsp), %rdi
movq %rax, %rdx
movl $0x6, %esi
callq 0x18460
movl %eax, 0x94(%rsp)
jmp 0x22625
cmpl $0x0, 0x84(%rsp)
je 0x22471
movq 0x88(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18170
movq 0x88(%rsp), %rdi
movl $0x7, %esi
leaq 0x6c(%rsp), %rdx
leaq 0x84(%rsp), %rcx
callq 0x19300
movq %rax, 0x50(%rsp)
cmpl $0x0, 0x84(%rsp)
jge 0x22549
jmp 0x224a5
movq 0x88(%rsp), %rdi
movq 0x60(%rsp), %rsi
movl 0x74(%rsp), %ecx
movl $0x18, %edx
movl $0x1, %r8d
callq 0x198d0
movq 0x88(%rsp), %rdi
movq 0x58(%rsp), %rsi
movl 0x70(%rsp), %ecx
movl $0x38, %edx
movl $0x1, %r8d
callq 0x198d0
movq 0x88(%rsp), %rdi
movq 0x50(%rsp), %rsi
movl 0x6c(%rsp), %ecx
movl $0x48, %edx
movl $0x1, %r8d
callq 0x198d0
movq 0x88(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x88(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x186d0
movq 0x20(%rsp), %rdi
movq %rax, %rdx
movl $0x7, %esi
callq 0x18460
movl %eax, 0x94(%rsp)
jmp 0x22625
cmpl $0x0, 0x84(%rsp)
je 0x22565
movq 0x88(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18170
movq 0x78(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x3d8(%rax), %rax
movq 0x48(%rsp), %rdi
movl 0x44(%rsp), %esi
movl 0x40(%rsp), %edx
movl 0x3c(%rsp), %ecx
movl 0x74(%rsp), %r8d
movq 0x60(%rsp), %r9
movl 0x70(%rsp), %ebp
movq 0x58(%rsp), %rbx
movl 0x6c(%rsp), %r11d
movq 0x50(%rsp), %r10
movl %ebp, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movq %r10, 0x18(%rsp)
callq *%rax
movq 0x88(%rsp), %rdi
movq 0x60(%rsp), %rsi
movl 0x74(%rsp), %ecx
movl $0x18, %edx
movl $0x1, %r8d
callq 0x198d0
movq 0x88(%rsp), %rdi
movq 0x58(%rsp), %rsi
movl 0x70(%rsp), %ecx
movl $0x38, %edx
movl $0x1, %r8d
callq 0x198d0
movq 0x88(%rsp), %rdi
movq 0x50(%rsp), %rsi
movl 0x6c(%rsp), %ecx
movl $0x48, %edx
movl $0x1, %r8d
callq 0x198d0
movl $0x0, 0x94(%rsp)
movl 0x94(%rsp), %eax
addq $0x98, %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)