decompiled_code:
__int64 __fastcall vector_top_back(__int64 a1)
{
__int64 result; // rax
int v2; // eax

result = 0LL;
if ( *(_DWORD *)(a1 + 4) )
{
v2 = vector_size(a1);
result = vector_get_element_at(a1, v2 - 1);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
__int64 result; // rax
int v2; // eax

result = 0LL;
if ( *(_DWORD *)(a1 + 4) )
{
v2 = func3(a1);
result = func4(a1, v2 - 1);
}
return result;
}

original_code:
void* vector_top_back(Vector *v) {
  if (v->_size == 0)
    return ((void *)0);
  return vector_get_element_at(v, vector_size(v) - 1);
}

canonical_original_code:
void *vector_top_back(struct Vector *v) {
  if (v->_size == 0)
    return ((void *)0);
  return vector_get_element_at(v, vector_size(v) - 1);
}


repo: kiennt/SimpleXML

decompiled_code:
__int64 __fastcall vector_top_front(__int64 a1)
{
__int64 result; // rax

result = 0LL;
if ( *(_DWORD *)(a1 + 4) )
result = vector_get_element_at(a1, 0);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
__int64 result; // rax

result = 0LL;
if ( *(_DWORD *)(a1 + 4) )
result = func4(a1, 0);
return result;
}

original_code:
void* vector_top_front(Vector *v) {
  if (v->_size == 0)
    return ((void *)0);
  return vector_get_element_at(v, 0);
}

canonical_original_code:
void *vector_top_front(struct Vector *v) {
  if (v->_size == 0)
    return ((void *)0);
  return vector_get_element_at(v, 0);
}

variable_types: struct Vector { int _capacity; int _size; void **_data; } *

return_type: void *


original_code:
int vector_insert_at_index(Vector *v, void* elem, int index) {
  vector_validated(v);
  ((void) sizeof ((index >= 0 && index <= v->_size && "index of out range") ? 1 : 0), __extension__ ({ if (index >= 0 && index <= v->_size && "index of out range") ; else __assert_fail ("index >= 0 && index <= v->_size && \"index of out range\"", "simple_vector.c", 107, __extension__ __PRETTY_FUNCTION__); }));
  int i;
  if (v->_size == v->_capacity) {
    v->_capacity = v->_capacity * 2;
    void** old_data = v->_data;
    v->_data = calloc(v->_capacity, sizeof(void*));
    for (i = 0; i < v->_size; ++i)
      v->_data[i] = old_data[i];
    free(old_data);
  }
  v->_size++;
  for (i = v->_size; i > index; --i) {
    v->_data[i] = v->_data[i - 1];
  }
  v->_data[index] = elem;
  return 1;
}

canonical_original_code:
int vector_insert_at_index(struct Vector *v, void *elem, int index) {
  vector_validated(v);
  ((void) sizeof ((index >= 0 && index <= v->_size && "index of out range") ? 1 : 0), __extension__ ({ if (index >= 0 && index <= v->_size && "index of out range") ; else __assert_fail ("index >= 0 && index <= v->_size && \"index of out range\"", "simple_vector.c", 107, __extension__ __PRETTY_FUNCTION__); }));
  int i;
  if (v->_size == v->_capacity) {
    v->_capacity = v->_capacity * 2;
    void **old_data = v->_data;
    v->_data = calloc(v->_capacity, sizeof(void *));
    for (i = 0; i < v->_size; ++i)
      v->_data[i] = old_data[i];
    free(old_data);
  }
  v->_size++;
  for (i = v->_size; i > index; --i) {
    v->_data[i] = v->_data[i - 1];
  }
  v->_data[index] = elem;
  return 1;
}

variable_types:
elem
void *

variable_types: index int

variable_types: i int

return_type: int

user_defined_types: struct Vector { int _capacity; int _size; void **_data; }


decompiled_code:
__int64 __fastcall vector_push_back(__int64 a1, __int64 a2)
{
return vector_insert_at_index(a1, a2, *(_DWORD *)(a1 + 4));
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, __int64 a2)
{
return func7(a1, a2, *(_DWORD *)(a1 + 4));
}

original_code:
int vector_push_back(Vector *v, void* elem) {
  return vector_insert_at_index(v, elem, v->_size);
}

canonical_original_code:
int vector_push_back(struct Vector *v, void *elem) {
  return vector_insert_at_index(v, elem, v->_size);
}


decompiled_code:
__int64 __fastcall vector_push_front(__int64 a1, __int64 a2)
{
return vector_insert_at_index(a1, a2, 0);
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, __int64 a2)
{
return func7(a1, a2, 0);
}

original_code:
int vector_push_front(Vector *v, void* elem) {
  return vector_insert_at_index(v, elem, 0);
}

canonical_original_code:
int vector_push_front(struct Vector *v, void *elem) {
  return vector_insert_at_index(v, elem, 0);
}


decompiled_code:
__int64 __fastcall vector_remove_element_at_index(__int64 a1, int a2)
{
int v2; // ebx
__int64 v3; // rsi
__int64 v4; // rax
int v5; // edx

v2 = a2;
vector_validated(a1);
if ( a2 < 0 || *(_DWORD *)(a1 + 4) <= a2 )
_assert_fail(
"index >= 0 && index < v->_size && \"index of out range\"",
"simple_vector.c",
0x86u,
"vector_remove_element_at_index");
v3 = *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8LL * a2);
v4 = 8LL * v2 + 8;
do
{
*(_QWORD *)(*(_QWORD *)(a1 + 8) + v4 - 8) = *(_QWORD *)(*(_QWORD *)(a1 + 8) + v4);
++v2;
v5 = *(_DWORD *)(a1 + 4);
v4 += 8LL;
}
while ( v5 > v2 );
*(_DWORD *)(a1 + 4) = v5 - 1;
return v3;
}

original_code:
void* vector_remove_element_at_index(Vector *v, int index) {
  vector_validated(v);
  ((void) sizeof ((index >= 0 && index < v->_size && "index of out range") ? 1 : 0), __extension__ ({ if (index >= 0 && index < v->_size && "index of out range") ; else __assert_fail ("index >= 0 && index < v->_size && \"index of out range\"", "simple_vector.c", 134, __extension__ __PRETTY_FUNCTION__); }));
  int i;
  void* elem;
  elem = v->_data[index];
  for (i = index; i < v->_size; ++i) {
    v->_data[i] = v->_data[i + 1];
  }
  v->_size--;
  return elem;
}

canonical_original_code:
void *vector_remove_element_at_index(struct Vector *v, int index) {
  vector_validated(v);
  ((void) sizeof ((index >= 0 && index < v->_size && "index of out range") ? 1 : 0), __extension__ ({ if (index >= 0 && index < v->_size && "index of out range") ; else __assert_fail ("index >= 0 && index < v->_size && \"index of out range\"", "simple_vector.c", 134, __extension__ __PRETTY_FUNCTION__); }));
  int i;
  void *elem;
  elem = v->_data[index];
  for (i = index; i < v->_size; ++i) {
    v->_data[i] = v->_data[i + 1];
  }
  v->_size--;
  return elem;
}


decompiled_code:
__int64 __fastcall vector_pop_back(__int64 a1)
{
return vector_remove_element_at_index(a1, *(_DWORD *)(a1 + 4) - 1);
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1)
{
return func10(a1, *(_DWORD *)(a1 + 4) - 1);
}

original_code:
void* vector_pop_back(Vector *v) {
  return vector_remove_element_at_index(v, v->_size - 1);
}

canonical_original_code:
void *vector_pop_back(struct Vector *v) {
  return vector_remove_element_at_index(v, v->_size - 1);
}


decompiled_code:
__int64 __fastcall vector_pop_front(__int64 a1)
{
return vector_remove_element_at_index(a1, 0);
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1)
{
return func10(a1, 0);
}

original_code:
void* vector_pop_front(Vector *v) {
  return vector_remove_element_at_index(v, 0);
}

canonical_original_code:
void *vector_pop_front(struct Vector *v) {
  return vector_remove_element_at_index(v, 0);
}


decompiled_code:
__int64 __fastcall vector_index_of_with_start(__int64 a1, __int64 a2, int a3)
{
int v4; // eax
__int64 v5; // rdx
unsigned int v6; // ecx

vector_validated(a1);
v4 = *(_DWORD *)(a1 + 4);
if ( a3 >= v4 )
return (unsigned int)-1;
v5 = a3;
while ( 1 )
{
v6 = v5;
if ( *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v5) == a2 )
break;
if ( v4 <= (int)++v5 )
return (unsigned int)-1;
}
return v6;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1, __int64 a2, int a3)
{
int v4; // eax
__int64 v5; // rdx
unsigned int v6; // ecx

func0(a1);
v4 = *(_DWORD *)(a1 + 4);
if ( a3 >= v4 )
return (unsigned int)-1;
v5 = a3;
while ( 1 )
{
v6 = v5;
if ( *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v5) == a2 )
break;
if ( v4 <= (int)++v5 )
return (unsigned int)-1;
}
return v6;
}

original_code:
int vector_index_of_with_start(Vector *v, void *elem, int start) {
  vector_validated(v);
  int i;
  for (i = start; i < v->_size; ++i) {
    if (v->_data[i] == elem) {
      return i;
    }
  }
  return -1;
}

canonical_original_code:
int vector_index_of_with_start(struct Vector *v, void *elem, int start) {
  vector_validated(v);
  int i;
  for (i = start; i < v->_size; ++i) {
    if (v->_data[i] == elem) {
      return i;
    }
  }
  return -1;
}

variable_types: start int


decompiled_code:
__int64 __fastcall vector_index_of(__int64 a1, __int64 a2)
{
return vector_index_of_with_start(a1, a2, 0);
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1, __int64 a2)
{
return func13(a1, a2, 0);
}

original_code:
int vector_index_of(Vector *v, void *elem) {
  return vector_index_of_with_start(v, elem, 0);
}

canonical_original_code:
int vector_index_of(struct Vector *v, void *elem) {
  return vector_index_of_with_start(v, elem, 0);
}


decompiled_code:
void __fastcall StackElement_release(void *a1)
{
free(a1);
}

canonical_decompiled_code:
void __fastcall func2(void *a1)
{
free(a1);
}

original_code:
static void StackElement_release(StackElement *se) {
  free(se);
  se = ((void *)0);
}

canonical_original_code:
static void StackElement_release(struct StackElement *se) {
  free(se);
  se = ((void *)0);
}

variable_types: struct StackElement { struct XMLElement { char *tag_name; char *value; struct XMLElement *parent; struct Vector { int _capacity; int _size; void **_data; } *children; } *element; int depth; } *

return_type: void

user_defined_types: struct StackElement { struct XMLElement *element; int depth; }

user_defined_types: struct XMLElement { char *tag_name; char *value; struct XMLElement *parent; struct Vector *children; }


decompiled_code:
void __fastcall XMLParser_release(void *ptr)
{
vector_release(*((_QWORD *)ptr + 5));
vector_release(*((_QWORD *)ptr + 3));
vector_release(*((_QWORD *)ptr + 4));
free(ptr);
}

canonical_decompiled_code:
void __fastcall func3(void *ptr)
{
vector_release(*((_QWORD *)ptr + 5));
vector_release(*((_QWORD *)ptr + 3));
vector_release(*((_QWORD *)ptr + 4));
free(ptr);
}

original_code:
static void XMLParser_release(XMLParser *p) {
  vector_release(p->element_stack);
  vector_release(p->value_stack);
  vector_release(p->tag_stack);
  free(p);
  p = ((void *)0);
}

canonical_original_code:
static void XMLParser_release(struct XMLParser *p) {
  vector_release(p->element_stack);
  vector_release(p->value_stack);
  vector_release(p->tag_stack);
  free(p);
  p = ((void *)0);
}

variable_types: struct XMLParser { char *_input; int _pos; int _depth; enum ParseState { STATE1=0, STATE2=1, STATE3=2, STATE4=3, STATE5=4, STATE6=5, STATE7=6, STATE8=7, STATE_ERROR=8 } state; struct Vector { int _capacity; int _size; void **_data; } *value_stack; struct Vector *tag_stack; struct Vector *element_stack; } *

user_defined_types: struct XMLParser { char *_input; int _pos; int _depth; enum ParseState state; struct Vector *value_stack; struct Vector *tag_stack; struct Vector *element_stack; }


decompiled_code:
void __fastcall XMLElement_release(void *ptr)
{
*((_QWORD *)ptr + 2) = 0LL;
free(*(void **)ptr);
free(*((void **)ptr + 1));
vector_release(*((_QWORD *)ptr + 3));
free(ptr);
}

canonical_decompiled_code:
void __fastcall func4(void *ptr)
{
*((_QWORD *)ptr + 2) = 0LL;
free(*(void **)ptr);
free(*((void **)ptr + 1));
vector_release(*((_QWORD *)ptr + 3));
free(ptr);
}

original_code:
void XMLElement_release(XMLElement *e) {
  e->parent = ((void *)0);
  free(e->tag_name);
  free(e->value);
  vector_release(e->children);
  free(e);
  e = ((void *)0);
}

canonical_original_code:
void XMLElement_release(struct XMLElement *e) {
  e->parent = ((void *)0);
  free(e->tag_name);
  free(e->value);
  vector_release(e->children);
  free(e);
  e = ((void *)0);
}

variable_types: struct XMLElement { char *tag_name; char *value; struct XMLElement *parent; struct Vector { int _capacity; int _size; void **_data; } *children; } *


