// File: /workspace/github_cpp_makefile_star2_O2/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 $0x28, %rsp
movq %rdi, %rbx
leaq 0x617ad(%rip), %rcx     # 0x7d909
pushq $0x1
popq %rsi
leaq 0x10(%rsp), %r14
movq %r14, %rdx
callq 0x1a500
movq %rax, %r12
movq (%r14), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x6b0(%rax)
je 0x1c1d2
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1a110
cmpl $0x5, %eax
jne 0x1c1d2
pushq $0x2
popq %rsi
leaq 0xc(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rdx
callq 0x188e0
movq %rax, %r14
cmpl $0x0, (%r15)
je 0x1c2b8
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x19150
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x18680
pushq $0x2
jmp 0x1c265
movq %r12, 0x20(%rsp)
leaq 0x60e22(%rip), %rcx     # 0x7d000
xorl %r15d, %r15d
pushq $0x2
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x1a500
movq %rax, 0x18(%rsp)
leaq 0x617a0(%rip), %rcx     # 0x7d99a
pushq $0x3
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x1a500
movq %rax, %rbp
pushq $0xa
popq %rsi
pushq $0x4
popq %rdx
movq %rbx, %rdi
callq 0x19c00
movl %eax, %r14d
pushq $0x5
popq %rsi
leaq 0x8(%rsp), %rdx
leaq 0xc(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rcx
callq 0x190a0
movq %rax, %r13
cmpl $0x0, (%r12)
je 0x1c276
movl 0x8(%rsp), %ecx
pushq $0x38
popq %rdx
pushq $0x1
popq %r8
movq %rbx, %rdi
movq %r13, %rsi
xorl %r9d, %r9d
callq 0x18d30
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x18680
pushq $0x5
popq %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x18420
movl %eax, %r15d
jmp 0x1c2de
movq 0x10(%rsp), %rax
movq 0x50(%rax), %rax
movl 0x8(%rsp), %r8d
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %rbp, %rdx
movl %r14d, %ecx
movq %r13, %r9
callq *0x380(%rax)
movl 0x8(%rsp), %ecx
pushq $0x38
popq %rdx
pushq $0x1
popq %r8
movq %rbx, %rdi
movq %r13, %rsi
xorl %r9d, %r9d
callq 0x18d30
jmp 0x1c2de
movq 0x10(%rsp), %rax
movq 0x50(%rax), %rax
movq %r12, %rdi
movq %r14, %rsi
callq *0x6b0(%rax)
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x19150
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq