function Result = StStMacroModelSearch(x,PAR,EXO)

% eps_L = 1 - PAR.alpha;
% eps_C = PAR.eps_C;
% delta = PAR.delta;
% rho   = PAR.rho;
% Z_0   = PAR.Z_0;
% G     = EXO.G;

% Computes the steady-state equilibrium
% x(1)     is C
% x(2)     is S
% x(3)     is L
% x(4)     is K
% x(5)     is eta_L
% x(6)     is mu_L
% x(7)     is theta
% x(8)     is r
%

% Result1 = (R0 - PAR.rho) * C0 ;
% Result2 = PAR.Z_0 * K0^(PAR.alpha) * L0^(1-PAR.alpha) - C0 - EXO.G ...
%     - PAR.c * theta0 * S0 - PAR.delta_k * K0 ;
% Result3 = EXO.Z_m * theta0^PAR.phi * S0 - PAR.delta_m * L0 ;
% Result4 = (R0 + PAR.delta_m) * eta_L0 + PAR.beta ...
%     *(EXO.s_U + EXO.Z_m * theta0^PAR.phi * eta_L0 - (1-PAR.alpha) * PAR.Z_0 ...
%     * K0^(PAR.alpha) * L0^(-PAR.alpha) ) ;
% Result5 = (R0 + PAR.delta_m) * mu_L0 + (1-PAR.beta) ...
%     *(EXO.s_U + EXO.Z_m * theta0^PAR.phi * eta_L0 - (1-PAR.alpha) * PAR.Z_0 ...
%     * K0^(PAR.alpha) * L0^(-PAR.alpha) ) ;
% Result6 = mu_L0 - PAR.c * theta0^(1-PAR.phi) / EXO.Z_m ;
% Result7 = ((1-PAR.epsilon)/PAR.epsilon) * C0  ...
%      -(EXO.s_U + EXO.Z_m * theta0^PAR.phi * eta_L0) * (1 - S0 - L0)  ;
% Result8 = R0 - PAR.alpha * PAR.Z_0 * K0^(PAR.alpha-1) * L0^(1-PAR.alpha) ...
%     + PAR.delta_k ;


Result = zeros(size(x));
Result(1) = (x(8)- PAR.rho) * x(1) ;
Result(2) = PAR.Z_0 * x(4)^(PAR.alpha) * x(3)^(1-PAR.alpha) - x(1) - EXO.G ...
    - PAR.c * x(7) * x(2) - PAR.delta_k * x(4) ;
Result(3) = EXO.Z_m * x(7)^PAR.phi * x(2) - PAR.delta_m * x(3) ;
Result(4) = (x(8) + PAR.delta_m) * x(5) + PAR.beta ...
    *(EXO.s_U + EXO.Z_m * x(7)^PAR.phi * x(5) - (1-PAR.alpha) * PAR.Z_0 ...
    * x(4)^(PAR.alpha) * x(3)^(-PAR.alpha) ) ;
Result(5) = (x(8) + PAR.delta_m) * x(6) + (1-PAR.beta) ...
    *(EXO.s_U + EXO.Z_m * x(7)^PAR.phi * x(5) - (1-PAR.alpha) * PAR.Z_0 ...
    * x(4)^(PAR.alpha) * x(3)^(-PAR.alpha) ) ;
Result(6) = x(6) - PAR.c * x(7)^(1-PAR.phi) / EXO.Z_m  ;
Result(7) = ((1-PAR.epsilon)/PAR.epsilon) * x(1)  ...
    -(EXO.s_U + EXO.Z_m * x(7)^PAR.phi * x(5)) * (1 - x(2) - x(3))  ;   
Result(8) = x(8) - PAR.alpha * PAR.Z_0 * x(4)^(PAR.alpha-1) * x(3)^(1-PAR.alpha) ...
    + PAR.delta_k ;
    
end
