You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: write_bitwise.m
    path of file: ./repos/cocoSim-deprecated/src/middleEnd
    
    the code of the file until where you have to start completion: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This file is part of CoCoSim.
% Copyright (C) 2014-2016  Carnegie Mellon University
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Bitwise Operator block
%
% Perform a bitwise logical operation between the values provided as input.
% The operation can also be performed on all the elements of a single multi
% dimensional input.
% Or between a single input and a parameter named BitMask containing the mask to
% be applied.
%
%% Generation scheme
%
% The generation relies on external functions of general signature:
% bitwise_operator_dt where operator is the logical operator (AND, OR,
% NAND, NOT, NOR, XOR) and dt is the data type of the inputs and the output
% of the function (bool, int, real).
%
%%% If the operator is NO
    
function (bool, int, real).
%
%%% If the operator is NOT
% The not operation is applied on each element of the input.
% The example here is provided for a vector of 3 elements as input.
%
%  Output_1_1 = bitwise_NOT_dt(Input_1_1);
%  Output_1_2 = bitwise_NOT_dt(Input_1_2);
%  Output_1_3 = bitwise_NOT_dt(Input_1_3);
%
%%% If the operator is AND, OR, NAND, NOR, XOR and the block has one input.
% The operation is applied on all the elements of the input.
% The example here is provided for a vector input of 3 elements.
%
%  Output_1_1 = bitwise_operator_dt(Input_1_1, bitwise_operator_dt(Input_1_2, Input_1_3));
%
%%% If the operator is AND, OR, NAND, NOR, XOR and the block has more than
% one input. The operation is applied element wise.
% The example here is provided for inputs vectors of 3 elements.
%
%  Output_1_1 = bitwise_operator_dt(Input_1_1, bitwise_operator_dt(Input_2_1, Input_3_1));
%  Output_1_2 = bitwise_operator_dt(Input_1_2, bitwise_operator_dt(Input_2_2, Input_3_2));
%  Output_1_3 = bitwise_operator_dt(Input_1_3, bitwise_operator_dt(Input_2_3, Input_3_3));
%
%% Code
%
function [output_string op_name] = write_bitwise(unbloc, inter_blk, operator, bit_mask, use_bit_mask, num_input, real_world)

output_string = '';
op_name = {};

[list_out] = list_var_sortie(unbloc);
[list_in] = list_var_entree(unbloc, inter_blk);

% Perform expansion if necessary
dim = 1;
dims = '';
for idx_in=1:unbloc.num_input
	[in_dim_r in_dim_c] = Utils.get_port_dims_simple(unbloc.inports_dim, idx_in);
	if in_dim_r ~= 1
		dim = in_dim_r;
		if in_dim_c ~= 1
			dim = in_dim_r * in_dim_c;
		end