decompiled_code:
__int64 __fastcall parse_xml_from_text(__int64 a1)
{
_QWORD *v1; // r15
_DWORD *v2; // rbp
const char **v3; // rax
const char **v4; // rbx
int v5; // ecx
unsigned int v6; // eax
int v7; // er12
const char *v8; // rsi
__int64 v9; // r13
_DWORD *v10; // r14
int i; // er13
__int64 v12; // rax
__int64 *v13; // rax
__int64 v14; // rbx
int v16; // [rsp+4h] [rbp-44h]
__int64 v17; // [rsp+8h] [rbp-40h]

v2 = XMLParser_create();
*(_QWORD *)v2 = a1;
v2[2] = 0;
v2[4] = 0;
while ( 1 )
{
v3 = (const char **)parser_get_next_token((__int64)v2);
v4 = v3;
if ( !v3 )
break;
v5 = *(_DWORD *)v3;
if ( *(_DWORD *)v3 != 3 || v3[1] )
{
v6 = v2[4];
v7 = state_translate[4 * v6 + v5];
if ( v7 == 8 )
{
free(v4);
_assert_fail("state != STATE_ERROR && \"error while parsing\"", "simple_xml.c", 0x139u, "parse_xml_from_text");
}
if ( v6 == 5 )
{
if ( v5 == 3 )
{
v8 = (const char *)vector_top_back(*((_QWORD *)v2 + 4));
if ( strcmp(v4[1], v8) )
_assert_fail(
"strcmp(token->data, vector_top_back(parser->tag_stack)) == 0",
"simple_xml.c",
0x109u,
"parse_xml_from_text");
}
}
else if ( v6 > 5 )
{
if ( v6 == 6 && v5 == 2 )
{
v17 = vector_top_back(*((_QWORD *)v2 + 4));
v9 = vector_top_back(*((_QWORD *)v2 + 3));
v16 = vector_size(*((_QWORD *)v2 + 5));
--v2[3];
v1 = XMLElement_create((__int64)v1, v17, v9);
v10 = StackElement_create();
*(_QWORD *)v10 = v1;
v10[2] = v2[3];
if ( v16 > 0 )
{
for ( i = 0; i != v16; ++i )
{
v12 = vector_top_back(*((_QWORD *)v2 + 5));
if ( *(_DWORD *)(v12 + 8) <= v10[2] )
break;
vector_push_front(v1[3], *(_QWORD *)v12);
vector_pop_back(*((_QWORD *)v2 + 5));
}
}
vector_push_back(*((_QWORD *)v2 + 5), v10);
vector_pop_back(*((_QWORD *)v2 + 4));
vector_pop_back(*((_QWORD *)v2 + 3));
}
}
else if ( v6 == 1 )
{
if ( v5 == 3 )
{
vector_push_back(*((_QWORD *)v2 + 4), v4[1]);
++v2[3];
}
}
else if ( v6 == 3 )
{
vector_push_back(*((_QWORD *)v2 + 3), v4[1]);
}
free(v4);
v2[4] = v7;
}
}
v13 = (__int64 *)vector_top_back(*((_QWORD *)v2 + 5));
v14 = *v13;
StackElement_release(v13);
XMLParser_release(v2);
return v14;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
_QWORD *v1; // r15
_DWORD *v2; // rbp
const char **v3; // rax
const char **v4; // rbx
int v5; // ecx
unsigned int v6; // eax
int v7; // er12
const char *v8; // rsi
__int64 v9; // r13
_DWORD *v10; // r14
int i; // er13
__int64 v12; // rax
__int64 *v13; // rax
__int64 v14; // rbx
int v16; // [rsp+4h] [rbp-44h]
__int64 v17; // [rsp+8h] [rbp-40h]

v2 = func1();
*(_QWORD *)v2 = a1;
v2[2] = 0;
v2[4] = 0;
while ( 1 )
{
v3 = (const char **)parser_get_next_token((__int64)v2);
v4 = v3;
if ( !v3 )
break;
v5 = *(_DWORD *)v3;
if ( *(_DWORD *)v3 != 3 || v3[1] )
{
v6 = v2[4];
v7 = state_translate[4 * v6 + v5];
if ( v7 == 8 )
{
free(v4);
_assert_fail("state != STATE_ERROR && \"error while parsing\"", "simple_xml.c", 0x139u, "parse_xml_from_text");
}
if ( v6 == 5 )
{
if ( v5 == 3 )
{
v8 = (const char *)vector_top_back(*((_QWORD *)v2 + 4));
if ( strcmp(v4[1], v8) )
_assert_fail(
"strcmp(token->data, vector_top_back(parser->tag_stack)) == 0",
"simple_xml.c",
0x109u,
"parse_xml_from_text");
}
}
else if ( v6 > 5 )
{
if ( v6 == 6 && v5 == 2 )
{
v17 = vector_top_back(*((_QWORD *)v2 + 4));
v9 = vector_top_back(*((_QWORD *)v2 + 3));
v16 = vector_size(*((_QWORD *)v2 + 5));
--v2[3];
v1 = XMLElement_create((__int64)v1, v17, v9);
v10 = func0();
*(_QWORD *)v10 = v1;
v10[2] = v2[3];
if ( v16 > 0 )
{
for ( i = 0; i != v16; ++i )
{
v12 = vector_top_back(*((_QWORD *)v2 + 5));
if ( *(_DWORD *)(v12 + 8) <= v10[2] )
break;
vector_push_front(v1[3], *(_QWORD *)v12);
vector_pop_back(*((_QWORD *)v2 + 5));
}
}
vector_push_back(*((_QWORD *)v2 + 5), v10);
vector_pop_back(*((_QWORD *)v2 + 4));
vector_pop_back(*((_QWORD *)v2 + 3));
}
}
else if ( v6 == 1 )
{
if ( v5 == 3 )
{
vector_push_back(*((_QWORD *)v2 + 4), v4[1]);
++v2[3];
}
}
else if ( v6 == 3 )
{
vector_push_back(*((_QWORD *)v2 + 3), v4[1]);
}
free(v4);
v2[4] = v7;
}
}
v13 = (__int64 *)vector_top_back(*((_QWORD *)v2 + 5));
v14 = *v13;
func2(v13);
func3(v2);
return v14;
}

original_code:
XMLElement* parse_xml_from_text(char *text) {
  XMLToken *token;
  XMLParser *parser;
  parser = XMLParser_create(parser);
  parser->_input = text;
  parser->_pos = 0;
  parser->state = STATE1;
  while (1) {
    ParseState state;
    token = parser_get_next_token(parser);
    if (token == ((void *)0)) break;
    if (token->type == TEXT && token->data == ((void *)0))
      continue;
    state = state_translate[parser->state][token->type];
    if (state != STATE_ERROR) {
      switch (parser->state) {
        case STATE1:
          break;
        case STATE2:
          if (token->type == TEXT) {
            vector_push_back(parser->tag_stack, token->data);
            parser->_depth++;
          }
          break;
        case STATE3:
          break;
        case STATE4:
          vector_push_back(parser->value_stack, token->data);
          break;
        case STATE5:
          break;
        case STATE6:
          if (token->type == TEXT) {
            ((void) sizeof ((strcmp(token->data, vector_top_back(parser->tag_stack)) == 0) ? 1 : 0), __extension__ ({ if (strcmp(token->data, vector_top_back(parser->tag_stack)) == 0) ; else __assert_fail ("strcmp(token->data, vector_top_back(parser->tag_stack)) == 0", "simple_xml.c", 265, __extension__ __PRETTY_FUNCTION__); }));
          }
          break;
        case STATE7:
          if (token->type == END_TAG) {
            char *current_tag, *current_value;
            int i, length;
            XMLElement *top;
            XMLElement *current;
            StackElement *se;
            current_tag = vector_top_back(parser->tag_stack);
            current_value = vector_top_back(parser->value_stack);
            length = vector_size(parser->element_stack);
            parser->_depth--;
            current = XMLElement_create(current, current_tag, current_value);
            se = StackElement_create(se);
            se->element = current;
            se->depth = parser->_depth;
            for (i = 0; i < length; ++i) {
              StackElement *elem = (StackElement *)vector_top_back(parser->element_stack);
              if (elem->depth <= se->depth) break;
              vector_push_front(current->children, elem->element);
              vector_pop_back(parser->element_stack);
            }
            vector_push_back(parser->element_stack, se);
            vector_pop_back(parser->tag_stack);
            vector_pop_back(parser->value_stack);
          }
          break;
        case STATE8:
          break;
        default:
          break;
      }
    }
    free(token);
    if (state == STATE_ERROR)
      ((void) sizeof ((state != STATE_ERROR && "error while parsing") ? 1 : 0), __extension__ ({ if (state != STATE_ERROR && "error while parsing") ; else __assert_fail ("state != STATE_ERROR && \"error while parsing\"", "simple_xml.c", 313, __extension__ __PRETTY_FUNCTION__); }));
    parser->state = state;
  }
  StackElement* stackElem = (StackElement *) vector_top_back(parser->element_stack);
  XMLElement *xmlElem = stackElem->element;
  StackElement_release(stackElem);
  XMLParser_release(parser);
  return xmlElem;
}

canonical_original_code:
struct XMLElement *parse_xml_from_text(char *text) {
  struct XMLToken *token;
  struct XMLParser *parser;
  parser = XMLParser_create(parser);
  parser->_input = text;
  parser->_pos = 0;
  parser->state = STATE1;
  while (1) {
    enum ParseState state;
    token = parser_get_next_token(parser);
    if (token == ((void *)0)) break;
    if (token->type == TEXT && token->data == ((void *)0))
      continue;
    state = state_translate[parser->state][token->type];
    if (state != STATE_ERROR) {
      switch (parser->state) {
        case STATE1:
          break;
        case STATE2:
          if (token->type == TEXT) {
            vector_push_back(parser->tag_stack, token->data);
            parser->_depth++;
          }
          break;
        case STATE3:
          break;
        case STATE4:
          vector_push_back(parser->value_stack, token->data);
          break;
        case STATE5:
          break;
        case STATE6:
          if (token->type == TEXT) {
            ((void) sizeof ((strcmp(token->data, vector_top_back(parser->tag_stack)) == 0) ? 1 : 0), __extension__ ({ if (strcmp(token->data, vector_top_back(parser->tag_stack)) == 0) ; else __assert_fail ("strcmp(token->data, vector_top_back(parser->tag_stack)) == 0", "simple_xml.c", 265, __extension__ __PRETTY_FUNCTION__); }));
          }
          break;
        case STATE7:
          if (token->type == END_TAG) {
            char *current_tag; char *current_value;
            int i; int length;
            struct XMLElement *top;
            struct XMLElement *current;
            struct StackElement *se;
            current_tag = vector_top_back(parser->tag_stack);
            current_value = vector_top_back(parser->value_stack);
            length = vector_size(parser->element_stack);
            parser->_depth--;
            current = XMLElement_create(current, current_tag, current_value);
            se = StackElement_create(se);
            se->element = current;
            se->depth = parser->_depth;
            for (i = 0; i < length; ++i) {
              struct StackElement *elem = (StackElement *)vector_top_back(parser->element_stack);
              if (elem->depth <= se->depth) break;
              vector_push_front(current->children, elem->element);
              vector_pop_back(parser->element_stack);
            }
            vector_push_back(parser->element_stack, se);
            vector_pop_back(parser->tag_stack);
            vector_pop_back(parser->value_stack);
          }
          break;
        case STATE8:
          break;
        default:
          break;
      }
    }
    free(token);
    if (state == STATE_ERROR)
      ((void) sizeof ((state != STATE_ERROR && "error while parsing") ? 1 : 0), __extension__ ({ if (state != STATE_ERROR && "error while parsing") ; else __assert_fail ("state != STATE_ERROR && \"error while parsing\"", "simple_xml.c", 313, __extension__ __PRETTY_FUNCTION__); }));
    parser->state = state;
  }
  struct StackElement *stackElem = (StackElement *) vector_top_back(parser->element_stack);
  struct XMLElement *xmlElem = stackElem->element;
  StackElement_release(stackElem);
  XMLParser_release(parser);
  return xmlElem;
}

variable_types:
text
char *

variable_types: struct XMLToken { enum XMLTokenType { BEGIN_OPEN_TAG=0, BEGIN_CLOSE_TAG=1, END_TAG=2, TEXT=3 } type; char *data; } *

variable_types: enum ParseState { STATE1=0, STATE2=1, STATE3=2, STATE4=3, STATE5=4, STATE6=5, STATE7=6, STATE8=7, STATE_ERROR=8 }

variable_types: length int

return_type: struct XMLElement { char *tag_name; char *value; struct XMLElement *parent; struct Vector { int _capacity; int _size; void **_data; } *children; } *

user_defined_types: struct XMLToken { enum XMLTokenType type; char *data; }


repo: kimito/libcr

decompiled_code:
char *__fastcall create_context_for(void (*a1)(void))
{
void *v2; // rax
char *ptr; // [rsp+8h] [rbp-20h]

if ( !a1 )
return 0LL;
ptr = (char *)malloc(0x798uLL);
*(_QWORD *)ptr = now_context;
if ( !getcontext((ucontext_t *)(ptr + 976)) )
{
v2 = malloc(0x4000uLL);
*((_QWORD *)ptr + 124) = v2;
if ( v2 )
{
*((_QWORD *)ptr + 126) = 0x4000LL;
*((_QWORD *)ptr + 123) = ptr + 8;
makecontext((ucontext_t *)(ptr + 976), a1, 0);
}
else
{
free(ptr);
}
}
return ptr;
}

canonical_decompiled_code:
char *__fastcall func6(void (*a1)(void))
{
void *v2; // rax
char *ptr; // [rsp+8h] [rbp-20h]

if ( !a1 )
return 0LL;
ptr = (char *)malloc(0x798uLL);
*(_QWORD *)ptr = now_context;
if ( !getcontext((ucontext_t *)(ptr + 976)) )
{
v2 = malloc(0x4000uLL);
*((_QWORD *)ptr + 124) = v2;
if ( v2 )
{
*((_QWORD *)ptr + 126) = 0x4000LL;
*((_QWORD *)ptr + 123) = ptr + 8;
makecontext((ucontext_t *)(ptr + 976), a1, 0);
}
else
{
free(ptr);
}
}
return ptr;
}

original_code:
cr_context* create_context_for( void (*func)(void) )
{
  cr_context *ret = ((void *)0);
  if( func == ((void *)0) ){
    return ((void *)0);
  }
  ret = (cr_context*)malloc( sizeof(cr_context) );
  ret->parent = now_context;
  if( ret != ((void *)0) && getcontext( &(ret->to) ) == 0 ){
    ucontext_t *to = &(ret->to);
    if( (to->uc_stack.ss_sp = malloc( STACK_SIZE )) != ((void *)0) ){
      to->uc_stack.ss_size = STACK_SIZE;
      to->uc_link = &(ret->from);
      makecontext(to, func, 0);
    }
    else{
      free(ret);
    }
  }
  return ret;
}

canonical_original_code:
struct tag_cr_context *create_context_for(void (*func)())
{
  struct tag_cr_context *ret = ((void *)0);
  if( func == ((void *)0) ){
    return ((void *)0);
  }
  ret = (struct tag_cr_context *)malloc( sizeof(cr_context) );
  ret->parent = now_context;
  if( ret != ((void *)0) && getcontext( &(ret->to) ) == 0 ){
    struct ucontext_t *to = &(ret->to);
    if( (to->uc_stack.ss_sp = malloc( STACK_SIZE )) != ((void *)0) ){
      to->uc_stack.ss_size = STACK_SIZE;
      to->uc_link = &(ret->from);
      makecontext(to, func, 0);
    }
    else{
      free(ret);
    }
  }
  return ret;
}

variable_types:
func
void (*)()

variable_types: struct tag_cr_context { struct tag_cr_context *parent; struct ucontext_t { unsigned long uc_flags; struct ucontext_t *uc_link; struct stack_t { void *ss_sp; int ss_flags; unsigned long ss_size; } uc_stack; struct mcontext_t { long long gregs[23]; struct _libc_fpstate { unsigned short cwd; unsigned short swd; unsigned short ftw; unsigned short fop; unsigned long rip; unsigned long rdp; unsigned int mxcsr; unsigned int mxcr_mask; struct _libc_fpxreg { unsigned short significand[4]; unsigned short exponent; unsigned short __glibc_reserved1[3]; } _st[8]; struct _libc_xmmreg { unsigned int element[4]; } _xmm[16]; unsigned int __glibc_reserved1[24]; } *fpregs; unsigned long long __reserved1[8]; } uc_mcontext; struct __sigset_t { unsigned long __val[-1]; } uc_sigmask; struct _libc_fpstate __fpregs_mem; unsigned long long __ssp[4]; } from; struct ucontext_t to; } *

variable_types: struct ucontext_t { unsigned long uc_flags; struct ucontext_t *uc_link; struct stack_t { void *ss_sp; int ss_flags; unsigned long ss_size; } uc_stack; struct mcontext_t { long long gregs[23]; struct _libc_fpstate { unsigned short cwd; unsigned short swd; unsigned short ftw; unsigned short fop; unsigned long rip; unsigned long rdp; unsigned int mxcsr; unsigned int mxcr_mask; struct _libc_fpxreg { unsigned short significand[4]; unsigned short exponent; unsigned short __glibc_reserved1[3]; } _st[8]; struct _libc_xmmreg { unsigned int element[4]; } _xmm[16]; unsigned int __glibc_reserved1[24]; } *fpregs; unsigned long long __reserved1[8]; } uc_mcontext; struct __sigset_t { unsigned long __val[-1]; } uc_sigmask; struct _libc_fpstate __fpregs_mem; unsigned long long __ssp[4]; } *

user_defined_types: struct tag_cr_context { struct tag_cr_context *parent; struct ucontext_t from; struct ucontext_t to; }

user_defined_types: struct ucontext_t { unsigned long uc_flags; struct ucontext_t *uc_link; struct stack_t uc_stack; struct mcontext_t uc_mcontext; struct __sigset_t uc_sigmask; struct _libc_fpstate __fpregs_mem; unsigned long long __ssp[4]; }

user_defined_types: struct mcontext_t { long long gregs[23]; struct _libc_fpstate *fpregs; unsigned long long __reserved1[8]; }

user_defined_types: struct _libc_fpstate { unsigned short cwd; unsigned short swd; unsigned short ftw; unsigned short fop; unsigned long rip; unsigned long rdp; unsigned int mxcsr; unsigned int mxcr_mask; struct _libc_fpxreg _st[8]; struct _libc_xmmreg _xmm[16]; unsigned int __glibc_reserved1[24]; }


