
size_t __regparm3 wcrtomb_internal(char *s,wchar_t wc)

{
  size_t sVar1;
  size_t sVar2;
  byte bVar3;
  wchar_t wVar4;
  int iVar5;
  
  if ((uint)wc < 0x80) {
    *s = (byte)wc;
    return 1;
  }
  if ((uint)wc < 0x800) {
    s[1] = (byte)wc & 0x3f | 0x80;
    wc = wc >> 6;
    sVar2 = 2;
    bVar3 = 0xc0;
  }
  else {
    sVar1 = 2;
    wVar4 = wc;
    do {
      wVar4 = (uint)wVar4 >> 5;
      sVar2 = sVar1 + 1;
      if ((uint)wVar4 < 0x800) {
        iVar5 = 0x3f00 >> ((byte)sVar2 & 0x1f);
        goto LAB_000b2189;
      }
      sVar1 = sVar2;
    } while (sVar2 != 6);
    sVar1 = 5;
    sVar2 = 6;
    iVar5 = -4;
LAB_000b2189:
    do {
      bVar3 = (byte)iVar5;
      s[sVar1] = (byte)wc & 0x3f | 0x80;
      wc = wc >> 6;
      sVar1 = sVar1 - 1;
    } while (sVar1 != 0);
  }
  *s = (byte)wc | bVar3;
  return sVar2;
}



int __regparm3 FUN_000b2129(byte *param_1,uint param_2)

{
  int iVar1;
  int iVar2;
  byte bVar3;
  uint uVar4;
  int iVar5;
  
  if (param_2 < 0x80) {
    *param_1 = (byte)param_2;
    return 1;
  }
  if (param_2 < 0x800) {
    param_1[1] = (byte)param_2 & 0x3f | 0x80;
    param_2 = (int)param_2 >> 6;
    iVar2 = 2;
    bVar3 = 0xc0;
  }
  else {
    iVar1 = 2;
    uVar4 = param_2;
    do {
      uVar4 = uVar4 >> 5;
      iVar2 = iVar1 + 1;
      if (uVar4 < 0x800) {
        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);
        goto LAB_000b2189;
      }
      iVar1 = iVar2;
    } while (iVar2 != 6);
    iVar1 = 5;
    iVar2 = 6;
    iVar5 = -4;
LAB_000b2189:
    do {
      bVar3 = (byte)iVar5;
      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;
      param_2 = (int)param_2 >> 6;
      iVar1 = iVar1 + -1;
    } while (iVar1 != 0);
  }
  *param_1 = (byte)param_2 | bVar3;
  return iVar2;
}


