
/* std::string::copy(char*, unsigned long, unsigned long) const */

size_t __thiscall std::string::copy(string *this,char *param_1,ulong param_2,ulong param_3)

{
  ulong uVar1;
  ulong __n;
  char *__src;
  
  uVar1 = *(ulong *)(*(long *)this + -0x18);
  if (uVar1 < param_3) {
                    /* WARNING: Subroutine does not return */
    __throw_out_of_range_fmt
              ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",param_3
               ,uVar1);
  }
  __n = uVar1 - param_3;
  if (param_2 < uVar1 - param_3) {
    __n = param_2;
  }
  if (__n != 0) {
    __src = (char *)(param_3 + *(long *)this);
    if (__n == 1) {
      *param_1 = *__src;
      return 1;
    }
    memcpy(param_1,__src,__n);
  }
  return __n;
}



size_t FUN_0030cdb0(long *param_1,undefined1 *param_2,ulong param_3,ulong param_4)

{
  ulong uVar1;
  ulong __n;
  undefined1 *__src;
  
  uVar1 = *(ulong *)(*param_1 + -0x18);
  if (uVar1 < param_4) {
                    /* WARNING: Subroutine does not return */
    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",
                 param_4,uVar1);
  }
  __n = uVar1 - param_4;
  if (param_3 < uVar1 - param_4) {
    __n = param_3;
  }
  if (__n != 0) {
    __src = (undefined1 *)(param_4 + *param_1);
    if (__n == 1) {
      *param_2 = *__src;
      return 1;
    }
    memcpy(param_2,__src,__n);
  }
  return __n;
}


