// File: /workspace/github_cpp_makefile_star2_O1/zgimbutas[P]mwrap/src/mwrap-cgen.cc
// Function: mex_unpack_input_array(_IO_FILE*, Var*)
void mex_unpack_input_array(FILE* fp, Var* v)
{
    if (v->devicespec != 'g'){
    fprintf(fp, "    if (mxGetM(prhs[%d])*mxGetN(prhs[%d]) != 0) {\n",
            v->input_label, v->input_label);
    if (strcmp(v->basetype, "fcomplex") == 0)
      fprintf(fp,
	      "        if( mxGetClassID(prhs[%d]) != mxSINGLE_CLASS )\n"
	      "            mw_err_txt_ = \"Invalid array argument, mxSINGLE_CLASS expected\";\n"
	      "        if (mw_err_txt_) goto mw_err_label;\n"
	      "        in%d_ = mxWrapGetArray_single_%s(prhs[%d], &mw_err_txt_);\n"
	      "        if (mw_err_txt_)\n"
	      "            goto mw_err_label;\n",
	      v->input_label, v->input_label, v->basetype, v->input_label);
    else if (strcmp(v->basetype, "dcomplex") == 0)
      fprintf(fp,
	      "        if( mxGetClassID(prhs[%d]) != mxDOUBLE_CLASS )\n"
	      "            mw_err_txt_ = \"Invalid array argument, mxDOUBLE_CLASS expected\";\n"
	      "        if (mw_err_txt_) goto mw_err_label;\n"
	      "        in%d_ = mxWrapGetArray_%s(prhs[%d], &mw_err_txt_);\n"
	      "        if (mw_err_txt_)\n"
	      "            goto mw_err_label;\n",
	      v->input_label, v->input_label, v->basetype, v->input_label);
    else if (strcmp(v->basetype, "float") == 0)
      if (v->iospec == 'i')
        fprintf(fp,
		"        if( mxGetClassID(prhs[%d]) != mxSINGLE_CLASS )\n"
		"            mw_err_txt_ = \"Invalid array argument, mxSINGLE_CLASS expected\";\n"
		"        if (mw_err_txt_) goto mw_err_label;\n"
                "#if MX_HAS_INTERLEAVED_COMPLEX\n"
                "        in%d_ = mxGetSingles(prhs[%d]);\n"
                "#else\n"
                "        in%d_ = (float*) mxGetData(prhs[%d]);\n"
                "#endif\n",
                v->input_label, v->input_label, v->input_label, v->input_label, v->input_label);
      else
        fprintf(fp,
                "        in%d_ = mxWrapGetArray_single_%s(prhs[%d], &mw_err_txt_);\n"
                "        if (mw_err_txt_)\n"
                "            goto mw_err_label;\n",
                v->input_label, v->basetype, v->input_label);
    else if (strcmp(v->basetype, "double") == 0)
      if (v->iospec == 'i'){
		fprintf(fp,
		"        if( mxGetClassID(prhs[%d]) != mxDOUBLE_CLASS )\n"
		"            mw_err_txt_ = \"Invalid array argument, mxDOUBLE_CLASS expected\";\n"
		"        if (mw_err_txt_) goto mw_err_label;\n"
		"#if MX_HAS_INTERLEAVED_COMPLEX\n"
		"        in%d_ = mxGetDoubles(prhs[%d]);\n"
		"#else\n"
		"        in%d_ = mxGetPr(prhs[%d]);\n"
		"#endif\n",
		v->input_label, v->input_label, v->input_label, v->input_label, v->input_label);
      }
      else
		fprintf(fp,
		"        in%d_ = mxWrapGetArray_%s(prhs[%d], &mw_err_txt_);\n"
		"        if (mw_err_txt_)\n"
		"            goto mw_err_label;\n",
		v->input_label, v->basetype, v->input_label);
    else
      fprintf(fp,
	      "        in%d_ = mxWrapGetArray_%s(prhs[%d], &mw_err_txt_);\n"
	      "        if (mw_err_txt_)\n"
	      "            goto mw_err_label;\n",
	      v->input_label, v->basetype, v->input_label);
    fprintf(fp,
            "    } else\n"
            "        in%d_ = NULL;\n",
            v->input_label);
    fprintf(fp, "\n");
    }

    if (v->devicespec == 'g'){
      if (v->iospec == 'i' || v->iospec == 'b'){
        fprintf(fp,
        "    // extract input GPU array pointer\n"
        "    if(!(mxIsGPUArray(prhs[%d])))\n"
        "        mw_err_txt_ = \"Invalid array argument, gpuArray expected\";\n"
        "    if (mw_err_txt_) goto mw_err_label;\n"
        "    mxGPUArray_in%d_ = mxGPUCreateFromMxArray(prhs[%d]);\n"
        "    in%d_ = (%s *)mxGPUGetDataReadOnly(mxGPUArray_in%d_);\n\n",
        v->input_label, v->input_label, v->input_label, v->input_label, basetype_to_cucomplex(v->basetype), v->input_label);
        }
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
cmpb $0x67, 0x9(%rsi)
je 0x989b
movl (%r14), %ecx
leaq 0xb30a(%rip), %rsi      # 0x14a9b
movq %rbx, %rdi
movl %ecx, %edx
xorl %eax, %eax
callq 0x3270
movq 0x10(%r14), %r15
leaq 0x3c8e(%rip), %rsi      # 0xd436
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x97f2
leaq 0x3c72(%rip), %rsi      # 0xd42d
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x97fe
leaq 0x42e9(%rip), %rsi      # 0xdab7
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x981c
leaq 0x42cf(%rip), %rsi      # 0xdab0
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x9832
movl (%r14), %edx
jmp 0x985a
movl (%r14), %ecx
leaq 0xb2d2(%rip), %rsi      # 0x14ace
jmp 0x9808
movl (%r14), %ecx
leaq 0xb3f1(%rip), %rsi      # 0x14bf9
movq %rbx, %rdi
movl %ecx, %edx
movq %r15, %r8
movl %ecx, %r9d
xorl %eax, %eax
callq 0x3270
jmp 0x987a
cmpb $0x69, 0x8(%r14)
movl (%r14), %edx
jne 0x9863
movl %edx, (%rsp)
leaq 0xb4ed(%rip), %rsi      # 0x14d1d
jmp 0x9846
cmpb $0x69, 0x8(%r14)
movl (%r14), %edx
jne 0x985a
movl %edx, (%rsp)
leaq 0xb60a(%rip), %rsi      # 0x14e50
movq %rbx, %rdi
movl %edx, %ecx
movl %edx, %r8d
movl %edx, %r9d
xorl %eax, %eax
callq 0x3270
jmp 0x987a
leaq 0xb448(%rip), %rsi      # 0x14ca9
jmp 0x986a
leaq 0xb314(%rip), %rsi      # 0x14b7e
movq %rbx, %rdi
movq %r15, %rcx
movl %edx, %r8d
xorl %eax, %eax
callq 0x3270
movl (%r14), %edx
leaq 0xb6f4(%rip), %rsi      # 0x14f78
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3270
movl $0xa, %edi
movq %rbx, %rsi
callq 0x3230
cmpb $0x67, 0x9(%r14)
jne 0x98e3
movzbl 0x8(%r14), %eax
cmpl $0x69, %eax
je 0x98b1
cmpl $0x62, %eax
jne 0x98e3
movl (%r14), %r15d
movq 0x10(%r14), %rdi
callq 0x7e44
movl %r15d, 0x8(%rsp)
movq %rax, (%rsp)
leaq 0xb6cd(%rip), %rsi      # 0x14f9a
movq %rbx, %rdi
movl %r15d, %edx
movl %r15d, %ecx
movl %r15d, %r8d
movl %r15d, %r9d
xorl %eax, %eax
callq 0x3270
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq