/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
undefined4
FUN_004033c8(uint *param_1,undefined4 param_2,code *param_3,undefined4 param_4,__time_t param_5)
{
bool bVar1;
__fd_mask *p_Var2;
int iVar3;
int iVar4;
uint uVar5;
char *__s;
timeval local_1058;
fd_set local_1050;
uint local_fd0;
char local_fcc;
char local_fcb;
ushort local_fca;
char local_fae;
fd_set *local_30;
timeval *local_2c;
p_Var2 = local_1050.fds_bits;
do {
*p_Var2 = 0;
p_Var2 = p_Var2 + 1;
local_2c = &local_1058;
} while ((uint *)p_Var2 != &local_fd0);
uVar5 = *param_1 >> 5;
local_1058.tv_sec = param_5;
local_30 = &local_1050;
local_1050.fds_bits[uVar5] = local_1050.fds_bits[uVar5] | 1 << (*param_1 & 0x1f);
local_1058.tv_usec = 0;
do {
while( true ) {
iVar3 = select(*param_1 + 1,local_30,(fd_set *)0x0,(fd_set *)0x0,local_2c);
if (iVar3 == 0) {
return 0xffffffff;
}
if (-1 < iVar3) break;
__s = "error on select !!\n";
LAB_004034f4:
fputs(__s,_stderr);
}
uVar5 = recv(*param_1,&local_fd0,4000,0) //possible issue identified - semgrep
if ((int)uVar5 < 0) {
__s = "couldn\'t read on listening socket, ignoring\n";
goto LAB_004034f4;
}
if (((((local_fd0 << 0x18 | local_fd0 >> 0x18 | (local_fd0 & 0xff0000) >> 8 |
(local_fd0 & 0xff00) << 8) == 0x92b1338) && (local_fae == '\x02')) &&
(((local_fca & 0xff) << 8 | (uint)(local_fca >> 8)) == uVar5)) &&
((((local_fcc == '\x02' || (local_fcc == '\x04')) || (local_fcc == '\x06')) &&
(local_fcb == *(char *)((int)param_1 + 0x16))))) {
iVar3 = FUN_00402c14(2,0);
if (iVar3 == 0) {
fputs("internal error!\n",_stderr);
return 0xffffffff;
}
iVar4 = FUN_00403270(iVar3,&local_fd0,uVar5);
bVar1 = false;
if ((iVar4 == 0) && (bVar1 = true, param_3 != (code *)0x0)) {
bVar1 = true;
(*param_3)(param_1,param_4,local_fcc,iVar3);
}
FUN_00402aa8(iVar3);
if (bVar1) {
return 0;
}
}
} while( true );
}