int * usock_open(int param_1,int param_2)

{
  int *__s;
  int iVar1;
  int *__name;
  
  if (param_2 == 0) {
    __s = (int *)0x0;
  }
  else {
    __s = (int *)malloc(0xe4)   //possible issue identified - semgrep
    if (__s != (int *)0x0) {
      memset(__s,0,0xe4)   //possible issue identified - semgrep
      iVar1 = socket(1,1,0);
      *__s = iVar1;
      if (-1 < iVar1) {
        *(undefined2 *)(__s + 2) = 1;
        snprintf((char *)((int)__s + 10),0x6c,"%s",param_2)   //possible issue identified - semgrep
        if (param_1 == 0) {
          *(undefined2 *)((int)__s + 0x76) = 1;
          snprintf((char *)(__s + 0x1e),0x6c,"%s_reply",param_2)   //possible issue identified - semgrep
          unlink((char *)(__s + 0x1e))   //possible issue identified - semgrep
          iVar1 = bind(*__s,(sockaddr *)((int)__s + 0x76),0x6e);
          if ((-1 < iVar1) && (iVar1 = connect(*__s,(sockaddr *)(__s + 2),0x6e), -1 < iVar1)) {
            __s[1] = 0;
            return __s;
          }
        }
        else {
          unlink((char *)((int)__s + 10))   //possible issue identified - semgrep
          iVar1 = bind(*__s,(sockaddr *)(__s + 2),0x6e);
          if (-1 < iVar1) {
            __s[1] = 1;
            return __s;
          }
        }
      }
    }
  }
  if (0 < *__s) {
    close(*__s);
    __name = __s + 0x1e;
    if (param_1 != 0) {
      __name = (int *)((int)__s + 10);
    }
    unlink((char *)__name)   //possible issue identified - semgrep
  }
  free(__s);
  return (int *)0x0;
}