// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/render_pass.c
// Function: Create
static int Create(lua_State *L)
    {
    int err;
    ud_t *ud, *device_ud;
    VkResult ec;
    VkRenderPass render_pass;
    VkRenderPassCreateInfo* info;
    VkRenderPassCreateInfo2* info2;
    VkDevice device = checkdevice(L, 1, &device_ud);
    const VkAllocationCallbacks *allocator = optallocator(L, 3);

    if(device_ud->ddt->CreateRenderPass2)
        {
#define CLEANUP zfreeVkRenderPassCreateInfo2(L, info2, 1)
        info2 = zcheckVkRenderPassCreateInfo2(L, 2, &err);
        if(err) { CLEANUP; return argerror(L, 2); }
        ec = device_ud->ddt->CreateRenderPass2(device, info2, allocator, &render_pass);
        CLEANUP;
        CheckError(L, ec);
#undef CLEANUP
        }
    else
        {
#define CLEANUP zfreeVkRenderPassCreateInfo(L, info, 1)
        info = zcheckVkRenderPassCreateInfo(L, 2, &err);
        if(err) { CLEANUP; return argerror(L, 2); }
        ec = device_ud->ddt->CreateRenderPass(device, info, allocator, &render_pass);
        CLEANUP;
        CheckError(L, ec);
#undef CLEANUP
        }
    TRACE_CREATE(render_pass, "render_pass");
    ud = newuserdata_nondispatchable(L, render_pass, RENDER_PASS_MT);
    ud->parent_ud = device_ud;
    ud->device = device;
    ud->instance = device_ud->instance;
    ud->allocator = allocator;
    ud->destructor = freerender_pass;
    ud->ddt = device_ud->ddt;
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x415f0(%rip), %rcx     # 0x8c03b
leaq 0x8(%rsp), %r12
movl $0x1, %esi
movq %r12, %rdx
callq 0x1a4e0
movq %rax, %r14
movq %rbx, %rdi
movl $0x3, %esi
callq 0x191b0
movq %rax, %r15
movq (%r12), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x5b8(%rax)
je 0x4aabe
leaq 0x14(%rsp), %r13
movq %rbx, %rdi
movl $0x2, %esi
movq %r13, %rdx
callq 0x193d0
movq %rax, %r12
cmpl $0x0, (%r13)
jne 0x4aadd
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
movq %rsp, %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *0x5b8(%rax)
jmp 0x4ab2c
leaq 0x14(%rsp), %r13
movq %rbx, %rdi
movl $0x2, %esi
movq %r13, %rdx
callq 0x18390
movq %rax, %r12
cmpl $0x0, (%r13)
je 0x4ab11
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x18680
movq %rbx, %rdi
movl $0x2, %esi
movq %rax, %rdx
callq 0x18410
jmp 0x4abbc
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
movq %rsp, %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *0x208(%rax)
movl %eax, %ebp
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19160
testl %ebp, %ebp
je 0x4ab58
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x18980
movq %rbx, %rdi
callq 0x199a0
jmp 0x4abbc
movq 0x75469(%rip), %rax     # 0xbffc8
cmpl $0x0, (%rax)
je 0x4ab76
movq (%rsp), %rsi
leaq 0x55439(%rip), %rdi     # 0x9ffa8
xorl %eax, %eax
callq 0x18960
movq (%rsp), %rsi
leaq 0x43484(%rip), %rdx     # 0x8e005
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x18320
movq 0x8(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq %r14, 0x20(%rax)
movq 0x18(%rcx), %rdx
movq %rdx, 0x18(%rax)
movq %r15, 0x40(%rax)
leaq 0xa6(%rip), %rdx        # 0x4ac51
movq %rdx, 0x8(%rax)
movq 0x50(%rcx), %rcx
movq %rcx, 0x50(%rax)
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq