/* WARNING: Removing unreachable block (ram,0x00401098) */
void FUN_00400e78(void)
{
char *__ptr;
FILE *pFVar1;
size_t sVar2;
uint uVar3;
char *pcVar4;
int iVar5;
int local_c0;
char acStack_bc [28];
char acStack_a0 [132];
local_c0 = 0;
memcpy(acStack_bc,"ABCDEFGHIJKLMNOPQRSTUVWXYZ",0x1b) //possible issue identified - semgrep
mkdir("/var/auth",0x1ff) //possible issue identified - semgrep
mkdir("/var/auth/auth_img",0x1ff) //possible issue identified - semgrep
pFVar1 = fopen("/var/auth/user.idx","r+") //possible issue identified - semgrep
if (pFVar1 == (FILE *)0x0) {
pFVar1 = fopen("/var/auth/user.idx","w") //possible issue identified - semgrep
}
else {
fscanf(pFVar1,"%d",&local_c0) //possible issue identified - semgrep
}
local_c0 = local_c0 + 1;
if (10 < local_c0) {
local_c0 = 1;
}
sprintf(acStack_a0,"%02d",local_c0) //possible issue identified - semgrep
rewind(pFVar1);
sVar2 = strlen(acStack_a0);
fwrite(acStack_a0,sVar2,1,pFVar1);
fclose(pFVar1);
sprintf(&DAT_004154b8,"/var/auth/auth_img/a%d.jpeg",local_c0) //possible issue identified - semgrep
unlink(&DAT_004154b8) //possible issue identified - semgrep
PTR_s__var_rndimg_jpeg_00415040 = &DAT_004154b8;
DAT_00415030 = 0x96;
DAT_00415034 = 0x28;
memset(&DAT_00415438,0,0x80) //possible issue identified - semgrep
iVar5 = 0;
do {
iVar5 = iVar5 + 1;
uVar3 = random();
sprintf(&DAT_00415438,"%s%c",&DAT_00415438,(int)acStack_bc[uVar3 % 0x1a]) //possible issue identified - semgrep
} while (iVar5 != 5);
DAT_00415434 = &DAT_00415438;
pcVar4 = strrchr(PTR_s__var_rndimg_jpeg_00415040,0x2f);
sprintf(acStack_a0,"%s%s.msg","/var/auth/",pcVar4 + 1) //possible issue identified - semgrep
pFVar1 = fopen(acStack_a0,"w") //possible issue identified - semgrep
__ptr = DAT_00415434;
sVar2 = strlen(DAT_00415434);
fwrite(__ptr,sVar2,1,pFVar1);
fclose(pFVar1);
printf("%s",pcVar4 + 1);
return;
}