// File: stetre[P]moonvulkan/src/cmd.c
// Function: CmdBeginRenderPass
static int CmdBeginRenderPass(lua_State *L)
    {
    int err;
    ud_t *ud;
    VkCommandBuffer cb = checkcommand_buffer(L, 1, &ud);
    if(ud->ddt->CmdBeginRenderPass2 && lua_type(L, 3) == LUA_TTABLE)
        {
#define CLEANUP do {                                    \
            zfreeVkRenderPassBeginInfo(L, info, 1);     \
            zfreeVkSubpassBeginInfo(L, binfo, 1);    \
} while(0)
        VkRenderPassBeginInfo* info=NULL;
        VkSubpassBeginInfo* binfo=NULL;
        info = zcheckVkRenderPassBeginInfo(L, 2, &err);
        if(err) { CLEANUP; return argerror(L, 2); }
        binfo = zcheckVkSubpassBeginInfo(L, 3, &err);
        if(err) { CLEANUP; return argerror(L, 3); }
        ud->ddt->CmdBeginRenderPass2(cb, info, binfo);
        CLEANUP;
#undef CLEANUP
        }
    else
        {
        VkSubpassContents contents = checksubpasscontents(L, 3);
#define CLEANUP zfreeVkRenderPassBeginInfo(L, info, 1)
        VkRenderPassBeginInfo* info = zcheckVkRenderPassBeginInfo(L, 2, &err);
        if(err) { CLEANUP; return argerror(L, 2); }
        ud->ddt->CmdBeginRenderPass(cb, info, contents);
        CLEANUP;
#undef CLEANUP
        }
    return 0;
    }

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq 0x58(%rsp), %rdi
movl $0x1, %esi
leaq 0x48(%rsp), %rdx
leaq 0xb149a(%rip), %rcx     # 0xcf909
callq 0x1a640
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x5c0(%rax)
je 0x1e60c
movq 0x58(%rsp), %rdi
movl $0x3, %esi
callq 0x1a240
cmpl $0x5, %eax
jne 0x1e60c
movq $0x0, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x58(%rsp), %rdi
movl $0x2, %esi
leaq 0x54(%rsp), %rdx
callq 0x19f50
movq %rax, 0x38(%rsp)
cmpl $0x0, 0x54(%rsp)
je 0x1e53c
jmp 0x1e4dc
movq 0x58(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x58(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x58(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x58(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x186d0
movq 0x18(%rsp), %rdi
movq %rax, %rdx
movl $0x2, %esi
callq 0x18460
movl %eax, 0x64(%rsp)
jmp 0x1e6c9
movq 0x58(%rsp), %rdi
movl $0x3, %esi
leaq 0x54(%rsp), %rdx
callq 0x18270
movq %rax, 0x30(%rsp)
cmpl $0x0, 0x54(%rsp)
je 0x1e5be
jmp 0x1e55e
movq 0x58(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x58(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x58(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x186d0
movq 0x10(%rsp), %rdi
movq %rax, %rdx
movl $0x3, %esi
callq 0x18460
movl %eax, 0x64(%rsp)
jmp 0x1e6c9
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x5c0(%rax), %rax
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq *%rax
movq 0x58(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x58(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
jmp 0x1e6c1
movq 0x58(%rsp), %rdi
movl $0x21, %esi
movl $0x3, %edx
callq 0x19d20
movl %eax, 0x2c(%rsp)
movq 0x58(%rsp), %rdi
movl $0x2, %esi
leaq 0x54(%rsp), %rdx
callq 0x19f50
movq %rax, 0x20(%rsp)
cmpl $0x0, 0x54(%rsp)
je 0x1e68d
movq 0x58(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x58(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x186d0
movq 0x8(%rsp), %rdi
movq %rax, %rdx
movl $0x2, %esi
callq 0x18460
movl %eax, 0x64(%rsp)
jmp 0x1e6c9
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x410(%rax), %rax
movq 0x40(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl 0x2c(%rsp), %edx
callq *%rax
movq 0x58(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)