longlong FUN_0801f724(uint param_1,uint param_2)

{
  bool bVar1;
  uint uVar2;
  int iVar3;
  int iVar4;
  uint uVar5;
  uint uVar6;
  uint uVar7;
  bool bVar8;
  bool bVar9;
  
  if (-1 < (int)(param_1 ^ param_2)) {
    iVar4 = param_1 - param_2;
    if (param_1 < param_2) {
      param_1 = param_1 - iVar4;
      param_2 = param_2 + iVar4;
    }
    uVar7 = (param_1 << 1) >> 0x18;
    uVar5 = param_2;
    if (uVar7 != 0xff) {
      uVar2 = (param_2 << 1) >> 0x18;
      if (uVar2 == 0) {
        uVar5 = param_2 << 9;
        if (uVar5 == 0 || uVar7 == 0) {
          param_1 = param_1 + (param_2 & 0x7fffff);
          goto LAB_080236da;
        }
        uVar2 = 0x17 - uVar7;
        if ((int)uVar2 < 0) goto LAB_080236ee;
      }
      else {
        uVar7 = uVar7 - uVar2;
        uVar2 = 0x19 - uVar7;
        if (uVar2 == 0 || 0x19 < (int)uVar7) {
LAB_080236ee:
          return CONCAT44(uVar5,param_1);
        }
        uVar5 = param_2 << 8 | 0x80000000;
      }
      uVar6 = uVar5 & ~(-0x80000000 >> (uVar2 & 0xff));
      uVar5 = uVar5 >> (uVar7 & 0xff);
      uVar7 = param_1 << 8 | 0x80000000;
      uVar2 = uVar7 + uVar5;
      if (!CARRY4(uVar7,uVar5)) {
        uVar2 = uVar2 & 0x7fffffff;
      }
      if (CARRY4(uVar7,uVar5)) {
        uVar2 = uVar2 >> 1 | 0x80000000;
      }
      uVar6 = uVar6 | uVar2 << 0x18;
      param_1 = (param_1 & 0xff800000) +
                (uVar2 >> 8) +
                (uint)(0x80000000 < uVar6 || uVar6 + 0x80000000 < (uint)((byte)(uVar2 >> 8) & 1));
      if (param_1 * 2 < 0xff000000) {
        return CONCAT44(uVar5,param_1);
      }
      param_1 = param_1 & 0xff800000;
    }
LAB_080236da:
    return CONCAT44(uVar5,param_1);
  }
  param_2 = param_2 ^ 0x80000000;
  if (param_1 < param_2) {
    uVar5 = param_1 - param_2 ^ 0x80000000;
    param_1 = param_1 - uVar5;
    param_2 = param_2 + uVar5;
  }
  uVar7 = param_1 >> 0x17;
  bVar8 = 0xfeffffff < param_1 << 1;
  bVar9 = param_2 << 1 < 0x1000001;
  uVar5 = param_1;
  if (bVar8 || bVar9) {
    if (param_1 << 1 < 0xff000000) {
      if ((param_2 & 0x7fffffff) != 0) {
        uVar6 = uVar7 - (param_2 >> 0x17);
        if (1 < (int)uVar6) {
          param_2 = param_2 << 9;
          if (0x17 < (int)uVar6) {
            return CONCAT44(param_2,param_1);
          }
LAB_0801f7a8:
          uVar5 = param_2 >> (uVar6 & 0xff);
          if (uVar5 << (uVar6 & 0xff) < param_2) {
            uVar5 = uVar5 | 1;
          }
          uVar2 = param_1 * 0x200 - uVar5;
          if (param_1 * 0x200 < uVar5) {
            uVar2 = uVar2 * 2;
            uVar7 = uVar7 - 1;
          }
          bVar8 = (uVar2 & 0x200) != 0;
          uVar5 = uVar2 * 0x800000;
          return CONCAT44((uVar5 + 0x80000000) - (uint)!bVar8,
                          uVar7 * 0x800000 +
                          (uVar2 >> 9) +
                          (uint)(0x80000000 < uVar5 || uVar5 + 0x80000000 < (uint)bVar8));
        }
        param_2 = param_2 & 0x7fffffff;
        param_1 = param_1 - param_2;
      }
      uVar5 = param_1;
      if ((param_1 & 0x7fffffff) == 0) {
        return (ulonglong)param_2 << 0x20;
      }
    }
    else if (0xfeffffff < param_2 << 1) {
      return CONCAT44(param_2,0xffffffff);
    }
  }
  else {
    uVar2 = param_2 >> 0x17;
    bVar1 = uVar7 - uVar2 < (uint)(bVar8 || bVar9);
    uVar6 = (uVar7 - uVar2) - (uint)(!bVar8 && !bVar9);
    if (uVar2 < uVar7 || bVar1) {
      param_2 = param_2 << 8 | 0x80000000;
      if ((uVar2 < uVar7 || bVar1) && uVar6 != 0) {
        if ((int)uVar6 < 0x19) goto LAB_0801f7a8;
        goto LAB_0801f7a2;
      }
      uVar5 = param_1 * 0x200 - param_2;
      if (param_2 <= param_1 * 0x200) {
        bVar8 = (uVar5 >> 8 & 1) != 0;
        if (bVar8) {
          param_2 = uVar5 >> 10;
        }
        return CONCAT44(param_2,(uVar5 >> 9) +
                                uVar7 * 0x800000 + (uint)(bVar8 && (uVar5 >> 9 & 1) != 0));
      }
    }
    else {
      uVar5 = param_1 - param_2;
      if (uVar5 == 0) goto LAB_0801f7a2;
      uVar5 = uVar5 * 0x200;
    }
    iVar3 = LZCOUNT(uVar5) + 1;
    uVar2 = (uVar5 << iVar3) >> 9;
    iVar4 = (int)param_1 >> 0x1f;
    uVar5 = -iVar4 | uVar7 << 0x18;
    uVar7 = uVar5 + iVar3 * -0x1000000;
    if (uVar5 < (uint)(iVar3 * 0x1000000) || uVar7 == 0) {
      uVar5 = (uVar2 | 0x800000) >> (1U - ((int)uVar7 >> 0x18) & 0xff) | iVar4 * -0x80000000;
    }
    else {
      uVar5 = uVar2 + (uVar7 >> 1 | iVar4 * -0x80000000);
    }
  }
LAB_0801f7a2:
  return CONCAT44(param_2,uVar5);
}