decompiled_code:
void __fastcall destroy_context(void *ptr)
{
void *v2; // rdi

if ( ptr )
{
v2 = (void *)*((_QWORD *)ptr + 124);
if ( v2 )
free(v2);
free(ptr);
}
}

canonical_decompiled_code:
void __fastcall func7(void *ptr)
{
void *v2; // rdi

if ( ptr )
{
v2 = (void *)*((_QWORD *)ptr + 124);
if ( v2 )
free(v2);
free(ptr);
}
}

original_code:
void destroy_context( cr_context* context )
{
  if( context ){
    if( context->to.uc_stack.ss_sp ){
      free( context->to.uc_stack.ss_sp );
    }
    free( context );
  }
}

canonical_original_code:
void destroy_context(struct tag_cr_context *context)
{
  if( context ){
    if( context->to.uc_stack.ss_sp ){
      free( context->to.uc_stack.ss_sp );
    }
    free( context );
  }
}

user_defined_types: struct stack_t { void *ss_sp; int ss_flags; unsigned long ss_size; }

user_defined_types: struct __sigset_t { unsigned long __val[-1]; }

user_defined_types: struct _libc_fpxreg { unsigned short significand[4]; unsigned short exponent; unsigned short __glibc_reserved1[3]; }

user_defined_types: struct _libc_xmmreg { unsigned int element[4]; }


resume

decompiled_code:
int __fastcall resume(__int64 a1)
{
now_context = a1;
return swapcontext((ucontext_t *)(a1 + 8), (const ucontext_t *)(a1 + 976));
}

canonical_decompiled_code:
int __fastcall func8(__int64 a1)
{
now_context = a1;
return swapcontext((ucontext_t *)(a1 + 8), (const ucontext_t *)(a1 + 976));
}

original_code:
void resume( cr_context *context )
{
  now_context = context;
  swapcontext( &(context->from), &(context->to) );
}

canonical_original_code:
void resume(struct tag_cr_context *context)
{
  now_context = context;
  swapcontext( &(context->from), &(context->to) );
}


yield

decompiled_code:
int yield()
{
__int64 v0; // rdi
int result; // eax

v0 = now_context;
if ( now_context )
{
now_context = *(_QWORD *)now_context;
result = swapcontext((ucontext_t *)(v0 + 976), (const ucontext_t *)(v0 + 8));
}
return result;
}

canonical_decompiled_code:
int func9()
{
__int64 v0; // rdi
int result; // eax

v0 = now_context;
if ( now_context )
{
now_context = *(_QWORD *)now_context;
result = swapcontext((ucontext_t *)(v0 + 976), (const ucontext_t *)(v0 + 8));
}
return result;
}

original_code:
void yield()
{
  if( now_context ){
    cr_context *tmp = now_context;
    now_context = tmp->parent;
    swapcontext( &(tmp->to), &(tmp->from) );
  }
}

canonical_original_code:
void yield()
{
  if( now_context ){
    struct tag_cr_context *tmp = now_context;
    now_context = tmp->parent;
    swapcontext( &(tmp->to), &(tmp->from) );
  }
}


repo: kimtang/qml

decompiled_code:
void __fastcall r_atan(float *a1)
{
atan(*a1);
}

canonical_decompiled_code:
void __fastcall func0(float *a1)
{
atan(*a1);
}

original_code:
double r_atan(real *x)
{
return( atan(*x) );
}

canonical_original_code:
double r_atan(float *x)
{
return( atan(*x) );
}

variable_types:
x
float *

return_type: double


decompiled_code:
__int64 __fastcall f__fatal(unsigned int a1, const char *a2)
{
const char *v2; // rsi
const char *v3; // r9
const char *v4; // r8
const char *v5; // rcx
const char *v6; // rdx

if ( a1 <= 0x63 )
{
perror(a2);
}
else if ( a1 + 1 > 0x84 )
{
fprintf(stderr, "%s: illegal error number %d\n", a2, a1);
}
else if ( a1 == -1 )
{
fprintf(stderr, "%s: end of file\n", a2);
}
else
{
fprintf(stderr, "%s: %s\n", a2, (&F_err)[a1 - 100]);
}
if ( f__curunit )
{
fprintf(stderr, "apparent state: unit %d ", 0x2E8BA2E8BA2E8BA3LL * ((__int64)(f__curunit - (_QWORD)&f__units) >> 3));
v2 = "named %s\n";
if ( !*(_QWORD *)(f__curunit + 8LL) )
v2 = "(unnamed)\n";
fprintf(stderr, v2);
}
else
{
fwrite("apparent state: internal I/O\n", 1uLL, 0x1DuLL, stderr);
}
if ( f__fmtbuf )
fprintf(stderr, "last format: %s\n", f__fmtbuf);
v3 = "external";
if ( !f__external )
v3 = "internal";
v4 = "formatted";
if ( !f__formatted )
v4 = "unformatted";
v5 = "sequential";
if ( !f__sequential )
v5 = "direct";
v6 = "reading";
if ( !f__reading )
v6 = "writing";
fprintf(stderr, "lately %s %s %s %s", v6, v5, v4, v3);
return sig_die(" IO", 1LL);
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int a1, const char *a2)
{
const char *v2; // rsi
const char *v3; // r9
const char *v4; // r8
const char *v5; // rcx
const char *v6; // rdx

if ( a1 <= 0x63 )
{
perror(a2);
}
else if ( a1 + 1 > 0x84 )
{
fprintf(stderr, "%s: illegal error number %d\n", a2, a1);
}
else if ( a1 == -1 )
{
fprintf(stderr, "%s: end of file\n", a2);
}
else
{
fprintf(stderr, "%s: %s\n", a2, (&F_err)[a1 - 100]);
}
if ( f__curunit )
{
fprintf(stderr, "apparent state: unit %d ", 0x2E8BA2E8BA2E8BA3LL * ((__int64)(f__curunit - (_QWORD)&f__units) >> 3));
v2 = "named %s\n";
if ( !*(_QWORD *)(f__curunit + 8LL) )
v2 = "(unnamed)\n";
fprintf(stderr, v2);
}
else
{
fwrite("apparent state: internal I/O\n", 1uLL, 0x1DuLL, stderr);
}
if ( f__fmtbuf )
fprintf(stderr, "last format: %s\n", f__fmtbuf);
v3 = "external";
if ( !f__external )
v3 = "internal";
v4 = "formatted";
if ( !f__formatted )
v4 = "unformatted";
v5 = "sequential";
if ( !f__sequential )
v5 = "direct";
v6 = "reading";
if ( !f__reading )
v6 = "writing";
fprintf(stderr, "lately %s %s %s %s", v6, v5, v4, v3);
return sig_die(" IO", 1LL);
}

original_code:
void
f__fatal(int n, const char *s)
{
 if(n<100 && n>=0) perror(s);
 else if(n >= (int)(sizeof(F_err)/sizeof(char *)+100) || n < -1)
 { fprintf(stderr,"%s: illegal error number %d\n",s,n);
 }
 else if(n == -1) fprintf(stderr,"%s: end of file\n",s);
 else
  fprintf(stderr,"%s: %s\n",s,F_err[n-100]);
 if (f__curunit) {
  fprintf(stderr,"apparent state: unit %d ",
   (int)(f__curunit-f__units));
  fprintf(stderr, f__curunit->ufnm ? "named %s\n" : "(unnamed)\n",
   f__curunit->ufnm);
  }
 else
  fprintf(stderr,"apparent state: internal I/O\n");
 if (f__fmtbuf)
  fprintf(stderr,"last format: %s\n",f__fmtbuf);
 fprintf(stderr,"lately %s %s %s %s",f__reading?"reading":"writing",
  f__sequential?"sequential":"direct",f__formatted?"formatted":"unformatted",
  f__external?"external":"internal");
 sig_die(" IO", 1);
}

canonical_original_code:
void f__fatal(int n, char *s)
{
 if(n<100 && n>=0) perror(s);
 else if(n >= (int)(sizeof(F_err)/sizeof(char *)+100) || n < -1)
 { fprintf(stderr,"%s: illegal error number %d\n",s,n);
 }
 else if(n == -1) fprintf(stderr,"%s: end of file\n",s);
 else
  fprintf(stderr,"%s: %s\n",s,F_err[n-100]);
 if (f__curunit) {
  fprintf(stderr,"apparent state: unit %d ",
   (int)(f__curunit-f__units));
  fprintf(stderr, f__curunit->ufnm ? "named %s\n" : "(unnamed)\n",
   f__curunit->ufnm);
  }
 else
  fprintf(stderr,"apparent state: internal I/O\n");
 if (f__fmtbuf)
  fprintf(stderr,"last format: %s\n",f__fmtbuf);
 fprintf(stderr,"lately %s %s %s %s",f__reading?"reading":"writing",
  f__sequential?"sequential":"direct",f__formatted?"formatted":"unformatted",
  f__external?"external":"internal");
 sig_die(" IO", 1);
}

variable_types: n int

variable_types:
s
char *


canonical_decompiled_code:
double __fastcall func0(float *a1)
{
return 0.4342944819032518 * log(*a1);
}


decompiled_code:
void __fastcall d_log(double *a1)
{
log(*a1);
}

canonical_decompiled_code:
void __fastcall func0(double *a1)
{
log(*a1);
}

original_code:
double d_log(doublereal *x)
{
return( log(*x) );
}

canonical_original_code:
double d_log(double *x)
{
return( log(*x) );
}

variable_types:
x
double *


original_code:
void z_sqrt(doublecomplex *r, doublecomplex *z)
{
 double mag, zi = z->i, zr = z->r;
 if( (mag = f__cabs(zr, zi)) == 0.)
  r->r = r->i = 0.;
 else if(zr > 0)
  {
  r->r = sqrt(0.5 * (mag + zr) );
  r->i = zi / r->r / 2;
  }
 else
  {
  r->i = sqrt(0.5 * (mag - zr) );
  if(zi < 0)
   r->i = - r->i;
  r->r = zi / r->i / 2;
  }
 }

canonical_original_code:
void z_sqrt(struct doublecomplex *r, struct doublecomplex *z)
{
 double mag; double zi = z->i; double zr = z->r;
 if( (mag = f__cabs(zr, zi)) == 0.)
  r->r = r->i = 0.;
 else if(zr > 0)
  {
  r->r = sqrt(0.5 * (mag + zr) );
  r->i = zi / r->r / 2;
  }
 else
  {
  r->i = sqrt(0.5 * (mag - zr) );
  if(zi < 0)
   r->i = - r->i;
  r->r = zi / r->i / 2;
  }
 }

variable_types:
r
struct doublecomplex { double r; } *

variable_types:
z
struct doublecomplex *

variable_types: mag double

variable_types: zi double

variable_types: zr double


decompiled_code:
void __fastcall c_sin(float *a1, float *a2)
{
float v2; // xmm0_4
float v3; // xmm0_4
double x; // [rsp+8h] [rbp-60h]
double v5; // [rsp+10h] [rbp-58h]
double v6; // [rsp+30h] [rbp-38h]
double v7; // [rsp+50h] [rbp-18h]

v5 = a2[1];
x = *a2;
v7 = sin(x);
v2 = v7 * cosh(v5);
*a1 = v2;
v6 = cos(x);
v3 = v6 * sinh(v5);
a1[1] = v3;
}

canonical_decompiled_code:
void __fastcall func0(float *a1, float *a2)
{
float v2; // xmm0_4
float v3; // xmm0_4
double x; // [rsp+8h] [rbp-60h]
double v5; // [rsp+10h] [rbp-58h]
double v6; // [rsp+30h] [rbp-38h]
double v7; // [rsp+50h] [rbp-18h]

v5 = a2[1];
x = *a2;
v7 = sin(x);
v2 = v7 * cosh(v5);
*a1 = v2;
v6 = cos(x);
v3 = v6 * sinh(v5);
a1[1] = v3;
}

original_code:
void c_sin(complex *r, complex *z)
{
 double zi = z->i, zr = z->r;
 r->r = sin(zr) * cosh(zi);
 r->i = cos(zr) * sinh(zi);
 }

canonical_original_code:
void c_sin(struct complex *r, struct complex *z)
{
 double zi = z->i; double zr = z->r;
 r->r = sin(zr) * cosh(zi);
 r->i = cos(zr) * sinh(zi);
 }

variable_types:
r
struct complex { float r; } *

variable_types:
z
struct complex *


decompiled_code:
double __fastcall r_abs(float *a1)
{
double v2; // [rsp+0h] [rbp-10h]
float v3; // [rsp+Ch] [rbp-4h]

v3 = *a1;
if ( *a1 >= 0.0 )
v2 = v3;
else
v2 = COERCE_FLOAT(LODWORD(v3) ^ LC1);
return v2;
}

canonical_decompiled_code:
double __fastcall func0(float *a1)
{
double v2; // [rsp+0h] [rbp-10h]
float v3; // [rsp+Ch] [rbp-4h]

v3 = *a1;
if ( *a1 >= 0.0 )
v2 = v3;
else
v2 = COERCE_FLOAT(LODWORD(v3) ^ LC1);
return v2;
}

original_code:
double r_abs(real *x)
{
if(*x >= 0)
 return(*x);
return(- *x);
}

canonical_original_code:
double r_abs(float *x)
{
if(*x >= 0)
 return(*x);
return(- *x);
}


original_code:
double r_nint(real *x)
{
return( (*x)>=0 ?
 floor(*x + .5) : -floor(.5 - *x) );
}

canonical_original_code:
double r_nint(float *x)
{
return( (*x)>=0 ?
 floor(*x + .5) : -floor(.5 - *x) );
}


decompiled_code:
__sighandler_t __fastcall signal_(_QWORD *a1, void (*a2)(int))
{
return signal(*a1, a2);
}

canonical_decompiled_code:
__sighandler_t __fastcall func0(_QWORD *a1, void (*a2)(int))
{
return signal(*a1, a2);
}

original_code:
ftnint
signal_(integer *sigp, sig_pf proc)
{
 int sig;
 sig = (int)*sigp;
 return (ftnint)signal(sig, proc);
 }

canonical_original_code:
long signal_(long *sigp, void (*proc)(int))
{
 int sig;
 sig = (int)*sigp;
 return (long)signal(sig, proc);
 }

variable_types:
sigp
long *

variable_types:
proc
void (*)(int)

variable_types: sig int

return_type: long


decompiled_code:
_BOOL8 l_gt()
{
return s_cmp() > 0;
}

canonical_decompiled_code:
_BOOL8 func0()
{
return s_cmp() > 0;
}

original_code:
logical l_gt(char *a, char *b, ftnlen la, ftnlen lb)
{
return(s_cmp(a,b,la,lb) > 0);
}

canonical_original_code:
long l_gt(char *a, char *b, long la, long lb)
{
return(s_cmp(a,b,la,lb) > 0);
}

variable_types:
a
char *

variable_types:
b
char *

variable_types: la long

variable_types: lb long


decompiled_code:
__int64 y_rsk()
{
int v0; // eax

if ( *(_QWORD *)(f__curunit + 64LL) )
return 0LL;
v0 = *(_DWORD *)(f__curunit + 28LL);
if ( v0 <= f__recpos || v0 == 1 )
return 0LL;
do
{
getc((FILE *)f);
++f__recpos;
}
while ( f__recpos < *(_DWORD *)(f__curunit + 28LL) );
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
int v0; // eax

if ( *(_QWORD *)(f__curunit + 64LL) )
return 0LL;
v0 = *(_DWORD *)(f__curunit + 28LL);
if ( v0 <= f__recpos || v0 == 1 )
return 0LL;
do
{
getc((FILE *)f);
++f__recpos;
}
while ( f__recpos < *(_DWORD *)(f__curunit + 28LL) );
return 0LL;
}

original_code:
int
y_rsk(void)
{
 if(f__curunit->uend || f__curunit->url <= f__recpos
  || f__curunit->url == 1) return 0;
 do {
  getc(f__cf);
 } while(++f__recpos < f__curunit->url);
 return 0;
}

