Could you help me port this GLSL shader?

Hello! I’m a newbie, and I know it’s silly to jump in straight into pure HLSL, but I’d really appreciate some help with this shader.

Here’s the original code:

#define OMUL vec3(1.19,0.94,0.87)
#define OPOW vec3(0.81,0.99,1.17)
#define OBASE 32.0
#define ORAD 2

{
	vec2 coord = TexCoord;
	vec2 px;
	if ( dolow == 1 ) px = 1.0/lowres;
	else px = 1.0/textureSize(InputTexture,0);
	vec2 nc;
	vec4 base = texture(InputTexture,coord);
	vec4 res = base;
	if ( doblur == 1 )
	{
		res *= OBASE;
		float cnt = OBASE;
		int i, j;
		for ( j=-ORAD; j<=ORAD; j++ ) for ( i=-ORAD; i<=ORAD; i++ )
		{
			nc = coord+px*vec2(i,j);
			if ( (nc.x >= 0.0) && (nc.x < 1.0) && (nc.y >= 0.0) && (nc.y < 1.0) )
			{
				res += texture(InputTexture,nc);
				cnt += 1.0;
			}
		}
		res /= cnt;
	}
	if ( dotint == 1 )
	{
		res.rgb *= OMUL;
		res.rgb = pow(res.rgb,OPOW);
	}
	FragColor = mix(base,res,blend);
}

And here’s what I have for now:

#define OMUL float3(1.19,0.94,0.87)
#define OPOW float3(0.81,0.99,1.17)
#define OBASE 32.0
#define ORAD 2
#define dolow 0
#define doblur 1
#define dotint 1

{
	float2 px;
	if ( dolow == 1 ) px = 1.0/2; //Placeholder value.
	else px = 1.0/GetDefaultSceneTextureUV(Parameters, 14);
	float2 nc;
	float4 base = SceneTextureLookup(GetDefaultSceneTextureUV(Parameters, 14), 14, false);
	float4 res = base;
	if ( doblur == 1 )
	{
		res *= OBASE;
		float cnt = OBASE;
		int i, j;
		for ( j=-ORAD; j<=ORAD; j++ ) for ( i=-ORAD; i<=ORAD; i++ )
		{
			nc = GetDefaultSceneTextureUV(Parameters, 14)+px*float2(i,j);
			if ( (nc.x >= 0.0) && (nc.x < 1.0) && (nc.y >= 0.0) && (nc.y < 1.0) )
			{
				res += SceneTextureLookup(GetDefaultSceneTextureUV(Parameters, 14), 14, false);
				cnt += 1.0;
			}
		}
		res /= cnt;
	}
	if ( dotint == 1 )
	{
		res.rgb *= OMUL;
		res.rgb = pow(res.rgb,OPOW);
	}
	return lerp(base,res,1);
}

Right now, only the last part of the shader, the reddish tint, is working for me. I’m quite sure I’m messing up the “base” and “res” variables, but I don’t know which functions to use here.