/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
void seama_main(int param_1,char **param_2)
{
int iVar1;
FILE *__stream;
FILE *__stream_00;
undefined4 uVar2;
char *pcVar3;
uint uVar4;
undefined4 *puVar5;
undefined4 *puVar6;
FUN_00408260("SEAMA version 0.20\n");
LAB_0040940c:
iVar1 = getopt(param_1,param_2,"hvd:s:i:m:x:") //possible issue identified - semgrep
pcVar3 = DAT_00422ac4;
if (0 < iVar1) {
uVar2 = 0xffffffff;
switch(iVar1) {
case 100:
DAT_00422ac0 = _optarg;
goto LAB_0040940c;
case 0x65:
case 0x66:
case 0x67:
case 0x6a:
case 0x6b:
case 0x6c:
case 0x6e:
case 0x6f:
case 0x70:
case 0x71:
case 0x72:
case 0x74:
case 0x75:
case 0x77:
uVar2 = 0xffffffff;
break;
case 0x68:
uVar2 = 0;
break;
case 0x69:
pcVar3 = "Exceed the maximum acceptable image files.!";
if (0x7f < (int)DAT_00422ad0) goto LAB_004093fc;
puVar5 = &DAT_00422ad8 + DAT_00422ad0;
DAT_00422ad0 = DAT_00422ad0 + 1;
*puVar5 = _optarg;
goto LAB_0040940c;
case 0x6d:
if (DAT_00422ad4 < 0x80) {
puVar5 = &DAT_00422cd8 + DAT_00422ad4;
DAT_00422ad4 = DAT_00422ad4 + 1;
*puVar5 = _optarg;
}
else {
pcVar3 = "Exceed the maximum acceptable META data.!";
LAB_004093fc:
puts(pcVar3);
}
goto LAB_0040940c;
case 0x73:
DAT_00422ac4 = _optarg;
goto LAB_0040940c;
case 0x76:
DAT_00422acc = DAT_00422acc + 1;
goto LAB_0040940c;
case 0x78:
goto switchD_00409328_caseD_78;
}
FUN_00409224(uVar2);
goto LAB_0040940c;
}
if (DAT_00422ac0 == (char *)0x0) {
if (DAT_00422ac4 == (char *)0x0) {
if (DAT_00422ac8 == (char *)0x0) {
FUN_00409034();
}
else {
FUN_00408be4();
}
}
else {
puVar6 = &DAT_00422ad8;
puVar5 = puVar6;
for (uVar4 = 0; uVar4 < DAT_00422ad0; uVar4 = uVar4 + 1) {
iVar1 = FUN_00408408(*puVar5,0);
puVar5 = puVar5 + 1;
if (iVar1 < 0) {
printf("\'%s\' is not a seama file !\n",(&DAT_00422ad8)[uVar4]);
goto LAB_004095d4;
}
}
__stream = fopen(pcVar3,"w+") //possible issue identified - semgrep
if (__stream != (FILE *)0x0) {
FUN_004088b8(__stream,&DAT_00422cd8,DAT_00422ad4,0);
FUN_004089d0(__stream,&DAT_00422cd8,DAT_00422ad4);
for (uVar4 = 0; uVar4 < DAT_00422ad0; uVar4 = uVar4 + 1) {
__stream_00 = fopen((char *)*puVar6,"r+") //possible issue identified - semgrep
if (__stream_00 != (FILE *)0x0) {
FUN_00408b10(__stream,__stream_00);
fclose(__stream_00);
}
puVar6 = puVar6 + 1;
}
fclose(__stream);
}
}
}
else {
FUN_00408408(DAT_00422ac0,1);
}
LAB_004095d4:
FUN_00408260("%s: exit with code %d\n","seama",0);
/* WARNING: Subroutine does not return */
exit(0);
switchD_00409328_caseD_78:
DAT_00422ac8 = _optarg;
goto LAB_0040940c;
}