PUSH EBP
PUSH EDI
PUSH ESI
PUSH EBX
CMP EDX,0x7f
JA 0x000b2140
MOV byte ptr [EAX],DL
MOV EBP,0x1
MOV EAX,EBP
POP EBX
POP ESI
POP EDI
POP EBP
RET
CMP EDX,0x7ff
JA 0x000b216b
MOV CL,DL
AND ECX,0x3f
OR ECX,0xffffff80
MOV byte ptr [EAX + 0x1],CL
SAR EDX,0x6
MOV EBP,0x2
MOV ESI,0xffffffc0
OR EDX,ESI
MOV byte ptr [EAX],DL
MOV EAX,EBP
POP EBX
POP ESI
POP EDI
POP EBP
RET
MOV ESI,EDX
MOV EBX,0x2
SHR ESI,0x5
LEA ECX,[EBX + 0x1]
CMP ESI,0x7ff
JA 0x000b219e
MOV ESI,0x3f00
SAR ESI,CL
MOV EBP,ECX
MOV EDI,EDX
AND EDI,0x3f
OR EDI,0xffffff80
MOV ECX,EDI
MOV byte ptr [EAX + EBX*0x1],CL
SAR EDX,0x6
DEC EBX
JNZ 0x000b2189
JMP 0x000b2160
MOV EBX,ECX
CMP ECX,0x6
JNZ 0x000b2172
MOV EBX,0x5
MOV EBP,0x6
MOV ESI,0xfffffffc
JMP 0x000b2189
(translation_unit "int __regparm3 FUN_000b2129(byte *param_1,uint param_2)\n\n{\n  int iVar1;\n  int iVar2;\n  byte bVar3;\n  uint uVar4;\n  int iVar5;\n  \n  if (param_2 < 0x80) {\n    *param_1 = (byte)param_2;\n    return 1;\n  }\n  if (param_2 < 0x800) {\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }\n  *param_1 = (byte)param_2 | bVar3;\n  return iVar2;\n}\n\n" (function_definition "int __regparm3 FUN_000b2129(byte *param_1,uint param_2)\n\n{\n  int iVar1;\n  int iVar2;\n  byte bVar3;\n  uint uVar4;\n  int iVar5;\n  \n  if (param_2 < 0x80) {\n    *param_1 = (byte)param_2;\n    return 1;\n  }\n  if (param_2 < 0x800) {\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }\n  *param_1 = (byte)param_2 | bVar3;\n  return iVar2;\n}" primitive_type (ERROR "__regparm3" identifier) (function_declarator "FUN_000b2129(byte *param_1,uint param_2)" identifier (parameter_list "(byte *param_1,uint param_2)" ( (parameter_declaration "byte *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "uint param_2" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  byte bVar3;\n  uint uVar4;\n  int iVar5;\n  \n  if (param_2 < 0x80) {\n    *param_1 = (byte)param_2;\n    return 1;\n  }\n  if (param_2 < 0x800) {\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }\n  *param_1 = (byte)param_2 | bVar3;\n  return iVar2;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "byte bVar3;" type_identifier identifier ;) (declaration "uint uVar4;" type_identifier identifier ;) (declaration "int iVar5;" primitive_type identifier ;) (if_statement "if (param_2 < 0x80) {\n    *param_1 = (byte)param_2;\n    return 1;\n  }" if (parenthesized_expression "(param_2 < 0x80)" ( (binary_expression "param_2 < 0x80" identifier < number_literal) )) (compound_statement "{\n    *param_1 = (byte)param_2;\n    return 1;\n  }" { (expression_statement "*param_1 = (byte)param_2;" (assignment_expression "*param_1 = (byte)param_2" (pointer_expression "*param_1" * identifier) = (cast_expression "(byte)param_2" ( (type_descriptor "byte" type_identifier) ) identifier)) ;) (return_statement "return 1;" return number_literal ;) })) (if_statement "if (param_2 < 0x800) {\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }" if (parenthesized_expression "(param_2 < 0x800)" ( (binary_expression "param_2 < 0x800" identifier < number_literal) )) (compound_statement "{\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }" { (expression_statement "param_1[1] = (byte)param_2 & 0x3f | 0x80;" (assignment_expression "param_1[1] = (byte)param_2 & 0x3f | 0x80" (subscript_expression "param_1[1]" identifier [ number_literal ]) = (binary_expression "(byte)param_2 & 0x3f | 0x80" (binary_expression "(byte)param_2 & 0x3f" (cast_expression "(byte)param_2" ( (type_descriptor "byte" type_identifier) ) identifier) & number_literal) | number_literal)) ;) (expression_statement "param_2 = (int)param_2 >> 6;" (assignment_expression "param_2 = (int)param_2 >> 6" identifier = (binary_expression "(int)param_2 >> 6" (cast_expression "(int)param_2" ( (type_descriptor "int" primitive_type) ) identifier) >> number_literal)) ;) (expression_statement "iVar2 = 2;" (assignment_expression "iVar2 = 2" identifier = number_literal) ;) (expression_statement "bVar3 = 0xc0;" (assignment_expression "bVar3 = 0xc0" identifier = number_literal) ;) }) (else_clause "else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }" else (compound_statement "{\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }" { (expression_statement "iVar1 = 2;" (assignment_expression "iVar1 = 2" identifier = number_literal) ;) (expression_statement "uVar4 = param_2;" (assignment_expression "uVar4 = param_2" identifier = identifier) ;) (do_statement "do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);" do (compound_statement "{\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    }" { (expression_statement "uVar4 = uVar4 >> 5;" (assignment_expression "uVar4 = uVar4 >> 5" identifier = (binary_expression "uVar4 >> 5" identifier >> number_literal)) ;) (expression_statement "iVar2 = iVar1 + 1;" (assignment_expression "iVar2 = iVar1 + 1" identifier = (binary_expression "iVar1 + 1" identifier + number_literal)) ;) (if_statement "if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }" if (parenthesized_expression "(uVar4 < 0x800)" ( (binary_expression "uVar4 < 0x800" identifier < number_literal) )) (compound_statement "{\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }" { (expression_statement "iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);" (assignment_expression "iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f)" identifier = (binary_expression "0x3f00 >> ((byte)iVar2 & 0x1f)" number_literal >> (parenthesized_expression "((byte)iVar2 & 0x1f)" ( (binary_expression "(byte)iVar2 & 0x1f" (cast_expression "(byte)iVar2" ( (type_descriptor "byte" type_identifier) ) identifier) & number_literal) )))) ;) (goto_statement "goto LAB_000b2189;" goto statement_identifier ;) })) (expression_statement "iVar1 = iVar2;" (assignment_expression "iVar1 = iVar2" identifier = identifier) ;) }) while (parenthesized_expression "(iVar2 != 6)" ( (binary_expression "iVar2 != 6" identifier != number_literal) )) ;) (expression_statement "iVar1 = 5;" (assignment_expression "iVar1 = 5" identifier = number_literal) ;) (expression_statement "iVar2 = 6;" (assignment_expression "iVar2 = 6" identifier = number_literal) ;) (expression_statement "iVar5 = -4;" (assignment_expression "iVar5 = -4" identifier = number_literal) ;) (labeled_statement "LAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);" statement_identifier : (do_statement "do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);" do (compound_statement "{\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    }" { (expression_statement "bVar3 = (byte)iVar5;" (assignment_expression "bVar3 = (byte)iVar5" identifier = (cast_expression "(byte)iVar5" ( (type_descriptor "byte" type_identifier) ) identifier)) ;) (expression_statement "param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;" (assignment_expression "param_1[iVar1] = (byte)param_2 & 0x3f | 0x80" (subscript_expression "param_1[iVar1]" identifier [ identifier ]) = (binary_expression "(byte)param_2 & 0x3f | 0x80" (binary_expression "(byte)param_2 & 0x3f" (cast_expression "(byte)param_2" ( (type_descriptor "byte" type_identifier) ) identifier) & number_literal) | number_literal)) ;) (expression_statement "param_2 = (int)param_2 >> 6;" (assignment_expression "param_2 = (int)param_2 >> 6" identifier = (binary_expression "(int)param_2 >> 6" (cast_expression "(int)param_2" ( (type_descriptor "int" primitive_type) ) identifier) >> number_literal)) ;) (expression_statement "iVar1 = iVar1 + -1;" (assignment_expression "iVar1 = iVar1 + -1" identifier = (binary_expression "iVar1 + -1" identifier + number_literal)) ;) }) while (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) ;)) }))) (expression_statement "*param_1 = (byte)param_2 | bVar3;" (assignment_expression "*param_1 = (byte)param_2 | bVar3" (pointer_expression "*param_1" * identifier) = (binary_expression "(byte)param_2 | bVar3" (cast_expression "(byte)param_2" ( (type_descriptor "byte" type_identifier) ) identifier) | identifier)) ;) (return_statement "return iVar2;" return identifier ;) })))
(translation_unit "size_t __regparm3 wcrtomb_internal(char *s,wchar_t wc)\n\n{\n  size_t sVar1;\n  size_t sVar2;\n  byte bVar3;\n  wchar_t wVar4;\n  int iVar5;\n  \n  if ((uint)wc < 0x80) {\n    *s = (byte)wc;\n    return 1;\n  }\n  if ((uint)wc < 0x800) {\n    s[1] = (byte)wc & 0x3f | 0x80;\n    wc = wc >> 6;\n    sVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    sVar1 = 2;\n    wVar4 = wc;\n    do {\n      wVar4 = (uint)wVar4 >> 5;\n      sVar2 = sVar1 + 1;\n      if ((uint)wVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)sVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      sVar1 = sVar2;\n    } while (sVar2 != 6);\n    sVar1 = 5;\n    sVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      s[sVar1] = (byte)wc & 0x3f | 0x80;\n      wc = wc >> 6;\n      sVar1 = sVar1 - 1;\n    } while (sVar1 != 0);\n  }\n  *s = (byte)wc | bVar3;\n  return sVar2;\n}\n\n" (function_definition "size_t __regparm3 wcrtomb_internal(char *s,wchar_t wc)\n\n{\n  size_t sVar1;\n  size_t sVar2;\n  byte bVar3;\n  wchar_t wVar4;\n  int iVar5;\n  \n  if ((uint)wc < 0x80) {\n    *s = (byte)wc;\n    return 1;\n  }\n  if ((uint)wc < 0x800) {\n    s[1] = (byte)wc & 0x3f | 0x80;\n    wc = wc >> 6;\n    sVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    sVar1 = 2;\n    wVar4 = wc;\n    do {\n      wVar4 = (uint)wVar4 >> 5;\n      sVar2 = sVar1 + 1;\n      if ((uint)wVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)sVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      sVar1 = sVar2;\n    } while (sVar2 != 6);\n    sVar1 = 5;\n    sVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      s[sVar1] = (byte)wc & 0x3f | 0x80;\n      wc = wc >> 6;\n      sVar1 = sVar1 - 1;\n    } while (sVar1 != 0);\n  }\n  *s = (byte)wc | bVar3;\n  return sVar2;\n}" primitive_type (ERROR "__regparm3" identifier) (function_declarator "wcrtomb_internal(char *s,wchar_t wc)" identifier (parameter_list "(char *s,wchar_t wc)" ( (parameter_declaration "char *s" primitive_type (pointer_declarator "*s" * identifier)) , (parameter_declaration "wchar_t wc" type_identifier identifier) ))) (compound_statement "{\n  size_t sVar1;\n  size_t sVar2;\n  byte bVar3;\n  wchar_t wVar4;\n  int iVar5;\n  \n  if ((uint)wc < 0x80) {\n    *s = (byte)wc;\n    return 1;\n  }\n  if ((uint)wc < 0x800) {\n    s[1] = (byte)wc & 0x3f | 0x80;\n    wc = wc >> 6;\n    sVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    sVar1 = 2;\n    wVar4 = wc;\n    do {\n      wVar4 = (uint)wVar4 >> 5;\n      sVar2 = sVar1 + 1;\n      if ((uint)wVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)sVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      sVar1 = sVar2;\n    } while (sVar2 != 6);\n    sVar1 = 5;\n    sVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      s[sVar1] = (byte)wc & 0x3f | 0x80;\n      wc = wc >> 6;\n      sVar1 = sVar1 - 1;\n    } while (sVar1 != 0);\n  }\n  *s = (byte)wc | bVar3;\n  return sVar2;\n}" { (declaration "size_t sVar1;" primitive_type identifier ;) (declaration "size_t sVar2;" primitive_type identifier ;) (declaration "byte bVar3;" type_identifier identifier ;) (declaration "wchar_t wVar4;" type_identifier identifier ;) (declaration "int iVar5;" primitive_type identifier ;) (if_statement "if ((uint)wc < 0x80) {\n    *s = (byte)wc;\n    return 1;\n  }" if (parenthesized_expression "((uint)wc < 0x80)" ( (binary_expression "(uint)wc < 0x80" (cast_expression "(uint)wc" ( (type_descriptor "uint" type_identifier) ) identifier) < number_literal) )) (compound_statement "{\n    *s = (byte)wc;\n    return 1;\n  }" { (expression_statement "*s = (byte)wc;" (assignment_expression "*s = (byte)wc" (pointer_expression "*s" * identifier) = (cast_expression "(byte)wc" ( (type_descriptor "byte" type_identifier) ) identifier)) ;) (return_statement "return 1;" return number_literal ;) })) (if_statement "if ((uint)wc < 0x800) {\n    s[1] = (byte)wc & 0x3f | 0x80;\n    wc = wc >> 6;\n    sVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    sVar1 = 2;\n    wVar4 = wc;\n    do {\n      wVar4 = (uint)wVar4 >> 5;\n      sVar2 = sVar1 + 1;\n      if ((uint)wVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)sVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      sVar1 = sVar2;\n    } while (sVar2 != 6);\n    sVar1 = 5;\n    sVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      s[sVar1] = (byte)wc & 0x3f | 0x80;\n      wc = wc >> 6;\n      sVar1 = sVar1 - 1;\n    } while (sVar1 != 0);\n  }" if (parenthesized_expression "((uint)wc < 0x800)" ( (binary_expression "(uint)wc < 0x800" (cast_expression "(uint)wc" ( (type_descriptor "uint" type_identifier) ) identifier) < number_literal) )) (compound_statement "{\n    s[1] = (byte)wc & 0x3f | 0x80;\n    wc = wc >> 6;\n    sVar2 = 2;\n    bVar3 = 0xc0;\n  }" { (expression_statement "s[1] = (byte)wc & 0x3f | 0x80;" (assignment_expression "s[1] = (byte)wc & 0x3f | 0x80" (subscript_expression "s[1]" identifier [ number_literal ]) = (binary_expression "(byte)wc & 0x3f | 0x80" (binary_expression "(byte)wc & 0x3f" (cast_expression "(byte)wc" ( (type_descriptor "byte" type_identifier) ) identifier) & number_literal) | number_literal)) ;) (expression_statement "wc = wc >> 6;" (assignment_expression "wc = wc >> 6" identifier = (binary_expression "wc >> 6" identifier >> number_literal)) ;) (expression_statement "sVar2 = 2;" (assignment_expression "sVar2 = 2" identifier = number_literal) ;) (expression_statement "bVar3 = 0xc0;" (assignment_expression "bVar3 = 0xc0" identifier = number_literal) ;) }) (else_clause "else {\n    sVar1 = 2;\n    wVar4 = wc;\n    do {\n      wVar4 = (uint)wVar4 >> 5;\n      sVar2 = sVar1 + 1;\n      if ((uint)wVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)sVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      sVar1 = sVar2;\n    } while (sVar2 != 6);\n    sVar1 = 5;\n    sVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      s[sVar1] = (byte)wc & 0x3f | 0x80;\n      wc = wc >> 6;\n      sVar1 = sVar1 - 1;\n    } while (sVar1 != 0);\n  }" else (compound_statement "{\n    sVar1 = 2;\n    wVar4 = wc;\n    do {\n      wVar4 = (uint)wVar4 >> 5;\n      sVar2 = sVar1 + 1;\n      if ((uint)wVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)sVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      sVar1 = sVar2;\n    } while (sVar2 != 6);\n    sVar1 = 5;\n    sVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      s[sVar1] = (byte)wc & 0x3f | 0x80;\n      wc = wc >> 6;\n      sVar1 = sVar1 - 1;\n    } while (sVar1 != 0);\n  }" { (expression_statement "sVar1 = 2;" (assignment_expression "sVar1 = 2" identifier = number_literal) ;) (expression_statement "wVar4 = wc;" (assignment_expression "wVar4 = wc" identifier = identifier) ;) (do_statement "do {\n      wVar4 = (uint)wVar4 >> 5;\n      sVar2 = sVar1 + 1;\n      if ((uint)wVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)sVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      sVar1 = sVar2;\n    } while (sVar2 != 6);" do (compound_statement "{\n      wVar4 = (uint)wVar4 >> 5;\n      sVar2 = sVar1 + 1;\n      if ((uint)wVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)sVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      sVar1 = sVar2;\n    }" { (expression_statement "wVar4 = (uint)wVar4 >> 5;" (assignment_expression "wVar4 = (uint)wVar4 >> 5" identifier = (binary_expression "(uint)wVar4 >> 5" (cast_expression "(uint)wVar4" ( (type_descriptor "uint" type_identifier) ) identifier) >> number_literal)) ;) (expression_statement "sVar2 = sVar1 + 1;" (assignment_expression "sVar2 = sVar1 + 1" identifier = (binary_expression "sVar1 + 1" identifier + number_literal)) ;) (if_statement "if ((uint)wVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)sVar2 & 0x1f);\n        goto LAB_000b2189;\n      }" if (parenthesized_expression "((uint)wVar4 < 0x800)" ( (binary_expression "(uint)wVar4 < 0x800" (cast_expression "(uint)wVar4" ( (type_descriptor "uint" type_identifier) ) identifier) < number_literal) )) (compound_statement "{\n        iVar5 = 0x3f00 >> ((byte)sVar2 & 0x1f);\n        goto LAB_000b2189;\n      }" { (expression_statement "iVar5 = 0x3f00 >> ((byte)sVar2 & 0x1f);" (assignment_expression "iVar5 = 0x3f00 >> ((byte)sVar2 & 0x1f)" identifier = (binary_expression "0x3f00 >> ((byte)sVar2 & 0x1f)" number_literal >> (parenthesized_expression "((byte)sVar2 & 0x1f)" ( (binary_expression "(byte)sVar2 & 0x1f" (cast_expression "(byte)sVar2" ( (type_descriptor "byte" type_identifier) ) identifier) & number_literal) )))) ;) (goto_statement "goto LAB_000b2189;" goto statement_identifier ;) })) (expression_statement "sVar1 = sVar2;" (assignment_expression "sVar1 = sVar2" identifier = identifier) ;) }) while (parenthesized_expression "(sVar2 != 6)" ( (binary_expression "sVar2 != 6" identifier != number_literal) )) ;) (expression_statement "sVar1 = 5;" (assignment_expression "sVar1 = 5" identifier = number_literal) ;) (expression_statement "sVar2 = 6;" (assignment_expression "sVar2 = 6" identifier = number_literal) ;) (expression_statement "iVar5 = -4;" (assignment_expression "iVar5 = -4" identifier = number_literal) ;) (labeled_statement "LAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      s[sVar1] = (byte)wc & 0x3f | 0x80;\n      wc = wc >> 6;\n      sVar1 = sVar1 - 1;\n    } while (sVar1 != 0);" statement_identifier : (do_statement "do {\n      bVar3 = (byte)iVar5;\n      s[sVar1] = (byte)wc & 0x3f | 0x80;\n      wc = wc >> 6;\n      sVar1 = sVar1 - 1;\n    } while (sVar1 != 0);" do (compound_statement "{\n      bVar3 = (byte)iVar5;\n      s[sVar1] = (byte)wc & 0x3f | 0x80;\n      wc = wc >> 6;\n      sVar1 = sVar1 - 1;\n    }" { (expression_statement "bVar3 = (byte)iVar5;" (assignment_expression "bVar3 = (byte)iVar5" identifier = (cast_expression "(byte)iVar5" ( (type_descriptor "byte" type_identifier) ) identifier)) ;) (expression_statement "s[sVar1] = (byte)wc & 0x3f | 0x80;" (assignment_expression "s[sVar1] = (byte)wc & 0x3f | 0x80" (subscript_expression "s[sVar1]" identifier [ identifier ]) = (binary_expression "(byte)wc & 0x3f | 0x80" (binary_expression "(byte)wc & 0x3f" (cast_expression "(byte)wc" ( (type_descriptor "byte" type_identifier) ) identifier) & number_literal) | number_literal)) ;) (expression_statement "wc = wc >> 6;" (assignment_expression "wc = wc >> 6" identifier = (binary_expression "wc >> 6" identifier >> number_literal)) ;) (expression_statement "sVar1 = sVar1 - 1;" (assignment_expression "sVar1 = sVar1 - 1" identifier = (binary_expression "sVar1 - 1" identifier - number_literal)) ;) }) while (parenthesized_expression "(sVar1 != 0)" ( (binary_expression "sVar1 != 0" identifier != number_literal) )) ;)) }))) (expression_statement "*s = (byte)wc | bVar3;" (assignment_expression "*s = (byte)wc | bVar3" (pointer_expression "*s" * identifier) = (binary_expression "(byte)wc | bVar3" (cast_expression "(byte)wc" ( (type_descriptor "byte" type_identifier) ) identifier) | identifier)) ;) (return_statement "return sVar2;" return identifier ;) })))
(translation_unit "int __regparm3 FUN_000b2129(byte *param_1,uint param_2)\n\n{\n  int iVar1;\n  int iVar2;\n  byte bVar3;\n  uint uVar4;\n  int iVar5;\n  \n  if (param_2 < 0x80) {\n    *param_1 = (byte)param_2;\n    return 1;\n  }\n  if (param_2 < 0x800) {\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }\n  *param_1 = (byte)param_2 | bVar3;\n  return iVar2;\n}\n\n" (function_definition "int __regparm3 FUN_000b2129(byte *param_1,uint param_2)\n\n{\n  int iVar1;\n  int iVar2;\n  byte bVar3;\n  uint uVar4;\n  int iVar5;\n  \n  if (param_2 < 0x80) {\n    *param_1 = (byte)param_2;\n    return 1;\n  }\n  if (param_2 < 0x800) {\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }\n  *param_1 = (byte)param_2 | bVar3;\n  return iVar2;\n}" primitive_type (ERROR "__regparm3" identifier) (function_declarator "FUN_000b2129(byte *param_1,uint param_2)" identifier (parameter_list "(byte *param_1,uint param_2)" ( (parameter_declaration "byte *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "uint param_2" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  byte bVar3;\n  uint uVar4;\n  int iVar5;\n  \n  if (param_2 < 0x80) {\n    *param_1 = (byte)param_2;\n    return 1;\n  }\n  if (param_2 < 0x800) {\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }\n  *param_1 = (byte)param_2 | bVar3;\n  return iVar2;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "byte bVar3;" type_identifier identifier ;) (declaration "uint uVar4;" type_identifier identifier ;) (declaration "int iVar5;" primitive_type identifier ;) (if_statement "if (param_2 < 0x80) {\n    *param_1 = (byte)param_2;\n    return 1;\n  }" if (parenthesized_expression "(param_2 < 0x80)" ( (binary_expression "param_2 < 0x80" identifier < number_literal) )) (compound_statement "{\n    *param_1 = (byte)param_2;\n    return 1;\n  }" { (expression_statement "*param_1 = (byte)param_2;" (assignment_expression "*param_1 = (byte)param_2" (pointer_expression "*param_1" * identifier) = (cast_expression "(byte)param_2" ( (type_descriptor "byte" type_identifier) ) identifier)) ;) (return_statement "return 1;" return number_literal ;) })) (if_statement "if (param_2 < 0x800) {\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }" if (parenthesized_expression "(param_2 < 0x800)" ( (binary_expression "param_2 < 0x800" identifier < number_literal) )) (compound_statement "{\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }" { (expression_statement "param_1[1] = (byte)param_2 & 0x3f | 0x80;" (assignment_expression "param_1[1] = (byte)param_2 & 0x3f | 0x80" (subscript_expression "param_1[1]" identifier [ number_literal ]) = (binary_expression "(byte)param_2 & 0x3f | 0x80" (binary_expression "(byte)param_2 & 0x3f" (cast_expression "(byte)param_2" ( (type_descriptor "byte" type_identifier) ) identifier) & number_literal) | number_literal)) ;) (expression_statement "param_2 = (int)param_2 >> 6;" (assignment_expression "param_2 = (int)param_2 >> 6" identifier = (binary_expression "(int)param_2 >> 6" (cast_expression "(int)param_2" ( (type_descriptor "int" primitive_type) ) identifier) >> number_literal)) ;) (expression_statement "iVar2 = 2;" (assignment_expression "iVar2 = 2" identifier = number_literal) ;) (expression_statement "bVar3 = 0xc0;" (assignment_expression "bVar3 = 0xc0" identifier = number_literal) ;) }) (else_clause "else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }" else (compound_statement "{\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }" { (expression_statement "iVar1 = 2;" (assignment_expression "iVar1 = 2" identifier = number_literal) ;) (expression_statement "uVar4 = param_2;" (assignment_expression "uVar4 = param_2" identifier = identifier) ;) (do_statement "do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);" do (compound_statement "{\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    }" { (expression_statement "uVar4 = uVar4 >> 5;" (assignment_expression "uVar4 = uVar4 >> 5" identifier = (binary_expression "uVar4 >> 5" identifier >> number_literal)) ;) (expression_statement "iVar2 = iVar1 + 1;" (assignment_expression "iVar2 = iVar1 + 1" identifier = (binary_expression "iVar1 + 1" identifier + number_literal)) ;) (if_statement "if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }" if (parenthesized_expression "(uVar4 < 0x800)" ( (binary_expression "uVar4 < 0x800" identifier < number_literal) )) (compound_statement "{\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }" { (expression_statement "iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);" (assignment_expression "iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f)" identifier = (binary_expression "0x3f00 >> ((byte)iVar2 & 0x1f)" number_literal >> (parenthesized_expression "((byte)iVar2 & 0x1f)" ( (binary_expression "(byte)iVar2 & 0x1f" (cast_expression "(byte)iVar2" ( (type_descriptor "byte" type_identifier) ) identifier) & number_literal) )))) ;) (goto_statement "goto LAB_000b2189;" goto statement_identifier ;) })) (expression_statement "iVar1 = iVar2;" (assignment_expression "iVar1 = iVar2" identifier = identifier) ;) }) while (parenthesized_expression "(iVar2 != 6)" ( (binary_expression "iVar2 != 6" identifier != number_literal) )) ;) (expression_statement "iVar1 = 5;" (assignment_expression "iVar1 = 5" identifier = number_literal) ;) (expression_statement "iVar2 = 6;" (assignment_expression "iVar2 = 6" identifier = number_literal) ;) (expression_statement "iVar5 = -4;" (assignment_expression "iVar5 = -4" identifier = number_literal) ;) (labeled_statement "LAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);" statement_identifier : (do_statement "do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);" do (compound_statement "{\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    }" { (expression_statement "bVar3 = (byte)iVar5;" (assignment_expression "bVar3 = (byte)iVar5" identifier = (cast_expression "(byte)iVar5" ( (type_descriptor "byte" type_identifier) ) identifier)) ;) (expression_statement "param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;" (assignment_expression "param_1[iVar1] = (byte)param_2 & 0x3f | 0x80" (subscript_expression "param_1[iVar1]" identifier [ identifier ]) = (binary_expression "(byte)param_2 & 0x3f | 0x80" (binary_expression "(byte)param_2 & 0x3f" (cast_expression "(byte)param_2" ( (type_descriptor "byte" type_identifier) ) identifier) & number_literal) | number_literal)) ;) (expression_statement "param_2 = (int)param_2 >> 6;" (assignment_expression "param_2 = (int)param_2 >> 6" identifier = (binary_expression "(int)param_2 >> 6" (cast_expression "(int)param_2" ( (type_descriptor "int" primitive_type) ) identifier) >> number_literal)) ;) (expression_statement "iVar1 = iVar1 + -1;" (assignment_expression "iVar1 = iVar1 + -1" identifier = (binary_expression "iVar1 + -1" identifier + number_literal)) ;) }) while (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) ;)) }))) (expression_statement "*param_1 = (byte)param_2 | bVar3;" (assignment_expression "*param_1 = (byte)param_2 | bVar3" (pointer_expression "*param_1" * identifier) = (binary_expression "(byte)param_2 | bVar3" (cast_expression "(byte)param_2" ( (type_descriptor "byte" type_identifier) ) identifier) | identifier)) ;) (return_statement "return iVar2;" return identifier ;) })))
(translation_unit (function_definition TYPE (ERROR IDENT) (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (expression_statement (assignment_expression (pointer_expression * IDENT) = (cast_expression ( (type_descriptor TYPE) ) IDENT)) ;) (return_statement return LIT ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = (binary_expression (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) & LIT) | LIT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) >> LIT)) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT >> LIT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression LIT >> (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) & LIT) )))) ;) (goto_statement goto statement_identifier ;) })) (expression_statement (assignment_expression IDENT = IDENT) ;) }) while (parenthesized_expression ( (binary_expression IDENT != LIT) )) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (labeled_statement statement_identifier : (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE) ) IDENT)) ;) (expression_statement (assignment_expression (subscript_expression IDENT [ IDENT ]) = (binary_expression (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) & LIT) | LIT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) >> LIT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) }) while (parenthesized_expression ( (binary_expression IDENT != LIT) )) ;)) }))) (expression_statement (assignment_expression (pointer_expression * IDENT) = (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) | IDENT)) ;) (return_statement return IDENT ;) })))
(function_definition "int __regparm3 FUN_000b2129(byte *param_1,uint param_2)\n\n{\n  int iVar1;\n  int iVar2;\n  byte bVar3;\n  uint uVar4;\n  int iVar5;\n  \n  if (param_2 < 0x80) {\n    *param_1 = (byte)param_2;\n    return 1;\n  }\n  if (param_2 < 0x800) {\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }\n  *param_1 = (byte)param_2 | bVar3;\n  return iVar2;\n}" (primitive_type "int") (ERROR "__regparm3" (identifier "__regparm3")) (function_declarator "FUN_000b2129(byte *param_1,uint param_2)" (identifier "FUN_000b2129") (parameter_list "(byte *param_1,uint param_2)" (( "(") (parameter_declaration "byte *param_1" (type_identifier "byte") (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "uint param_2" (type_identifier "uint") (identifier "param_2")) () ")"))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  byte bVar3;\n  uint uVar4;\n  int iVar5;\n  \n  if (param_2 < 0x80) {\n    *param_1 = (byte)param_2;\n    return 1;\n  }\n  if (param_2 < 0x800) {\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }\n  *param_1 = (byte)param_2 | bVar3;\n  return iVar2;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "int iVar2;" (primitive_type "int") (identifier "iVar2") (; ";")) (declaration "byte bVar3;" (type_identifier "byte") (identifier "bVar3") (; ";")) (declaration "uint uVar4;" (type_identifier "uint") (identifier "uVar4") (; ";")) (declaration "int iVar5;" (primitive_type "int") (identifier "iVar5") (; ";")) (if_statement "if (param_2 < 0x80) {\n    *param_1 = (byte)param_2;\n    return 1;\n  }" (if "if") (parenthesized_expression "(param_2 < 0x80)" (( "(") (binary_expression "param_2 < 0x80" (identifier "param_2") (< "<") (number_literal "0x80")) () ")")) (compound_statement "{\n    *param_1 = (byte)param_2;\n    return 1;\n  }" ({ "{") (expression_statement "*param_1 = (byte)param_2;" (assignment_expression "*param_1 = (byte)param_2" (pointer_expression "*param_1" (* "*") (identifier "param_1")) (= "=") (cast_expression "(byte)param_2" (( "(") (type_descriptor "byte" (type_identifier "byte")) () ")") (identifier "param_2"))) (; ";")) (return_statement "return 1;" (return "return") (number_literal "1") (; ";")) (} "}"))) (if_statement "if (param_2 < 0x800) {\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }\n  else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }" (if "if") (parenthesized_expression "(param_2 < 0x800)" (( "(") (binary_expression "param_2 < 0x800" (identifier "param_2") (< "<") (number_literal "0x800")) () ")")) (compound_statement "{\n    param_1[1] = (byte)param_2 & 0x3f | 0x80;\n    param_2 = (int)param_2 >> 6;\n    iVar2 = 2;\n    bVar3 = 0xc0;\n  }" ({ "{") (expression_statement "param_1[1] = (byte)param_2 & 0x3f | 0x80;" (assignment_expression "param_1[1] = (byte)param_2 & 0x3f | 0x80" (subscript_expression "param_1[1]" (identifier "param_1") ([ "[") (number_literal "1") (] "]")) (= "=") (binary_expression "(byte)param_2 & 0x3f | 0x80" (binary_expression "(byte)param_2 & 0x3f" (cast_expression "(byte)param_2" (( "(") (type_descriptor "byte" (type_identifier "byte")) () ")") (identifier "param_2")) (& "&") (number_literal "0x3f")) (| "|") (number_literal "0x80"))) (; ";")) (expression_statement "param_2 = (int)param_2 >> 6;" (assignment_expression "param_2 = (int)param_2 >> 6" (identifier "param_2") (= "=") (binary_expression "(int)param_2 >> 6" (cast_expression "(int)param_2" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "param_2")) (>> ">>") (number_literal "6"))) (; ";")) (expression_statement "iVar2 = 2;" (assignment_expression "iVar2 = 2" (identifier "iVar2") (= "=") (number_literal "2")) (; ";")) (expression_statement "bVar3 = 0xc0;" (assignment_expression "bVar3 = 0xc0" (identifier "bVar3") (= "=") (number_literal "0xc0")) (; ";")) (} "}")) (else_clause "else {\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }" (else "else") (compound_statement "{\n    iVar1 = 2;\n    uVar4 = param_2;\n    do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);\n    iVar1 = 5;\n    iVar2 = 6;\n    iVar5 = -4;\nLAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);\n  }" ({ "{") (expression_statement "iVar1 = 2;" (assignment_expression "iVar1 = 2" (identifier "iVar1") (= "=") (number_literal "2")) (; ";")) (expression_statement "uVar4 = param_2;" (assignment_expression "uVar4 = param_2" (identifier "uVar4") (= "=") (identifier "param_2")) (; ";")) (do_statement "do {\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    } while (iVar2 != 6);" (do "do") (compound_statement "{\n      uVar4 = uVar4 >> 5;\n      iVar2 = iVar1 + 1;\n      if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }\n      iVar1 = iVar2;\n    }" ({ "{") (expression_statement "uVar4 = uVar4 >> 5;" (assignment_expression "uVar4 = uVar4 >> 5" (identifier "uVar4") (= "=") (binary_expression "uVar4 >> 5" (identifier "uVar4") (>> ">>") (number_literal "5"))) (; ";")) (expression_statement "iVar2 = iVar1 + 1;" (assignment_expression "iVar2 = iVar1 + 1" (identifier "iVar2") (= "=") (binary_expression "iVar1 + 1" (identifier "iVar1") (+ "+") (number_literal "1"))) (; ";")) (if_statement "if (uVar4 < 0x800) {\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }" (if "if") (parenthesized_expression "(uVar4 < 0x800)" (( "(") (binary_expression "uVar4 < 0x800" (identifier "uVar4") (< "<") (number_literal "0x800")) () ")")) (compound_statement "{\n        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);\n        goto LAB_000b2189;\n      }" ({ "{") (expression_statement "iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);" (assignment_expression "iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f)" (identifier "iVar5") (= "=") (binary_expression "0x3f00 >> ((byte)iVar2 & 0x1f)" (number_literal "0x3f00") (>> ">>") (parenthesized_expression "((byte)iVar2 & 0x1f)" (( "(") (binary_expression "(byte)iVar2 & 0x1f" (cast_expression "(byte)iVar2" (( "(") (type_descriptor "byte" (type_identifier "byte")) () ")") (identifier "iVar2")) (& "&") (number_literal "0x1f")) () ")")))) (; ";")) (goto_statement "goto LAB_000b2189;" (goto "goto") (statement_identifier "LAB_000b2189") (; ";")) (} "}"))) (expression_statement "iVar1 = iVar2;" (assignment_expression "iVar1 = iVar2" (identifier "iVar1") (= "=") (identifier "iVar2")) (; ";")) (} "}")) (while "while") (parenthesized_expression "(iVar2 != 6)" (( "(") (binary_expression "iVar2 != 6" (identifier "iVar2") (!= "!=") (number_literal "6")) () ")")) (; ";")) (expression_statement "iVar1 = 5;" (assignment_expression "iVar1 = 5" (identifier "iVar1") (= "=") (number_literal "5")) (; ";")) (expression_statement "iVar2 = 6;" (assignment_expression "iVar2 = 6" (identifier "iVar2") (= "=") (number_literal "6")) (; ";")) (expression_statement "iVar5 = -4;" (assignment_expression "iVar5 = -4" (identifier "iVar5") (= "=") (number_literal "-4")) (; ";")) (labeled_statement "LAB_000b2189:\n    do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);" (statement_identifier "LAB_000b2189") (: ":") (do_statement "do {\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    } while (iVar1 != 0);" (do "do") (compound_statement "{\n      bVar3 = (byte)iVar5;\n      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;\n      param_2 = (int)param_2 >> 6;\n      iVar1 = iVar1 + -1;\n    }" ({ "{") (expression_statement "bVar3 = (byte)iVar5;" (assignment_expression "bVar3 = (byte)iVar5" (identifier "bVar3") (= "=") (cast_expression "(byte)iVar5" (( "(") (type_descriptor "byte" (type_identifier "byte")) () ")") (identifier "iVar5"))) (; ";")) (expression_statement "param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;" (assignment_expression "param_1[iVar1] = (byte)param_2 & 0x3f | 0x80" (subscript_expression "param_1[iVar1]" (identifier "param_1") ([ "[") (identifier "iVar1") (] "]")) (= "=") (binary_expression "(byte)param_2 & 0x3f | 0x80" (binary_expression "(byte)param_2 & 0x3f" (cast_expression "(byte)param_2" (( "(") (type_descriptor "byte" (type_identifier "byte")) () ")") (identifier "param_2")) (& "&") (number_literal "0x3f")) (| "|") (number_literal "0x80"))) (; ";")) (expression_statement "param_2 = (int)param_2 >> 6;" (assignment_expression "param_2 = (int)param_2 >> 6" (identifier "param_2") (= "=") (binary_expression "(int)param_2 >> 6" (cast_expression "(int)param_2" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "param_2")) (>> ">>") (number_literal "6"))) (; ";")) (expression_statement "iVar1 = iVar1 + -1;" (assignment_expression "iVar1 = iVar1 + -1" (identifier "iVar1") (= "=") (binary_expression "iVar1 + -1" (identifier "iVar1") (+ "+") (number_literal "-1"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(iVar1 != 0)" (( "(") (binary_expression "iVar1 != 0" (identifier "iVar1") (!= "!=") (number_literal "0")) () ")")) (; ";"))) (} "}")))) (expression_statement "*param_1 = (byte)param_2 | bVar3;" (assignment_expression "*param_1 = (byte)param_2 | bVar3" (pointer_expression "*param_1" (* "*") (identifier "param_1")) (= "=") (binary_expression "(byte)param_2 | bVar3" (cast_expression "(byte)param_2" (( "(") (type_descriptor "byte" (type_identifier "byte")) () ")") (identifier "param_2")) (| "|") (identifier "bVar3"))) (; ";")) (return_statement "return iVar2;" (return "return") (identifier "iVar2") (; ";")) (} "}")))

size_t __regparm3 function_1(char *s,type_1 var_1)

{
  size_t var_2;
  size_t var_3;
  type_2 var_4;
  type_1 wVar4;
  int iVar5;
  
  if ((type_3)var_1 < 0x80) {
    *s = (type_2)var_1;
    return 1;
  }
  if ((type_3)var_1 < 0x800) {
    s[1] = (type_2)var_1 & 0x3f | 0x80;
    var_1 = var_1 >> 6;
    var_3 = 2;
    var_4 = 0xc0;
  }
  else {
    var_2 = 2;
    wVar4 = var_1;
    do {
      wVar4 = (type_3)wVar4 >> 5;
      var_3 = var_2 + 1;
      if ((type_3)wVar4 < 0x800) {
        iVar5 = 0x3f00 >> ((type_2)var_3 & 0x1f);
        goto LAB_000b2189;
      }
      var_2 = var_3;
    } while (var_3 != 6);
    var_2 = 5;
    var_3 = 6;
    iVar5 = -4;
LAB_000b2189:
    do {
      var_4 = (type_2)iVar5;
      s[var_2] = (type_2)var_1 & 0x3f | 0x80;
      var_1 = var_1 >> 6;
      var_2 = var_2 - 1;
    } while (var_2 != 0);
  }
  *s = (type_2)var_1 | var_4;
  return var_3;
}


(translation_unit (function_definition type: (primitive_type) (ERROR (identifier)) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (type_identifier) declarator: (identifier)))) body: (compound_statement (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)))) (return_statement (number_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (subscript_expression argument: (identifier) index: (number_literal)) right: (binary_expression left: (binary_expression left: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)) right: (number_literal)) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (cast_expression type: (type_descriptor type: (primitive_type)) value: (identifier)) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (assignment_expression left: (identifier) right: (number_literal)))) alternative: (else_clause (compound_statement (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (do_statement body: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (number_literal) right: (parenthesized_expression (binary_expression left: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)) right: (number_literal)))))) (goto_statement label: (statement_identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier)))) condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (labeled_statement label: (statement_identifier) (do_statement body: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)))) (expression_statement (assignment_expression left: (subscript_expression argument: (identifier) index: (identifier)) right: (binary_expression left: (binary_expression left: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)) right: (number_literal)) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (cast_expression type: (type_descriptor type: (primitive_type)) value: (identifier)) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal))))) condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal)))))))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (binary_expression left: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)) right: (identifier)))) (return_statement (identifier)))))

