#include <metal_stdlib>

using namespace metal;
float4 smoothstep_40864c() {
  float4 arg_0 = float4(2.0f);
  float4 arg_1 = float4(4.0f);
  float4 arg_2 = float4(3.0f);
  float4 res = smoothstep(arg_0, arg_1, arg_2);
  return res;
}

fragment void fragment_main(device float4* tint_symbol_1 [[buffer(0)]]) {
  *(tint_symbol_1) = smoothstep_40864c();
  return;
}

kernel void compute_main(device float4* tint_symbol_2 [[buffer(0)]]) {
  *(tint_symbol_2) = smoothstep_40864c();
  return;
}

struct VertexOutput {
  float4 pos;
  float4 prevent_dce;
};

struct tint_symbol {
  float4 prevent_dce [[user(locn0)]] [[flat]];
  float4 pos [[position]];
};

VertexOutput vertex_main_inner() {
  VertexOutput out = {};
  out.pos = float4(0.0f);
  out.prevent_dce = smoothstep_40864c();
  return out;
}

vertex tint_symbol vertex_main() {
  VertexOutput const inner_result = vertex_main_inner();
  tint_symbol wrapper_result = {};
  wrapper_result.pos = inner_result.pos;
  wrapper_result.prevent_dce = inner_result.prevent_dce;
  return wrapper_result;
}

