
ulong chacha20_prng_read(uchar *out,ulong outlen,prng_state *prng)

{
  int iVar1;
  
  if (((prng != (prng_state *)0x0 && out != (uchar *)0x0) && (outlen != 0)) && (prng->ready != 0)) {
    iVar1 = chacha_keystream((chacha_state *)prng,out,outlen);
    if (iVar1 != 0) {
      outlen = 0;
    }
    return outlen;
  }
  return 0;
}



long chacha20_prng_read(long param_1,long param_2,long param_3)

{
  int iVar1;
  
  if (((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)) {
    iVar1 = chacha_keystream(param_3,param_1,param_2);
    if (iVar1 != 0) {
      param_2 = 0;
    }
    return param_2;
  }
  return 0;
}


TEST RDX,RDX
SETZ CL
TEST RDI,RDI
SETZ AL
OR CL,AL
JNZ 0x001946cf
TEST RSI,RSI
JZ 0x001946cf
CMP word ptr [RDX + 0x44f0],0x0
JNZ 0x001946d8
XOR EAX,EAX
RET
PUSH RBX
MOV R8,RDX
MOV RBX,RSI
MOV RSI,RDI
MOV RDX,RBX
MOV RDI,R8
CALL 0x00113fa0
MOV EDX,EAX
MOV RAX,RBX
TEST EDX,EDX
JZ 0x001946f8
XOR EAX,EAX
POP RBX
RET
(translation_unit "long chacha20_prng_read(long param_1,long param_2,long param_3)\n\n{\n  int iVar1;\n  \n  if (((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)) {\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }\n  return 0;\n}\n\n" (function_definition "long chacha20_prng_read(long param_1,long param_2,long param_3)\n\n{\n  int iVar1;\n  \n  if (((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)) {\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }\n  return 0;\n}" (sized_type_specifier "long" long) (function_declarator "chacha20_prng_read(long param_1,long param_2,long param_3)" identifier (parameter_list "(long param_1,long param_2,long param_3)" ( (parameter_declaration "long param_1" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_2" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_3" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  int iVar1;\n  \n  if (((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)) {\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }\n  return 0;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (if_statement "if (((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)) {\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }" if (parenthesized_expression "(((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0))" ( (binary_expression "((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)" (parenthesized_expression "((param_3 != 0 && param_1 != 0) && (param_2 != 0))" ( (binary_expression "(param_3 != 0 && param_1 != 0) && (param_2 != 0)" (parenthesized_expression "(param_3 != 0 && param_1 != 0)" ( (binary_expression "param_3 != 0 && param_1 != 0" (binary_expression "param_3 != 0" identifier != number_literal) && (binary_expression "param_1 != 0" identifier != number_literal)) )) && (parenthesized_expression "(param_2 != 0)" ( (binary_expression "param_2 != 0" identifier != number_literal) ))) )) && (parenthesized_expression "(*(short *)(param_3 + 0x44f0) != 0)" ( (binary_expression "*(short *)(param_3 + 0x44f0) != 0" (pointer_expression "*(short *)(param_3 + 0x44f0)" * (cast_expression "(short *)(param_3 + 0x44f0)" ( (type_descriptor "short *" (sized_type_specifier "short" short) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_3 + 0x44f0)" ( (binary_expression "param_3 + 0x44f0" identifier + number_literal) )))) != number_literal) ))) )) (compound_statement "{\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }" { (expression_statement "iVar1 = chacha_keystream(param_3,param_1,param_2);" (assignment_expression "iVar1 = chacha_keystream(param_3,param_1,param_2)" identifier = (call_expression "chacha_keystream(param_3,param_1,param_2)" identifier (argument_list "(param_3,param_1,param_2)" ( identifier , identifier , identifier )))) ;) (if_statement "if (iVar1 != 0) {\n      param_2 = 0;\n    }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n      param_2 = 0;\n    }" { (expression_statement "param_2 = 0;" (assignment_expression "param_2 = 0" identifier = number_literal) ;) })) (return_statement "return param_2;" return identifier ;) })) (return_statement "return 0;" return number_literal ;) })))
(translation_unit "ulong chacha20_prng_read(uchar *out,ulong outlen,prng_state *prng)\n\n{\n  int iVar1;\n  \n  if (((prng != (prng_state *)0x0 && out != (uchar *)0x0) && (outlen != 0)) && (prng->ready != 0)) {\n    iVar1 = chacha_keystream((chacha_state *)prng,out,outlen);\n    if (iVar1 != 0) {\n      outlen = 0;\n    }\n    return outlen;\n  }\n  return 0;\n}\n\n" (function_definition "ulong chacha20_prng_read(uchar *out,ulong outlen,prng_state *prng)\n\n{\n  int iVar1;\n  \n  if (((prng != (prng_state *)0x0 && out != (uchar *)0x0) && (outlen != 0)) && (prng->ready != 0)) {\n    iVar1 = chacha_keystream((chacha_state *)prng,out,outlen);\n    if (iVar1 != 0) {\n      outlen = 0;\n    }\n    return outlen;\n  }\n  return 0;\n}" type_identifier (function_declarator "chacha20_prng_read(uchar *out,ulong outlen,prng_state *prng)" identifier (parameter_list "(uchar *out,ulong outlen,prng_state *prng)" ( (parameter_declaration "uchar *out" type_identifier (pointer_declarator "*out" * identifier)) , (parameter_declaration "ulong outlen" type_identifier identifier) , (parameter_declaration "prng_state *prng" type_identifier (pointer_declarator "*prng" * identifier)) ))) (compound_statement "{\n  int iVar1;\n  \n  if (((prng != (prng_state *)0x0 && out != (uchar *)0x0) && (outlen != 0)) && (prng->ready != 0)) {\n    iVar1 = chacha_keystream((chacha_state *)prng,out,outlen);\n    if (iVar1 != 0) {\n      outlen = 0;\n    }\n    return outlen;\n  }\n  return 0;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (if_statement "if (((prng != (prng_state *)0x0 && out != (uchar *)0x0) && (outlen != 0)) && (prng->ready != 0)) {\n    iVar1 = chacha_keystream((chacha_state *)prng,out,outlen);\n    if (iVar1 != 0) {\n      outlen = 0;\n    }\n    return outlen;\n  }" if (parenthesized_expression "(((prng != (prng_state *)0x0 && out != (uchar *)0x0) && (outlen != 0)) && (prng->ready != 0))" ( (binary_expression "((prng != (prng_state *)0x0 && out != (uchar *)0x0) && (outlen != 0)) && (prng->ready != 0)" (parenthesized_expression "((prng != (prng_state *)0x0 && out != (uchar *)0x0) && (outlen != 0))" ( (binary_expression "(prng != (prng_state *)0x0 && out != (uchar *)0x0) && (outlen != 0)" (parenthesized_expression "(prng != (prng_state *)0x0 && out != (uchar *)0x0)" ( (binary_expression "prng != (prng_state *)0x0 && out != (uchar *)0x0" (binary_expression "prng != (prng_state *)0x0" identifier != (cast_expression "(prng_state *)0x0" ( (type_descriptor "prng_state *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) && (binary_expression "out != (uchar *)0x0" identifier != (cast_expression "(uchar *)0x0" ( (type_descriptor "uchar *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal))) )) && (parenthesized_expression "(outlen != 0)" ( (binary_expression "outlen != 0" identifier != number_literal) ))) )) && (parenthesized_expression "(prng->ready != 0)" ( (binary_expression "prng->ready != 0" (field_expression "prng->ready" identifier -> field_identifier) != number_literal) ))) )) (compound_statement "{\n    iVar1 = chacha_keystream((chacha_state *)prng,out,outlen);\n    if (iVar1 != 0) {\n      outlen = 0;\n    }\n    return outlen;\n  }" { (expression_statement "iVar1 = chacha_keystream((chacha_state *)prng,out,outlen);" (assignment_expression "iVar1 = chacha_keystream((chacha_state *)prng,out,outlen)" identifier = (call_expression "chacha_keystream((chacha_state *)prng,out,outlen)" identifier (argument_list "((chacha_state *)prng,out,outlen)" ( (cast_expression "(chacha_state *)prng" ( (type_descriptor "chacha_state *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier) , identifier , identifier )))) ;) (if_statement "if (iVar1 != 0) {\n      outlen = 0;\n    }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n      outlen = 0;\n    }" { (expression_statement "outlen = 0;" (assignment_expression "outlen = 0" identifier = number_literal) ;) })) (return_statement "return outlen;" return identifier ;) })) (return_statement "return 0;" return number_literal ;) })))
(translation_unit "long chacha20_prng_read(long param_1,long param_2,long param_3)\n\n{\n  int iVar1;\n  \n  if (((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)) {\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }\n  return 0;\n}\n\n" (function_definition "long chacha20_prng_read(long param_1,long param_2,long param_3)\n\n{\n  int iVar1;\n  \n  if (((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)) {\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }\n  return 0;\n}" (sized_type_specifier "long" long) (function_declarator "chacha20_prng_read(long param_1,long param_2,long param_3)" identifier (parameter_list "(long param_1,long param_2,long param_3)" ( (parameter_declaration "long param_1" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_2" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_3" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  int iVar1;\n  \n  if (((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)) {\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }\n  return 0;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (if_statement "if (((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)) {\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }" if (parenthesized_expression "(((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0))" ( (binary_expression "((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)" (parenthesized_expression "((param_3 != 0 && param_1 != 0) && (param_2 != 0))" ( (binary_expression "(param_3 != 0 && param_1 != 0) && (param_2 != 0)" (parenthesized_expression "(param_3 != 0 && param_1 != 0)" ( (binary_expression "param_3 != 0 && param_1 != 0" (binary_expression "param_3 != 0" identifier != number_literal) && (binary_expression "param_1 != 0" identifier != number_literal)) )) && (parenthesized_expression "(param_2 != 0)" ( (binary_expression "param_2 != 0" identifier != number_literal) ))) )) && (parenthesized_expression "(*(short *)(param_3 + 0x44f0) != 0)" ( (binary_expression "*(short *)(param_3 + 0x44f0) != 0" (pointer_expression "*(short *)(param_3 + 0x44f0)" * (cast_expression "(short *)(param_3 + 0x44f0)" ( (type_descriptor "short *" (sized_type_specifier "short" short) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_3 + 0x44f0)" ( (binary_expression "param_3 + 0x44f0" identifier + number_literal) )))) != number_literal) ))) )) (compound_statement "{\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }" { (expression_statement "iVar1 = chacha_keystream(param_3,param_1,param_2);" (assignment_expression "iVar1 = chacha_keystream(param_3,param_1,param_2)" identifier = (call_expression "chacha_keystream(param_3,param_1,param_2)" identifier (argument_list "(param_3,param_1,param_2)" ( identifier , identifier , identifier )))) ;) (if_statement "if (iVar1 != 0) {\n      param_2 = 0;\n    }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n      param_2 = 0;\n    }" { (expression_statement "param_2 = 0;" (assignment_expression "param_2 = 0" identifier = number_literal) ;) })) (return_statement "return param_2;" return identifier ;) })) (return_statement "return 0;" return number_literal ;) })))
(translation_unit (function_definition (sized_type_specifier long) (function_declarator IDENT (parameter_list ( (parameter_declaration (sized_type_specifier long) IDENT) , (parameter_declaration (sized_type_specifier long) IDENT) , (parameter_declaration (sized_type_specifier long) IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (binary_expression IDENT != LIT) && (binary_expression IDENT != LIT)) )) && (parenthesized_expression ( (binary_expression IDENT != LIT) ))) )) && (parenthesized_expression ( (binary_expression (pointer_expression * (cast_expression ( (type_descriptor (sized_type_specifier short) (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) != LIT) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) })) (return_statement return IDENT ;) })) (return_statement return LIT ;) })))
(function_definition "long chacha20_prng_read(long param_1,long param_2,long param_3)\n\n{\n  int iVar1;\n  \n  if (((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)) {\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }\n  return 0;\n}" (sized_type_specifier "long" (long "long")) (function_declarator "chacha20_prng_read(long param_1,long param_2,long param_3)" (identifier "chacha20_prng_read") (parameter_list "(long param_1,long param_2,long param_3)" (( "(") (parameter_declaration "long param_1" (sized_type_specifier "long" (long "long")) (identifier "param_1")) (, ",") (parameter_declaration "long param_2" (sized_type_specifier "long" (long "long")) (identifier "param_2")) (, ",") (parameter_declaration "long param_3" (sized_type_specifier "long" (long "long")) (identifier "param_3")) () ")"))) (compound_statement "{\n  int iVar1;\n  \n  if (((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)) {\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }\n  return 0;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (if_statement "if (((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)) {\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }" (if "if") (parenthesized_expression "(((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0))" (( "(") (binary_expression "((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)" (parenthesized_expression "((param_3 != 0 && param_1 != 0) && (param_2 != 0))" (( "(") (binary_expression "(param_3 != 0 && param_1 != 0) && (param_2 != 0)" (parenthesized_expression "(param_3 != 0 && param_1 != 0)" (( "(") (binary_expression "param_3 != 0 && param_1 != 0" (binary_expression "param_3 != 0" (identifier "param_3") (!= "!=") (number_literal "0")) (&& "&&") (binary_expression "param_1 != 0" (identifier "param_1") (!= "!=") (number_literal "0"))) () ")")) (&& "&&") (parenthesized_expression "(param_2 != 0)" (( "(") (binary_expression "param_2 != 0" (identifier "param_2") (!= "!=") (number_literal "0")) () ")"))) () ")")) (&& "&&") (parenthesized_expression "(*(short *)(param_3 + 0x44f0) != 0)" (( "(") (binary_expression "*(short *)(param_3 + 0x44f0) != 0" (pointer_expression "*(short *)(param_3 + 0x44f0)" (* "*") (cast_expression "(short *)(param_3 + 0x44f0)" (( "(") (type_descriptor "short *" (sized_type_specifier "short" (short "short")) (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_3 + 0x44f0)" (( "(") (binary_expression "param_3 + 0x44f0" (identifier "param_3") (+ "+") (number_literal "0x44f0")) () ")")))) (!= "!=") (number_literal "0")) () ")"))) () ")")) (compound_statement "{\n    iVar1 = chacha_keystream(param_3,param_1,param_2);\n    if (iVar1 != 0) {\n      param_2 = 0;\n    }\n    return param_2;\n  }" ({ "{") (expression_statement "iVar1 = chacha_keystream(param_3,param_1,param_2);" (assignment_expression "iVar1 = chacha_keystream(param_3,param_1,param_2)" (identifier "iVar1") (= "=") (call_expression "chacha_keystream(param_3,param_1,param_2)" (identifier "chacha_keystream") (argument_list "(param_3,param_1,param_2)" (( "(") (identifier "param_3") (, ",") (identifier "param_1") (, ",") (identifier "param_2") () ")")))) (; ";")) (if_statement "if (iVar1 != 0) {\n      param_2 = 0;\n    }" (if "if") (parenthesized_expression "(iVar1 != 0)" (( "(") (binary_expression "iVar1 != 0" (identifier "iVar1") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n      param_2 = 0;\n    }" ({ "{") (expression_statement "param_2 = 0;" (assignment_expression "param_2 = 0" (identifier "param_2") (= "=") (number_literal "0")) (; ";")) (} "}"))) (return_statement "return param_2;" (return "return") (identifier "param_2") (; ";")) (} "}"))) (return_statement "return 0;" (return "return") (number_literal "0") (; ";")) (} "}")))

type_1 function_1(type_2 *var_2,type_1 var_3,type_3 *var_1)

{
  int var_5;
  
  if (((var_1 != (type_3 *)0x0 && var_2 != (type_2 *)0x0) && (var_3 != 0)) && (var_1->ready != 0)) {
    var_5 = var_4((type_4 *)var_1,var_2,var_3);
    if (var_5 != 0) {
      var_3 = 0;
    }
    return var_3;
  }
  return 0;
}


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

long MASKED(long param_1,long param_2,long param_3)

{
  int iVar1;
  
  if (((param_3 != 0 && param_1 != 0) && (param_2 != 0)) && (*(short *)(param_3 + 0x44f0) != 0)) {
    iVar1 = chacha_keystream(param_3,param_1,param_2);
    if (iVar1 != 0) {
      param_2 = 0;
    }
    return param_2;
  }
  return 0;
}

