// language: metal2.3
#include <metal_stdlib>
#include <simd/simd.h>

using metal::uint;

struct UniformCompatible {
    uint val_u32_;
    int val_i32_;
    float val_f32_;
    char _pad3[4];
    ulong val_u64_;
    char _pad4[8];
    metal::ulong2 val_u64_2_;
    char _pad5[16];
    metal::ulong3 val_u64_3_;
    metal::ulong4 val_u64_4_;
    long val_i64_;
    char _pad8[8];
    metal::long2 val_i64_2_;
    metal::long3 val_i64_3_;
    metal::long4 val_i64_4_;
    ulong final_value;
};
struct type_11 {
    ulong inner[2];
};
struct type_12 {
    long inner[2];
};
struct StorageCompatible {
    type_11 val_u64_array_2_;
    type_12 val_i64_array_2_;
};
constant ulong constant_variable = 20uL;

long int64_function(
    long x,
    constant UniformCompatible& input_uniform,
    device UniformCompatible const& input_storage,
    device StorageCompatible const& input_arrays,
    device UniformCompatible& output,
    device StorageCompatible& output_arrays
) {
    long val = 20L;
    long _e8 = val;
    val = _e8 + ((31L - 1002003004005006L) + -9223372036854775807L);
    long _e10 = val;
    long _e13 = val;
    val = _e13 + (_e10 + 5L);
    uint _e17 = input_uniform.val_u32_;
    long _e18 = val;
    long _e22 = val;
    val = _e22 + static_cast<long>(_e17 + static_cast<uint>(_e18));
    int _e26 = input_uniform.val_i32_;
    long _e27 = val;
    long _e31 = val;
    val = _e31 + static_cast<long>(_e26 + static_cast<int>(_e27));
    float _e35 = input_uniform.val_f32_;
    long _e36 = val;
    long _e40 = val;
    val = _e40 + static_cast<long>(_e35 + static_cast<float>(_e36));
    long _e44 = input_uniform.val_i64_;
    long _e47 = val;
    val = _e47 + metal::long3(_e44).z;
    ulong _e51 = input_uniform.val_u64_;
    long _e53 = val;
    val = _e53 + as_type<long>(_e51);
    metal::ulong2 _e57 = input_uniform.val_u64_2_;
    long _e60 = val;
    val = _e60 + as_type<metal::long2>(_e57).y;
    metal::ulong3 _e64 = input_uniform.val_u64_3_;
    long _e67 = val;
    val = _e67 + as_type<metal::long3>(_e64).z;
    metal::ulong4 _e71 = input_uniform.val_u64_4_;
    long _e74 = val;
    val = _e74 + as_type<metal::long4>(_e71).w;
    long _e80 = input_uniform.val_i64_;
    long _e83 = input_storage.val_i64_;
    output.val_i64_ = _e80 + _e83;
    metal::long2 _e89 = input_uniform.val_i64_2_;
    metal::long2 _e92 = input_storage.val_i64_2_;
    output.val_i64_2_ = _e89 + _e92;
    metal::long3 _e98 = input_uniform.val_i64_3_;
    metal::long3 _e101 = input_storage.val_i64_3_;
    output.val_i64_3_ = _e98 + _e101;
    metal::long4 _e107 = input_uniform.val_i64_4_;
    metal::long4 _e110 = input_storage.val_i64_4_;
    output.val_i64_4_ = _e107 + _e110;
    type_12 _e116 = input_arrays.val_i64_array_2_;
    output_arrays.val_i64_array_2_ = _e116;
    long _e117 = val;
    long _e119 = val;
    val = _e119 + metal::abs(_e117);
    long _e121 = val;
    long _e122 = val;
    long _e123 = val;
    long _e125 = val;
    val = _e125 + metal::clamp(_e121, _e122, _e123);
    long _e127 = val;
    metal::long2 _e128 = metal::long2(_e127);
    long _e129 = val;
    metal::long2 _e130 = metal::long2(_e129);
    long _e132 = val;
    val = _e132 + ( + _e128.x * _e130.x + _e128.y * _e130.y);
    long _e134 = val;
    long _e135 = val;
    long _e137 = val;
    val = _e137 + metal::max(_e134, _e135);
    long _e139 = val;
    long _e140 = val;
    long _e142 = val;
    val = _e142 + metal::min(_e139, _e140);
    long _e144 = val;
    long _e146 = val;
    val = _e146 + metal::select(metal::select(-1, 1, (_e144 > 0)), 0, (_e144 == 0));
    long _e148 = val;
    return _e148;
}

