//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v0.6.164 on Mon Jul 20 01:15:57 2026
//
//
// Buffer Definitions:
//
// Resource bind info for params
// {
//
//   struct TextParameters
//   {
//
//       float4 rect;                   // Offset:    0
//       float4 colour;                 // Offset:   16
//       float4 background;             // Offset:   32
//       float2 border;                 // Offset:   48
//       float h_anchor;                // Offset:   56
//       float v_anchor;                // Offset:   60
//       float h_align;                 // Offset:   64
//       float font_scale;              // Offset:   68
//
//   } $Element;                        // Offset:    0 Size:    72
//
// }
//
// Resource bind info for textpos
// {
//
//   struct cs2gs
//   {
//
//       uint start;                    // Offset:    0
//       uint len;                      // Offset:    4
//       float2 pos;                    // Offset:    8
//
//   } $Element;                        // Offset:    0 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// font                              texture   float          2d  100        1
// text                              texture    uint         buf  113        1
// params                            texture  struct         r/o  114        1
// IniParams                         texture  float4          1d  120        1
// textpos                               UAV  struct         r/w    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Input
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Output
cs_5_0
dcl_globalFlags refactoringAllowed
dcl_resource_texture2d (float,float,float,float) t100
dcl_resource_buffer (uint,uint,uint,uint) t113
dcl_resource_structured t114, 72
dcl_resource_texture1d (float,float,float,float) t120
dcl_uav_structured u0, 16
dcl_temps 8
dcl_thread_group 1, 1, 1
ld_structured_indexable(structured_buffer, stride=72)(mixed,mixed,mixed,mixed) r0.xy, l(0), l(64), t114.xyxx
ld_indexable(texture1d)(float,float,float,float) r0.zw, l(0, 0, 0, 0), t120.zwxy
mul r0.y, r0.y, r0.w
mul r0.y, r0.y, l(0.000925925910)
div r0.w, l(16.000000), r0.w
dp2 r0.w, r0.wwww, r0.yyyy
ld_structured_indexable(structured_buffer, stride=72)(mixed,mixed,mixed,mixed) r1.x, l(0), l(8), t114.xxxx
ld_structured_indexable(structured_buffer, stride=72)(mixed,mixed,mixed,mixed) r1.y, l(0), l(0), t114.xxxx
add r1.x, -r1.y, r1.x
store_structured u0.x, l(1), l(0), l(0)
store_structured u0.xy, l(1), l(8), l(0,0,0,0)
eq r1.yz, r0.xxxx, l(0.000000, 1.000000, 2.000000, 0.000000)
ld_structured_indexable(structured_buffer, stride=72)(mixed,mixed,mixed,mixed) r0.x, l(0), l(64), t114.xxxx
eq r2.xy, r0.xxxx, l(1.000000, 2.000000, 0.000000, 0.000000)
mov r3.zw, l(0,0,0,0)
mov r4.xw, l(0,0,0,0)
mov r5.xy, l(-1,0,0,0)
mov r4.y, l(0)
mov r6.yz, l(0,0,0,0)
mov r0.x, l(1)
mov r1.w, l(1)
mov r2.zw, l(0,0,0,-1.000000)
loop
  ld_indexable(buffer)(uint,uint,uint,uint) r5.w, r6.yyyy, t113.yzwx
  breakc_z r5.w
  ieq r7.xy, r5.wwww, l(32, 10, 0, 0)
  movc r5.yz, r7.xxxx, r6.zzyz, r5.yyxy
  bfi r6.w, l(4), l(0), r5.w, l(240)
  utof r6.w, r6.w
  ushr r5.w, r5.w, l(4)
  ishl r5.w, r5.w, l(1)
  iadd r5.w, r5.w, l(76)
  utof r5.w, r5.w
  ftoi r3.x, r6.w
  ftoi r3.y, r5.w
  ld_indexable(texture2d)(float,float,float,float) r3.x, r3.xyzw, t100.xyzw
  mul r3.x, r3.x, l(255.000000)
  div r3.x, r3.x, r0.z
  dp2 r3.x, r3.xxxx, r0.yyyy
  add r6.z, r3.x, r6.z
  if_nz r7.y
    iadd r3.x, -r2.z, r6.y
    iadd r3.x, r3.x, l(1)
    store_structured u0.x, r0.x, l(4), r3.x
    max r2.w, r2.w, r6.z
    if_nz r1.y
      add r3.x, r1.x, -r6.z
      mov r3.y, r1.w
      loop
        ult r5.w, r0.x, r3.y
        breakc_nz r5.w
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r5.w, r3.y, l(8), u0.xxxx
        mad r5.w, r3.x, l(0.500000), r5.w
        store_structured u0.x, r3.y, l(8), r5.w
        iadd r3.y, r3.y, l(1)
      endloop
    else
      if_nz r1.z
        add r3.x, r1.x, -r6.z
        mov r3.y, r1.w
        loop
          ult r5.w, r0.x, r3.y
          breakc_nz r5.w
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r5.w, r3.y, l(8), u0.xxxx
          add r5.w, r3.x, r5.w
          store_structured u0.x, r3.y, l(8), r5.w
          iadd r3.y, r3.y, l(1)
        endloop
      endif
    endif
    iadd r1.w, r0.x, l(1)
    iadd r2.z, r6.y, l(1)
    add r4.y, -r0.w, r4.y
    store_structured u0.x, r1.w, l(0), r2.z
    store_structured u0.xy, r1.w, l(8), r4.xyxx
    mov r6.z, l(0)
    mov r0.x, r1.w
    mov r5.x, l(-1)
  else
    ge r3.x, r6.z, r1.x
    if_nz r3.x
      ine r3.x, r5.z, l(-1)
      if_nz r3.x
        iadd r3.x, -r2.z, r5.z
        max r2.w, r2.w, r5.y
        iadd r2.z, r5.z, l(1)
        if_nz r2.x
          add r3.y, r1.x, -r5.y
          mov r5.w, r1.w
          loop
            ult r6.w, r0.x, r5.w
            breakc_nz r6.w
            ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r6.w, r5.w, l(8), u0.xxxx
            mad r6.w, r3.y, l(0.500000), r6.w
            store_structured u0.x, r5.w, l(8), r6.w
            iadd r5.w, r5.w, l(1)
          endloop
        else
          if_nz r2.y
            add r3.y, r1.x, -r5.y
            mov r5.w, r1.w
            loop
              ult r6.w, r0.x, r5.w
              breakc_nz r6.w
              ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r6.w, r5.w, l(8), u0.xxxx
              add r6.w, r3.y, r6.w
              store_structured u0.x, r5.w, l(8), r6.w
              iadd r5.w, r5.w, l(1)
            endloop
          endif
        endif
        iadd r1.w, r0.x, l(1)
        add r4.z, -r0.w, r4.y
        mov r4.y, r4.z
        mov r3.y, r2.z
        mov r6.y, r5.z
        mov r5.w, r1.w
      else
        iadd r6.w, -r2.z, r6.y
        iadd r3.x, r6.w, l(1)
        max r2.w, r2.w, r6.z
        if_nz r2.x
          add r6.w, r1.x, -r6.z
          mov r7.x, r1.w
          loop
            ult r7.y, r0.x, r7.x
            breakc_nz r7.y
            ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r7.y, r7.x, l(8), u0.xxxx
            mad r7.y, r6.w, l(0.500000), r7.y
            store_structured u0.x, r7.x, l(8), r7.y
            iadd r7.x, r7.x, l(1)
          endloop
        else
          if_nz r2.y
            add r6.w, r1.x, -r6.z
            mov r7.x, r1.w
            loop
              ult r7.y, r0.x, r7.x
              breakc_nz r7.y
              ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r7.y, r7.x, l(8), u0.xxxx
              add r7.y, r6.w, r7.y
              store_structured u0.x, r7.x, l(8), r7.y
              iadd r7.x, r7.x, l(1)
            endloop
          endif
        endif
        iadd r1.w, r0.x, l(1)
        iadd r2.z, r6.y, l(1)
        add r4.z, -r0.w, r4.y
        mov r4.y, r4.z
        mov r3.y, r2.z
        mov r5.w, r1.w
      endif
      iadd r6.w, r0.x, l(1)
      store_structured u0.xy, r6.w, l(8), r4.wzww
      store_structured u0.x, r6.w, l(0), r3.y
      store_structured u0.x, r0.x, l(4), r3.x
      mov r6.z, l(0)
      mov r0.x, r5.w
      mov r5.x, l(-1)
    else
      iadd r3.x, -r2.z, r6.y
      uge r3.x, r3.x, l(24)
      if_nz r3.x
        iadd r3.x, -r2.z, r6.y
        iadd r3.x, r3.x, l(1)
        store_structured u0.x, r0.x, l(4), r3.x
        iadd r0.x, r0.x, l(1)
        iadd r2.z, r6.y, l(1)
        store_structured u0.x, r0.x, l(0), r2.z
        mov r6.x, r4.y
        store_structured u0.xy, r0.x, l(8), r6.zxzz
      endif
      mov r5.x, r5.z
    endif
  endif
  iadd r6.y, r6.y, l(1)