canonical_original_code:
int y_rsk()
{
 if(f__curunit->uend || f__curunit->url <= f__recpos
  || f__curunit->url == 1) return 0;
 do {
  getc(f__cf);
 } while(++f__recpos < f__curunit->url);
 return 0;
}


decompiled_code:
__int64 y_getc()
{
unsigned int v0; // ebx
int v1; // eax
int v2; // edx
int *v4; // rax

if ( *(_QWORD *)(f__curunit + 64LL) )
return (unsigned int)-1;
v0 = getc((FILE *)f);
if ( v0 == -1 )
{
if ( feof((FILE *)f) )
{
*(_QWORD *)(f__curunit + 64LL) = 1LL;
*_errno_location() = 0;
}
else
{
if ( !*f__elist )
{
v4 = _errno_location();
f__fatal((unsigned int)*v4, "readingd");
}
v0 = *_errno_location();
}
}
else
{
v1 = ++f__recpos;
v2 = *(_DWORD *)(f__curunit + 28LL);
if ( v2 != 1 && v1 > v2 )
v0 = 32;
}
return v0;
}

canonical_decompiled_code:
__int64 func1()
{
unsigned int v0; // ebx
int v1; // eax
int v2; // edx
int *v4; // rax

if ( *(_QWORD *)(f__curunit + 64LL) )
return (unsigned int)-1;
v0 = getc((FILE *)f);
if ( v0 == -1 )
{
if ( feof((FILE *)f) )
{
*(_QWORD *)(f__curunit + 64LL) = 1LL;
*_errno_location() = 0;
}
else
{
if ( !*f__elist )
{
v4 = _errno_location();
f__fatal((unsigned int)*v4, "readingd");
}
v0 = *_errno_location();
}
}
else
{
v1 = ++f__recpos;
v2 = *(_DWORD *)(f__curunit + 28LL);
if ( v2 != 1 && v1 > v2 )
v0 = 32;
}
return v0;
}

original_code:
int
y_getc(void)
{
 int ch;
 if(f__curunit->uend) return(-1);
 if((ch=getc(f__cf))!=(-1))
 {
  f__recpos++;
  if(f__curunit->url>=f__recpos ||
   f__curunit->url==1)
   return(ch);
  else return(' ');
 }
 if(feof(f__cf))
 {
  f__curunit->uend=1;
  (*__errno_location ())=0;
  return(-1);
 }
 {if(f__elist->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"readingd"); return((*__errno_location ()));};
}

canonical_original_code:
int y_getc()
{
 int ch;
 if(f__curunit->uend) return(-1);
 if((ch=getc(f__cf))!=(-1))
 {
  f__recpos++;
  if(f__curunit->url>=f__recpos ||
   f__curunit->url==1)
   return(ch);
  else return(' ');
 }
 if(feof(f__cf))
 {
  f__curunit->uend=1;
  (*__errno_location ())=0;
  return(-1);
 }
 {if(f__elist->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"readingd"); return((*__errno_location ()));};
}

variable_types: ch int


