// File: /workspace/github_cpp_makefile_star2_O1/stetre[P]moonvulkan/src/cmd.c
// Function: CmdCopyBufferToImage
static int CmdCopyBufferToImage(lua_State *L)
    {
    int err;
    uint32_t count;
    ud_t *ud;
    VkCommandBuffer cb = checkcommand_buffer(L, 1, &ud);
    if(ud->ddt->CmdCopyBufferToImage2KHR && lua_type(L, 2)==LUA_TTABLE)
        {
        VkCopyBufferToImageInfo2KHR *info = zcheckVkCopyBufferToImageInfo2KHR(L, 2, &err);
#define CLEANUP zfreeVkCopyBufferToImageInfo2KHR(L, info, 1)
        if(err) { CLEANUP; return argerror(L, 2); }
        ud->ddt->CmdCopyBufferToImage2KHR(cb, info);
        CLEANUP;
#undef CLEANUP
        }
    else
        {
        VkBuffer srcBuffer = checkbuffer(L, 2, NULL);
        VkImage dstImage = checkimage(L, 3, NULL);
        VkImageLayout dstImageLayout = checkimagelayout(L, 4);
#define CLEANUP zfreearrayVkBufferImageCopy(L, regions, count, 1)
        VkBufferImageCopy* regions = zcheckarrayVkBufferImageCopy(L, 5, &count, &err);
        if(err) { CLEANUP; return argerror(L, 5); }
        ud->ddt->CmdCopyBufferToImage(cb, srcBuffer, dstImage, dstImageLayout, count, regions);
        CLEANUP;
#undef CLEANUP
        }
    return 0;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x7361c(%rip), %rcx     # 0x8f909
leaq 0x8(%rsp), %r15
movl $0x1, %esi
movq %r15, %rdx
callq 0x1a520
movq %rax, %r14
movq (%r15), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x6b0(%rax)
je 0x1c37d
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1a130
cmpl $0x5, %eax
jne 0x1c37d
leaq 0x4(%rsp), %r12
movq %rbx, %rdi
movl $0x2, %esi
movq %r12, %rdx
callq 0x188f0
movq %rax, %r15
movl (%r12), %ebp
testl %ebp, %ebp
je 0x1c47d
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x19170
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x18690
movq %rbx, %rdi
movl $0x2, %esi
movq %rax, %rdx
callq 0x18420
jmp 0x1c4a2
movq %r14, 0x10(%rsp)
leaq 0x72c77(%rip), %rcx     # 0x8f000
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1a520
movq %rax, %r15
leaq 0x735f8(%rip), %rcx     # 0x8f99a
movq %rbx, %rdi
movl $0x3, %esi
xorl %edx, %edx
callq 0x1a520
movq %rax, %r13
movq %rbx, %rdi
movl $0xa, %esi
movl $0x4, %edx
callq 0x19c20
movl %eax, %ebp
movq %rsp, %rdx
leaq 0x4(%rsp), %r14
movq %rbx, %rdi
movl $0x5, %esi
movq %r14, %rcx
callq 0x190c0
movq %rax, %r12
movl (%r14), %r14d
testl %r14d, %r14d
je 0x1c428
movl (%rsp), %ecx
movl $0x38, %edx
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x18d40
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x18690
movq %rbx, %rdi
movl $0x5, %esi
movq %rax, %rdx
callq 0x18420
jmp 0x1c467
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
movl (%rsp), %r8d
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
movq %r12, %r9
callq *0x380(%rax)
movl (%rsp), %ecx
movl $0x38, %edx
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x18d40
testl %r14d, %r14d
jne 0x1c46e
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x6b0(%rax)
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x19170
testl %ebp, %ebp
jne 0x1c46e
jmp 0x1c46c