endloop
iadd r0.y, -r2.z, r6.y
iadd r0.y, r0.y, l(1)
store_structured u0.x, r0.x, l(4), r0.y
max r4.x, r6.z, r2.w
iadd r0.y, r6.y, l(-1)
ld_indexable(buffer)(uint,uint,uint,uint) r0.y, r0.yyyy, t113.yxzw
ine r0.yz, r0.yyyy, l(0, 10, 13, 0)
and r0.y, r0.z, r0.y
if_nz r0.y
  add r4.y, -r0.w, r4.y
  if_nz r2.x
    add r0.y, r1.x, -r6.z
    mov r0.z, r1.w
    loop
      ult r0.w, r0.x, r0.z
      breakc_nz r0.w
      ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.w, r0.z, l(8), u0.xxxx
      mad r0.w, r0.y, l(0.500000), r0.w
      store_structured u0.x, r0.z, l(8), r0.w
      iadd r0.z, r0.z, l(1)
    endloop
  else
    if_nz r2.y
      add r0.y, r1.x, -r6.z
      mov r0.z, r1.w
      loop
        ult r0.w, r0.x, r0.z
        breakc_nz r0.w
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.w, r0.z, l(8), u0.xxxx
        add r0.w, r0.w, r0.y
        store_structured u0.x, r0.z, l(8), r0.w
        iadd r0.z, r0.z, l(1)
      endloop
    endif
  endif