decompiled_code:
__int64 __fastcall c_dfe(_QWORD *a1)
{
unsigned __int64 v2; // rdx
FILE *v3; // rdi
__int64 v4; // rsi
__int64 result; // rax

f__sequential = 0LL;
f__external = 1LL;
f__formatted = 1LL;
f__elist = a1;
f__recpos = 0;
f__scale = 0;
f__cursor = 0LL;
v2 = a1[1];
f__curunit = &f__units[11 * v2];
if ( v2 > 0x64 )
{
if ( *a1 )
*_errno_location() = 101;
else
f__fatal(101LL, "startchk");
result = 101LL;
}
else if ( f__units[11 * v2] || !(unsigned int)fk_open(4LL, 5LL) )
{
v3 = (FILE *)*f__curunit;
f = (_QWORD (__fastcall *)(char, float))*f__curunit;
if ( f__curunit[5] )
{
if ( f__curunit[4] )
{
f__fmtbuf = a1[3];
v4 = a1[4];
if ( v4 <= 0 )
{
if ( *a1 )
*_errno_location() = 130;
else
f__fatal(130LL, "dfe");
result = 130LL;
}
else
{
fseeko64(v3, *((int *)f__curunit + 7) * (v4 - 1), 0);
f__curunit[8] = 0LL;
result = 0LL;
}
}
else
{
if ( *a1 )
*_errno_location() = 104;
else
f__fatal(104LL, "dfe");
result = 104LL;
}
}
else
{
if ( *a1 )
*_errno_location() = 102;
else
f__fatal(102LL, "dfe");
result = 102LL;
}
}
else
{
if ( *a1 )
*_errno_location() = 104;
else
f__fatal(104LL, "dfe");
result = 104LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(_QWORD *a1)
{
unsigned __int64 v2; // rdx
FILE *v3; // rdi
__int64 v4; // rsi
__int64 result; // rax

f__sequential = 0LL;
f__external = 1LL;
f__formatted = 1LL;
f__elist = a1;
f__recpos = 0;
f__scale = 0;
f__cursor = 0LL;
v2 = a1[1];
f__curunit = &f__units[11 * v2];
if ( v2 > 0x64 )
{
if ( *a1 )
*_errno_location() = 101;
else
f__fatal(101LL, "startchk");
result = 101LL;
}
else if ( f__units[11 * v2] || !(unsigned int)fk_open(4LL, 5LL) )
{
v3 = (FILE *)*f__curunit;
f = (_QWORD (__fastcall *)(char, float))*f__curunit;
if ( f__curunit[5] )
{
if ( f__curunit[4] )
{
f__fmtbuf = a1[3];
v4 = a1[4];
if ( v4 <= 0 )
{
if ( *a1 )
*_errno_location() = 130;
else
f__fatal(130LL, "dfe");
result = 130LL;
}
else
{
fseeko64(v3, *((int *)f__curunit + 7) * (v4 - 1), 0);
f__curunit[8] = 0LL;
result = 0LL;
}
}
else
{
if ( *a1 )
*_errno_location() = 104;
else
f__fatal(104LL, "dfe");
result = 104LL;
}
}
else
{
if ( *a1 )
*_errno_location() = 102;
else
f__fatal(102LL, "dfe");
result = 102LL;
}
}
else
{
if ( *a1 )
*_errno_location() = 104;
else
f__fatal(104LL, "dfe");
result = 104LL;
}
return result;
}

original_code:
int
c_dfe(cilist *a)
{
 f__sequential=0;
 f__formatted=f__external=1;
 f__elist=a;
 f__cursor=f__scale=f__recpos=0;
 f__curunit = &f__units[a->ciunit];
 if(a->ciunit>100 || a->ciunit<0)
  {if(a->cierr) (*__errno_location ())= 101; else f__fatal(101,"startchk"); return(101);};
 if(f__curunit->ufd==((void *)0) && fk_open(4,5,a->ciunit))
  {if(a->cierr) (*__errno_location ())= 104; else f__fatal(104,"dfe"); return(104);};
 f__cf=f__curunit->ufd;
 if(!f__curunit->ufmt) {if(a->cierr) (*__errno_location ())= 102; else f__fatal(102,"dfe"); return(102);}
 if(!f__curunit->useek) {if(a->cierr) (*__errno_location ())= 104; else f__fatal(104,"dfe"); return(104);}
 f__fmtbuf=a->cifmt;
 if(a->cirec <= 0)
  {if(a->cierr) (*__errno_location ())= 130; else f__fatal(130,"dfe"); return(130);}
 fseeko64(f__cf,(__off64_t)f__curunit->url * (a->cirec-1),0);
 f__curunit->uend = 0;
 return(0);
}

canonical_original_code:
int c_dfe(struct cilist *a)
{
 f__sequential=0;
 f__formatted=f__external=1;
 f__elist=a;
 f__cursor=f__scale=f__recpos=0;
 f__curunit = &f__units[a->ciunit];
 if(a->ciunit>100 || a->ciunit<0)
  {if(a->cierr) (*__errno_location ())= 101; else f__fatal(101,"startchk"); return(101);};
 if(f__curunit->ufd==((void *)0) && fk_open(4,5,a->ciunit))
  {if(a->cierr) (*__errno_location ())= 104; else f__fatal(104,"dfe"); return(104);};
 f__cf=f__curunit->ufd;
 if(!f__curunit->ufmt) {if(a->cierr) (*__errno_location ())= 102; else f__fatal(102,"dfe"); return(102);}
 if(!f__curunit->useek) {if(a->cierr) (*__errno_location ())= 104; else f__fatal(104,"dfe"); return(104);}
 f__fmtbuf=a->cifmt;
 if(a->cirec <= 0)
  {if(a->cierr) (*__errno_location ())= 130; else f__fatal(130,"dfe"); return(130);}
 fseeko64(f__cf,(long)f__curunit->url * (a->cirec-1),0);
 f__curunit->uend = 0;
 return(0);
}

variable_types: struct cilist { long cierr; long ciunit; long ciend; char *cifmt; long cirec; } *


decompiled_code:
__int64 __fastcall s_rdfe(_QWORD *a1)
{
__int64 result; // rax
int *v2; // rax

if ( !f__init )
f_init();
f__reading = 1LL;
LODWORD(result) = c_dfe(a1);
if ( (_DWORD)result )
return (int)result;
if ( f__curunit[9] && (unsigned int)f__nowreading() )
{
if ( !*a1 )
{
v2 = _errno_location();
f__fatal((unsigned int)*v2, "read start");
}
result = *_errno_location();
}
else
{
f__getn = y_getc;
f__doed = &rd_ed;
f__doned = &rd_ned;
f__donewrec = sub_11F;
f__dorevert = sub_11F;
f__doend = y_rsk;
if ( (int)pars_f(f__fmtbuf) < 0 )
{
if ( *a1 )
*_errno_location() = 100;
else
f__fatal(100LL, "read start");
result = 100LL;
}
else
{
fmt_bg();
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(_QWORD *a1)
{
__int64 result; // rax
int *v2; // rax

if ( !f__init )
f_init();
f__reading = 1LL;
LODWORD(result) = func5(a1);
if ( (_DWORD)result )
return (int)result;
if ( f__curunit[9] && (unsigned int)f__nowreading() )
{
if ( !*a1 )
{
v2 = _errno_location();
f__fatal((unsigned int)*v2, "read start");
}
result = *_errno_location();
}
else
{
f__getn = y_getc;
f__doed = &rd_ed;
f__doned = &rd_ned;
f__donewrec = sub_11F;
f__dorevert = sub_11F;
f__doend = y_rsk;
if ( (int)pars_f(f__fmtbuf) < 0 )
{
if ( *a1 )
*_errno_location() = 100;
else
f__fatal(100LL, "read start");
result = 100LL;
}
else
{
fmt_bg();
result = 0LL;
}
}
return result;
}

original_code:
integer s_rdfe(cilist *a)
{
 int n;
 if(!f__init) f_init();
 f__reading=1;
 if(n=c_dfe(a))return(n);
 if(f__curunit->uwrt && f__nowreading(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"read start"); return((*__errno_location ()));};
 f__getn = y_getc;
 f__doed = rd_ed;
 f__doned = rd_ned;
 f__dorevert = f__donewrec = y_err;
 f__doend = y_rsk;
 if(pars_f(f__fmtbuf)<0)
  {if(a->cierr) (*__errno_location ())= 100; else f__fatal(100,"read start"); return(100);};
 fmt_bg();
 return(0);
}

canonical_original_code:
long s_rdfe(struct cilist *a)
{
 int n;
 if(!f__init) f_init();
 f__reading=1;
 if(n=c_dfe(a))return(n);
 if(f__curunit->uwrt && f__nowreading(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"read start"); return((*__errno_location ()));};
 f__getn = y_getc;
 f__doed = rd_ed;
 f__doned = rd_ned;
 f__dorevert = f__donewrec = y_err;
 f__doend = y_rsk;
 if(pars_f(f__fmtbuf)<0)
  {if(a->cierr) (*__errno_location ())= 100; else f__fatal(100,"read start"); return(100);};
 fmt_bg();
 return(0);
}

variable_types: n int

user_defined_types: struct cilist { long cierr; long ciunit; long ciend; char *cifmt; long cirec; }


decompiled_code:
__int64 __fastcall s_wdfe(_QWORD *a1)
{
__int64 result; // rax
int *v2; // rax

if ( !f__init )
f_init();
f__reading = 0LL;
LODWORD(result) = c_dfe(a1);
if ( (_DWORD)result )
return (int)result;
if ( f__curunit[9] != 1LL && (unsigned int)f__nowwriting() )
{
if ( !*a1 )
{
v2 = _errno_location();
f__fatal((unsigned int)*v2, "startwrt");
}
result = *_errno_location();
}
else
{
f__putn = (__int64 (__fastcall *)(_QWORD))&x_putc;
f__doed = &w_ed;
f__doned = &w_ned;
f__dorevert = sub_11F;
f__donewrec = sub_1ED;
f__doend = sub_15B;
if ( (int)pars_f(f__fmtbuf) < 0 )
{
if ( *a1 )
*_errno_location() = 100;
else
f__fatal(100LL, "startwrt");
result = 100LL;
}
else
{
fmt_bg();
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(_QWORD *a1)
{
__int64 result; // rax
int *v2; // rax

if ( !f__init )
f_init();
f__reading = 0LL;
LODWORD(result) = func5(a1);
if ( (_DWORD)result )
return (int)result;
if ( f__curunit[9] != 1LL && (unsigned int)f__nowwriting() )
{
if ( !*a1 )
{
v2 = _errno_location();
f__fatal((unsigned int)*v2, "startwrt");
}
result = *_errno_location();
}
else
{
f__putn = (__int64 (__fastcall *)(_QWORD))&x_putc;
f__doed = &w_ed;
f__doned = &w_ned;
f__dorevert = sub_11F;
f__donewrec = sub_1ED;
f__doend = sub_15B;
if ( (int)pars_f(f__fmtbuf) < 0 )
{
if ( *a1 )
*_errno_location() = 100;
else
f__fatal(100LL, "startwrt");
result = 100LL;
}
else
{
fmt_bg();
result = 0LL;
}
}
return result;
}

original_code:
integer s_wdfe(cilist *a)
{
 int n;
 if(!f__init) f_init();
 f__reading=0;
 if(n=c_dfe(a)) return(n);
 if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"startwrt"); return((*__errno_location ()));};
 f__putn = x_putc;
 f__doed = w_ed;
 f__doned= w_ned;
 f__dorevert = y_err;
 f__donewrec = y_newrec;
 f__doend = y_rev;
 if(pars_f(f__fmtbuf)<0)
  {if(a->cierr) (*__errno_location ())= 100; else f__fatal(100,"startwrt"); return(100);};
 fmt_bg();
 return(0);
}

canonical_original_code:
long s_wdfe(struct cilist *a)
{
 int n;
 if(!f__init) f_init();
 f__reading=0;
 if(n=c_dfe(a)) return(n);
 if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"startwrt"); return((*__errno_location ()));};
 f__putn = x_putc;
 f__doed = w_ed;
 f__doned= w_ned;
 f__dorevert = y_err;
 f__donewrec = y_newrec;
 f__doend = y_rev;
 if(pars_f(f__fmtbuf)<0)
  {if(a->cierr) (*__errno_location ())= 100; else f__fatal(100,"startwrt"); return(100);};
 fmt_bg();
 return(0);
}


decompiled_code:
__int64 e_rdfe()
{
en_fio();
return 0LL;
}

canonical_decompiled_code:
__int64 func8()
{
en_fio();
return 0LL;
}

original_code:
integer e_rdfe(void)
{
 en_fio();
 return 0;
}

canonical_original_code:
long e_rdfe()
{
 en_fio();
 return 0;
}


decompiled_code:
__int64 e_wdfe()
{
return (int)en_fio();
}

canonical_decompiled_code:
__int64 func9()
{
return (int)en_fio();
}

original_code:
integer e_wdfe(void)
{
 return en_fio();
}

canonical_original_code:
long e_wdfe()
{
 return en_fio();
}


decompiled_code:
__int64 __fastcall h_nint(float *a1)
{
double v1; // xmm3_8
__m128d v2; // xmm3
__int64 result; // rax
unsigned __int64 v4; // xmm3_8
__m128d v5; // xmm3
double v6; // [rsp+10h] [rbp-30h]
double v7; // [rsp+28h] [rbp-18h]
float v8; // [rsp+3Ch] [rbp-4h]

v8 = *a1;
if ( *a1 < 0.0 )
{
v6 = 0.5 - v8;
*(double *)&v4 = v6;
if ( COERCE_DOUBLE(*(_QWORD *)&v6 & LC3) < 4.503599627370496e15 )
{
v5.m128d_f64[0] = (double)(int)v6;
v4 = COERCE_UNSIGNED_INT64(v5.m128d_f64[0] - COERCE_DOUBLE(*(_OWORD *)&_mm_cmpgt_sd(
v5,
(__m128d)*(unsigned __int64 *)&v6) & LC4)) | ~LC3 & *(_QWORD *)&v6;
}
result = (unsigned int)(int)COERCE_DOUBLE(v4 ^ LC5);
}
else
{
v7 = v8 + 0.5;
v1 = v7;
if ( COERCE_DOUBLE(*(_QWORD *)&v7 & LC3) < 4.503599627370496e15 )
{
v2.m128d_f64[0] = (double)(int)v7;
*(_QWORD *)&v1 = COERCE_UNSIGNED_INT64(
v2.m128d_f64[0]
- COERCE_DOUBLE(*(_OWORD *)&_mm_cmpgt_sd(v2, (__m128d)*(unsigned __int64 *)&v7) & LC4)) | ~LC3 & *(_QWORD *)&v7;
}
result = (unsigned int)(int)v1;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(float *a1)
{
double v1; // xmm3_8
__m128d v2; // xmm3
__int64 result; // rax
unsigned __int64 v4; // xmm3_8
__m128d v5; // xmm3
double v6; // [rsp+10h] [rbp-30h]
double v7; // [rsp+28h] [rbp-18h]
float v8; // [rsp+3Ch] [rbp-4h]

v8 = *a1;
if ( *a1 < 0.0 )
{
v6 = 0.5 - v8;
*(double *)&v4 = v6;
if ( COERCE_DOUBLE(*(_QWORD *)&v6 & LC3) < 4.503599627370496e15 )
{
v5.m128d_f64[0] = (double)(int)v6;
v4 = COERCE_UNSIGNED_INT64(v5.m128d_f64[0] - COERCE_DOUBLE(*(_OWORD *)&_mm_cmpgt_sd(
v5,
(__m128d)*(unsigned __int64 *)&v6) & LC4)) | ~LC3 & *(_QWORD *)&v6;
}
result = (unsigned int)(int)COERCE_DOUBLE(v4 ^ LC5);
}
else
{
v7 = v8 + 0.5;
v1 = v7;
if ( COERCE_DOUBLE(*(_QWORD *)&v7 & LC3) < 4.503599627370496e15 )
{
v2.m128d_f64[0] = (double)(int)v7;
*(_QWORD *)&v1 = COERCE_UNSIGNED_INT64(
v2.m128d_f64[0]
- COERCE_DOUBLE(*(_OWORD *)&_mm_cmpgt_sd(v2, (__m128d)*(unsigned __int64 *)&v7) & LC4)) | ~LC3 & *(_QWORD *)&v7;
}
result = (unsigned int)(int)v1;
}
return result;
}

original_code:
shortint h_nint(real *x)
{
return (shortint)(*x >= 0 ? floor(*x + .5) : -floor(.5 - *x));
}

canonical_original_code:
short h_nint(float *x)
{
return (shortint)(*x >= 0 ? floor(*x + .5) : -floor(.5 - *x));
}

variable_types:
x
float *

return_type: short


decompiled_code:
void __fastcall d_acos(double *a1)
{
acos(*a1);
}

canonical_decompiled_code:
void __fastcall func0(double *a1)
{
acos(*a1);
}

original_code:
double d_acos(doublereal *x)
{
return( acos(*x) );
}

canonical_original_code:
double d_acos(double *x)
{
return( acos(*x) );
}

variable_types:
x
double *


decompiled_code:
__int64 __fastcall c_due(_QWORD *a1)
{
unsigned __int64 v2; // rdx
FILE *v3; // rdi
__int64 v4; // rsi
__int64 result; // rax

if ( !f__init )
f_init();
f__recpos = 0;
f__formatted = 0LL;
f__sequential = 0LL;
f__external = 1LL;
v2 = a1[1];
f__curunit = &f__units[11 * v2];
if ( v2 > 0x63 )
{
if ( *a1 )
*_errno_location() = 101;
else
f__fatal(101LL, "startio");
result = 101LL;
}
else
{
f__elist = a1;
if ( f__units[11 * v2] || !(unsigned int)fk_open(4LL, 6LL) )
{
v3 = (FILE *)*f__curunit;
f = (_QWORD (__fastcall *)(char, float))*f__curunit;
if ( f__curunit[5] )
{
if ( *a1 )
*_errno_location() = 102;
else
f__fatal(102LL, "cdue");
result = 102LL;
}
else if ( f__curunit[4] )
{
if ( v3 )
{
v4 = a1[4];
if ( v4 <= 0 )
{
if ( *a1 )
*_errno_location() = 130;
else
f__fatal(130LL, "due");
result = 130LL;
}
else
{
fseeko64(v3, *((int *)f__curunit + 7) * (v4 - 1), 0);
f__curunit[8] = 0LL;
result = 0LL;
}
}
else
{
if ( *a1 )
*_errno_location() = 114;
else
f__fatal(114LL, "cdue");
result = 114LL;
}
}
else
{
if ( *a1 )
*_errno_location() = 104;
else
f__fatal(104LL, "cdue");
result = 104LL;
}
}
else
{
if ( *a1 )
*_errno_location() = 104;
else
f__fatal(104LL, "due");
result = 104LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(_QWORD *a1)
{
unsigned __int64 v2; // rdx
FILE *v3; // rdi
__int64 v4; // rsi
__int64 result; // rax

if ( !f__init )
f_init();
f__recpos = 0;
f__formatted = 0LL;
f__sequential = 0LL;
f__external = 1LL;
v2 = a1[1];
f__curunit = &f__units[11 * v2];
if ( v2 > 0x63 )
{
if ( *a1 )
*_errno_location() = 101;
else
f__fatal(101LL, "startio");
result = 101LL;
}
else
{
f__elist = a1;
if ( f__units[11 * v2] || !(unsigned int)fk_open(4LL, 6LL) )
{
v3 = (FILE *)*f__curunit;
f = (_QWORD (__fastcall *)(char, float))*f__curunit;
if ( f__curunit[5] )
{
if ( *a1 )
*_errno_location() = 102;
else
f__fatal(102LL, "cdue");
result = 102LL;
}
else if ( f__curunit[4] )
{
if ( v3 )
{
v4 = a1[4];
if ( v4 <= 0 )
{
if ( *a1 )
*_errno_location() = 130;
else
f__fatal(130LL, "due");
result = 130LL;
}
else
{
fseeko64(v3, *((int *)f__curunit + 7) * (v4 - 1), 0);
f__curunit[8] = 0LL;
result = 0LL;
}
}
else
{
if ( *a1 )
*_errno_location() = 114;
else
f__fatal(114LL, "cdue");
result = 114LL;
}
}
else
{
if ( *a1 )
*_errno_location() = 104;
else
f__fatal(104LL, "cdue");
result = 104LL;
}
}
else
{
if ( *a1 )
*_errno_location() = 104;
else
f__fatal(104LL, "due");
result = 104LL;
}
}
return result;
}

original_code:
int
c_due(cilist *a)
{
 if(!f__init) f_init();
 f__sequential=f__formatted=f__recpos=0;
 f__external=1;
 f__curunit = &f__units[a->ciunit];
 if(a->ciunit>=100 || a->ciunit<0)
  {if(a->cierr) (*__errno_location ())= 101; else f__fatal(101,"startio"); return(101);};
 f__elist=a;
 if(f__curunit->ufd==((void *)0) && fk_open(4,6,a->ciunit) ) {if(a->cierr) (*__errno_location ())= 104; else f__fatal(104,"due"); return(104);};
 f__cf=f__curunit->ufd;
 if(f__curunit->ufmt) {if(a->cierr) (*__errno_location ())= 102; else f__fatal(102,"cdue"); return(102);}
 if(!f__curunit->useek) {if(a->cierr) (*__errno_location ())= 104; else f__fatal(104,"cdue"); return(104);}
 if(f__curunit->ufd==((void *)0)) {if(a->cierr) (*__errno_location ())= 114; else f__fatal(114,"cdue"); return(114);}
 if(a->cirec <= 0)
  {if(a->cierr) (*__errno_location ())= 130; else f__fatal(130,"due"); return(130);}
 fseeko64(f__cf,(__off64_t)(a->cirec-1)*f__curunit->url,0);
 f__curunit->uend = 0;
 return(0);
}

canonical_original_code:
int c_due(struct cilist *a)
{
 if(!f__init) f_init();
 f__sequential=f__formatted=f__recpos=0;
 f__external=1;
 f__curunit = &f__units[a->ciunit];
 if(a->ciunit>=100 || a->ciunit<0)
  {if(a->cierr) (*__errno_location ())= 101; else f__fatal(101,"startio"); return(101);};
 f__elist=a;
 if(f__curunit->ufd==((void *)0) && fk_open(4,6,a->ciunit) ) {if(a->cierr) (*__errno_location ())= 104; else f__fatal(104,"due"); return(104);};
 f__cf=f__curunit->ufd;
 if(f__curunit->ufmt) {if(a->cierr) (*__errno_location ())= 102; else f__fatal(102,"cdue"); return(102);}
 if(!f__curunit->useek) {if(a->cierr) (*__errno_location ())= 104; else f__fatal(104,"cdue"); return(104);}
 if(f__curunit->ufd==((void *)0)) {if(a->cierr) (*__errno_location ())= 114; else f__fatal(114,"cdue"); return(114);}
 if(a->cirec <= 0)
  {if(a->cierr) (*__errno_location ())= 130; else f__fatal(130,"due"); return(130);}
 fseeko64(f__cf,(__off64_t)(a->cirec-1)*f__curunit->url,0);
 f__curunit->uend = 0;
 return(0);
}


decompiled_code:
__int64 __fastcall s_rdue(_QWORD *a1)
{
__int64 result; // rax
int v2; // edx
int *v3; // rax

f__reading = 1LL;
LODWORD(result) = c_due(a1);
if ( (_DWORD)result )
return (int)result;
result = f__curunit[9];
if ( result )
{
v2 = f__nowreading();
result = 0LL;
if ( v2 )
{
if ( !*a1 )
{
v3 = _errno_location();
f__fatal((unsigned int)*v3, "read start");
}
result = *_errno_location();
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(_QWORD *a1)
{
__int64 result; // rax
int v2; // edx
int *v3; // rax

f__reading = 1LL;
LODWORD(result) = func0(a1);
if ( (_DWORD)result )
return (int)result;
result = f__curunit[9];
if ( result )
{
v2 = f__nowreading();
result = 0LL;
if ( v2 )
{
if ( !*a1 )
{
v3 = _errno_location();
f__fatal((unsigned int)*v3, "read start");
}
result = *_errno_location();
}
}
return result;
}

original_code:
integer s_rdue(cilist *a)
{
 int n;
 f__reading=1;
 if(n=c_due(a)) return(n);
 if(f__curunit->uwrt && f__nowreading(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"read start"); return((*__errno_location ()));};
 return(0);
}

canonical_original_code:
long s_rdue(struct cilist *a)
{
 int n;
 f__reading=1;
 if(n=c_due(a)) return(n);
 if(f__curunit->uwrt && f__nowreading(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"read start"); return((*__errno_location ()));};
 return(0);
}


decompiled_code:
__int64 __fastcall s_wdue(_QWORD *a1)
{
__int64 result; // rax
int v2; // edx
int *v3; // rax

f__reading = 0LL;
LODWORD(result) = c_due(a1);
if ( (_DWORD)result )
return (int)result;
result = 0LL;
if ( f__curunit[9] != 1LL )
{
v2 = f__nowwriting();
result = 0LL;
if ( v2 )
{
if ( !*a1 )
{
v3 = _errno_location();
f__fatal((unsigned int)*v3, "write start");
}
result = *_errno_location();
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(_QWORD *a1)
{
__int64 result; // rax
int v2; // edx
int *v3; // rax

f__reading = 0LL;
LODWORD(result) = func0(a1);
if ( (_DWORD)result )
return (int)result;
result = 0LL;
if ( f__curunit[9] != 1LL )
{
v2 = f__nowwriting();
result = 0LL;
if ( v2 )
{
if ( !*a1 )
{
v3 = _errno_location();
f__fatal((unsigned int)*v3, "write start");
}
result = *_errno_location();
}
}
return result;
}

original_code:
integer s_wdue(cilist *a)
{
 int n;
 f__reading=0;
 if(n=c_due(a)) return(n);
 if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"write start"); return((*__errno_location ()));};
 return(0);
}

canonical_original_code:
long s_wdue(struct cilist *a)
{
 int n;
 f__reading=0;
 if(n=c_due(a)) return(n);
 if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"write start"); return((*__errno_location ()));};
 return(0);
}


decompiled_code:
__off64_t e_rdue()
{
int v0; // esi
__off64_t result; // rax

v0 = *((_DWORD *)f__curunit + 7);
result = 0LL;
if ( v0 != 1 )
{
result = 0LL;
if ( v0 != f__recpos )
{
fseeko64((FILE *)f, v0 - f__recpos, 1);
result = ftello64((FILE *)f) % *((int *)f__curunit + 7);
if ( result )
{
if ( *f__elist )
*_errno_location() = 200;
else
f__fatal(200LL, "syserr");
result = 200LL;
}
}
}
return result;
}

canonical_decompiled_code:
__off64_t func3()
{
int v0; // esi
__off64_t result; // rax

v0 = *((_DWORD *)f__curunit + 7);
result = 0LL;
if ( v0 != 1 )
{
result = 0LL;
if ( v0 != f__recpos )
{
fseeko64((FILE *)f, v0 - f__recpos, 1);
result = ftello64((FILE *)f) % *((int *)f__curunit + 7);
if ( result )
{
if ( *f__elist )
*_errno_location() = 200;
else
f__fatal(200LL, "syserr");
result = 200LL;
}
}
}
return result;
}

original_code:
integer e_rdue(void)
{
 if(f__curunit->url==1 || f__recpos==f__curunit->url)
  return(0);
 fseeko64(f__cf,(__off64_t)(f__curunit->url-f__recpos),1);
 if(ftello64(f__cf)%f__curunit->url)
  {if(f__elist->cierr) (*__errno_location ())= 200; else f__fatal(200,"syserr"); return(200);};
 return(0);
}

canonical_original_code:
long e_rdue()
{
 if(f__curunit->url==1 || f__recpos==f__curunit->url)
  return(0);
 fseeko64(f__cf,(__off64_t)(f__curunit->url-f__recpos),1);
 if(ftello64(f__cf)%f__curunit->url)
  {if(f__elist->cierr) (*__errno_location ())= 200; else f__fatal(200,"syserr"); return(200);};
 return(0);
}


decompiled_code:
__off64_t e_wdue()
{
return e_rdue();
}

canonical_decompiled_code:
__off64_t func4()
{
return func3();
}

original_code:
integer e_wdue(void)
{
 return(e_rdue());
}

canonical_original_code:
long e_wdue()
{
 return(e_rdue());
}


original_code:
integer i_indx(char *a, char *b, ftnlen la, ftnlen lb)
{
ftnlen i, n;
char *s, *t, *bend;
n = la - lb + 1;
bend = b + lb;
for(i = 0 ; i < n ; ++i)
 {
 s = a + i;
 t = b;
 while(t < bend)
  if(*s++ != *t++)
   goto no;
 return(i+1);
 no: ;
 }
return(0);
}

canonical_original_code:
long i_indx(char *a, char *b, long la, long lb)
{
long i; long n;
char *s; char *t; char *bend;
n = la - lb + 1;
bend = b + lb;
for(i = 0 ; i < n ; ++i)
 {
 s = a + i;
 t = b;
 while(t < bend)
  if(*s++ != *t++)
   goto no;
 return(i+1);
 no: ;
 }
return(0);
}

variable_types: i long

variable_types: n long

variable_types:
s
char *

variable_types:
t
char *

variable_types:
bend
char *


decompiled_code:
__int64 __fastcall i_len(__int64 a1, __int64 a2)
{
return a2;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
return a2;
}

original_code:
integer i_len(char *s, ftnlen n)
{
return(n);
}

canonical_original_code:
long i_len(char *s, long n)
{
return(n);
}


decompiled_code:
__int64 z_rnew()
{
++f__icnum;
f__icptr = *(_QWORD *)(f + 8LL) + *(_QWORD *)(f + 32LL) * f__icnum;
f__recpos = 0;
f__cursor = 0LL;
f__hiwater = 0LL;
return 1LL;
}

canonical_decompiled_code:
__int64 func0()
{
++f__icnum;
f__icptr = *(_QWORD *)(f + 8LL) + *(_QWORD *)(f + 32LL) * f__icnum;
f__recpos = 0;
f__cursor = 0LL;
f__hiwater = 0LL;
return 1LL;
}

original_code:
int
z_rnew(void)
{
 f__icptr = f__svic->iciunit + (++f__icnum)*f__svic->icirlen;
 f__recpos = 0;
 f__cursor = 0;
 f__hiwater = 0;
 return 1;
}

canonical_original_code:
int z_rnew()
{
 f__icptr = f__svic->iciunit + (++f__icnum)*f__svic->icirlen;
 f__recpos = 0;
 f__cursor = 0;
 f__hiwater = 0;
 return 1;
}


decompiled_code:
__int64 iw_rev()
{
if ( f__workdone )
sub_A5();
f__cursor = 0LL;
f__recpos = 0;
f__hiwater = 0LL;
f__workdone = 0LL;
return 0LL;
}

canonical_decompiled_code:
__int64 func2()
{
if ( f__workdone )
func1();
f__cursor = 0LL;
f__recpos = 0;
f__hiwater = 0LL;
f__workdone = 0LL;
return 0LL;
}

original_code:
int
iw_rev(void)
{
 if(f__workdone)
  z_endp();
 f__hiwater = f__recpos = f__cursor = 0;
 return(f__workdone=0);
 }

canonical_original_code:
int iw_rev()
{
 if(f__workdone)
  z_endp();
 f__hiwater = f__recpos = f__cursor = 0;
 return(f__workdone=0);
 }


decompiled_code:
__int64 z_wnew()
{
int v0; // eax
_BYTE *v1; // rax

if ( f__recpos < f__hiwater )
{
f__icptr += f__hiwater - f__recpos;
f__recpos = f__hiwater;
}
v0 = f__recpos++;
if ( v0 < *(_QWORD *)(f + 32LL) )
{
do
{
v1 = (_BYTE *)f__icptr++;
*v1 = 32;
LODWORD(v1) = f__recpos++;
}
while ( (int)v1 < *(_QWORD *)(f + 32LL) );
}
f__recpos = 0;
f__cursor = 0LL;
f__hiwater = 0LL;
++f__icnum;
return 1LL;
}

canonical_decompiled_code:
__int64 func3()
{
int v0; // eax
_BYTE *v1; // rax

if ( f__recpos < f__hiwater )
{
f__icptr += f__hiwater - f__recpos;
f__recpos = f__hiwater;
}
v0 = f__recpos++;
if ( v0 < *(_QWORD *)(f + 32LL) )
{
do
{
v1 = (_BYTE *)f__icptr++;
*v1 = 32;
LODWORD(v1) = f__recpos++;
}
while ( (int)v1 < *(_QWORD *)(f + 32LL) );
}
f__recpos = 0;
f__cursor = 0LL;
f__hiwater = 0LL;
++f__icnum;
return 1LL;
}

original_code:
int
z_wnew(void)
{
 if (f__recpos < f__hiwater) {
  f__icptr += f__hiwater - f__recpos;
  f__recpos = f__hiwater;
  }
 while(f__recpos++ < f__svic->icirlen)
  *f__icptr++ = ' ';
 f__recpos = 0;
 f__cursor = 0;
 f__hiwater = 0;
 f__icnum++;
 return 1;
}

canonical_original_code:
int z_wnew()
{
 if (f__recpos < f__hiwater) {
  f__icptr += f__hiwater - f__recpos;
  f__recpos = f__hiwater;
  }
 while(f__recpos++ < f__svic->icirlen)
  *f__icptr++ = ' ';
 f__recpos = 0;
 f__cursor = 0;
 f__hiwater = 0;
 f__icnum++;
 return 1;
}


decompiled_code:
__int64 z_getc()
{
int v0; // eax
unsigned int v1; // edx
unsigned __int8 *v2; // rax

v0 = f__recpos++;
v1 = 10;
if ( v0 >= *(_QWORD *)(f + 32LL) )
return v1;
v2 = (unsigned __int8 *)f__icptr;
if ( f__icptr < f__icend )
{
++f__icptr;
return *v2;
}
if ( *(_QWORD *)(f + 16LL) )
*_errno_location() = -1;
else
f__fatal(0xFFFFFFFFLL, "endfile");
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 func4()
{
int v0; // eax
unsigned int v1; // edx
unsigned __int8 *v2; // rax

v0 = f__recpos++;
v1 = 10;
if ( v0 >= *(_QWORD *)(f + 32LL) )
return v1;
v2 = (unsigned __int8 *)f__icptr;
if ( f__icptr < f__icend )
{
++f__icptr;
return *v2;
}
if ( *(_QWORD *)(f + 16LL) )
*_errno_location() = -1;
else
f__fatal(0xFFFFFFFFLL, "endfile");
return 0xFFFFFFFFLL;
}

original_code:
int
z_getc(void)
{
 if(f__recpos++ < f__svic->icirlen) {
  if(f__icptr >= f__icend) {if(f__svic->iciend) (*__errno_location ())= ((-1)); else f__fatal(((-1)),"endfile"); return(((-1)));};
  return(*(unsigned char *)f__icptr++);
  }
 return '\n';
}

canonical_original_code:
int z_getc()
{
 if(f__recpos++ < f__svic->icirlen) {
  if(f__icptr >= f__icend) {if(f__svic->iciend) (*__errno_location ())= ((-1)); else f__fatal(((-1)),"endfile"); return(((-1)));};
  return(*(unsigned char *)f__icptr++);
  }
 return '\n';
}


decompiled_code:
__int64 __fastcall c_si(_QWORD *a1)
{
__int64 result; // rax

f__elist = a1;
f__fmtbuf = a1[3];
f__curunit = 0LL;
f__formatted = 1LL;
f__sequential = 1LL;
f__external = 0LL;
if ( (int)pars_f() < 0 )
{
if ( *a1 )
*_errno_location() = 100;
else
f__fatal(100LL, "startint");
result = 100LL;
}
else
{
fmt_bg();
f__scale = 0;
f__cplus = 0LL;
f__cblank = 0LL;
f = a1;
f__recpos = 0;
f__icnum = 0;
f__cursor = 0LL;
f__hiwater = 0LL;
f__icptr = a1[1];
f__icend = a1[5] * a1[4] + f__icptr;
f = 0LL;
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(_QWORD *a1)
{
__int64 result; // rax

f__elist = a1;
f__fmtbuf = a1[3];
f__curunit = 0LL;
f__formatted = 1LL;
f__sequential = 1LL;
f__external = 0LL;
if ( (int)pars_f() < 0 )
{
if ( *a1 )
*_errno_location() = 100;
else
f__fatal(100LL, "startint");
result = 100LL;
}
else
{
fmt_bg();
f__scale = 0;
f__cplus = 0LL;
f__cblank = 0LL;
f = a1;
f__recpos = 0;
f__icnum = 0;
f__cursor = 0LL;
f__hiwater = 0LL;
f__icptr = a1[1];
f__icend = a1[5] * a1[4] + f__icptr;
f = 0LL;
result = 0LL;
}
return result;
}

original_code:
int
c_si(icilist *a)
{
 f__elist = (cilist *)a;
 f__fmtbuf=a->icifmt;
 f__curunit = 0;
 f__sequential=f__formatted=1;
 f__external=0;
 if(pars_f(f__fmtbuf)<0)
  {if(a->icierr) (*__errno_location ())= 100; else f__fatal(100,"startint"); return(100);};
 fmt_bg();
 f__cblank=f__cplus=f__scale=0;
 f__svic=a;
 f__icnum=f__recpos=0;
 f__cursor = 0;
 f__hiwater = 0;
 f__icptr = a->iciunit;
 f__icend = f__icptr + a->icirlen*a->icirnum;
 f__cf = 0;
 return(0);
}

canonical_original_code:
int c_si(struct icilist *a)
{
 f__elist = (struct cilist *)a;
 f__fmtbuf=a->icifmt;
 f__curunit = 0;
 f__sequential=f__formatted=1;
 f__external=0;
 if(pars_f(f__fmtbuf)<0)
  {if(a->icierr) (*__errno_location ())= 100; else f__fatal(100,"startint"); return(100);};
 fmt_bg();
 f__cblank=f__cplus=f__scale=0;
 f__svic=a;
 f__icnum=f__recpos=0;
 f__cursor = 0;
 f__hiwater = 0;
 f__icptr = a->iciunit;
 f__icend = f__icptr + a->icirlen*a->icirnum;
 f__cf = 0;
 return(0);
}

variable_types: struct icilist { long icierr; char *iciunit; long iciend; char *icifmt; long icirlen; long icirnum; } *


decompiled_code:
__int64 __fastcall s_rsfi(_QWORD *a1)
{
__int64 result; // rax

LODWORD(result) = c_si(a1);
if ( (_DWORD)result )
return (int)result;
f__reading = 1LL;
f__doed = &rd_ed;
f__doned = &rd_ned;
f__getn = z_getc;
f__dorevert = sub_A5;
f__donewrec = z_rnew;
f__doend = sub_A5;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func6(_QWORD *a1)
{
__int64 result; // rax

LODWORD(result) = func5(a1);
if ( (_DWORD)result )
return (int)result;
f__reading = 1LL;
f__doed = &rd_ed;
f__doned = &rd_ned;
f__getn = z_getc;
f__dorevert = sub_A5;
f__donewrec = z_rnew;
f__doend = sub_A5;
return 0LL;
}

original_code:
integer s_rsfi(icilist *a)
{ int n;
 if(n=c_si(a)) return(n);
 f__reading=1;
 f__doed=rd_ed;
 f__doned=rd_ned;
 f__getn=z_getc;
 f__dorevert = z_endp;
 f__donewrec = z_rnew;
 f__doend = z_endp;
 return(0);
}

canonical_original_code:
long s_rsfi(struct icilist *a)
{ int n;
 if(n=c_si(a)) return(n);
 f__reading=1;
 f__doed=rd_ed;
 f__doned=rd_ned;
 f__getn=z_getc;
 f__dorevert = z_endp;
 f__donewrec = z_rnew;
 f__doend = z_endp;
 return(0);
}

user_defined_types: struct icilist { long icierr; char *iciunit; long iciend; char *icifmt; long icirlen; long icirnum; }


decompiled_code:
__int64 __fastcall s_wsfi(_QWORD *a1)
{
__int64 result; // rax

LODWORD(result) = c_si(a1);
if ( (_DWORD)result )
return (int)result;
f__reading = 0LL;
f__doed = &w_ed;
f__doned = &w_ned;
f__putn = z_putc;
f__dorevert = iw_rev;
f__donewrec = z_wnew;
f__doend = sub_A5;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func7(_QWORD *a1)
{
__int64 result; // rax

LODWORD(result) = func5(a1);
if ( (_DWORD)result )
return (int)result;
f__reading = 0LL;
f__doed = &w_ed;
f__doned = &w_ned;
f__putn = z_putc;
f__dorevert = iw_rev;
f__donewrec = z_wnew;
f__doend = sub_A5;
return 0LL;
}

original_code:
integer s_wsfi(icilist *a)
{ int n;
 if(n=c_si(a)) return(n);
 f__reading=0;
 f__doed=w_ed;
 f__doned=w_ned;
 f__putn=z_putc;
 f__dorevert = iw_rev;
 f__donewrec = z_wnew;
 f__doend = z_endp;
 return(0);
}

canonical_original_code:
long s_wsfi(struct icilist *a)
{ int n;
 if(n=c_si(a)) return(n);
 f__reading=0;
 f__doed=w_ed;
 f__doned=w_ned;
 f__putn=z_putc;
 f__dorevert = iw_rev;
 f__donewrec = z_wnew;
 f__doend = z_endp;
 return(0);
}


decompiled_code:
__int64 e_rsfi()
{
__int64 result; // rax

LODWORD(result) = en_fio();
f__fmtbuf = 0LL;
return (int)result;
}

canonical_decompiled_code:
__int64 func8()
{
__int64 result; // rax

LODWORD(result) = en_fio();
f__fmtbuf = 0LL;
return (int)result;
}

original_code:
integer e_rsfi(void)
{ int n = en_fio();
 f__fmtbuf = ((void *)0);
 return(n);
}

canonical_original_code:
long e_rsfi()
{ int n = en_fio();
 f__fmtbuf = ((void *)0);
 return(n);
}


decompiled_code:
__int64 e_wsfi()
{
int v0; // er8
__int64 v1; // rax
int v2; // eax
_BYTE *v3; // rax

v0 = en_fio();
f__fmtbuf = 0LL;
v1 = f[5];
if ( v1 == 1 )
{
LABEL_4:
if ( f__recpos < f__hiwater )
f__recpos = f__hiwater;
v2 = f__recpos;
if ( f__recpos < f[4] )
{
if ( f__recpos )
{
LABEL_8:
f__recpos = v2 + 1;
do
{
v3 = (_BYTE *)f__icptr++;
*v3 = 32;
LODWORD(v3) = f__recpos++;
}
while ( (int)v3 < f[4] );
return v0;
}
LABEL_13:
if ( f__icnum )
return v0;
goto LABEL_8;
}
goto LABEL_19;
}
if ( v1 >= f__icnum )
{
if ( v1 != f__icnum )
goto LABEL_4;
if ( !(f__hiwater | f__recpos) )
{
v2 = f__recpos;
if ( f[4] > f__recpos )
goto LABEL_13;
LABEL_19:
if ( *f )
*_errno_location() = 110;
else
f__fatal(110LL, "recend");
return 110LL;
}
}
if ( *f )
*_errno_location() = 110;
else
f__fatal(110LL, "inwrite");
return 110LL;
}

canonical_decompiled_code:
__int64 func9()
{
int v0; // er8
__int64 v1; // rax
int v2; // eax
_BYTE *v3; // rax

v0 = en_fio();
f__fmtbuf = 0LL;
v1 = f[5];
if ( v1 == 1 )
{
LABEL_4:
if ( f__recpos < f__hiwater )
f__recpos = f__hiwater;
v2 = f__recpos;
if ( f__recpos < f[4] )
{
if ( f__recpos )
{
LABEL_8:
f__recpos = v2 + 1;
do
{
v3 = (_BYTE *)f__icptr++;
*v3 = 32;
LODWORD(v3) = f__recpos++;
}
while ( (int)v3 < f[4] );
return v0;
}
LABEL_13:
if ( f__icnum )
return v0;
goto LABEL_8;
}
goto LABEL_19;
}
if ( v1 >= f__icnum )
{
if ( v1 != f__icnum )
goto LABEL_4;
if ( !(f__hiwater | f__recpos) )
{
v2 = f__recpos;
if ( f[4] > f__recpos )
goto LABEL_13;
LABEL_19:
if ( *f )
*_errno_location() = 110;
else
f__fatal(110LL, "recend");
return 110LL;
}
}
if ( *f )
*_errno_location() = 110;
else
f__fatal(110LL, "inwrite");
return 110LL;
}

original_code:
integer e_wsfi(void)
{
 int n;
 n = en_fio();
 f__fmtbuf = ((void *)0);
 if(f__svic->icirnum != 1
  && (f__icnum > f__svic->icirnum
  || (f__icnum == f__svic->icirnum && (f__recpos | f__hiwater))))
  {if(f__svic->icierr) (*__errno_location ())= 110; else f__fatal(110,"inwrite"); return(110);};
 if (f__recpos < f__hiwater)
  f__recpos = f__hiwater;
 if (f__recpos >= f__svic->icirlen)
  {if(f__svic->icierr) (*__errno_location ())= 110; else f__fatal(110,"recend"); return(110);};
 if (!f__recpos && f__icnum)
  return n;
 while(f__recpos++ < f__svic->icirlen)
  *f__icptr++ = ' ';
 return n;
}

canonical_original_code:
long e_wsfi()
{
 int n;
 n = en_fio();
 f__fmtbuf = ((void *)0);
 if(f__svic->icirnum != 1
  && (f__icnum > f__svic->icirnum
  || (f__icnum == f__svic->icirnum && (f__recpos | f__hiwater))))
  {if(f__svic->icierr) (*__errno_location ())= 110; else f__fatal(110,"inwrite"); return(110);};
 if (f__recpos < f__hiwater)
  f__recpos = f__hiwater;
 if (f__recpos >= f__svic->icirlen)
  {if(f__svic->icierr) (*__errno_location ())= 110; else f__fatal(110,"recend"); return(110);};
 if (!f__recpos && f__icnum)
  return n;
 while(f__recpos++ < f__svic->icirlen)
  *f__icptr++ = ' ';
 return n;
}


decompiled_code:
void __fastcall r_atn2(float *a1, float *a2)
{
atan2(*a1, *a2);
}

canonical_decompiled_code:
void __fastcall func0(float *a1, float *a2)
{
atan2(*a1, *a2);
}

original_code:
double r_atn2(real *x, real *y)
{
return( atan2(*x,*y) );
}

canonical_original_code:
double r_atn2(float *x, float *y)
{
return( atan2(*x,*y) );
}

variable_types:
y
float *


original_code:
void
s_cat(char *lp, char *rpp[], ftnint rnp[], ftnint *np, ftnlen ll)
{
 ftnlen i, nc;
 char *rp;
 ftnlen n = *np;
 ftnlen L, m;
 char *lp0, *lp1;
 lp0 = 0;
 lp1 = lp;
 L = ll;
 i = 0;
 while(i < n) {
  rp = rpp[i];
  m = rnp[i++];
  if (rp >= lp1 || rp + m <= lp) {
   if ((L -= m) <= 0) {
    n = i;
    break;
    }
   lp1 += m;
   continue;
   }
  lp0 = lp;
  lp = lp1 = F77_aloc(L = ll, "s_cat");
  break;
  }
 lp1 = lp;
 for(i = 0 ; i < n ; ++i) {
  nc = ll;
  if(rnp[i] < nc)
   nc = rnp[i];
  ll -= nc;
  rp = rpp[i];
  while(--nc >= 0)
   *lp++ = *rp++;
  }
 while(--ll >= 0)
  *lp++ = ' ';
 if (lp0) {
  memcpy(lp0, lp1, L);
  free(lp1);
  }
 }

canonical_original_code:
void s_cat(char *lp, char *rpp[], long rnp[], long *np, long ll)
{
 long i; long nc;
 char *rp;
 long n = *np;
 long L; long m;
 char *lp0; char *lp1;
 lp0 = 0;
 lp1 = lp;
 L = ll;
 i = 0;
 while(i < n) {
  rp = rpp[i];
  m = rnp[i++];
  if (rp >= lp1 || rp + m <= lp) {
   if ((L -= m) <= 0) {
    n = i;
    break;
    }
   lp1 += m;
   continue;
   }
  lp0 = lp;
  lp = lp1 = F77_aloc(L = ll, "s_cat");
  break;
  }
 lp1 = lp;
 for(i = 0 ; i < n ; ++i) {
  nc = ll;
  if(rnp[i] < nc)
   nc = rnp[i];
  ll -= nc;
  rp = rpp[i];
  while(--nc >= 0)
   *lp++ = *rp++;
  }
 while(--ll >= 0)
  *lp++ = ' ';
 if (lp0) {
  memcpy(lp0, lp1, L);
  free(lp1);
  }
 }

variable_types:
lp
char *

variable_types:
rpp
char *[]

variable_types:
rnp
long []

variable_types:
np
long *

variable_types: ll long

variable_types: nc long

variable_types:
rp
char *

variable_types: L long

variable_types: m long


decompiled_code:
__int64 f_exit()
{
__int64 i; // rbx
__int64 result; // rax

if ( !qword_290 )
{
qword_290 = 1LL;
qword_2A0 = 0LL;
for ( i = 0LL; i != 100; ++i )
{
*(&qword_290 + 1) = i;
result = f_clos((__int64)&qword_290);
}
}
return result;
}

canonical_decompiled_code:
__int64 func1()
{
__int64 i; // rbx
__int64 result; // rax

if ( !qword_290 )
{
qword_290 = 1LL;
qword_2A0 = 0LL;
for ( i = 0LL; i != 100; ++i )
{
*(&qword_290 + 1) = i;
result = func0((__int64)&qword_290);
}
}
return result;
}

original_code:
void
f_exit(void)
{ int i;
 static cllist xx;
 if (!xx.cerr) {
  xx.cerr=1;
  xx.csta=((void *)0);
  for(i=0;i<100;i++)
  {
   xx.cunit=i;
   (void) f_clos(&xx);
  }
 }
}

canonical_original_code:
void f_exit()
{ int i;
 static struct cllist xx;
 if (!xx.cerr) {
  xx.cerr=1;
  xx.csta=((void *)0);
  for(i=0;i<100;i++)
  {
   xx.cunit=i;
   (void) f_clos(&xx);
  }
 }
}

variable_types: i int

variable_types: struct cllist { long cerr; long cunit; char *csta; }


original_code:
int
flush_(void)
{ int i;
 for(i=0;i<100;i++)
  if(f__units[i].ufd != ((void *)0) && f__units[i].uwrt)
   fflush(f__units[i].ufd);
return 0;
}

canonical_original_code:
int flush_()
{ int i;
 for(i=0;i<100;i++)
  if(f__units[i].ufd != ((void *)0) && f__units[i].uwrt)
   fflush(f__units[i].ufd);
return 0;
}


decompiled_code:
__int64 xrd_SL()
{
int v0; // eax

if ( !*(_QWORD *)(f__curunit + 64LL) )
{
while ( 1 )
{
v0 = getc((FILE *)f);
if ( v0 == 10 )
break;
if ( v0 == -1 )
{
*(_QWORD *)(f__curunit + 64LL) = 1LL;
break;
}
}
}
f__recpos = 0;
f__cursor = 0LL;
return 1LL;
}

canonical_decompiled_code:
__int64 func0()
{
int v0; // eax

if ( !*(_QWORD *)(f__curunit + 64LL) )
{
while ( 1 )
{
v0 = getc((FILE *)f);
if ( v0 == 10 )
break;
if ( v0 == -1 )
{
*(_QWORD *)(f__curunit + 64LL) = 1LL;
break;
}
}
}
f__recpos = 0;
f__cursor = 0LL;
return 1LL;
}

original_code:
int
xrd_SL(void)
{ int ch;
 if(!f__curunit->uend)
  while((ch=getc(f__cf))!='\n')
   if (ch == (-1)) {
    f__curunit->uend = 1;
    break;
    }
 f__cursor=f__recpos=0;
 return(1);
}

canonical_original_code:
int xrd_SL()
{ int ch;
 if(!f__curunit->uend)
  while((ch=getc(f__cf))!='\n')
   if (ch == (-1)) {
    f__curunit->uend = 1;
    break;
    }
 f__cursor=f__recpos=0;
 return(1);
}

variable_types: ch int


decompiled_code:
__int64 x_endp()
{
xrd_SL();
return (unsigned int)-(*(_QWORD *)(f__curunit + 64LL) == 1LL);
}

canonical_decompiled_code:
__int64 func1()
{
func0();
return (unsigned int)-(*(_QWORD *)(f__curunit + 64LL) == 1LL);
}

original_code:
int
x_endp(void)
{
 xrd_SL();
 return f__curunit->uend == 1 ? (-1) : 0;
}

canonical_original_code:
int x_endp()
{
 xrd_SL();
 return f__curunit->uend == 1 ? (-1) : 0;
}


decompiled_code:
__int64 x_rev()
{
xrd_SL();
return 0LL;
}

canonical_decompiled_code:
__int64 func2()
{
func0();
return 0LL;
}

original_code:
int
x_rev(void)
{
 (void) xrd_SL();
 return(0);
}

canonical_original_code:
int x_rev()
{
 (void) xrd_SL();
 return(0);
}


decompiled_code:
__int64 x_getc()
{
int v0; // eax
unsigned int v1; // ebx

if ( *(_QWORD *)(f__curunit + 64LL) )
return (unsigned int)-1;
v0 = getc((FILE *)f);
v1 = v0;
if ( v0 == -1 || v0 == 10 )
{
if ( v0 == 10 )
{
ungetc(10, (FILE *)f);
}
else if ( *(_QWORD *)(f__curunit + 64LL) || (v1 = -1, feof((FILE *)f)) )
{
*_errno_location() = 0;
*(_QWORD *)(f__curunit + 64LL) = 1LL;
v1 = -1;
}
}
else
{
++f__recpos;
}
return v1;
}

canonical_decompiled_code:
__int64 func3()
{
int v0; // eax
unsigned int v1; // ebx

if ( *(_QWORD *)(f__curunit + 64LL) )
return (unsigned int)-1;
v0 = getc((FILE *)f);
v1 = v0;
if ( v0 == -1 || v0 == 10 )
{
if ( v0 == 10 )
{
ungetc(10, (FILE *)f);
}
else if ( *(_QWORD *)(f__curunit + 64LL) || (v1 = -1, feof((FILE *)f)) )
{
*_errno_location() = 0;
*(_QWORD *)(f__curunit + 64LL) = 1LL;
v1 = -1;
}
}
else
{
++f__recpos;
}
return v1;
}

original_code:
int
x_getc(void)
{ int ch;
 if(f__curunit->uend) return((-1));
 ch = getc(f__cf);
 if(ch!=(-1) && ch!='\n')
 { f__recpos++;
  return(ch);
 }
 if(ch=='\n')
 { (void) ungetc(ch,f__cf);
  return(ch);
 }
 if(f__curunit->uend || feof(f__cf))
 { (*__errno_location ())=0;
  f__curunit->uend=1;
  return(-1);
 }
 return(-1);
}

canonical_original_code:
int x_getc()
{ int ch;
 if(f__curunit->uend) return((-1));
 ch = getc(f__cf);
 if(ch!=(-1) && ch!='\n')
 { f__recpos++;
  return(ch);
 }
 if(ch=='\n')
 { (void) ungetc(ch,f__cf);
  return(ch);
 }
 if(f__curunit->uend || feof(f__cf))
 { (*__errno_location ())=0;
  f__curunit->uend=1;
  return(-1);
 }
 return(-1);
}


decompiled_code:
__int64 __fastcall s_rsfe(_QWORD *a1)
{
__int64 result; // rax
int *v2; // rax

if ( !f__init )
f_init();
f__reading = 1LL;
f__sequential = 1LL;
f__formatted = 1LL;
f__external = 1LL;
LODWORD(result) = c_sfe(a1);
if ( (_DWORD)result )
return (int)result;
f__elist = a1;
f__recpos = 0;
f__cursor = 0LL;
f__scale = 0;
f__fmtbuf = a1[3];
f = (_QWORD (__fastcall *)(char, float))*f__curunit;
if ( (int)pars_f() < 0 )
{
if ( *a1 )
*_errno_location() = 100;
else
f__fatal(100LL, "startio");
result = 100LL;
}
else
{
f__getn = x_getc;
f__doed = &rd_ed;
f__doned = &rd_ned;
fmt_bg();
f__doend = x_endp;
f__donewrec = xrd_SL;
f__dorevert = x_rev;
f__cblank = f__curunit[7];
f__cplus = 0LL;
if ( f__curunit[9] && (unsigned int)f__nowreading() )
{
if ( !*a1 )
{
v2 = _errno_location();
f__fatal((unsigned int)*v2, "read start");
}
result = *_errno_location();
}
else
{
result = f__curunit[8];
if ( result )
{
if ( *(_QWORD *)(f__elist + 16LL) )
*_errno_location() = -1;
else
f__fatal(0xFFFFFFFFLL, "read start");
result = -1LL;
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(_QWORD *a1)
{
__int64 result; // rax
int *v2; // rax

if ( !f__init )
f_init();
f__reading = 1LL;
f__sequential = 1LL;
f__formatted = 1LL;
f__external = 1LL;
LODWORD(result) = c_sfe(a1);
if ( (_DWORD)result )
return (int)result;
f__elist = a1;
f__recpos = 0;
f__cursor = 0LL;
f__scale = 0;
f__fmtbuf = a1[3];
f = (_QWORD (__fastcall *)(char, float))*f__curunit;
if ( (int)pars_f() < 0 )
{
if ( *a1 )
*_errno_location() = 100;
else
f__fatal(100LL, "startio");
result = 100LL;
}
else
{
f__getn = x_getc;
f__doed = &rd_ed;
f__doned = &rd_ned;
fmt_bg();
f__doend = x_endp;
f__donewrec = xrd_SL;
f__dorevert = x_rev;
f__cblank = f__curunit[7];
f__cplus = 0LL;
if ( f__curunit[9] && (unsigned int)f__nowreading() )
{
if ( !*a1 )
{
v2 = _errno_location();
f__fatal((unsigned int)*v2, "read start");
}
result = *_errno_location();
}
else
{
result = f__curunit[8];
if ( result )
{
if ( *(_QWORD *)(f__elist + 16LL) )
*_errno_location() = -1;
else
f__fatal(0xFFFFFFFFLL, "read start");
result = -1LL;
}
}
}
return result;
}

original_code:
integer s_rsfe(cilist *a)
{ int n;
 if(!f__init) f_init();
 f__reading=1;
 f__sequential=1;
 f__formatted=1;
 f__external=1;
 if(n=c_sfe(a)) return(n);
 f__elist=a;
 f__cursor=f__recpos=0;
 f__scale=0;
 f__fmtbuf=a->cifmt;
 f__cf=f__curunit->ufd;
 if(pars_f(f__fmtbuf)<0) {if(a->cierr) (*__errno_location ())= 100; else f__fatal(100,"startio"); return(100);};
 f__getn= x_getc;
 f__doed= rd_ed;
 f__doned= rd_ned;
 fmt_bg();
 f__doend=x_endp;
 f__donewrec=xrd_SL;
 f__dorevert=x_rev;
 f__cblank=f__curunit->ublnk;
 f__cplus=0;
 if(f__curunit->uwrt && f__nowreading(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"read start"); return((*__errno_location ()));};
 if(f__curunit->uend)
  {if(f__elist->ciend) (*__errno_location ())= ((-1)); else f__fatal(((-1)),"read start"); return(((-1)));};
 return(0);
}

canonical_original_code:
long s_rsfe(struct cilist *a)
{ int n;
 if(!f__init) f_init();
 f__reading=1;
 f__sequential=1;
 f__formatted=1;
 f__external=1;
 if(n=c_sfe(a)) return(n);
 f__elist=a;
 f__cursor=f__recpos=0;
 f__scale=0;
 f__fmtbuf=a->cifmt;
 f__cf=f__curunit->ufd;
 if(pars_f(f__fmtbuf)<0) {if(a->cierr) (*__errno_location ())= 100; else f__fatal(100,"startio"); return(100);};
 f__getn= x_getc;
 f__doed= rd_ed;
 f__doned= rd_ned;
 fmt_bg();
 f__doend=x_endp;
 f__donewrec=xrd_SL;
 f__dorevert=x_rev;
 f__cblank=f__curunit->ublnk;
 f__cplus=0;
 if(f__curunit->uwrt && f__nowreading(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"read start"); return((*__errno_location ()));};
 if(f__curunit->uend)
  {if(f__elist->ciend) (*__errno_location ())= ((-1)); else f__fatal(((-1)),"read start"); return(((-1)));};
 return(0);
}

variable_types: struct cilist { long cierr; long ciunit; long ciend; char *cifmt; long cirec; } *

variable_types: n int


decompiled_code:
__int64 __fastcall do_us(int *a1, void *a2, __int64 a3)
{
size_t v3; // rdx
__int64 result; // rax

if ( f__reading )
{
f__recpos += *a1 * a3;
if ( f__recpos > f__reclen )
{
if ( *f__elist )
*_errno_location() = 110;
else
f__fatal(110LL, "do_us");
result = 110LL;
}
else
{
v3 = fread(a2, (int)a3, *a1, (FILE *)f);
result = 0LL;
if ( v3 != *(_QWORD *)a1 )
{
if ( f__elist[2] )
*_errno_location() = -1;
else
f__fatal(0xFFFFFFFFLL, "do_us");
result = 0xFFFFFFFFLL;
}
}
}
else
{
f__reclen += *(_QWORD *)a1 * a3;
fwrite(a2, (int)a3, *a1, (FILE *)f);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(int *a1, void *a2, __int64 a3)
{
size_t v3; // rdx
__int64 result; // rax

if ( f__reading )
{
f__recpos += *a1 * a3;
if ( f__recpos > f__reclen )
{
if ( *f__elist )
*_errno_location() = 110;
else
f__fatal(110LL, "do_us");
result = 110LL;
}
else
{
v3 = fread(a2, (int)a3, *a1, (FILE *)f);
result = 0LL;
if ( v3 != *(_QWORD *)a1 )
{
if ( f__elist[2] )
*_errno_location() = -1;
else
f__fatal(0xFFFFFFFFLL, "do_us");
result = 0xFFFFFFFFLL;
}
}
}
else
{
f__reclen += *(_QWORD *)a1 * a3;
fwrite(a2, (int)a3, *a1, (FILE *)f);
result = 0LL;
}
return result;
}

original_code:
int
do_us(ftnint *number, char *ptr, ftnlen len)
{
 if(f__reading)
 {
  f__recpos += (int)(*number * len);
  if(f__recpos>f__reclen)
   {if(f__elist->cierr) (*__errno_location ())= 110; else f__fatal(110,"do_us"); return(110);};
  if (fread(ptr,(int)len,(int)(*number),f__cf) != *number)
   {if(f__elist->ciend) (*__errno_location ())= (-1); else f__fatal((-1),"do_us"); return((-1));};
  return(0);
 }
 else
 {
  f__reclen += *number * len;
  (void) fwrite(ptr,(int)len,(int)(*number),f__cf);
  return(0);
 }
}

canonical_original_code:
int do_us(long *number, char *ptr, long len)
{
 if(f__reading)
 {
  f__recpos += (int)(*number * len);
  if(f__recpos>f__reclen)
   {if(f__elist->cierr) (*__errno_location ())= 110; else f__fatal(110,"do_us"); return(110);};
  if (fread(ptr,(int)len,(int)(*number),f__cf) != *number)
   {if(f__elist->ciend) (*__errno_location ())= (-1); else f__fatal((-1),"do_us"); return((-1));};
  return(0);
 }
 else
 {
  f__reclen += *number * len;
  (void) fwrite(ptr,(int)len,(int)(*number),f__cf);
  return(0);
 }
}

variable_types:
number
long *

variable_types:
ptr
char *

variable_types: len long


decompiled_code:
__int64 __fastcall do_ud(int *a1, void *a2, int a3)
{
int v3; // eax
int v4; // ecx
__int64 v5; // rbp

v3 = f__recpos + *a1 * a3;
f__recpos = v3;
v4 = *(_DWORD *)(f__curunit + 28LL);
if ( v4 == 1 || v3 <= v4 )
{
v5 = f__reading;
if ( f__reading )
{
v5 = 0LL;
if ( fread(a2, a3, *a1, (FILE *)f) != *(_QWORD *)a1 )
{
if ( *f__elist )
*_errno_location() = -1;
else
f__fatal(0xFFFFFFFFLL, "do_ud");
v5 = -1LL;
}
}
else
{
fwrite(a2, a3, *a1, (FILE *)f);
}
}
else
{
if ( *f__elist )
*_errno_location() = 110;
else
f__fatal(110LL, "do_ud");
v5 = 110LL;
}
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func1(int *a1, void *a2, int a3)
{
int v3; // eax
int v4; // ecx
__int64 v5; // rbp

v3 = f__recpos + *a1 * a3;
f__recpos = v3;
v4 = *(_DWORD *)(f__curunit + 28LL);
if ( v4 == 1 || v3 <= v4 )
{
v5 = f__reading;
if ( f__reading )
{
v5 = 0LL;
if ( fread(a2, a3, *a1, (FILE *)f) != *(_QWORD *)a1 )
{
if ( *f__elist )
*_errno_location() = -1;
else
f__fatal(0xFFFFFFFFLL, "do_ud");
v5 = -1LL;
}
}
else
{
fwrite(a2, a3, *a1, (FILE *)f);
}
}
else
{
if ( *f__elist )
*_errno_location() = 110;
else
f__fatal(110LL, "do_ud");
v5 = 110LL;
}
return v5;
}

original_code:
integer do_ud(ftnint *number, char *ptr, ftnlen len)
{
 f__recpos += (int)(*number * len);
 if(f__recpos > f__curunit->url && f__curunit->url!=1)
  {if(f__elist->cierr) (*__errno_location ())= 110; else f__fatal(110,"do_ud"); return(110);};
 if(f__reading)
 {
  if(fread(ptr,(int)len,(int)(*number),f__cf) != *number)
   {if(f__elist->cierr) (*__errno_location ())= (-1); else f__fatal((-1),"do_ud"); return((-1));}
  else return(0);
 }
 (void) fwrite(ptr,(int)len,(int)(*number),f__cf);
 return(0);
}

canonical_original_code:
long do_ud(long *number, char *ptr, long len)
{
 f__recpos += (int)(*number * len);
 if(f__recpos > f__curunit->url && f__curunit->url!=1)
  {if(f__elist->cierr) (*__errno_location ())= 110; else f__fatal(110,"do_ud"); return(110);};
 if(f__reading)
 {
  if(fread(ptr,(int)len,(int)(*number),f__cf) != *number)
   {if(f__elist->cierr) (*__errno_location ())= (-1); else f__fatal((-1),"do_ud"); return((-1));}
  else return(0);
 }
 (void) fwrite(ptr,(int)len,(int)(*number),f__cf);
 return(0);
}


decompiled_code:
__int64 __fastcall do_uio(int *a1, void *a2, __int64 a3)
{
__int64 result; // rax

if ( f__sequential )
result = (int)do_us(a1, a2, a3);
else
result = do_ud(a1, a2, a3);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(int *a1, void *a2, __int64 a3)
{
__int64 result; // rax

if ( f__sequential )
result = (int)func0(a1, a2, a3);
else
result = func1(a1, a2, a3);
return result;
}

original_code:
integer do_uio(ftnint *number, char *ptr, ftnlen len)
{
 if(f__sequential)
  return(do_us(number,ptr,len));
 else return(do_ud(number,ptr,len));
}

canonical_original_code:
long do_uio(long *number, char *ptr, long len)
{
 if(f__sequential)
  return(do_us(number,ptr,len));
 else return(do_ud(number,ptr,len));
}


decompiled_code:
void __fastcall r_asin(float *a1)
{
asin(*a1);
}

canonical_decompiled_code:
void __fastcall func0(float *a1)
{
asin(*a1);
}

original_code:
double r_asin(real *x)
{
return( asin(*x) );
}

canonical_original_code:
double r_asin(float *x)
{
return( asin(*x) );
}

variable_types:
x
float *


decompiled_code:
void __fastcall r_cosh(float *a1)
{
cosh(*a1);
}

canonical_decompiled_code:
void __fastcall func0(float *a1)
{
cosh(*a1);
}

original_code:
double r_cosh(real *x)
{
return( cosh(*x) );
}

canonical_original_code:
double r_cosh(float *x)
{
return( cosh(*x) );
}


decompiled_code:
__int64 __fastcall s_wsle(_QWORD *a1)
{
__int64 result; // rax
int v2; // edx
int *v3; // rax

LODWORD(result) = c_le();
if ( (_DWORD)result )
return (int)result;
f__reading = 0LL;
f__external = 1LL;
f__formatted = 1LL;
f__putn = &x_putc;
f__lioproc = &l_write;
L_len = 80LL;
f__donewrec = &x_wSL;
result = 0LL;
if ( *(_QWORD *)(f__curunit + 72LL) != 1LL )
{
v2 = f__nowwriting();
result = 0LL;
if ( v2 )
{
if ( !*a1 )
{
v3 = _errno_location();
f__fatal((unsigned int)*v3, "list output start");
}
result = *_errno_location();
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(_QWORD *a1)
{
__int64 result; // rax
int v2; // edx
int *v3; // rax

LODWORD(result) = c_le();
if ( (_DWORD)result )
return (int)result;
f__reading = 0LL;
f__external = 1LL;
f__formatted = 1LL;
f__putn = &x_putc;
f__lioproc = &l_write;
L_len = 80LL;
f__donewrec = &x_wSL;
result = 0LL;
if ( *(_QWORD *)(f__curunit + 72LL) != 1LL )
{
v2 = f__nowwriting();
result = 0LL;
if ( v2 )
{
if ( !*a1 )
{
v3 = _errno_location();
f__fatal((unsigned int)*v3, "list output start");
}
result = *_errno_location();
}
}
return result;
}

original_code:
integer s_wsle(cilist *a)
{
 int n;
 if(n=c_le(a)) return(n);
 f__reading=0;
 f__external=1;
 f__formatted=1;
 f__putn = x_putc;
 f__lioproc = l_write;
 L_len = 80;
 f__donewrec = x_wSL;
 if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"list output start"); return((*__errno_location ()));};
 return(0);
 }

canonical_original_code:
long s_wsle(struct cilist *a)
{
 int n;
 if(n=c_le(a)) return(n);
 f__reading=0;
 f__external=1;
 f__formatted=1;
 f__putn = x_putc;
 f__lioproc = l_write;
 L_len = 80;
 f__donewrec = x_wSL;
 if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"list output start"); return((*__errno_location ()));};
 return(0);
 }


decompiled_code:
__int64 e_wsle()
{
__int64 result; // rax

LODWORD(result) = f__putbuf(10LL);
f__recpos = 0;
return (int)result;
}

canonical_decompiled_code:
__int64 func1()
{
__int64 result; // rax

LODWORD(result) = f__putbuf(10LL);
f__recpos = 0;
return (int)result;
}

original_code:
integer e_wsle(void)
{
 int n = f__putbuf('\n');
 f__recpos=0;
 return(n);
 }

canonical_original_code:
long e_wsle()
{
 int n = f__putbuf('\n');
 f__recpos=0;
 return(n);
 }


decompiled_code:
void __fastcall d_sqrt(double *a1)
{
sqrt(*a1);
}

canonical_decompiled_code:
void __fastcall func0(double *a1)
{
sqrt(*a1);
}

original_code:
double d_sqrt(doublereal *x)
{
return( sqrt(*x) );
}

canonical_original_code:
double d_sqrt(double *x)
{
return( sqrt(*x) );
}

variable_types:
x
double *


decompiled_code:
__int64 __fastcall lbit_shift(unsigned __int64 a1, __int64 a2)
{
__int64 result; // rax
unsigned __int64 v3; // rdi

result = a1 << a2;
v3 = a1 >> -(char)a2;
if ( a2 < 0 )
result = v3;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned __int64 a1, __int64 a2)
{
__int64 result; // rax
unsigned __int64 v3; // rdi

result = a1 << a2;
v3 = a1 >> -(char)a2;
if ( a2 < 0 )
result = v3;
return result;
}

original_code:
integer
lbit_shift(integer a, integer b)
{
 return b >= 0 ? a << b : (integer)((uinteger)a >> -b);
 }

canonical_original_code:
long lbit_shift(long a, long b)
{
 return b >= 0 ? a << b : (integer)((unsigned long)a >> -b);
 }

variable_types: a long

variable_types: b long


original_code:
double d_mod(doublereal *x, doublereal *y)
{
 double quotient;
 if( (quotient = *x / *y) >= 0)
  quotient = floor(quotient);
 else
  quotient = -floor(-quotient);
 return(*x - (*y) * quotient );
}

canonical_original_code:
double d_mod(double *x, double *y)
{
 double quotient;
 if( (quotient = *x / *y) >= 0)
  quotient = floor(quotient);
 else
  quotient = -floor(-quotient);
 return(*x - (*y) * quotient );
}

variable_types:
y
double *

variable_types: quotient double


decompiled_code:
__int64 __fastcall s_wsni(_QWORD *a1)
{
_QWORD v2[7]; // [rsp+0h] [rbp-38h] BYREF

sub_0(a1);
v2[3] = a1[3];
x_wsne(v2);
sub_D3();
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(_QWORD *a1)
{
_QWORD v2[7]; // [rsp+0h] [rbp-38h] BYREF

sub_0(a1);
v2[3] = a1[3];
x_wsne(v2);
func0();
return 0LL;
}

original_code:
integer
s_wsni(icilist *a)
{
 cilist ca;
 c_liw(a);
 ca.cifmt = a->icifmt;
 x_wsne(&ca);
 z_wSL();
 return 0;
 }

canonical_original_code:
long s_wsni(struct icilist *a)
{
 struct cilist ca;
 c_liw(a);
 ca.cifmt = a->icifmt;
 x_wsne(&ca);
 z_wSL();
 return 0;
 }

variable_types: struct icilist { long icierr; char *iciunit; long iciend; char *icifmt; long icirlen; long icirnum; } *

variable_types: struct cilist { long cierr; long ciunit; long ciend; char *cifmt; long cirec; }


decompiled_code:
__int64 __fastcall s_wsli(_QWORD *a1)
{
f__lioproc = &l_write;
sub_0(a1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(_QWORD *a1)
{
f__lioproc = &l_write;
sub_0(a1);
return 0LL;
}

original_code:
integer
s_wsli(icilist *a)
{
 f__lioproc = l_write;
 c_liw(a);
 return(0);
 }

canonical_original_code:
long s_wsli(struct icilist *a)
{
 f__lioproc = l_write;
 c_liw(a);
 return(0);
 }


decompiled_code:
__int64 e_wsli()
{
sub_D3();
return 0LL;
}

canonical_decompiled_code:
__int64 func3()
{
func0();
return 0LL;
}

original_code:
integer e_wsli(void)
{
 z_wSL();
 return(0);
 }

canonical_original_code:
long e_wsli()
{
 z_wSL();
 return(0);
 }


decompiled_code:
double __fastcall d_abs(double *a1)
{
double v2; // [rsp+0h] [rbp-8h]

v2 = *a1;
if ( *a1 < 0.0 )
*(_QWORD *)&v2 ^= LC1;
return v2;
}

canonical_decompiled_code:
double __fastcall func0(double *a1)
{
double v2; // [rsp+0h] [rbp-8h]

v2 = *a1;
if ( *a1 < 0.0 )
*(_QWORD *)&v2 ^= LC1;
return v2;
}

original_code:
double d_abs(doublereal *x)
{
if(*x >= 0)
 return(*x);
return(- *x);
}

canonical_original_code:
double d_abs(double *x)
{
if(*x >= 0)
 return(*x);
return(- *x);
}