// File: /workspace/github_cpp_makefile_star2_O2/stetre[P]moonvulkan/src/cmd.c
// Function: CmdBlitImage
static int CmdBlitImage(lua_State *L)
    {
    int err;
    uint32_t count;
    ud_t *ud;
    VkCommandBuffer cb = checkcommand_buffer(L, 1, &ud);
    if(ud->ddt->CmdBlitImage2KHR && lua_type(L, 2)==LUA_TTABLE)
        {
        VkBlitImageInfo2KHR *info = zcheckVkBlitImageInfo2KHR(L, 2, &err);
#define CLEANUP zfreeVkBlitImageInfo2KHR(L, info, 1)
        if(err) { CLEANUP; return argerror(L, 2); }
        ud->ddt->CmdBlitImage2KHR(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);
        VkFilter filter = checkfilter(L, 7); /* before regions so there is no need to free them on error */
#define CLEANUP zfreearrayVkImageBlit(L, regions, count, 1)
        VkImageBlit* regions = zcheckarrayVkImageBlit(L, 6, &count, &err);
        if(err) { CLEANUP; return argerror(L, 6); }
        ud->ddt->CmdBlitImage(cb, srcImage, srcImageLayout, dstImage, dstImageLayout, count, regions, filter);
        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 0x61987(%rip), %rcx     # 0x7d909
pushq $0x1
popq %rsi
leaq 0x18(%rsp), %r14
movq %r14, %rdx
callq 0x1a500
movq %rax, %r12
movq (%r14), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x6c0(%rax)
je 0x1bff8
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1a110
cmpl $0x5, %eax
jne 0x1bff8
pushq $0x2
popq %rsi
leaq 0x14(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rdx
callq 0x19a70
movq %rax, %r14
cmpl $0x0, (%r15)
je 0x1c10c
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 0x1c0af
movq %r12, 0x30(%rsp)
leaq 0x61996(%rip), %r15     # 0x7d99a
xorl %r14d, %r14d
pushq $0x2
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
movq %r15, %rcx
callq 0x1a500
movq %rax, 0x28(%rsp)
pushq $0xa
popq %rbp
pushq $0x3
popq %rdx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x19c00
movl %eax, 0x10(%rsp)
pushq $0x4
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
movq %r15, %rcx
callq 0x1a500
movq %rax, 0x20(%rsp)
pushq $0x5
popq %rdx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x19c00
movl %eax, %r12d
pushq $0x17
popq %rsi
pushq $0x7
popq %rdx
movq %rbx, %rdi
callq 0x19c00
movl %eax, %ebp
pushq $0x6
popq %rsi
leaq 0xc(%rsp), %rdx
leaq 0x14(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rcx
callq 0x1a1b0
movq %rax, %r15
cmpl $0x0, (%r13)
je 0x1c0c0
movl 0xc(%rsp), %ecx
pushq $0x50
popq %rdx
pushq $0x1
popq %r8
movq %rbx, %rdi
movq %r15, %rsi
xorl %r9d, %r9d
callq 0x18d30
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x18680
pushq $0x6
popq %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x18420
movl %eax, %r14d
jmp 0x1c132
movq 0x18(%rsp), %rax
movq 0x50(%rax), %rax
movl 0xc(%rsp), %r9d
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl 0x10(%rsp), %edx
movq 0x20(%rsp), %rcx
movl %r12d, %r8d
pushq %rbp
pushq %r15
callq *0x378(%rax)
addq $0x10, %rsp
movl 0xc(%rsp), %ecx
pushq $0x50
popq %rdx
pushq $0x1
popq %r8
movq %rbx, %rdi
movq %r15, %rsi
xorl %r9d, %r9d
callq 0x18d30
jmp 0x1c132
movq 0x18(%rsp), %rax
movq 0x50(%rax), %rax
movq %r12, %rdi
movq %r14, %rsi
callq *0x6c0(%rax)
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x19150
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq