// File: /workspace/github_cpp_makefile_star2_O3/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 0x9770
movl (%r14), %ecx
leaq 0xb41c(%rip), %rsi      # 0x14a7b
movq %rbx, %rdi
movl %ecx, %edx
xorl %eax, %eax
callq 0x3270
movq 0x10(%r14), %r15
leaq 0x3dc0(%rip), %rsi      # 0xd436
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x96c0
leaq 0x3da4(%rip), %rsi      # 0xd42d
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x96cc
leaq 0x4413(%rip), %rsi      # 0xdaaf
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x96ea
leaq 0x43f9(%rip), %rsi      # 0xdaa8
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x9700
movl (%r14), %edx
jmp 0x9728
movl (%r14), %ecx
leaq 0xb3e4(%rip), %rsi      # 0x14aae
jmp 0x96d6
movl (%r14), %ecx
leaq 0xb503(%rip), %rsi      # 0x14bd9
movq %rbx, %rdi
movl %ecx, %edx
movq %r15, %r8
movl %ecx, %r9d
xorl %eax, %eax
callq 0x3270
jmp 0x9748
cmpb $0x69, 0x8(%r14)
movl (%r14), %edx
jne 0x9731
movl %edx, (%rsp)
leaq 0xb5ff(%rip), %rsi      # 0x14cfd
jmp 0x9714
cmpb $0x69, 0x8(%r14)
movl (%r14), %edx
jne 0x9728
movl %edx, (%rsp)
leaq 0xb71c(%rip), %rsi      # 0x14e30
movq %rbx, %rdi
movl %edx, %ecx
movl %edx, %r8d
movl %edx, %r9d
xorl %eax, %eax
callq 0x3270
jmp 0x9748
leaq 0xb55a(%rip), %rsi      # 0x14c89
jmp 0x9738
leaq 0xb426(%rip), %rsi      # 0x14b5e
movq %rbx, %rdi
movq %r15, %rcx
movl %edx, %r8d
xorl %eax, %eax
callq 0x3270
movl (%r14), %edx
leaq 0xb806(%rip), %rsi      # 0x14f58
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3270
movl $0xa, %edi
movq %rbx, %rsi
callq 0x3230
cmpb $0x67, 0x9(%r14)
jne 0x97b1
movzbl 0x8(%r14), %eax
cmpl $0x69, %eax
je 0x977f
cmpl $0x62, %eax
jne 0x97b1
movl (%r14), %r15d
movq 0x10(%r14), %rdi
callq 0x7dc0
movl %r15d, 0x8(%rsp)
movq %rax, (%rsp)
leaq 0xb7df(%rip), %rsi      # 0x14f7a
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