PUSH RBX
MOV RAX,qword ptr [RDI]
MOV R8,RSI
MOV RSI,RCX
MOV RBX,qword ptr [RAX + -0x18]
CMP RCX,RBX
JA 0x0030cdfb
SUB RBX,RCX
CMP RBX,RDX
CMOVA RBX,RDX
TEST RBX,RBX
JZ 0x0030cde6
ADD RSI,RAX
CMP RBX,0x1
JZ 0x0030cdf0
MOV RDX,RBX
MOV RDI,R8
CALL 0x00147aa0
MOV RAX,RBX
POP RBX
RET
MOVZX EAX,byte ptr [RSI]
MOV byte ptr [R8],AL
MOV RAX,RBX
POP RBX
RET
MOV RDX,RSI
MOV RCX,RBX
LEA RSI,[0x3911aa]
XOR EAX,EAX
LEA RDI,[0x376b80]
CALL 0x00319620
(translation_unit "size_t FUN_0030cdb0(long *param_1,undefined1 *param_2,ulong param_3,ulong param_4)\n\n{\n  ulong uVar1;\n  ulong __n;\n  undefined1 *__src;\n  \n  uVar1 = *(ulong *)(*param_1 + -0x18);\n  if (uVar1 < param_4) {\n                    /* WARNING: Subroutine does not return */\n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }\n  __n = uVar1 - param_4;\n  if (param_3 < uVar1 - param_4) {\n    __n = param_3;\n  }\n  if (__n != 0) {\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }\n  return __n;\n}\n\n" (function_definition "size_t FUN_0030cdb0(long *param_1,undefined1 *param_2,ulong param_3,ulong param_4)\n\n{\n  ulong uVar1;\n  ulong __n;\n  undefined1 *__src;\n  \n  uVar1 = *(ulong *)(*param_1 + -0x18);\n  if (uVar1 < param_4) {\n                    /* WARNING: Subroutine does not return */\n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }\n  __n = uVar1 - param_4;\n  if (param_3 < uVar1 - param_4) {\n    __n = param_3;\n  }\n  if (__n != 0) {\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }\n  return __n;\n}" primitive_type (function_declarator "FUN_0030cdb0(long *param_1,undefined1 *param_2,ulong param_3,ulong param_4)" identifier (parameter_list "(long *param_1,undefined1 *param_2,ulong param_3,ulong param_4)" ( (parameter_declaration "long *param_1" (sized_type_specifier "long" long) (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "undefined1 *param_2" type_identifier (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "ulong param_3" type_identifier identifier) , (parameter_declaration "ulong param_4" type_identifier identifier) ))) (compound_statement "{\n  ulong uVar1;\n  ulong __n;\n  undefined1 *__src;\n  \n  uVar1 = *(ulong *)(*param_1 + -0x18);\n  if (uVar1 < param_4) {\n                    /* WARNING: Subroutine does not return */\n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }\n  __n = uVar1 - param_4;\n  if (param_3 < uVar1 - param_4) {\n    __n = param_3;\n  }\n  if (__n != 0) {\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }\n  return __n;\n}" { (declaration "ulong uVar1;" type_identifier identifier ;) (declaration "ulong __n;" type_identifier identifier ;) (declaration "undefined1 *__src;" type_identifier (pointer_declarator "*__src" * identifier) ;) (expression_statement "uVar1 = *(ulong *)(*param_1 + -0x18);" (assignment_expression "uVar1 = *(ulong *)(*param_1 + -0x18)" identifier = (pointer_expression "*(ulong *)(*param_1 + -0x18)" * (cast_expression "(ulong *)(*param_1 + -0x18)" ( (type_descriptor "ulong *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*param_1 + -0x18)" ( (binary_expression "*param_1 + -0x18" (pointer_expression "*param_1" * identifier) + number_literal) ))))) ;) (if_statement "if (uVar1 < param_4) {\n                    /* WARNING: Subroutine does not return */\n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }" if (parenthesized_expression "(uVar1 < param_4)" ( (binary_expression "uVar1 < param_4" identifier < identifier) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }" { comment (expression_statement "FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);" (call_expression "FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1)" identifier (argument_list "("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1)" ( (string_literal ""%s: __pos (which is %zu) > this->size() (which is %zu)"" " string_content ") , (string_literal ""basic_string::copy"" " string_content ") , identifier , identifier ))) ;) })) (expression_statement "__n = uVar1 - param_4;" (assignment_expression "__n = uVar1 - param_4" identifier = (binary_expression "uVar1 - param_4" identifier - identifier)) ;) (if_statement "if (param_3 < uVar1 - param_4) {\n    __n = param_3;\n  }" if (parenthesized_expression "(param_3 < uVar1 - param_4)" ( (binary_expression "param_3 < uVar1 - param_4" identifier < (binary_expression "uVar1 - param_4" identifier - identifier)) )) (compound_statement "{\n    __n = param_3;\n  }" { (expression_statement "__n = param_3;" (assignment_expression "__n = param_3" identifier = identifier) ;) })) (if_statement "if (__n != 0) {\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }" if (parenthesized_expression "(__n != 0)" ( (binary_expression "__n != 0" identifier != number_literal) )) (compound_statement "{\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }" { (expression_statement "__src = (undefined1 *)(param_4 + *param_1);" (assignment_expression "__src = (undefined1 *)(param_4 + *param_1)" identifier = (cast_expression "(undefined1 *)(param_4 + *param_1)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_4 + *param_1)" ( (binary_expression "param_4 + *param_1" identifier + (pointer_expression "*param_1" * identifier)) )))) ;) (if_statement "if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }" if (parenthesized_expression "(__n == 1)" ( (binary_expression "__n == 1" identifier == number_literal) )) (compound_statement "{\n      *param_2 = *__src;\n      return 1;\n    }" { (expression_statement "*param_2 = *__src;" (assignment_expression "*param_2 = *__src" (pointer_expression "*param_2" * identifier) = (pointer_expression "*__src" * identifier)) ;) (return_statement "return 1;" return number_literal ;) })) (expression_statement "memcpy(param_2,__src,__n);" (call_expression "memcpy(param_2,__src,__n)" identifier (argument_list "(param_2,__src,__n)" ( identifier , identifier , identifier ))) ;) })) (return_statement "return __n;" return identifier ;) })))
(translation_unit "/* std::string::copy(char*, unsigned long, unsigned long) const */\n\nsize_t __thiscall std::string::copy(string *this,char *param_1,ulong param_2,ulong param_3)\n\n{\n  ulong uVar1;\n  ulong __n;\n  char *__src;\n  \n  uVar1 = *(ulong *)(*(long *)this + -0x18);\n  if (uVar1 < param_3) {\n                    /* WARNING: Subroutine does not return */\n    __throw_out_of_range_fmt\n              ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",param_3\n               ,uVar1);\n  }\n  __n = uVar1 - param_3;\n  if (param_2 < uVar1 - param_3) {\n    __n = param_2;\n  }\n  if (__n != 0) {\n    __src = (char *)(param_3 + *(long *)this);\n    if (__n == 1) {\n      *param_1 = *__src;\n      return 1;\n    }\n    memcpy(param_1,__src,__n);\n  }\n  return __n;\n}\n\n" comment (function_definition "size_t __thiscall std::string::copy(string *this,char *param_1,ulong param_2,ulong param_3)\n\n{\n  ulong uVar1;\n  ulong __n;\n  char *__src;\n  \n  uVar1 = *(ulong *)(*(long *)this + -0x18);\n  if (uVar1 < param_3) {\n                    /* WARNING: Subroutine does not return */\n    __throw_out_of_range_fmt\n              ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",param_3\n               ,uVar1);\n  }\n  __n = uVar1 - param_3;\n  if (param_2 < uVar1 - param_3) {\n    __n = param_2;\n  }\n  if (__n != 0) {\n    __src = (char *)(param_3 + *(long *)this);\n    if (__n == 1) {\n      *param_1 = *__src;\n      return 1;\n    }\n    memcpy(param_1,__src,__n);\n  }\n  return __n;\n}" primitive_type (ms_call_modifier "__thiscall" __thiscall) (ERROR "std::string::" identifier : : identifier : :) (function_declarator "copy(string *this,char *param_1,ulong param_2,ulong param_3)" identifier (parameter_list "(string *this,char *param_1,ulong param_2,ulong param_3)" ( (parameter_declaration "string *this" type_identifier (pointer_declarator "*this" * identifier)) , (parameter_declaration "char *param_1" primitive_type (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "ulong param_2" type_identifier identifier) , (parameter_declaration "ulong param_3" type_identifier identifier) ))) (compound_statement "{\n  ulong uVar1;\n  ulong __n;\n  char *__src;\n  \n  uVar1 = *(ulong *)(*(long *)this + -0x18);\n  if (uVar1 < param_3) {\n                    /* WARNING: Subroutine does not return */\n    __throw_out_of_range_fmt\n              ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",param_3\n               ,uVar1);\n  }\n  __n = uVar1 - param_3;\n  if (param_2 < uVar1 - param_3) {\n    __n = param_2;\n  }\n  if (__n != 0) {\n    __src = (char *)(param_3 + *(long *)this);\n    if (__n == 1) {\n      *param_1 = *__src;\n      return 1;\n    }\n    memcpy(param_1,__src,__n);\n  }\n  return __n;\n}" { (declaration "ulong uVar1;" type_identifier identifier ;) (declaration "ulong __n;" type_identifier identifier ;) (declaration "char *__src;" primitive_type (pointer_declarator "*__src" * identifier) ;) (expression_statement "uVar1 = *(ulong *)(*(long *)this + -0x18);" (assignment_expression "uVar1 = *(ulong *)(*(long *)this + -0x18)" identifier = (pointer_expression "*(ulong *)(*(long *)this + -0x18)" * (cast_expression "(ulong *)(*(long *)this + -0x18)" ( (type_descriptor "ulong *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*(long *)this + -0x18)" ( (binary_expression "*(long *)this + -0x18" (pointer_expression "*(long *)this" * (cast_expression "(long *)this" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) identifier)) + number_literal) ))))) ;) (if_statement "if (uVar1 < param_3) {\n                    /* WARNING: Subroutine does not return */\n    __throw_out_of_range_fmt\n              ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",param_3\n               ,uVar1);\n  }" if (parenthesized_expression "(uVar1 < param_3)" ( (binary_expression "uVar1 < param_3" identifier < identifier) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    __throw_out_of_range_fmt\n              ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",param_3\n               ,uVar1);\n  }" { comment (expression_statement "__throw_out_of_range_fmt\n              ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",param_3\n               ,uVar1);" (call_expression "__throw_out_of_range_fmt\n              ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",param_3\n               ,uVar1)" identifier (argument_list "("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",param_3\n               ,uVar1)" ( (string_literal ""%s: __pos (which is %zu) > this->size() (which is %zu)"" " string_content ") , (string_literal ""basic_string::copy"" " string_content ") , identifier , identifier ))) ;) })) (expression_statement "__n = uVar1 - param_3;" (assignment_expression "__n = uVar1 - param_3" identifier = (binary_expression "uVar1 - param_3" identifier - identifier)) ;) (if_statement "if (param_2 < uVar1 - param_3) {\n    __n = param_2;\n  }" if (parenthesized_expression "(param_2 < uVar1 - param_3)" ( (binary_expression "param_2 < uVar1 - param_3" identifier < (binary_expression "uVar1 - param_3" identifier - identifier)) )) (compound_statement "{\n    __n = param_2;\n  }" { (expression_statement "__n = param_2;" (assignment_expression "__n = param_2" identifier = identifier) ;) })) (if_statement "if (__n != 0) {\n    __src = (char *)(param_3 + *(long *)this);\n    if (__n == 1) {\n      *param_1 = *__src;\n      return 1;\n    }\n    memcpy(param_1,__src,__n);\n  }" if (parenthesized_expression "(__n != 0)" ( (binary_expression "__n != 0" identifier != number_literal) )) (compound_statement "{\n    __src = (char *)(param_3 + *(long *)this);\n    if (__n == 1) {\n      *param_1 = *__src;\n      return 1;\n    }\n    memcpy(param_1,__src,__n);\n  }" { (expression_statement "__src = (char *)(param_3 + *(long *)this);" (assignment_expression "__src = (char *)(param_3 + *(long *)this)" identifier = (cast_expression "(char *)(param_3 + *(long *)this)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_3 + *(long *)this)" ( (binary_expression "param_3 + *(long *)this" identifier + (pointer_expression "*(long *)this" * (cast_expression "(long *)this" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) identifier))) )))) ;) (if_statement "if (__n == 1) {\n      *param_1 = *__src;\n      return 1;\n    }" if (parenthesized_expression "(__n == 1)" ( (binary_expression "__n == 1" identifier == number_literal) )) (compound_statement "{\n      *param_1 = *__src;\n      return 1;\n    }" { (expression_statement "*param_1 = *__src;" (assignment_expression "*param_1 = *__src" (pointer_expression "*param_1" * identifier) = (pointer_expression "*__src" * identifier)) ;) (return_statement "return 1;" return number_literal ;) })) (expression_statement "memcpy(param_1,__src,__n);" (call_expression "memcpy(param_1,__src,__n)" identifier (argument_list "(param_1,__src,__n)" ( identifier , identifier , identifier ))) ;) })) (return_statement "return __n;" return identifier ;) })))
(translation_unit "size_t FUN_0030cdb0(long *param_1,undefined1 *param_2,ulong param_3,ulong param_4)\n\n{\n  ulong uVar1;\n  ulong __n;\n  undefined1 *__src;\n  \n  uVar1 = *(ulong *)(*param_1 + -0x18);\n  if (uVar1 < param_4) {\n                    \n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }\n  __n = uVar1 - param_4;\n  if (param_3 < uVar1 - param_4) {\n    __n = param_3;\n  }\n  if (__n != 0) {\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }\n  return __n;\n}\n\n" (function_definition "size_t FUN_0030cdb0(long *param_1,undefined1 *param_2,ulong param_3,ulong param_4)\n\n{\n  ulong uVar1;\n  ulong __n;\n  undefined1 *__src;\n  \n  uVar1 = *(ulong *)(*param_1 + -0x18);\n  if (uVar1 < param_4) {\n                    \n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }\n  __n = uVar1 - param_4;\n  if (param_3 < uVar1 - param_4) {\n    __n = param_3;\n  }\n  if (__n != 0) {\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }\n  return __n;\n}" primitive_type (function_declarator "FUN_0030cdb0(long *param_1,undefined1 *param_2,ulong param_3,ulong param_4)" identifier (parameter_list "(long *param_1,undefined1 *param_2,ulong param_3,ulong param_4)" ( (parameter_declaration "long *param_1" (sized_type_specifier "long" long) (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "undefined1 *param_2" type_identifier (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "ulong param_3" type_identifier identifier) , (parameter_declaration "ulong param_4" type_identifier identifier) ))) (compound_statement "{\n  ulong uVar1;\n  ulong __n;\n  undefined1 *__src;\n  \n  uVar1 = *(ulong *)(*param_1 + -0x18);\n  if (uVar1 < param_4) {\n                    \n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }\n  __n = uVar1 - param_4;\n  if (param_3 < uVar1 - param_4) {\n    __n = param_3;\n  }\n  if (__n != 0) {\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }\n  return __n;\n}" { (declaration "ulong uVar1;" type_identifier identifier ;) (declaration "ulong __n;" type_identifier identifier ;) (declaration "undefined1 *__src;" type_identifier (pointer_declarator "*__src" * identifier) ;) (expression_statement "uVar1 = *(ulong *)(*param_1 + -0x18);" (assignment_expression "uVar1 = *(ulong *)(*param_1 + -0x18)" identifier = (pointer_expression "*(ulong *)(*param_1 + -0x18)" * (cast_expression "(ulong *)(*param_1 + -0x18)" ( (type_descriptor "ulong *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*param_1 + -0x18)" ( (binary_expression "*param_1 + -0x18" (pointer_expression "*param_1" * identifier) + number_literal) ))))) ;) (if_statement "if (uVar1 < param_4) {\n                    \n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }" if (parenthesized_expression "(uVar1 < param_4)" ( (binary_expression "uVar1 < param_4" identifier < identifier) )) (compound_statement "{\n                    \n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }" { (expression_statement "FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);" (call_expression "FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1)" identifier (argument_list "("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1)" ( (string_literal ""%s: __pos (which is %zu) > this->size() (which is %zu)"" " string_content ") , (string_literal ""basic_string::copy"" " string_content ") , identifier , identifier ))) ;) })) (expression_statement "__n = uVar1 - param_4;" (assignment_expression "__n = uVar1 - param_4" identifier = (binary_expression "uVar1 - param_4" identifier - identifier)) ;) (if_statement "if (param_3 < uVar1 - param_4) {\n    __n = param_3;\n  }" if (parenthesized_expression "(param_3 < uVar1 - param_4)" ( (binary_expression "param_3 < uVar1 - param_4" identifier < (binary_expression "uVar1 - param_4" identifier - identifier)) )) (compound_statement "{\n    __n = param_3;\n  }" { (expression_statement "__n = param_3;" (assignment_expression "__n = param_3" identifier = identifier) ;) })) (if_statement "if (__n != 0) {\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }" if (parenthesized_expression "(__n != 0)" ( (binary_expression "__n != 0" identifier != number_literal) )) (compound_statement "{\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }" { (expression_statement "__src = (undefined1 *)(param_4 + *param_1);" (assignment_expression "__src = (undefined1 *)(param_4 + *param_1)" identifier = (cast_expression "(undefined1 *)(param_4 + *param_1)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_4 + *param_1)" ( (binary_expression "param_4 + *param_1" identifier + (pointer_expression "*param_1" * identifier)) )))) ;) (if_statement "if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }" if (parenthesized_expression "(__n == 1)" ( (binary_expression "__n == 1" identifier == number_literal) )) (compound_statement "{\n      *param_2 = *__src;\n      return 1;\n    }" { (expression_statement "*param_2 = *__src;" (assignment_expression "*param_2 = *__src" (pointer_expression "*param_2" * identifier) = (pointer_expression "*__src" * identifier)) ;) (return_statement "return 1;" return number_literal ;) })) (expression_statement "memcpy(param_2,__src,__n);" (call_expression "memcpy(param_2,__src,__n)" identifier (argument_list "(param_2,__src,__n)" ( identifier , identifier , identifier ))) ;) })) (return_statement "return __n;" return identifier ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration (sized_type_specifier long) (pointer_declarator * IDENT)) , (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) + LIT) ))))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < IDENT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (string_literal " string_content ") , (string_literal " string_content ") , IDENT , IDENT ))) ;) })) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < (binary_expression IDENT - IDENT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = IDENT) ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + (pointer_expression * IDENT)) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression (pointer_expression * IDENT) = (pointer_expression * IDENT)) ;) (return_statement return LIT ;) })) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT ))) ;) })) (return_statement return IDENT ;) })))
(function_definition "size_t FUN_0030cdb0(long *param_1,undefined1 *param_2,ulong param_3,ulong param_4)\n\n{\n  ulong uVar1;\n  ulong __n;\n  undefined1 *__src;\n  \n  uVar1 = *(ulong *)(*param_1 + -0x18);\n  if (uVar1 < param_4) {\n                    \n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }\n  __n = uVar1 - param_4;\n  if (param_3 < uVar1 - param_4) {\n    __n = param_3;\n  }\n  if (__n != 0) {\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }\n  return __n;\n}" (primitive_type "size_t") (function_declarator "FUN_0030cdb0(long *param_1,undefined1 *param_2,ulong param_3,ulong param_4)" (identifier "FUN_0030cdb0") (parameter_list "(long *param_1,undefined1 *param_2,ulong param_3,ulong param_4)" (( "(") (parameter_declaration "long *param_1" (sized_type_specifier "long" (long "long")) (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "undefined1 *param_2" (type_identifier "undefined1") (pointer_declarator "*param_2" (* "*") (identifier "param_2"))) (, ",") (parameter_declaration "ulong param_3" (type_identifier "ulong") (identifier "param_3")) (, ",") (parameter_declaration "ulong param_4" (type_identifier "ulong") (identifier "param_4")) () ")"))) (compound_statement "{\n  ulong uVar1;\n  ulong __n;\n  undefined1 *__src;\n  \n  uVar1 = *(ulong *)(*param_1 + -0x18);\n  if (uVar1 < param_4) {\n                    \n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }\n  __n = uVar1 - param_4;\n  if (param_3 < uVar1 - param_4) {\n    __n = param_3;\n  }\n  if (__n != 0) {\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }\n  return __n;\n}" ({ "{") (declaration "ulong uVar1;" (type_identifier "ulong") (identifier "uVar1") (; ";")) (declaration "ulong __n;" (type_identifier "ulong") (identifier "__n") (; ";")) (declaration "undefined1 *__src;" (type_identifier "undefined1") (pointer_declarator "*__src" (* "*") (identifier "__src")) (; ";")) (expression_statement "uVar1 = *(ulong *)(*param_1 + -0x18);" (assignment_expression "uVar1 = *(ulong *)(*param_1 + -0x18)" (identifier "uVar1") (= "=") (pointer_expression "*(ulong *)(*param_1 + -0x18)" (* "*") (cast_expression "(ulong *)(*param_1 + -0x18)" (( "(") (type_descriptor "ulong *" (type_identifier "ulong") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(*param_1 + -0x18)" (( "(") (binary_expression "*param_1 + -0x18" (pointer_expression "*param_1" (* "*") (identifier "param_1")) (+ "+") (number_literal "-0x18")) () ")"))))) (; ";")) (if_statement "if (uVar1 < param_4) {\n                    \n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }" (if "if") (parenthesized_expression "(uVar1 < param_4)" (( "(") (binary_expression "uVar1 < param_4" (identifier "uVar1") (< "<") (identifier "param_4")) () ")")) (compound_statement "{\n                    \n    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);\n  }" ({ "{") (expression_statement "FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1);" (call_expression "FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1)" (identifier "FUN_00319620") (argument_list "("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",\n                 param_4,uVar1)" (( "(") (string_literal ""%s: __pos (which is %zu) > this->size() (which is %zu)"" (" """) (string_content "%s: __pos (which is %zu) > this->size() (which is %zu)") (" """)) (, ",") (string_literal ""basic_string::copy"" (" """) (string_content "basic_string::copy") (" """)) (, ",") (identifier "param_4") (, ",") (identifier "uVar1") () ")"))) (; ";")) (} "}"))) (expression_statement "__n = uVar1 - param_4;" (assignment_expression "__n = uVar1 - param_4" (identifier "__n") (= "=") (binary_expression "uVar1 - param_4" (identifier "uVar1") (- "-") (identifier "param_4"))) (; ";")) (if_statement "if (param_3 < uVar1 - param_4) {\n    __n = param_3;\n  }" (if "if") (parenthesized_expression "(param_3 < uVar1 - param_4)" (( "(") (binary_expression "param_3 < uVar1 - param_4" (identifier "param_3") (< "<") (binary_expression "uVar1 - param_4" (identifier "uVar1") (- "-") (identifier "param_4"))) () ")")) (compound_statement "{\n    __n = param_3;\n  }" ({ "{") (expression_statement "__n = param_3;" (assignment_expression "__n = param_3" (identifier "__n") (= "=") (identifier "param_3")) (; ";")) (} "}"))) (if_statement "if (__n != 0) {\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }" (if "if") (parenthesized_expression "(__n != 0)" (( "(") (binary_expression "__n != 0" (identifier "__n") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    __src = (undefined1 *)(param_4 + *param_1);\n    if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }\n    memcpy(param_2,__src,__n);\n  }" ({ "{") (expression_statement "__src = (undefined1 *)(param_4 + *param_1);" (assignment_expression "__src = (undefined1 *)(param_4 + *param_1)" (identifier "__src") (= "=") (cast_expression "(undefined1 *)(param_4 + *param_1)" (( "(") (type_descriptor "undefined1 *" (type_identifier "undefined1") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_4 + *param_1)" (( "(") (binary_expression "param_4 + *param_1" (identifier "param_4") (+ "+") (pointer_expression "*param_1" (* "*") (identifier "param_1"))) () ")")))) (; ";")) (if_statement "if (__n == 1) {\n      *param_2 = *__src;\n      return 1;\n    }" (if "if") (parenthesized_expression "(__n == 1)" (( "(") (binary_expression "__n == 1" (identifier "__n") (== "==") (number_literal "1")) () ")")) (compound_statement "{\n      *param_2 = *__src;\n      return 1;\n    }" ({ "{") (expression_statement "*param_2 = *__src;" (assignment_expression "*param_2 = *__src" (pointer_expression "*param_2" (* "*") (identifier "param_2")) (= "=") (pointer_expression "*__src" (* "*") (identifier "__src"))) (; ";")) (return_statement "return 1;" (return "return") (number_literal "1") (; ";")) (} "}"))) (expression_statement "memcpy(param_2,__src,__n);" (call_expression "memcpy(param_2,__src,__n)" (identifier "memcpy") (argument_list "(param_2,__src,__n)" (( "(") (identifier "param_2") (, ",") (identifier "__src") (, ",") (identifier "__n") () ")"))) (; ";")) (} "}"))) (return_statement "return __n;" (return "return") (identifier "__n") (; ";")) (} "}")))

/* std::string::copy(char*, unsigned long, unsigned long) const */

size_t __thiscall std::type_1::function_1(type_1 *this,char *param_1,type_2 var_4,type_2 var_2)

{
  type_2 var_1;
  type_2 var_5;
  char *__src;
  
  var_1 = *(type_2 *)(*(long *)this + -0x18);
  if (var_1 < var_2) {
                    /* WARNING: Subroutine does not return */
    var_3
              ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",var_2
               ,var_1);
  }
  var_5 = var_1 - var_2;
  if (var_4 < var_1 - var_2) {
    var_5 = var_4;
  }
  if (var_5 != 0) {
    __src = (char *)(var_2 + *(long *)this);
    if (var_5 == 1) {
      *param_1 = *__src;
      return 1;
    }
    var_6(param_1,__src,var_5);
  }
  return var_5;
}


(translation_unit (function_definition type: (primitive_type) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (sized_type_specifier) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier)))) body: (compound_statement (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (pointer_expression argument: (identifier)) right: (number_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (compound_statement (expression_statement (call_expression function: (identifier) arguments: (argument_list (string_literal (string_content)) (string_literal (string_content)) (identifier) (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (pointer_expression argument: (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (pointer_expression argument: (identifier)))) (return_statement (number_literal)))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (identifier)))))) (return_statement (identifier)))))

size_t MASKED(long *param_1,undefined1 *param_2,ulong param_3,ulong param_4)

{
  ulong uVar1;
  ulong __n;
  undefined1 *__src;
  
  uVar1 = *(ulong *)(*param_1 + -0x18);
  if (uVar1 < param_4) {
                    /* WARNING: Subroutine does not return */
    FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::copy",
                 param_4,uVar1);
  }
  __n = uVar1 - param_4;
  if (param_3 < uVar1 - param_4) {
    __n = param_3;
  }
  if (__n != 0) {
    __src = (undefined1 *)(param_4 + *param_1);
    if (__n == 1) {
      *param_2 = *__src;
      return 1;
    }
    memcpy(param_2,__src,__n);
  }
  return __n;
}

