/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

void genuuid_main(int param_1,char **param_2)

{
  int iVar1;
  char *pcVar2;
  sysinfo *psVar3;
  size_t sVar4;
  code *pcVar5;
  char acStack_110 [10];
  undefined2 local_106;
  undefined2 local_104;
  undefined2 local_102;
  sysinfo local_100;
  sysinfo local_c0;
  undefined1 auStack_80 [88];
  
LAB_004080b0:
  do {
    iVar1 = getopt(param_1,param_2,"hm:s:r")   //possible issue identified - semgrep
    if (iVar1 < 1) {
      read_hexstring(&DAT_00422ab4,6,PTR_s_00_00_00_00_00_00_004221b0);
      if (DAT_00422ab0 == 0) {
        FUN_00407e50(acStack_110);
        local_106 = DAT_00422ab4;
        local_102 = DAT_00422ab8;
        local_104 = DAT_00422ab6;
      }
      else {
        sysinfo(&local_c0);
        srand(local_c0.uptime)   //possible issue identified - semgrep
        psVar3 = &local_100;
        do {
          iVar1 = rand()   //possible issue identified - semgrep
          psVar3->uptime = iVar1;
          psVar3 = (sysinfo *)psVar3->loads;
        } while (psVar3 != &local_c0);
        sVar4 = 0;
        if (PTR_s_rgbin_genuuid_004221b4 != (undefined *)0x0) {
          sVar4 = strlen(PTR_s_rgbin_genuuid_004221b4);
        }
        MD5Init(auStack_80);
        MD5Update(auStack_80,&local_c0,0x40);
        if (sVar4 != 0) {
          MD5Update(auStack_80,PTR_s_rgbin_genuuid_004221b4,sVar4);
        }
        MD5Update(auStack_80,&local_100,0x40);
        MD5Final(acStack_110,auStack_80);
      }
      pcVar5 = print_uuid;
      pcVar2 = acStack_110;
LAB_0040823c:
      (*pcVar5)(pcVar2);
      iVar1 = 0;
LAB_004080a8:
                    /* WARNING: Subroutine does not return */
      exit(iVar1);
    }
    if (iVar1 != 0x6d) {
      if (iVar1 < 0x6e) {
        if (iVar1 == 0x68) {
          pcVar5 = puts;
          pcVar2 = 
          "Usage: genuuid [OPTIONS]\n  -h                show this help message.\n  -m {macaddr}      specify the MAC address. (default is 00:00:00:00:00:00)\n  -s {seed string}  specify the seed string.\n  -r                generate random uuid."
          ;
          goto LAB_0040823c;
        }
      }
      else {
        if (iVar1 == 0x72) {
          DAT_00422ab0 = DAT_00422ab0 + 1;
          goto LAB_004080b0;
        }
        if (iVar1 == 0x73) {
          PTR_s_rgbin_genuuid_004221b4 = _optarg;
          goto LAB_004080b0;
        }
      }
      puts(
          "Usage: genuuid [OPTIONS]\n  -h                show this help message.\n  -m {macaddr}      specify the MAC address. (default is 00:00:00:00:00:00)\n  -s {seed string}  specify the seed string.\n  -r                generate random uuid."
          );
      iVar1 = -1;
      goto LAB_004080a8;
    }
    PTR_s_00_00_00_00_00_00_004221b0 = _optarg;
  } while( true );
}