// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/cmd.c
// Function: CmdCopyImage
static int CmdCopyImage(lua_State *L)
    {
    int err;
    uint32_t count;
    ud_t *ud;
    VkCommandBuffer cb = checkcommand_buffer(L, 1, &ud);
    if(ud->ddt->CmdCopyImage2KHR && lua_type(L, 2)==LUA_TTABLE)
        {
        VkCopyImageInfo2KHR *info = zcheckVkCopyImageInfo2KHR(L, 2, &err);
#define CLEANUP zfreeVkCopyImageInfo2KHR(L, info, 1)
        if(err) { CLEANUP; return argerror(L, 2); }
        ud->ddt->CmdCopyImage2KHR(cb, info);
        CLEANUP;
#undef CLEANUP
        }
    else
        {
        VkImage srcImage = checkimage(L, 2, NULL);
        VkImageLayout srcImageLayout = checkimagelayout(L, 3);
        VkImage dstImage = checkimage(L, 4, NULL);
        VkImageLayout dstImageLayout = checkimagelayout(L, 5);
#define CLEANUP zfreearrayVkImageCopy(L, regions, count, 1)
        VkImageCopy* regions = zcheckarrayVkImageCopy(L, 6, &count, &err);
        if(err) { CLEANUP; return argerror(L, 6); }
        ud->ddt->CmdCopyImage(cb, srcImage, srcImageLayout, dstImage, dstImageLayout, count, regions);
        CLEANUP;
#undef CLEANUP
        }
    return 0;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x70a4a(%rip), %rcx     # 0x8c909
leaq 0x20(%rsp), %r14
movl $0x1, %esi
movq %r14, %rdx
callq 0x1a4e0
movq %rax, %r12
movq (%r14), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x6a8(%rax)
je 0x1bf45
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1a0f0
cmpl $0x5, %eax
jne 0x1bf45
leaq 0x1c(%rsp), %r15
movq %rbx, %rdi
movl $0x2, %esi
movq %r15, %rdx
callq 0x196a0
movq %rax, %r14
cmpl $0x0, (%r15)
je 0x1c05a
movq %rbx, %rdi
movq %r14, %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 0x1c002
movq %r12, 0x30(%rsp)
leaq 0x70a49(%rip), %r14     # 0x8c99a
xorl %r15d, %r15d
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
movq %r14, %rcx
callq 0x1a4e0
movq %rax, 0x28(%rsp)
movq %rbx, %rdi
movl $0xa, %esi
movl $0x3, %edx
callq 0x19be0
movl %eax, 0x18(%rsp)
movq %rbx, %rdi
movl $0x4, %esi
xorl %edx, %edx
movq %r14, %rcx
callq 0x1a4e0
movq %rax, %r14
movq %rbx, %rdi
movl $0xa, %esi
movl $0x5, %edx
callq 0x19be0
movl %eax, %r12d
leaq 0x14(%rsp), %rdx
leaq 0x1c(%rsp), %rbp
movq %rbx, %rdi
movl $0x6, %esi
movq %rbp, %rcx
callq 0x18860
movq %rax, %r13
cmpl $0x0, (%rbp)
je 0x1c00f
movl 0x14(%rsp), %ecx
movl $0x44, %edx
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x18d30
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x18680
movq %rbx, %rdi
movl $0x6, %esi
movq %rax, %rdx
callq 0x18410
movl %eax, %r15d
jmp 0x1c082
movq 0x20(%rsp), %rax
movq 0x50(%rax), %rax
movl 0x14(%rsp), %r9d
movq %r13, (%rsp)
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl 0x18(%rsp), %edx
movq %r14, %rcx
movl %r12d, %r8d
callq *0x370(%rax)
movl 0x14(%rsp), %ecx
movl $0x44, %edx
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x18d30
jmp 0x1c082
movq 0x20(%rsp), %rax
movq 0x50(%rax), %rax
movq %r12, %rdi
movq %r14, %rsi
callq *0x6a8(%rax)
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x19160
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq