
/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* WARNING: Unknown calling convention */

int give_terminal_to(pid_t pgrp,int force)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  int *piVar4;
  int in_GS_OFFSET;
  sigset_t set;
  sigset_t oset;
  
  iVar1 = *(int *)(in_GS_OFFSET + 0x14);
  uVar2 = force | job_control;
  if (uVar2 != 0) {
    sigemptyset((sigset_t *)&set);
    sigaddset((sigset_t *)&set,0x16);
    sigaddset((sigset_t *)&set,0x15);
    sigaddset((sigset_t *)&set,0x14);
    sigaddset((sigset_t *)&set,0x11);
    sigemptyset((sigset_t *)&oset);
    sigprocmask(0,(sigset_t *)&set,(sigset_t *)&oset);
    iVar3 = tcsetpgrp(shell_tty,pgrp);
    if (iVar3 < 0) {
      piVar4 = __errno_location();
      iVar3 = *piVar4;
      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);
      *piVar4 = iVar3;
      uVar2 = 0xffffffff;
    }
    else {
      terminal_pgrp = pgrp;
      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);
      uVar2 = 0;
    }
  }
  if (iVar1 == *(int *)(in_GS_OFFSET + 0x14)) {
    return uVar2;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail_local();
}



/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

uint give_terminal_to(__pid_t param_1,uint param_2)

{
  int iVar1;
  int *piVar2;
  int in_GS_OFFSET;
  sigset_t local_120;
  sigset_t local_a0;
  int local_20;
  undefined4 uStack_14;
  
  uStack_14 = 0x60ad9;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  param_2 = param_2 | job_control;
  if (param_2 != 0) {
    sigemptyset(&local_120);
    sigaddset(&local_120,0x16);
    sigaddset(&local_120,0x15);
    sigaddset(&local_120,0x14);
    sigaddset(&local_120,0x11);
    sigemptyset(&local_a0);
    sigprocmask(0,&local_120,&local_a0);
    iVar1 = tcsetpgrp(shell_tty,param_1);
    if (iVar1 < 0) {
      piVar2 = __errno_location();
      iVar1 = *piVar2;
      sigprocmask(2,&local_a0,(sigset_t *)0x0);
      *piVar2 = iVar1;
      param_2 = 0xffffffff;
    }
    else {
      terminal_pgrp = param_1;
      sigprocmask(2,&local_a0,(sigset_t *)0x0);
      param_2 = 0;
    }
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return param_2;
  }
                    /* WARNING: Subroutine does not return */
  FUN_000ecc40();
}