endif
store_structured u0.xy, l(0), l(8), r4.xyxx
ret
// Approximately 216 instruction slots used

///////////////////////////////// HLSL Code /////////////////////////////////
// // ---- Created with 3Dmigoto v0.6.164 on Mon Jul 20 01:15:57 2026
//
// struct TextParameters
// {
//     float4 rect;                   // Offset:    0
//     float4 colour;                 // Offset:   16
//     float4 background;             // Offset:   32
//     float2 border;                 // Offset:   48
//     float h_anchor;                // Offset:   56
//     float v_anchor;                // Offset:   60
//     float h_align;                 // Offset:   64
//     float font_scale;              // Offset:   68
// };
//
// struct cs2gs
// {
//     uint start;                    // Offset:    0
//     uint len;                      // Offset:    4
//     float2 pos;                    // Offset:    8
// };
//
// Texture2D<float> font : register(t100);
// Buffer<uint> text : register(t113);
// StructuredBuffer<TextParameters> params : register(t114);
// RWStructuredBuffer<cs2gs> textpos : register(u0);
//
//
// // 3Dmigoto declarations
// #define cmp -
// Texture1D<float4> IniParams : register(t120);
// Buffer<float4> StereoParams : register(t125);
//
//
// void main)
// {
//   float4 r0,r1,r2,r3,r4,r5,r6,r7;
//   uint4 bitmask, uiDest;
//   float4 fDest;
//
// // Needs manual fix for instruction:
// // unknown dcl_: dcl_thread_group 1, 1, 1
//   r0.x = params[0].h_align;
//   r0.y = params[0].font_scale;
//   r0.zw = IniParams.Load(float4(0,0,0,0)).xy;
//   r0.y = r0.w * r0.y;
//   r0.y = 0.00092592591 * r0.y;
//   r0.w = 16 / r0.w;
//   r0.w = dot(r0.ww, r0.yy);
//   r1.x = params[0].rect.z;
//   r1.y = params[0].rect.x;
//   r1.x = r1.x + -r1.y;
//   textpos[1].start = 0;
//   textpos[1].pos.x = 0;
//   textpos[1].pos.y = 0;
//   r1.yz = cmp(r0.xx == float2(1,2));
//   r0.x = params[0].h_align;
//   r2.xy = cmp(r0.xx == float2(1,2));
//   r3.zw = float2(0,0);
//   r4.xw = float2(0,0);
//   r5.xy = float2(-1,0);
//   r4.y = 0;
//   r6.yz = float2(0,0);
//   r0.x = 1;
//   r1.w = 1;
//   r2.zw = float2(0,-1);
//   while (true) {
//     r5.w = text.Load(r6.y).x;
//     if (r5.w == 0) break;
//     r7.xy = cmp((int2)r5.ww == int2(32,10));
//     r5.yz = r7.xx ? r6.zy : r5.yx;
//     bitmask.w = ((~(-1 << 4)) << 0) & 0xffffffff;  r6.w = (((uint)r5.w << 0) & bitmask.w) | ((uint)240 & ~bitmask.w);
//     r6.w = (uint)r6.w;
//     r5.w = (uint)r5.w >> 4;
//     r5.w = (uint)r5.w << 1;
//     r5.w = (int)r5.w + 76;
//     r5.w = (uint)r5.w;
//     r3.x = (int)r6.w;
//     r3.y = (int)r5.w;
//     r3.x = font.Load(r3.xyz).x;
//     r3.x = 255 * r3.x;
//     r3.x = r3.x / r0.z;
//     r3.x = dot(r3.xx, r0.yy);
//     r6.z = r6.z + r3.x;
//     if (r7.y != 0) {
//       r3.x = (int)-r2.z + (int)r6.y;
//       r3.x = (int)r3.x + 1;
//       textpos[r0.x].len = r3.x;
//       r2.w = max(r6.z, r2.w);
//       if (r1.y != 0) {
//         r3.x = -r6.z + r1.x;
//         r3.y = r1.w;
//         while (true) {
//           r5.w = cmp((uint)r0.x < (uint)r3.y);
//           if (r5.w != 0) break;
//           r5.w = textpos[r3.y].pos.x;
//           r5.w = r3.x * 0.5 + r5.w;
//           textpos[r3.y].pos.x = r5.w;
//           r3.y = (int)r3.y + 1;
//         }
//       } else {
//         if (r1.z != 0) {
//           r3.x = -r6.z + r1.x;
//           r3.y = r1.w;
//           while (true) {
//             r5.w = cmp((uint)r0.x < (uint)r3.y);
//             if (r5.w != 0) break;
//             r5.w = textpos[r3.y].pos.x;
//             r5.w = r5.w + r3.x;
//             textpos[r3.y].pos.x = r5.w;
//             r3.y = (int)r3.y + 1;
//           }
//         }
//       }
//       r1.w = (int)r0.x + 1;
//       r2.z = (int)r6.y + 1;
//       r4.y = r4.y + -r0.w;
//       textpos[r1.w].start = r2.z;
//       textpos[r1.w].pos.x = r4.x;
//       textpos[r1.w].pos.y = r4.y;
//       r6.z = 0;
//       r0.x = r1.w;
//       r5.x = -1;
//     } else {
//       r3.x = cmp(r6.z >= r1.x);
//       if (r3.x != 0) {
//         r3.x = cmp((int)r5.z != -1);
//         if (r3.x != 0) {
//           r3.x = (int)-r2.z + (int)r5.z;
//           r2.w = max(r5.y, r2.w);
//           r2.z = (int)r5.z + 1;
//           if (r2.x != 0) {
//             r3.y = -r5.y + r1.x;
//             r5.w = r1.w;
//             while (true) {
//               r6.w = cmp((uint)r0.x < (uint)r5.w);
//               if (r6.w != 0) break;
//               r6.w = textpos[r5.w].pos.x;
//               r6.w = r3.y * 0.5 + r6.w;
//               textpos[r5.w].pos.x = r6.w;
//               r5.w = (int)r5.w + 1;
//             }
//           } else {
//             if (r2.y != 0) {
//               r3.y = -r5.y + r1.x;
//               r5.w = r1.w;
//               while (true) {
//                 r6.w = cmp((uint)r0.x < (uint)r5.w);
//                 if (r6.w != 0) break;
//                 r6.w = textpos[r5.w].pos.x;
//                 r6.w = r6.w + r3.y;
//                 textpos[r5.w].pos.x = r6.w;
//                 r5.w = (int)r5.w + 1;
//               }
//             }
//           }
//           r1.w = (int)r0.x + 1;
//           r4.z = r4.y + -r0.w;
//           r4.y = r4.z;
//           r3.y = r2.z;
//           r6.y = r5.z;
//           r5.w = r1.w;
//         } else {
//           r6.w = (int)-r2.z + (int)r6.y;
//           r3.x = (int)r6.w + 1;
//           r2.w = max(r6.z, r2.w);
//           if (r2.x != 0) {
//             r6.w = -r6.z + r1.x;
//             r7.x = r1.w;
//             while (true) {
//               r7.y = cmp((uint)r0.x < (uint)r7.x);
//               if (r7.y != 0) break;
//               r7.y = textpos[r7.x].pos.x;
//               r7.y = r6.w * 0.5 + r7.y;
//               textpos[r7.x].pos.x = r7.y;
//               r7.x = (int)r7.x + 1;
//             }
//           } else {
//             if (r2.y != 0) {
//               r6.w = -r6.z + r1.x;
//               r7.x = r1.w;
//               while (true) {
//                 r7.y = cmp((uint)r0.x < (uint)r7.x);
//                 if (r7.y != 0) break;
//                 r7.y = textpos[r7.x].pos.x;
//                 r7.y = r7.y + r6.w;
//                 textpos[r7.x].pos.x = r7.y;
//                 r7.x = (int)r7.x + 1;
//               }
//             }
//           }
//           r1.w = (int)r0.x + 1;
//           r2.z = (int)r6.y + 1;
//           r4.z = r4.y + -r0.w;
//           r4.y = r4.z;
//           r3.y = r2.z;
//           r5.w = r1.w;
//         }
//         r6.w = (int)r0.x + 1;
//         textpos[r6.w].pos.x = r4.w;
//         textpos[r6.w].pos.y = r4.z;
//         textpos[r6.w].start = r3.y;
//         textpos[r0.x].len = r3.x;
//         r6.z = 0;
//         r0.x = r5.w;
//         r5.x = -1;
//       } else {
//         r3.x = (int)-r2.z + (int)r6.y;
//         r3.x = cmp((uint)r3.x >= 24);
//         if (r3.x != 0) {
//           r3.x = (int)-r2.z + (int)r6.y;
//           r3.x = (int)r3.x + 1;
//           textpos[r0.x].len = r3.x;
//           r0.x = (int)r0.x + 1;
//           r2.z = (int)r6.y + 1;
//           textpos[r0.x].start = r2.z;
//           r6.x = r4.y;
//           textpos[r0.x].pos.x = r6.z;
//           textpos[r0.x].pos.y = r6.x;
//         }
//         r5.x = r5.z;
//       }
//     }
//     r6.y = (int)r6.y + 1;
//   }
//   r0.y = (int)-r2.z + (int)r6.y;
//   r0.y = (int)r0.y + 1;
//   textpos[r0.x].len = r0.y;
//   r4.x = max(r2.w, r6.z);
//   r0.y = (int)r6.y + -1;
//   r0.y = text.Load(r0.y).x;
//   r0.yz = cmp((int2)r0.yy != int2(10,13));
//   r0.y = r0.z ? r0.y : 0;
//   if (r0.y != 0) {
//     r4.y = r4.y + -r0.w;
//     if (r2.x != 0) {
//       r0.y = -r6.z + r1.x;
//       r0.z = r1.w;
//       while (true) {
//         r0.w = cmp((uint)r0.x < (uint)r0.z);
//         if (r0.w != 0) break;
//         r0.w = textpos[r0.z].pos.x;
//         r0.w = r0.y * 0.5 + r0.w;
//         textpos[r0.z].pos.x = r0.w;
//         r0.z = (int)r0.z + 1;
//       }
//     } else {
//       if (r2.y != 0) {
//         r0.y = -r6.z + r1.x;
//         r0.z = r1.w;
//         while (true) {
//           r0.w = cmp((uint)r0.x < (uint)r0.z);
//           if (r0.w != 0) break;
//           r0.w = textpos[r0.z].pos.x;
//           r0.w = r0.y + r0.w;
//           textpos[r0.z].pos.x = r0.w;
//           r0.z = (int)r0.z + 1;
//         }
//       }
//     }
//   }
//   textpos[0].pos.x = r4.x;
//   textpos[0].pos.y = r4.y;
//   return;
// }
/////////////////////////////////////////////////////////////////////////////