int __regparm3 MASKED(byte *param_1,uint param_2)

{
  int iVar1;
  int iVar2;
  byte bVar3;
  uint uVar4;
  int iVar5;
  
  if (param_2 < 0x80) {
    *param_1 = (byte)param_2;
    return 1;
  }
  if (param_2 < 0x800) {
    param_1[1] = (byte)param_2 & 0x3f | 0x80;
    param_2 = (int)param_2 >> 6;
    iVar2 = 2;
    bVar3 = 0xc0;
  }
  else {
    iVar1 = 2;
    uVar4 = param_2;
    do {
      uVar4 = uVar4 >> 5;
      iVar2 = iVar1 + 1;
      if (uVar4 < 0x800) {
        iVar5 = 0x3f00 >> ((byte)iVar2 & 0x1f);
        goto LAB_000b2189;
      }
      iVar1 = iVar2;
    } while (iVar2 != 6);
    iVar1 = 5;
    iVar2 = 6;
    iVar5 = -4;
LAB_000b2189:
    do {
      bVar3 = (byte)iVar5;
      param_1[iVar1] = (byte)param_2 & 0x3f | 0x80;
      param_2 = (int)param_2 >> 6;
      iVar1 = iVar1 + -1;
    } while (iVar1 != 0);
  }
  *param_1 = (byte)param_2 | bVar3;
  return iVar2;
}

