// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Xunit;
// Generated by Fuzzlyn v1.5 on 2022-03-14 21:20:55
// Run on X64 Windows
// Seed: 16520696696442011600
// Reduced from 677.9 KiB to 2.4 KiB in 00:04:01
// Debug: Outputs 53474
// Release: Outputs 226
public class C0
{
    public byte F0;
    public sbyte F3;
    public byte F4;
    public byte F5;
    public uint F6;
    public C0(byte f4, byte f5, uint f6)
    {
        F4 = f4;
        F5 = f5;
        F6 = f6;
    }
}

public class C1
{
    public C0 F4;
    public C1(C0 f4)
    {
        F4 = f4;
    }
}

public struct S0
{
    public sbyte F0;
    public C0 F2;
    public bool F4;
    public ulong F5;
    public uint F6;
    public bool F7;
    public S0(sbyte f0, C0 f1, C0 f2, bool f4, ulong f5, uint f6, bool f7) : this()
    {
        F0 = f0;
        F2 = f2;
        F4 = f4;
        F5 = f5;
        F6 = f6;
        F7 = f7;
    }
}

public class Runtime_66624
{
    public static IRuntime s_rt;
    public static C0 s_1 = new C0(0, 0, 0);
    public static C1[][] s_3 = new C1[][] { new C1[] { new C1(new C0(0, 0, 0)) } };
    [Fact]
    public static int TestEntryPoint()
    {
        CollectibleALC alc = new CollectibleALC();
        System.Reflection.Assembly asm = alc.LoadFromAssemblyPath(System.Reflection.Assembly.GetExecutingAssembly().Location);
        System.Reflection.MethodInfo mi = asm.GetType(typeof(Runtime_66624).FullName).GetMethod(nameof(MainInner));
        System.Type runtimeTy = asm.GetType(typeof(Runtime).FullName);
        return (int)mi.Invoke(null, new object[] { System.Activator.CreateInstance(runtimeTy) });
    }

    public static int MainInner(IRuntime rt)
    {
        s_rt = rt;
        return M10(53474);
    }

    public static int M10(ushort arg0)
    {
        var vr1 = new S0[] { new S0(0, new C0(0, 0, 0), new C0(0, 0, 0), false, 0, 0, false) };
        S0 var1 = new S0(s_1.F3, new C0(0, 0, s_3[0][0].F4.F6), new C0(0, 0, 0), true, 0, 0, false);
        try
        {
            byte vr5 = var1.F2.F0;
        }
        finally
        {
            var1 = new S0(0, new C0(0, 0, 0), new C0(0, 1, 0), true, 0, 0, true);
        }

        if ((byte)arg0 < 1)
        {
            C0[] var4 = new C0[] { new C0(0, 0, 0) };
        }

        s_rt.WriteLine("c_4102", arg0);
        return ((Runtime)s_rt).Result;
    }
}

public interface IRuntime
{
    void WriteLine<T>(string site, T value);
}

public class Runtime : IRuntime
{
    public int Result;

    public void WriteLine<T>(string site, T value)
    {
        Result = (ushort)(object)value == 53474 ? 100 : -1;
    }
}

public class CollectibleALC : System.Runtime.Loader.AssemblyLoadContext
{
    public CollectibleALC() : base(true)
    {
    }
}