PUSH EBP
PUSH EDI
PUSH ESI
PUSH EBX
CALL 0x00031ed0
ADD EBX,0xe9527
SUB ESP,0x11c
MOV EDX,dword ptr GS:[0x14]
MOV dword ptr [ESP + 0x10c],EDX
XOR EDX,EDX
MOV EAX,dword ptr [ESP + 0x134]
OR EAX,dword ptr [EBX + 0x78c]
JNZ 0x00060b28
MOV ECX,dword ptr [ESP + 0x10c]
XOR ECX,dword ptr GS:[0x14]
JNZ 0x00060be5
ADD ESP,0x11c
POP EBX
POP ESI
POP EDI
POP EBP
RET
SUB ESP,0xc
LEA ESI,[ESP + 0x18]
PUSH ESI
CALL 0x0002fa40
POP EAX
POP EDX
PUSH 0x16
PUSH ESI
CALL 0x0002f810
POP ECX
POP EDI
PUSH 0x15
PUSH ESI
CALL 0x0002f810
POP EBP
POP EAX
PUSH 0x14
PUSH ESI
CALL 0x0002f810
POP EAX
POP EDX
PUSH 0x11
PUSH ESI
CALL 0x0002f810
POP ECX
LEA EDI,[ESP + 0x98]
PUSH EDI
CALL 0x0002fa40
ADD ESP,0xc
PUSH EDI
PUSH ESI
PUSH 0x0
CALL 0x0002f1a0
POP ESI
POP EBP
PUSH dword ptr [ESP + 0x138]
PUSH dword ptr [EBX + 0x7ac]
CALL 0x0002f260
ADD ESP,0x10
TEST EAX,EAX
JS 0x00060bc0
MOV EAX,dword ptr [ESP + 0x130]
SUB ESP,0x4
PUSH 0x0
PUSH EDI
PUSH 0x2
MOV dword ptr [EBX + 0x7a4],EAX
CALL 0x0002f1a0
ADD ESP,0x10
XOR EAX,EAX
JMP 0x00060b04
CALL 0x0002f8b0
SUB ESP,0x4
MOV EBP,dword ptr [EAX]
PUSH 0x0
MOV ESI,EAX
PUSH EDI
PUSH 0x2
CALL 0x0002f1a0
MOV dword ptr [ESI],EBP
ADD ESP,0x10
MOV EAX,0xffffffff
JMP 0x00060b04
CALL 0x000ecc40
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nuint give_terminal_to(__pid_t param_1,uint param_2)\n\n{\n  int iVar1;\n  int *piVar2;\n  int in_GS_OFFSET;\n  sigset_t local_120;\n  sigset_t local_a0;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x60ad9;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  param_2 = param_2 | job_control;\n  if (param_2 != 0) {\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return param_2;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_000ecc40();\n}\n\n" comment (function_definition "uint give_terminal_to(__pid_t param_1,uint param_2)\n\n{\n  int iVar1;\n  int *piVar2;\n  int in_GS_OFFSET;\n  sigset_t local_120;\n  sigset_t local_a0;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x60ad9;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  param_2 = param_2 | job_control;\n  if (param_2 != 0) {\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return param_2;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_000ecc40();\n}" type_identifier (function_declarator "give_terminal_to(__pid_t param_1,uint param_2)" identifier (parameter_list "(__pid_t param_1,uint param_2)" ( (parameter_declaration "__pid_t param_1" type_identifier identifier) , (parameter_declaration "uint param_2" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  int *piVar2;\n  int in_GS_OFFSET;\n  sigset_t local_120;\n  sigset_t local_a0;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x60ad9;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  param_2 = param_2 | job_control;\n  if (param_2 != 0) {\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return param_2;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_000ecc40();\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int *piVar2;" primitive_type (pointer_declarator "*piVar2" * identifier) ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "sigset_t local_120;" type_identifier identifier ;) (declaration "sigset_t local_a0;" type_identifier identifier ;) (declaration "int local_20;" primitive_type identifier ;) (declaration "undefined4 uStack_14;" type_identifier identifier ;) (expression_statement "uStack_14 = 0x60ad9;" (assignment_expression "uStack_14 = 0x60ad9" identifier = number_literal) ;) (expression_statement "local_20 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_20 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "param_2 = param_2 | job_control;" (assignment_expression "param_2 = param_2 | job_control" identifier = (binary_expression "param_2 | job_control" identifier | identifier)) ;) (if_statement "if (param_2 != 0) {\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }" if (parenthesized_expression "(param_2 != 0)" ( (binary_expression "param_2 != 0" identifier != number_literal) )) (compound_statement "{\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }" { (expression_statement "sigemptyset(&local_120);" (call_expression "sigemptyset(&local_120)" identifier (argument_list "(&local_120)" ( (pointer_expression "&local_120" & identifier) ))) ;) (expression_statement "sigaddset(&local_120,0x16);" (call_expression "sigaddset(&local_120,0x16)" identifier (argument_list "(&local_120,0x16)" ( (pointer_expression "&local_120" & identifier) , number_literal ))) ;) (expression_statement "sigaddset(&local_120,0x15);" (call_expression "sigaddset(&local_120,0x15)" identifier (argument_list "(&local_120,0x15)" ( (pointer_expression "&local_120" & identifier) , number_literal ))) ;) (expression_statement "sigaddset(&local_120,0x14);" (call_expression "sigaddset(&local_120,0x14)" identifier (argument_list "(&local_120,0x14)" ( (pointer_expression "&local_120" & identifier) , number_literal ))) ;) (expression_statement "sigaddset(&local_120,0x11);" (call_expression "sigaddset(&local_120,0x11)" identifier (argument_list "(&local_120,0x11)" ( (pointer_expression "&local_120" & identifier) , number_literal ))) ;) (expression_statement "sigemptyset(&local_a0);" (call_expression "sigemptyset(&local_a0)" identifier (argument_list "(&local_a0)" ( (pointer_expression "&local_a0" & identifier) ))) ;) (expression_statement "sigprocmask(0,&local_120,&local_a0);" (call_expression "sigprocmask(0,&local_120,&local_a0)" identifier (argument_list "(0,&local_120,&local_a0)" ( number_literal , (pointer_expression "&local_120" & identifier) , (pointer_expression "&local_a0" & identifier) ))) ;) (expression_statement "iVar1 = tcsetpgrp(shell_tty,param_1);" (assignment_expression "iVar1 = tcsetpgrp(shell_tty,param_1)" identifier = (call_expression "tcsetpgrp(shell_tty,param_1)" identifier (argument_list "(shell_tty,param_1)" ( identifier , identifier )))) ;) (if_statement "if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }" if (parenthesized_expression "(iVar1 < 0)" ( (binary_expression "iVar1 < 0" identifier < number_literal) )) (compound_statement "{\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }" { (expression_statement "piVar2 = __errno_location();" (assignment_expression "piVar2 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar1 = *piVar2;" (assignment_expression "iVar1 = *piVar2" identifier = (pointer_expression "*piVar2" * identifier)) ;) (expression_statement "sigprocmask(2,&local_a0,(sigset_t *)0x0);" (call_expression "sigprocmask(2,&local_a0,(sigset_t *)0x0)" identifier (argument_list "(2,&local_a0,(sigset_t *)0x0)" ( number_literal , (pointer_expression "&local_a0" & identifier) , (cast_expression "(sigset_t *)0x0" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ))) ;) (expression_statement "*piVar2 = iVar1;" (assignment_expression "*piVar2 = iVar1" (pointer_expression "*piVar2" * identifier) = identifier) ;) (expression_statement "param_2 = 0xffffffff;" (assignment_expression "param_2 = 0xffffffff" identifier = number_literal) ;) }) (else_clause "else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }" else (compound_statement "{\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }" { (expression_statement "terminal_pgrp = param_1;" (assignment_expression "terminal_pgrp = param_1" identifier = identifier) ;) (expression_statement "sigprocmask(2,&local_a0,(sigset_t *)0x0);" (call_expression "sigprocmask(2,&local_a0,(sigset_t *)0x0)" identifier (argument_list "(2,&local_a0,(sigset_t *)0x0)" ( number_literal , (pointer_expression "&local_a0" & identifier) , (cast_expression "(sigset_t *)0x0" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ))) ;) (expression_statement "param_2 = 0;" (assignment_expression "param_2 = 0" identifier = number_literal) ;) }))) })) (if_statement "if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return param_2;\n  }" if (parenthesized_expression "(local_20 == *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "local_20 == *(int *)(in_GS_OFFSET + 0x14)" identifier == (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) )) (compound_statement "{\n    return param_2;\n  }" { (return_statement "return param_2;" return identifier ;) })) comment (expression_statement "FUN_000ecc40();" (call_expression "FUN_000ecc40()" identifier (argument_list "()" ( ))) ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n/* WARNING: Unknown calling convention */\n\nint give_terminal_to(pid_t pgrp,int force)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  int in_GS_OFFSET;\n  sigset_t set;\n  sigset_t oset;\n  \n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  uVar2 = force | job_control;\n  if (uVar2 != 0) {\n    sigemptyset((sigset_t *)&set);\n    sigaddset((sigset_t *)&set,0x16);\n    sigaddset((sigset_t *)&set,0x15);\n    sigaddset((sigset_t *)&set,0x14);\n    sigaddset((sigset_t *)&set,0x11);\n    sigemptyset((sigset_t *)&oset);\n    sigprocmask(0,(sigset_t *)&set,(sigset_t *)&oset);\n    iVar3 = tcsetpgrp(shell_tty,pgrp);\n    if (iVar3 < 0) {\n      piVar4 = __errno_location();\n      iVar3 = *piVar4;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      *piVar4 = iVar3;\n      uVar2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = pgrp;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      uVar2 = 0;\n    }\n  }\n  if (iVar1 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar2;\n  }\n                    /* WARNING: Subroutine does not return */\n  __stack_chk_fail_local();\n}\n\n" comment comment (function_definition "int give_terminal_to(pid_t pgrp,int force)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  int in_GS_OFFSET;\n  sigset_t set;\n  sigset_t oset;\n  \n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  uVar2 = force | job_control;\n  if (uVar2 != 0) {\n    sigemptyset((sigset_t *)&set);\n    sigaddset((sigset_t *)&set,0x16);\n    sigaddset((sigset_t *)&set,0x15);\n    sigaddset((sigset_t *)&set,0x14);\n    sigaddset((sigset_t *)&set,0x11);\n    sigemptyset((sigset_t *)&oset);\n    sigprocmask(0,(sigset_t *)&set,(sigset_t *)&oset);\n    iVar3 = tcsetpgrp(shell_tty,pgrp);\n    if (iVar3 < 0) {\n      piVar4 = __errno_location();\n      iVar3 = *piVar4;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      *piVar4 = iVar3;\n      uVar2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = pgrp;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      uVar2 = 0;\n    }\n  }\n  if (iVar1 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar2;\n  }\n                    /* WARNING: Subroutine does not return */\n  __stack_chk_fail_local();\n}" primitive_type (function_declarator "give_terminal_to(pid_t pgrp,int force)" identifier (parameter_list "(pid_t pgrp,int force)" ( (parameter_declaration "pid_t pgrp" type_identifier identifier) , (parameter_declaration "int force" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  int in_GS_OFFSET;\n  sigset_t set;\n  sigset_t oset;\n  \n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  uVar2 = force | job_control;\n  if (uVar2 != 0) {\n    sigemptyset((sigset_t *)&set);\n    sigaddset((sigset_t *)&set,0x16);\n    sigaddset((sigset_t *)&set,0x15);\n    sigaddset((sigset_t *)&set,0x14);\n    sigaddset((sigset_t *)&set,0x11);\n    sigemptyset((sigset_t *)&oset);\n    sigprocmask(0,(sigset_t *)&set,(sigset_t *)&oset);\n    iVar3 = tcsetpgrp(shell_tty,pgrp);\n    if (iVar3 < 0) {\n      piVar4 = __errno_location();\n      iVar3 = *piVar4;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      *piVar4 = iVar3;\n      uVar2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = pgrp;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      uVar2 = 0;\n    }\n  }\n  if (iVar1 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar2;\n  }\n                    /* WARNING: Subroutine does not return */\n  __stack_chk_fail_local();\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int *piVar4;" primitive_type (pointer_declarator "*piVar4" * identifier) ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "sigset_t set;" type_identifier identifier ;) (declaration "sigset_t oset;" type_identifier identifier ;) (expression_statement "iVar1 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "iVar1 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "uVar2 = force | job_control;" (assignment_expression "uVar2 = force | job_control" identifier = (binary_expression "force | job_control" identifier | identifier)) ;) (if_statement "if (uVar2 != 0) {\n    sigemptyset((sigset_t *)&set);\n    sigaddset((sigset_t *)&set,0x16);\n    sigaddset((sigset_t *)&set,0x15);\n    sigaddset((sigset_t *)&set,0x14);\n    sigaddset((sigset_t *)&set,0x11);\n    sigemptyset((sigset_t *)&oset);\n    sigprocmask(0,(sigset_t *)&set,(sigset_t *)&oset);\n    iVar3 = tcsetpgrp(shell_tty,pgrp);\n    if (iVar3 < 0) {\n      piVar4 = __errno_location();\n      iVar3 = *piVar4;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      *piVar4 = iVar3;\n      uVar2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = pgrp;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      uVar2 = 0;\n    }\n  }" if (parenthesized_expression "(uVar2 != 0)" ( (binary_expression "uVar2 != 0" identifier != number_literal) )) (compound_statement "{\n    sigemptyset((sigset_t *)&set);\n    sigaddset((sigset_t *)&set,0x16);\n    sigaddset((sigset_t *)&set,0x15);\n    sigaddset((sigset_t *)&set,0x14);\n    sigaddset((sigset_t *)&set,0x11);\n    sigemptyset((sigset_t *)&oset);\n    sigprocmask(0,(sigset_t *)&set,(sigset_t *)&oset);\n    iVar3 = tcsetpgrp(shell_tty,pgrp);\n    if (iVar3 < 0) {\n      piVar4 = __errno_location();\n      iVar3 = *piVar4;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      *piVar4 = iVar3;\n      uVar2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = pgrp;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      uVar2 = 0;\n    }\n  }" { (expression_statement "sigemptyset((sigset_t *)&set);" (call_expression "sigemptyset((sigset_t *)&set)" identifier (argument_list "((sigset_t *)&set)" ( (cast_expression "(sigset_t *)&set" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&set" & identifier)) ))) ;) (expression_statement "sigaddset((sigset_t *)&set,0x16);" (call_expression "sigaddset((sigset_t *)&set,0x16)" identifier (argument_list "((sigset_t *)&set,0x16)" ( (cast_expression "(sigset_t *)&set" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&set" & identifier)) , number_literal ))) ;) (expression_statement "sigaddset((sigset_t *)&set,0x15);" (call_expression "sigaddset((sigset_t *)&set,0x15)" identifier (argument_list "((sigset_t *)&set,0x15)" ( (cast_expression "(sigset_t *)&set" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&set" & identifier)) , number_literal ))) ;) (expression_statement "sigaddset((sigset_t *)&set,0x14);" (call_expression "sigaddset((sigset_t *)&set,0x14)" identifier (argument_list "((sigset_t *)&set,0x14)" ( (cast_expression "(sigset_t *)&set" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&set" & identifier)) , number_literal ))) ;) (expression_statement "sigaddset((sigset_t *)&set,0x11);" (call_expression "sigaddset((sigset_t *)&set,0x11)" identifier (argument_list "((sigset_t *)&set,0x11)" ( (cast_expression "(sigset_t *)&set" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&set" & identifier)) , number_literal ))) ;) (expression_statement "sigemptyset((sigset_t *)&oset);" (call_expression "sigemptyset((sigset_t *)&oset)" identifier (argument_list "((sigset_t *)&oset)" ( (cast_expression "(sigset_t *)&oset" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&oset" & identifier)) ))) ;) (expression_statement "sigprocmask(0,(sigset_t *)&set,(sigset_t *)&oset);" (call_expression "sigprocmask(0,(sigset_t *)&set,(sigset_t *)&oset)" identifier (argument_list "(0,(sigset_t *)&set,(sigset_t *)&oset)" ( number_literal , (cast_expression "(sigset_t *)&set" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&set" & identifier)) , (cast_expression "(sigset_t *)&oset" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&oset" & identifier)) ))) ;) (expression_statement "iVar3 = tcsetpgrp(shell_tty,pgrp);" (assignment_expression "iVar3 = tcsetpgrp(shell_tty,pgrp)" identifier = (call_expression "tcsetpgrp(shell_tty,pgrp)" identifier (argument_list "(shell_tty,pgrp)" ( identifier , identifier )))) ;) (if_statement "if (iVar3 < 0) {\n      piVar4 = __errno_location();\n      iVar3 = *piVar4;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      *piVar4 = iVar3;\n      uVar2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = pgrp;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      uVar2 = 0;\n    }" if (parenthesized_expression "(iVar3 < 0)" ( (binary_expression "iVar3 < 0" identifier < number_literal) )) (compound_statement "{\n      piVar4 = __errno_location();\n      iVar3 = *piVar4;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      *piVar4 = iVar3;\n      uVar2 = 0xffffffff;\n    }" { (expression_statement "piVar4 = __errno_location();" (assignment_expression "piVar4 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar4;" (assignment_expression "iVar3 = *piVar4" identifier = (pointer_expression "*piVar4" * identifier)) ;) (expression_statement "sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);" (call_expression "sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0)" identifier (argument_list "(2,(sigset_t *)&oset,(sigset_t *)0x0)" ( number_literal , (cast_expression "(sigset_t *)&oset" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&oset" & identifier)) , (cast_expression "(sigset_t *)0x0" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ))) ;) (expression_statement "*piVar4 = iVar3;" (assignment_expression "*piVar4 = iVar3" (pointer_expression "*piVar4" * identifier) = identifier) ;) (expression_statement "uVar2 = 0xffffffff;" (assignment_expression "uVar2 = 0xffffffff" identifier = number_literal) ;) }) (else_clause "else {\n      terminal_pgrp = pgrp;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      uVar2 = 0;\n    }" else (compound_statement "{\n      terminal_pgrp = pgrp;\n      sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);\n      uVar2 = 0;\n    }" { (expression_statement "terminal_pgrp = pgrp;" (assignment_expression "terminal_pgrp = pgrp" identifier = identifier) ;) (expression_statement "sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0);" (call_expression "sigprocmask(2,(sigset_t *)&oset,(sigset_t *)0x0)" identifier (argument_list "(2,(sigset_t *)&oset,(sigset_t *)0x0)" ( number_literal , (cast_expression "(sigset_t *)&oset" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&oset" & identifier)) , (cast_expression "(sigset_t *)0x0" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ))) ;) (expression_statement "uVar2 = 0;" (assignment_expression "uVar2 = 0" identifier = number_literal) ;) }))) })) (if_statement "if (iVar1 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar2;\n  }" if (parenthesized_expression "(iVar1 == *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "iVar1 == *(int *)(in_GS_OFFSET + 0x14)" identifier == (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) )) (compound_statement "{\n    return uVar2;\n  }" { (return_statement "return uVar2;" return identifier ;) })) comment (expression_statement "__stack_chk_fail_local();" (call_expression "__stack_chk_fail_local()" identifier (argument_list "()" ( ))) ;) })))
(translation_unit "uint give_terminal_to(__pid_t param_1,uint param_2)\n\n{\n  int iVar1;\n  int *piVar2;\n  int in_GS_OFFSET;\n  sigset_t local_120;\n  sigset_t local_a0;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x60ad9;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  param_2 = param_2 | job_control;\n  if (param_2 != 0) {\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return param_2;\n  }\n                    \n  FUN_000ecc40();\n}\n\n" (function_definition "uint give_terminal_to(__pid_t param_1,uint param_2)\n\n{\n  int iVar1;\n  int *piVar2;\n  int in_GS_OFFSET;\n  sigset_t local_120;\n  sigset_t local_a0;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x60ad9;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  param_2 = param_2 | job_control;\n  if (param_2 != 0) {\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return param_2;\n  }\n                    \n  FUN_000ecc40();\n}" type_identifier (function_declarator "give_terminal_to(__pid_t param_1,uint param_2)" identifier (parameter_list "(__pid_t param_1,uint param_2)" ( (parameter_declaration "__pid_t param_1" type_identifier identifier) , (parameter_declaration "uint param_2" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  int *piVar2;\n  int in_GS_OFFSET;\n  sigset_t local_120;\n  sigset_t local_a0;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x60ad9;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  param_2 = param_2 | job_control;\n  if (param_2 != 0) {\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return param_2;\n  }\n                    \n  FUN_000ecc40();\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int *piVar2;" primitive_type (pointer_declarator "*piVar2" * identifier) ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "sigset_t local_120;" type_identifier identifier ;) (declaration "sigset_t local_a0;" type_identifier identifier ;) (declaration "int local_20;" primitive_type identifier ;) (declaration "undefined4 uStack_14;" type_identifier identifier ;) (expression_statement "uStack_14 = 0x60ad9;" (assignment_expression "uStack_14 = 0x60ad9" identifier = number_literal) ;) (expression_statement "local_20 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_20 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "param_2 = param_2 | job_control;" (assignment_expression "param_2 = param_2 | job_control" identifier = (binary_expression "param_2 | job_control" identifier | identifier)) ;) (if_statement "if (param_2 != 0) {\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }" if (parenthesized_expression "(param_2 != 0)" ( (binary_expression "param_2 != 0" identifier != number_literal) )) (compound_statement "{\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }" { (expression_statement "sigemptyset(&local_120);" (call_expression "sigemptyset(&local_120)" identifier (argument_list "(&local_120)" ( (pointer_expression "&local_120" & identifier) ))) ;) (expression_statement "sigaddset(&local_120,0x16);" (call_expression "sigaddset(&local_120,0x16)" identifier (argument_list "(&local_120,0x16)" ( (pointer_expression "&local_120" & identifier) , number_literal ))) ;) (expression_statement "sigaddset(&local_120,0x15);" (call_expression "sigaddset(&local_120,0x15)" identifier (argument_list "(&local_120,0x15)" ( (pointer_expression "&local_120" & identifier) , number_literal ))) ;) (expression_statement "sigaddset(&local_120,0x14);" (call_expression "sigaddset(&local_120,0x14)" identifier (argument_list "(&local_120,0x14)" ( (pointer_expression "&local_120" & identifier) , number_literal ))) ;) (expression_statement "sigaddset(&local_120,0x11);" (call_expression "sigaddset(&local_120,0x11)" identifier (argument_list "(&local_120,0x11)" ( (pointer_expression "&local_120" & identifier) , number_literal ))) ;) (expression_statement "sigemptyset(&local_a0);" (call_expression "sigemptyset(&local_a0)" identifier (argument_list "(&local_a0)" ( (pointer_expression "&local_a0" & identifier) ))) ;) (expression_statement "sigprocmask(0,&local_120,&local_a0);" (call_expression "sigprocmask(0,&local_120,&local_a0)" identifier (argument_list "(0,&local_120,&local_a0)" ( number_literal , (pointer_expression "&local_120" & identifier) , (pointer_expression "&local_a0" & identifier) ))) ;) (expression_statement "iVar1 = tcsetpgrp(shell_tty,param_1);" (assignment_expression "iVar1 = tcsetpgrp(shell_tty,param_1)" identifier = (call_expression "tcsetpgrp(shell_tty,param_1)" identifier (argument_list "(shell_tty,param_1)" ( identifier , identifier )))) ;) (if_statement "if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }" if (parenthesized_expression "(iVar1 < 0)" ( (binary_expression "iVar1 < 0" identifier < number_literal) )) (compound_statement "{\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }" { (expression_statement "piVar2 = __errno_location();" (assignment_expression "piVar2 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar1 = *piVar2;" (assignment_expression "iVar1 = *piVar2" identifier = (pointer_expression "*piVar2" * identifier)) ;) (expression_statement "sigprocmask(2,&local_a0,(sigset_t *)0x0);" (call_expression "sigprocmask(2,&local_a0,(sigset_t *)0x0)" identifier (argument_list "(2,&local_a0,(sigset_t *)0x0)" ( number_literal , (pointer_expression "&local_a0" & identifier) , (cast_expression "(sigset_t *)0x0" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ))) ;) (expression_statement "*piVar2 = iVar1;" (assignment_expression "*piVar2 = iVar1" (pointer_expression "*piVar2" * identifier) = identifier) ;) (expression_statement "param_2 = 0xffffffff;" (assignment_expression "param_2 = 0xffffffff" identifier = number_literal) ;) }) (else_clause "else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }" else (compound_statement "{\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }" { (expression_statement "terminal_pgrp = param_1;" (assignment_expression "terminal_pgrp = param_1" identifier = identifier) ;) (expression_statement "sigprocmask(2,&local_a0,(sigset_t *)0x0);" (call_expression "sigprocmask(2,&local_a0,(sigset_t *)0x0)" identifier (argument_list "(2,&local_a0,(sigset_t *)0x0)" ( number_literal , (pointer_expression "&local_a0" & identifier) , (cast_expression "(sigset_t *)0x0" ( (type_descriptor "sigset_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ))) ;) (expression_statement "param_2 = 0;" (assignment_expression "param_2 = 0" identifier = number_literal) ;) }))) })) (if_statement "if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return param_2;\n  }" if (parenthesized_expression "(local_20 == *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "local_20 == *(int *)(in_GS_OFFSET + 0x14)" identifier == (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) )) (compound_statement "{\n    return param_2;\n  }" { (return_statement "return param_2;" return identifier ;) })) (expression_statement "FUN_000ecc40();" (call_expression "FUN_000ecc40()" identifier (argument_list "()" ( ))) ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT | IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (pointer_expression & IDENT) ))) ;) (expression_statement (call_expression IDENT (argument_list ( (pointer_expression & IDENT) , LIT ))) ;) (expression_statement (call_expression IDENT (argument_list ( (pointer_expression & IDENT) , LIT ))) ;) (expression_statement (call_expression IDENT (argument_list ( (pointer_expression & IDENT) , LIT ))) ;) (expression_statement (call_expression IDENT (argument_list ( (pointer_expression & IDENT) , LIT ))) ;) (expression_statement (call_expression IDENT (argument_list ( (pointer_expression & IDENT) ))) ;) (expression_statement (call_expression IDENT (argument_list ( LIT , (pointer_expression & IDENT) , (pointer_expression & IDENT) ))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (call_expression IDENT (argument_list ( LIT , (pointer_expression & IDENT) , (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT) ))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = IDENT) ;) (expression_statement (call_expression IDENT (argument_list ( LIT , (pointer_expression & IDENT) , (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT) ))) ;) (expression_statement (assignment_expression IDENT = LIT) ;) }))) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (call_expression IDENT (argument_list ( ))) ;) })))
(function_definition "uint give_terminal_to(__pid_t param_1,uint param_2)\n\n{\n  int iVar1;\n  int *piVar2;\n  int in_GS_OFFSET;\n  sigset_t local_120;\n  sigset_t local_a0;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x60ad9;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  param_2 = param_2 | job_control;\n  if (param_2 != 0) {\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return param_2;\n  }\n                    \n  FUN_000ecc40();\n}" (type_identifier "uint") (function_declarator "give_terminal_to(__pid_t param_1,uint param_2)" (identifier "give_terminal_to") (parameter_list "(__pid_t param_1,uint param_2)" (( "(") (parameter_declaration "__pid_t param_1" (type_identifier "__pid_t") (identifier "param_1")) (, ",") (parameter_declaration "uint param_2" (type_identifier "uint") (identifier "param_2")) () ")"))) (compound_statement "{\n  int iVar1;\n  int *piVar2;\n  int in_GS_OFFSET;\n  sigset_t local_120;\n  sigset_t local_a0;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x60ad9;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  param_2 = param_2 | job_control;\n  if (param_2 != 0) {\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return param_2;\n  }\n                    \n  FUN_000ecc40();\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "int *piVar2;" (primitive_type "int") (pointer_declarator "*piVar2" (* "*") (identifier "piVar2")) (; ";")) (declaration "int in_GS_OFFSET;" (primitive_type "int") (identifier "in_GS_OFFSET") (; ";")) (declaration "sigset_t local_120;" (type_identifier "sigset_t") (identifier "local_120") (; ";")) (declaration "sigset_t local_a0;" (type_identifier "sigset_t") (identifier "local_a0") (; ";")) (declaration "int local_20;" (primitive_type "int") (identifier "local_20") (; ";")) (declaration "undefined4 uStack_14;" (type_identifier "undefined4") (identifier "uStack_14") (; ";")) (expression_statement "uStack_14 = 0x60ad9;" (assignment_expression "uStack_14 = 0x60ad9" (identifier "uStack_14") (= "=") (number_literal "0x60ad9")) (; ";")) (expression_statement "local_20 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_20 = *(int *)(in_GS_OFFSET + 0x14)" (identifier "local_20") (= "=") (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" (* "*") (cast_expression "(int *)(in_GS_OFFSET + 0x14)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(in_GS_OFFSET + 0x14)" (( "(") (binary_expression "in_GS_OFFSET + 0x14" (identifier "in_GS_OFFSET") (+ "+") (number_literal "0x14")) () ")"))))) (; ";")) (expression_statement "param_2 = param_2 | job_control;" (assignment_expression "param_2 = param_2 | job_control" (identifier "param_2") (= "=") (binary_expression "param_2 | job_control" (identifier "param_2") (| "|") (identifier "job_control"))) (; ";")) (if_statement "if (param_2 != 0) {\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }" (if "if") (parenthesized_expression "(param_2 != 0)" (( "(") (binary_expression "param_2 != 0" (identifier "param_2") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    sigemptyset(&local_120);\n    sigaddset(&local_120,0x16);\n    sigaddset(&local_120,0x15);\n    sigaddset(&local_120,0x14);\n    sigaddset(&local_120,0x11);\n    sigemptyset(&local_a0);\n    sigprocmask(0,&local_120,&local_a0);\n    iVar1 = tcsetpgrp(shell_tty,param_1);\n    if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }\n  }" ({ "{") (expression_statement "sigemptyset(&local_120);" (call_expression "sigemptyset(&local_120)" (identifier "sigemptyset") (argument_list "(&local_120)" (( "(") (pointer_expression "&local_120" (& "&") (identifier "local_120")) () ")"))) (; ";")) (expression_statement "sigaddset(&local_120,0x16);" (call_expression "sigaddset(&local_120,0x16)" (identifier "sigaddset") (argument_list "(&local_120,0x16)" (( "(") (pointer_expression "&local_120" (& "&") (identifier "local_120")) (, ",") (number_literal "0x16") () ")"))) (; ";")) (expression_statement "sigaddset(&local_120,0x15);" (call_expression "sigaddset(&local_120,0x15)" (identifier "sigaddset") (argument_list "(&local_120,0x15)" (( "(") (pointer_expression "&local_120" (& "&") (identifier "local_120")) (, ",") (number_literal "0x15") () ")"))) (; ";")) (expression_statement "sigaddset(&local_120,0x14);" (call_expression "sigaddset(&local_120,0x14)" (identifier "sigaddset") (argument_list "(&local_120,0x14)" (( "(") (pointer_expression "&local_120" (& "&") (identifier "local_120")) (, ",") (number_literal "0x14") () ")"))) (; ";")) (expression_statement "sigaddset(&local_120,0x11);" (call_expression "sigaddset(&local_120,0x11)" (identifier "sigaddset") (argument_list "(&local_120,0x11)" (( "(") (pointer_expression "&local_120" (& "&") (identifier "local_120")) (, ",") (number_literal "0x11") () ")"))) (; ";")) (expression_statement "sigemptyset(&local_a0);" (call_expression "sigemptyset(&local_a0)" (identifier "sigemptyset") (argument_list "(&local_a0)" (( "(") (pointer_expression "&local_a0" (& "&") (identifier "local_a0")) () ")"))) (; ";")) (expression_statement "sigprocmask(0,&local_120,&local_a0);" (call_expression "sigprocmask(0,&local_120,&local_a0)" (identifier "sigprocmask") (argument_list "(0,&local_120,&local_a0)" (( "(") (number_literal "0") (, ",") (pointer_expression "&local_120" (& "&") (identifier "local_120")) (, ",") (pointer_expression "&local_a0" (& "&") (identifier "local_a0")) () ")"))) (; ";")) (expression_statement "iVar1 = tcsetpgrp(shell_tty,param_1);" (assignment_expression "iVar1 = tcsetpgrp(shell_tty,param_1)" (identifier "iVar1") (= "=") (call_expression "tcsetpgrp(shell_tty,param_1)" (identifier "tcsetpgrp") (argument_list "(shell_tty,param_1)" (( "(") (identifier "shell_tty") (, ",") (identifier "param_1") () ")")))) (; ";")) (if_statement "if (iVar1 < 0) {\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }\n    else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }" (if "if") (parenthesized_expression "(iVar1 < 0)" (( "(") (binary_expression "iVar1 < 0" (identifier "iVar1") (< "<") (number_literal "0")) () ")")) (compound_statement "{\n      piVar2 = __errno_location();\n      iVar1 = *piVar2;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      *piVar2 = iVar1;\n      param_2 = 0xffffffff;\n    }" ({ "{") (expression_statement "piVar2 = __errno_location();" (assignment_expression "piVar2 = __errno_location()" (identifier "piVar2") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar1 = *piVar2;" (assignment_expression "iVar1 = *piVar2" (identifier "iVar1") (= "=") (pointer_expression "*piVar2" (* "*") (identifier "piVar2"))) (; ";")) (expression_statement "sigprocmask(2,&local_a0,(sigset_t *)0x0);" (call_expression "sigprocmask(2,&local_a0,(sigset_t *)0x0)" (identifier "sigprocmask") (argument_list "(2,&local_a0,(sigset_t *)0x0)" (( "(") (number_literal "2") (, ",") (pointer_expression "&local_a0" (& "&") (identifier "local_a0")) (, ",") (cast_expression "(sigset_t *)0x0" (( "(") (type_descriptor "sigset_t *" (type_identifier "sigset_t") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")) () ")"))) (; ";")) (expression_statement "*piVar2 = iVar1;" (assignment_expression "*piVar2 = iVar1" (pointer_expression "*piVar2" (* "*") (identifier "piVar2")) (= "=") (identifier "iVar1")) (; ";")) (expression_statement "param_2 = 0xffffffff;" (assignment_expression "param_2 = 0xffffffff" (identifier "param_2") (= "=") (number_literal "0xffffffff")) (; ";")) (} "}")) (else_clause "else {\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }" (else "else") (compound_statement "{\n      terminal_pgrp = param_1;\n      sigprocmask(2,&local_a0,(sigset_t *)0x0);\n      param_2 = 0;\n    }" ({ "{") (expression_statement "terminal_pgrp = param_1;" (assignment_expression "terminal_pgrp = param_1" (identifier "terminal_pgrp") (= "=") (identifier "param_1")) (; ";")) (expression_statement "sigprocmask(2,&local_a0,(sigset_t *)0x0);" (call_expression "sigprocmask(2,&local_a0,(sigset_t *)0x0)" (identifier "sigprocmask") (argument_list "(2,&local_a0,(sigset_t *)0x0)" (( "(") (number_literal "2") (, ",") (pointer_expression "&local_a0" (& "&") (identifier "local_a0")) (, ",") (cast_expression "(sigset_t *)0x0" (( "(") (type_descriptor "sigset_t *" (type_identifier "sigset_t") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")) () ")"))) (; ";")) (expression_statement "param_2 = 0;" (assignment_expression "param_2 = 0" (identifier "param_2") (= "=") (number_literal "0")) (; ";")) (} "}")))) (} "}"))) (if_statement "if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return param_2;\n  }" (if "if") (parenthesized_expression "(local_20 == *(int *)(in_GS_OFFSET + 0x14))" (( "(") (binary_expression "local_20 == *(int *)(in_GS_OFFSET + 0x14)" (identifier "local_20") (== "==") (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" (* "*") (cast_expression "(int *)(in_GS_OFFSET + 0x14)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(in_GS_OFFSET + 0x14)" (( "(") (binary_expression "in_GS_OFFSET + 0x14" (identifier "in_GS_OFFSET") (+ "+") (number_literal "0x14")) () ")"))))) () ")")) (compound_statement "{\n    return param_2;\n  }" ({ "{") (return_statement "return param_2;" (return "return") (identifier "param_2") (; ";")) (} "}"))) (expression_statement "FUN_000ecc40();" (call_expression "FUN_000ecc40()" (identifier "FUN_000ecc40") (argument_list "()" (( "(") () ")"))) (; ";")) (} "}")))

/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* WARNING: Unknown calling convention */

int function_1(type_1 pgrp,int var_2)

{
  int var_11;
  type_2 var_4;
  int var_9;
  int *piVar4;
  int var_1;
  type_3 set;
  type_3 oset;
  
  var_11 = *(int *)(var_1 + 0x14);
  var_4 = var_2 | var_3;
  if (var_4 != 0) {
    var_5((type_3 *)&set);
    var_6((type_3 *)&set,0x16);
    var_6((type_3 *)&set,0x15);
    var_6((type_3 *)&set,0x14);
    var_6((type_3 *)&set,0x11);
    var_5((type_3 *)&oset);
    var_7(0,(type_3 *)&set,(type_3 *)&oset);
    var_9 = var_8(shell_tty,pgrp);
    if (var_9 < 0) {
      piVar4 = var_10();
      var_9 = *piVar4;
      var_7(2,(type_3 *)&oset,(type_3 *)0x0);
      *piVar4 = var_9;
      var_4 = 0xffffffff;
    }
    else {
      terminal_pgrp = pgrp;
      var_7(2,(type_3 *)&oset,(type_3 *)0x0);
      var_4 = 0;
    }
  }
  if (var_11 == *(int *)(var_1 + 0x14)) {
    return var_4;
  }
                    /* WARNING: Subroutine does not return */
  var_12();
}


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

/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

uint MASKED(__pid_t param_1,uint param_2)

{
  int iVar1;
  int *piVar2;
  int in_GS_OFFSET;
  sigset_t local_120;
  sigset_t local_a0;
  int local_20;
  undefined4 uStack_14;
  
  uStack_14 = 0x60ad9;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  param_2 = param_2 | job_control;
  if (param_2 != 0) {
    sigemptyset(&local_120);
    sigaddset(&local_120,0x16);
    sigaddset(&local_120,0x15);
    sigaddset(&local_120,0x14);
    sigaddset(&local_120,0x11);
    sigemptyset(&local_a0);
    sigprocmask(0,&local_120,&local_a0);
    iVar1 = tcsetpgrp(shell_tty,param_1);
    if (iVar1 < 0) {
      piVar2 = __errno_location();
      iVar1 = *piVar2;
      sigprocmask(2,&local_a0,(sigset_t *)0x0);
      *piVar2 = iVar1;
      param_2 = 0xffffffff;
    }
    else {
      terminal_pgrp = param_1;
      sigprocmask(2,&local_a0,(sigset_t *)0x0);
      param_2 = 0;
    }
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return param_2;
  }
                    /* WARNING: Subroutine does not return */
  FUN_000ecc40();
}