ulong uint64_function(
    ulong x_1,
    constant UniformCompatible& input_uniform,
    device UniformCompatible const& input_storage,
    device StorageCompatible const& input_arrays,
    device UniformCompatible& output,
    device StorageCompatible& output_arrays
) {
    ulong val_1 = 20uL;
    ulong _e8 = val_1;
    val_1 = _e8 + ((31uL + 18446744073709551615uL) - 18446744073709551615uL);
    ulong _e10 = val_1;
    ulong _e13 = val_1;
    val_1 = _e13 + (_e10 + 5uL);
    uint _e17 = input_uniform.val_u32_;
    ulong _e18 = val_1;
    ulong _e22 = val_1;
    val_1 = _e22 + static_cast<ulong>(_e17 + static_cast<uint>(_e18));
    int _e26 = input_uniform.val_i32_;
    ulong _e27 = val_1;
    ulong _e31 = val_1;
    val_1 = _e31 + static_cast<ulong>(_e26 + static_cast<int>(_e27));
    float _e35 = input_uniform.val_f32_;
    ulong _e36 = val_1;
    ulong _e40 = val_1;
    val_1 = _e40 + static_cast<ulong>(_e35 + static_cast<float>(_e36));
    ulong _e44 = input_uniform.val_u64_;
    ulong _e47 = val_1;
    val_1 = _e47 + metal::ulong3(_e44).z;
    long _e51 = input_uniform.val_i64_;
    ulong _e53 = val_1;
    val_1 = _e53 + as_type<ulong>(_e51);
    metal::long2 _e57 = input_uniform.val_i64_2_;
    ulong _e60 = val_1;
    val_1 = _e60 + as_type<metal::ulong2>(_e57).y;
    metal::long3 _e64 = input_uniform.val_i64_3_;
    ulong _e67 = val_1;
    val_1 = _e67 + as_type<metal::ulong3>(_e64).z;
    metal::long4 _e71 = input_uniform.val_i64_4_;
    ulong _e74 = val_1;
    val_1 = _e74 + as_type<metal::ulong4>(_e71).w;
    ulong _e80 = input_uniform.val_u64_;
    ulong _e83 = input_storage.val_u64_;
    output.val_u64_ = _e80 + _e83;
    metal::ulong2 _e89 = input_uniform.val_u64_2_;
    metal::ulong2 _e92 = input_storage.val_u64_2_;
    output.val_u64_2_ = _e89 + _e92;
    metal::ulong3 _e98 = input_uniform.val_u64_3_;
    metal::ulong3 _e101 = input_storage.val_u64_3_;
    output.val_u64_3_ = _e98 + _e101;
    metal::ulong4 _e107 = input_uniform.val_u64_4_;
    metal::ulong4 _e110 = input_storage.val_u64_4_;
    output.val_u64_4_ = _e107 + _e110;
    type_11 _e116 = input_arrays.val_u64_array_2_;
    output_arrays.val_u64_array_2_ = _e116;
    ulong _e117 = val_1;
    ulong _e119 = val_1;
    val_1 = _e119 + metal::abs(_e117);
    ulong _e121 = val_1;
    ulong _e122 = val_1;
    ulong _e123 = val_1;
    ulong _e125 = val_1;
    val_1 = _e125 + metal::clamp(_e121, _e122, _e123);
    ulong _e127 = val_1;
    metal::ulong2 _e128 = metal::ulong2(_e127);
    ulong _e129 = val_1;
    metal::ulong2 _e130 = metal::ulong2(_e129);
    ulong _e132 = val_1;
    val_1 = _e132 + ( + _e128.x * _e130.x + _e128.y * _e130.y);
    ulong _e134 = val_1;
    ulong _e135 = val_1;
    ulong _e137 = val_1;
    val_1 = _e137 + metal::max(_e134, _e135);
    ulong _e139 = val_1;
    ulong _e140 = val_1;
    ulong _e142 = val_1;
    val_1 = _e142 + metal::min(_e139, _e140);
    ulong _e144 = val_1;
    return _e144;
}

kernel void main_(
  constant UniformCompatible& input_uniform [[user(fake0)]]
, device UniformCompatible const& input_storage [[user(fake0)]]
, device StorageCompatible const& input_arrays [[user(fake0)]]
, device UniformCompatible& output [[user(fake0)]]
, device StorageCompatible& output_arrays [[user(fake0)]]
) {
    ulong _e3 = uint64_function(67uL, input_uniform, input_storage, input_arrays, output, output_arrays);
    long _e5 = int64_function(60L, input_uniform, input_storage, input_arrays, output, output_arrays);
    output.final_value = _e3 + as_type<ulong>(_e5);
    return;
}
