// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/descriptor_set_layout.c
// Function: Create
static int Create(lua_State *L)
    {
    ud_t *ud;
    int err;
    VkResult ec;
    VkDescriptorSetLayout descriptor_set_layout;
    VkDescriptorSetLayoutCreateInfo *info;
    VkDevice device = checkdevice(L, 1, NULL);
    const VkAllocationCallbacks *allocator = NULL;

#define CLEANUP zfreeVkDescriptorSetLayoutCreateInfo(L, info, 1)
    if(lua_istable(L, 2))
        {
        allocator = optallocator(L, 3);
        info = zcheckVkDescriptorSetLayoutCreateInfo(L, 2, &err);
        if(err) { CLEANUP; return argerror(L, 2); }
        }
    else
        {
        info = znewVkDescriptorSetLayoutCreateInfo(L, &err);
        info->flags = optflags(L, 2, 0);
        info->pBindings = zcheckarrayVkDescriptorSetLayoutBinding(L, 3, &info->bindingCount, &err);
        if(err < 0) { CLEANUP; return argerror(L, 3); }
        if(err == ERR_NOTPRESENT) lua_pop(L, 1);
        }

    ec = UD(device)->ddt->CreateDescriptorSetLayout(device, info, allocator, &descriptor_set_layout);
    CLEANUP;
#undef CLEANUP
    CheckError(L, ec);
    TRACE_CREATE(descriptor_set_layout, "descriptor_set_layout");
    ud = newuserdata_nondispatchable(L, descriptor_set_layout, DESCRIPTOR_SET_LAYOUT_MT);
    ud->parent_ud = UD(device);
    ud->device = device;
    ud->instance = UD(device)->instance;
    ud->allocator = allocator;
    ud->destructor = freedescriptor_set_layout;
    ud->ddt = UD(device)->ddt;
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x67fe0(%rip), %rcx     # 0x8c03b
movl $0x1, %esi
xorl %edx, %edx
callq 0x1a4e0
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1a0f0
cmpl $0x5, %eax
jne 0x240db
movq %rbx, %rdi
movl $0x3, %esi
callq 0x191b0
movq %rax, %r15
leaq 0xc(%rsp), %r13
movq %rbx, %rdi
movl $0x2, %esi
movq %r13, %rdx
callq 0x197c0
movq %rax, %r12
cmpl $0x0, (%r13)
je 0x24142
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
jmp 0x241b8
leaq 0xc(%rsp), %r15
movl $0x20, %edx
movq %rbx, %rdi
movl $0x20, %esi
movq %r15, %rcx
callq 0x19da0
movq %rax, %r12
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x192a0
movl %eax, 0x10(%r12)
leaq 0x14(%r12), %rdx
movq %rbx, %rdi
movl $0x3, %esi
movq %r15, %rcx
callq 0x19ff0
movq %rax, 0x18(%r12)
movl (%r15), %eax
testl %eax, %eax
js 0x24191
cmpl $0x1, %eax
jne 0x2413f
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18150
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x19e90
movq 0x50(%rax), %rax
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *0x1b8(%rax)
movl %eax, %ebp
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19160
testl %ebp, %ebp
je 0x241c2
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x18980
movq %rbx, %rdi
callq 0x199a0
jmp 0x2423e
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 $0x3, %esi
movq %rax, %rdx
callq 0x18410
jmp 0x2423e
movq 0x9bdff(%rip), %rax     # 0xbffc8
cmpl $0x0, (%rax)
je 0x241e1
movq 0x10(%rsp), %rsi
leaq 0x69ae8(%rip), %rdi     # 0x8dcc2
xorl %eax, %eax
callq 0x18960
movq 0x10(%rsp), %rsi
leaq 0x69a17(%rip), %rdx     # 0x8dc04
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x18320
movq %rax, %rbx
movq %r14, %rdi
callq 0x19e90
movq %rax, 0x10(%rbx)
movq %r14, 0x20(%rbx)
movq %r14, %rdi
callq 0x19e90
movq 0x18(%rax), %rax
movq %rax, 0x18(%rbx)
movq %r15, 0x40(%rbx)
leaq 0x1a5(%rip), %rax       # 0x243ca
movq %rax, 0x8(%rbx)
movq %r14, %rdi
callq 0x19e90
movq 0x50(%rax), %rax
movq %rax, 0x50(%rbx)
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq