diff --git a/README.md b/README.md index 7a0beb8a..4f6cf626 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ Progress | Decompiled | Matched | Linked | Data | |:---:|:---:|:---:|:---:| -| 96.69% | 83.11% | 58.19% | 89.93% | +| 96.71% | 83.23% | 58.19% | 89.93% | -units 777/1027 complete, functions 11997/12563 matched. +units 777/1027 complete, functions 12005/12563 matched. decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data diff --git a/src/scene/setting/AOSS.c b/src/scene/setting/AOSS.c index dd239d85..6b4eb350 100644 --- a/src/scene/setting/AOSS.c +++ b/src/scene/setting/AOSS.c @@ -297,7 +297,7 @@ void AOSS_81401DC0(u32 seed, u32* table); s16 AOSS_81401BBC(void* buffer); int AOSS_81401574(void* packet, AOSSRequestRecords* request, int socket); int AOSS_81401778(void* packet, void* request, int socket); -int AOSS_81401E80(void* packet, s32 length, const char* key, int keyLength); +int AOSS_81401E80(void* packet, s32 length, char* key, int keyLength); int AOSS_814020CC(void* settings, void* config); int AOSS_81400E0C(const AOSSOptionRecord* packet, u8* settings); int AOSS_814013AC(int state, const AOSSReplyOption* response, int responseLength, void* config, void* networkData); @@ -410,8 +410,10 @@ int AOSS_Init_old(AOSSInitInput* input) AOSSWaitSettings waitSettings; AOSSNetworkSettings settings; AOSSRequestRecords requestRecords; - s16 connectionWait; - s16 responseWait; + struct { + s16 connection; + s16 response; + } waitIntervals; AOSSSocketAddress replyAddress; u8 messageIdentity[8]; AOSSSocketAddress socketAddress; @@ -424,22 +426,22 @@ int AOSS_Init_old(AOSSInitInput* input) u32 networkAddresses[5]; u32 gatewayAddress; - connectionWait = s_defaultOptions[0]; - responseWait = s_defaultOptions[1]; + waitIntervals.connection = s_defaultOptions[0]; + waitIntervals.response = s_defaultOptions[1]; waitSettings.value = 0; receivedPackets = 0; memset(&requestRecords,0,0x18); - connectionWait = input->options[0]; - if (connectionWait == -1) { - connectionWait = 10; + waitIntervals.connection = input->options[0]; + if (waitIntervals.connection == -1) { + waitIntervals.connection = 10; } initialWait = input->options[2]; if (initialWait == -1) { initialWait = 10; } - responseWait = input->options[1]; - if (responseWait == -1) { - responseWait = 100; + waitIntervals.response = input->options[1]; + if (waitIntervals.response == -1) { + waitIntervals.response = 100; } waitSettings.halfwords.low = input->options[3]; if (waitSettings.halfwords.low == 0xffff) { @@ -462,11 +464,11 @@ int AOSS_Init_old(AOSSInitInput* input) s_runtime.active = '\0'; if ((input->flags & 1) == 1) { attemptCount = 0; - initialWait = connectionWait; + initialWait = waitIntervals.connection; if (s_operationState != 0) { s_operationState = 0; AOSSi_Status(0); - initialWait = connectionWait; + initialWait = waitIntervals.connection; } while (1) { if (s_accessPointList != 0) { @@ -532,7 +534,7 @@ int AOSS_Init_old(AOSSInitInput* input) s_accessPointConfig = (int *)AOSSi_Alloc(0x58); if (s_accessPointConfig != (int *)0x0) { memset(s_accessPointConfig,0,0x58); - initialWait = connectionWait; + initialWait = waitIntervals.connection; remainingWait = 0; goto wait_for_initial_link; } @@ -562,7 +564,7 @@ int AOSS_Init_old(AOSSInitInput* input) } goto finish_initialization; } - remainingWait = responseWait; + remainingWait = waitIntervals.response; if ((short)initialWait <= attemptCount) { input->status = 1; if (s_accessPointConfig != (int *)0x0) { @@ -644,7 +646,7 @@ wait_for_initial_link: resultCode = 0xffffffff; goto finish_initialization; } - initialSleep = responseWait; + initialSleep = waitIntervals.response; if ((state == 0) && (*s_accessPointConfig == 1)) goto handle_initial_link; for (; initialSleep != 0; initialSleep = initialSleep - nextSleep) { if (AOSSi_cancel_flag == 1) { @@ -806,7 +808,7 @@ wait_for_packet: goto finish_initialization; } memset(s_accessPointConfig,0,0x58); - initialWait = connectionWait; + initialWait = waitIntervals.connection; for (waitAttempt = 0; waitAttempt < (short)initialWait; waitAttempt = waitAttempt + 1) { state = AOSS_814020CC(&settings,s_accessPointConfig); if (state == -1) { @@ -822,7 +824,7 @@ wait_for_packet: resultCode = 0xffffffff; goto finish_initialization; } - remainingWait = responseWait; + remainingWait = waitIntervals.response; if ((state == 0) && (*s_accessPointConfig == 1)) break; for (; remainingWait != 0; remainingWait = remainingWait - initialSleep) { if (AOSSi_cancel_flag == 1) { @@ -1044,7 +1046,7 @@ cancelled_configuration: resultCode = 0xffffffff; goto finish_initialization; handle_initial_link: - if (remainingWait == connectionWait) { + if (remainingWait == waitIntervals.connection) { input->status = 0xf; if (s_accessPointConfig != (int *)0x0) { AOSSi_Free(s_accessPointConfig); @@ -1072,8 +1074,8 @@ handle_initial_link: retryWait = rand(); requestRecords.records[requestResult].transactionId = (short)retryWait; receivedLength = SOHtoNs(retryWait & 0xffff); - requestResult = requestResult + 1; requestRecords.records[requestResult].transactionId = receivedLength; + requestResult = requestResult + 1; state = state + 8; } while (requestResult < 3); s_socket = SOSocket(2,2,0); @@ -1184,7 +1186,7 @@ request_socket_cleanup_complete: goto finish_initialization; } memset(s_accessPointConfig,0,0x58); - initialWait = connectionWait; + initialWait = waitIntervals.connection; for (waitAttempt = 0; waitAttempt < (short)initialWait; waitAttempt = waitAttempt + 1) { requestResult = AOSS_814020CC(&settings,s_accessPointConfig); if (requestResult == -1) { @@ -1200,7 +1202,7 @@ request_socket_cleanup_complete: resultCode = 0xffffffff; goto finish_initialization; } - remainingWait = responseWait; + remainingWait = waitIntervals.response; if ((requestResult == 0) && (*s_accessPointConfig == 1)) break; for (; remainingWait != 0; remainingWait = remainingWait - initialSleep) { if (AOSSi_cancel_flag == 1) { @@ -1713,7 +1715,7 @@ int AOSS_814002F0(int state, AOSSReceiveBuffer* packet, int* count, AOSSRequestR if ((packetSequence & 0x10) != 0) { operationState = 1; } - s_operationState = operationState; + s_connectionState = operationState; *count = 0; return 1; } @@ -1974,10 +1976,10 @@ int AOSS_81400E0C(const AOSSOptionRecord* packet, u8* settings) { const u8* packetBytes = (const u8*)packet; const AOSSOptionRecord* record; s32 length; + const u8* valueBytes; s32 index; u32 value; u16 nextOffset; - const u8* valueBytes; memset(settings, 0, 0x104); record = packet; @@ -2007,7 +2009,8 @@ int AOSS_81400E0C(const AOSSOptionRecord* packet, u8* settings) { value = 0; valueBytes = record->data; for (index = 0; index < length; index++) { - value = (value << 8) + *valueBytes++; + value <<= 8; + value += *valueBytes++; } value = SONtoHl(value); s_runtime.ipAddress = value; @@ -2016,7 +2019,8 @@ int AOSS_81400E0C(const AOSSOptionRecord* packet, u8* settings) { value = 0; valueBytes = record->data; for (index = 0; index < length; index++) { - value = (value << 8) + *valueBytes++; + value <<= 8; + value += *valueBytes++; } value = SONtoHl(value); s_runtime.subnetMask = value; @@ -2027,10 +2031,11 @@ int AOSS_81400E0C(const AOSSOptionRecord* packet, u8* settings) { nextOffset = record->nextOffset; if (nextOffset == 0) { - return 0; + break; } record = (const AOSSOptionRecord*)(packetBytes + SONtoHs(nextOffset)); } + return 0; } int AOSS_81401104(const AOSSOptionRecord* packet, AOSSStoredConfig* config) { @@ -2154,7 +2159,6 @@ int AOSS_81401284(const AOSSOptionRecord* packet, AOSSStoredConfig* config) { int AOSS_814013AC(int state, const AOSSReplyOption* response, int responseLength, void* config, void* networkData) { const AOSSReplyOption* responseRecord; - const AOSSReplyOption* option; AOSSConfigRecord* configRecord; AOSSStoredConfig* wep40Config; AOSSStoredConfig* wep104Config; @@ -2162,6 +2166,7 @@ int AOSS_814013AC(int state, const AOSSReplyOption* response, int responseLength AOSSStoredConfig* aesConfig; u8* networkSettings; u32 flags = 0; + const AOSSReplyOption* option; u32 length; s32 remainingLength = responseLength; int result; @@ -2184,8 +2189,8 @@ int AOSS_814013AC(int state, const AOSSReplyOption* response, int responseLength } length = responseRecord->fields.length; - remainingLength = SONtoHs((u16)length); option = (const AOSSReplyOption*)&responseRecord->bytes[4]; + remainingLength = SONtoHs((u16)length); configRecord = &((AOSSConfigData*)config)->records[state]; networkSettings = ((AOSSNetworkBufferRecord*)networkData)[state + 3].bytes; wep40Config = (AOSSStoredConfig*)&configRecord->reserved00[8]; @@ -2241,20 +2246,21 @@ int AOSS_814013AC(int state, const AOSSReplyOption* response, int responseLength } int AOSS_81401574(void* packet, AOSSRequestRecords* request, int socket) { - AOSSDiscoveryPacket* response = (AOSSDiscoveryPacket*)s_responseBuffer; u8* responsePayload; u8 accessPointName[8]; AOSSSocketAddress destination; AOSSRequestBuffer* requestRecord; + AOSSDiscoveryPacket* response; s16 recordLength; s16 requestLength; int encryptionResult; int result; + response = (AOSSDiscoveryPacket*)s_responseBuffer; memset(response, 0, 0x5dc); requestRecord = (AOSSRequestBuffer*)AOSSi_Alloc(0x210); if (requestRecord == 0) { - s_connectionState = 2; + s_errorCode = 2; return -1; } @@ -2264,7 +2270,7 @@ int AOSS_81401574(void* packet, AOSSRequestRecords* request, int socket) { memcpy(accessPointName, s_accessPointName, 8); recordLength = AOSS_81401BBC(&requestRecord->record); if (recordLength < 0) { - s_connectionState = 3; + s_errorCode = 3; if (requestRecord != 0) { AOSSi_Free(requestRecord); } @@ -2276,7 +2282,7 @@ int AOSS_81401574(void* packet, AOSSRequestRecords* request, int socket) { memcpy(responsePayload, requestRecord, requestLength); encryptionResult = AOSS_81401E80(accessPointName, 8, s_manufacturer, 6); if (encryptionResult != 0) { - s_connectionState = 2; + s_errorCode = 2; if (requestRecord != 0) { AOSSi_Free(requestRecord); } @@ -2320,7 +2326,6 @@ int AOSS_81401778(void* packet, void* request, int socket) { u32 stateLength; u32 index; u32 firstByte; - u32 secondByte; u8 value; u8 swap; s16 responseLength; @@ -2361,7 +2366,7 @@ int AOSS_81401778(void* packet, void* request, int socket) { memcpy(s_packetState.keyAddress, s_accessPointName, 8); AOSS_81401C9C(&schedule, s_packetState.keyNonce, sizeof(s_packetState.keyNonce) + sizeof(s_packetState.keyAddress), 8); - for (index = 0; index < 8; index += 2) { + for (index = 0; index < 8; index++) { schedule.i = (schedule.i + 1) % schedule.length & 0xff; firstByte = schedule.bytes[schedule.i]; schedule.j = (firstByte + schedule.j) % schedule.length & 0xff; @@ -2371,16 +2376,6 @@ int AOSS_81401778(void* packet, void* request, int socket) { schedule.bytes[schedule.i] = swap; value = schedule.bytes[stateLength % schedule.length] ^ hello.data.bytes[index]; response->payload.bytes[index + 4] = value; - - schedule.i = (schedule.i + 1) % schedule.length & 0xff; - secondByte = schedule.bytes[schedule.i]; - schedule.j = (secondByte + schedule.j) % schedule.length & 0xff; - swap = schedule.bytes[schedule.j]; - stateLength = secondByte + swap; - schedule.bytes[schedule.j] = (u8)secondByte; - schedule.bytes[schedule.i] = swap; - value = schedule.bytes[stateLength % schedule.length] ^ hello.data.bytes[index + 1]; - response->payload.bytes[index + 5] = value; } AOSSi_Free(schedule.bytes); } @@ -2393,7 +2388,7 @@ int AOSS_81401778(void* packet, void* request, int socket) { memcpy(accessPointName, &requestRecords->records[1], 8); encryptionResult = AOSS_81401E80(accessPointName, 8, s_manufacturer, 6); if (encryptionResult != 0) { - s_connectionState = 2; + s_errorCode = 2; return -1; } @@ -2445,11 +2440,11 @@ s16 AOSS_81401BBC(void* buffer) { } void AOSS_81401C9C(AOSSKeySchedule* schedule, const u8* key, u32 keyLength, u32 stateLength) { - u8* state; u32 index = 0; - u32 keyIndex = 0; - u32 swapIndex = 0; + u32 keyIndex; + u32 swapIndex; u8 value; + u8* state; schedule->j = 0; state = schedule->bytes; @@ -2459,9 +2454,11 @@ void AOSS_81401C9C(AOSSKeySchedule* schedule, const u8* key, u32 keyLength, u32 state[index] = (u8)index; } index = 0; + swapIndex = 0; + keyIndex = 0; for (; index < stateLength; index++) { value = state[index]; - swapIndex = (swapIndex + value + key[keyIndex]) % schedule->length; + swapIndex = (value + swapIndex + key[keyIndex]) % schedule->length; { u8 swapped = state[swapIndex]; state[swapIndex] = value; @@ -2491,15 +2488,17 @@ void AOSS_81401DC0(u32 seed, u32* table) { } } -int AOSS_81401E80(void* packet, s32 length, const char* key, int keyLength) { - u8* packetBytes = (u8*)packet; +int AOSS_81401E80(void* packet, s32 length, char* key, int keyLength) { + u8* temporaryHalf; + s32 halfLength = length / 2; + u8* packetHalf; + s32 round; u8* keyMask; u8* temporary; - s32 halfLength = (((s32)((u32)length >> 31) + length) >> 1); - s32 round; - s32 index; s32 keyIndex; + s32 index; int result = -1; + u8* packetBytes; keyMask = (u8*)AOSSi_Alloc(halfLength); if (keyMask == 0) { @@ -2512,6 +2511,9 @@ int AOSS_81401E80(void* packet, s32 length, const char* key, int keyLength) { return -1; } + packetBytes = (u8*)packet; + packetHalf = packetBytes + halfLength; + temporaryHalf = temporary + halfLength; for (round = 0; round < 2; round++) { keyIndex = round % keyLength; for (index = 0; index < halfLength; index++) { @@ -2524,11 +2526,11 @@ int AOSS_81401E80(void* packet, s32 length, const char* key, int keyLength) { } for (index = 0; index < halfLength; index++) { - packetBytes[halfLength + index] ^= keyMask[index]; + packetHalf[index] = packetHalf[index] ^ keyMask[index]; } - memcpy(temporary, packetBytes + halfLength, halfLength); - memcpy(temporary + halfLength, packetBytes, halfLength); + memcpy(temporary, packetHalf, halfLength); + memcpy(temporaryHalf, packetBytes, halfLength); memcpy(packetBytes, temporary, length); } @@ -2559,7 +2561,7 @@ int AOSS_814020CC(void* settings, void* config) { s_socketStarted = 0; SOCleanup(); } - *(u32*)s_responseBuffer = 0; + *s_accessPointConfig = 0; break; } diff --git a/src/scene/setting/ATERM.c b/src/scene/setting/ATERM.c index c0c10516..1410ef75 100644 --- a/src/scene/setting/ATERM.c +++ b/src/scene/setting/ATERM.c @@ -518,7 +518,7 @@ char gAtermAossSsid[7] = "******"; extern u32 gAtermUseSharedAddress; extern char gAtermProductName[5]; u32 gAtermCancelRequested; -u8 gAtermSelectedBssid[8]; +u8 gAtermSelectedBssid[6]; u32 gAtermProtocolState; u8 gAtermAddressBuffer[8]; u32 gAtermResponseMode; @@ -761,13 +761,13 @@ int ATERM_8140276C(AtermApRecordSet* currentRecords, AtermApRecordSet* previousR AtermApRecord* currentRecord = currentRecords->entries; AtermApRecord* previousRecord = previousRecords->entries; u32 currentIndex = 0; - u32 previousIndex; + int found = 0; int result = 0; u32 ssidLength; size_t compareLength; size_t aossLength; size_t formattedSsidLength; - int found = 0; + u32 previousIndex; for (; currentIndex < currentRecords->count; currentIndex++) { @@ -900,7 +900,7 @@ int ATERM_81402A24(void) { while (iteration < 300 && gAtermCancelRequested == 0) { s64 currentTime = OSGetTime(); - now = (u32)(currentTime / (__mulhwu(0x10624DD3, OS_BUS_CLOCK >> 2) >> 6)); + now = (u32)OSTicksToMilliseconds(currentTime); if (gAtermDeadline <= now) { break; } @@ -959,7 +959,7 @@ int ATERM_81402A24(void) { s32 addressIndex = 0; char* output = selectedMacText; - for (addressIndex = 0; addressIndex < 6; addressIndex++) { + for (addressIndex = 0; ; addressIndex++) { u8 addressByte = *addressCursor++; char* encoded = output; s32 highNibble = (addressByte & 0xF0) >> 4; @@ -976,9 +976,10 @@ int ATERM_81402A24(void) { } *encoded = 0; output += encoded - output; - if (addressIndex < 5) { - *output++ = ':'; + if (addressIndex == 5) { + break; } + *output++ = ':'; } *output = '\0'; } @@ -992,7 +993,7 @@ int ATERM_81402A24(void) { progressInfo[2] = -1; } else { s64 currentTime = OSGetTime(); - now = (u32)(currentTime / (__mulhwu(0x10624DD3, OS_BUS_CLOCK >> 2) >> 6)); + now = (u32)OSTicksToMilliseconds(currentTime); progressInfo[2] = gAtermDeadline - now; } progressInfo[3] = gAtermResult; @@ -1003,7 +1004,7 @@ int ATERM_81402A24(void) { if (iteration >= 300) { result = -3; } else { - now = (u32)(OSGetTime() / (__mulhwu(0x10624DD3, OS_BUS_CLOCK >> 2) >> 6)); + now = (u32)OSTicksToMilliseconds(OSGetTime()); if (now > gAtermDeadline) { result = -3; } else { @@ -1216,10 +1217,11 @@ int ATERM_814031DC(AtermAssociationRequest* request) { int ATERM_814033F0(u16* response) { u16* optionCursor = response + 4; + u8* optionValue; u16* responseEnd; u32 optionType; s32 optionLength; - u8* optionValue; + char* key; u32 value; s32 result = 0; @@ -1258,7 +1260,7 @@ int ATERM_814033F0(u16* response) { case 0x209: { u32 keyIndex = optionType - 0x206; - char* key = gScanSettings.wirelessKeys[keyIndex].key; + key = gScanSettings.wirelessKeys[keyIndex].key; memset(key, 0, sizeof(gScanSettings.wirelessKeys[keyIndex].key)); if (gScanSettings.wirelessKeys[0].keyFormat == 1) { s32 byteIndex; @@ -1337,11 +1339,11 @@ int ATERM_81403614(u8* destination, const char* source, s32 length) { int ATERM_814036D8(void) { s32 result = 1; - char* outputKey; char* sourceKey; + char* outputKey; + char* keyString; s32 keyIndex; size_t keyLength; - char* keyString; struct { char text[32]; char terminator; @@ -1357,15 +1359,15 @@ int ATERM_814036D8(void) { result = -7; } else { gAtermConfigurationResult.securityMode = gScanSettings.authAlgorithm; - outputKey = (char*)gAtermConfigurationResult.reserved028; sourceKey = gScanSettings.wirelessKeys[0].key; + keyString = keyText.text; + outputKey = (char*)gAtermConfigurationResult.reserved028; keyIndex = 0; do { memcpy(keyText.text, sourceKey, 0x20); keyText.terminator = '\0'; - keyString = keyText.text; - keyLength = strlen(keyString); + keyLength = strlen(keyText.text); switch (keyLength) { case 0: break; @@ -1397,8 +1399,8 @@ int ATERM_814036D8(void) { result = -7; break; } - outputKey += 0x20; sourceKey += 0x28; + outputKey += 0x20; keyIndex++; } while (keyIndex < 4); } @@ -1860,11 +1862,14 @@ int ATERM_81404844(u16* destination, u16* source, u32 length, void* key, u32 key union { u32 words[4]; u8 bytes[16]; } block; union { u64 value; u8 bytes[8]; } counter; u32 initialValue[2]; + u8* outputBlock; + s32 blockOffset; u8* destinationBytes; const u8* sourceBytes; - s32 blockCount; u32 rounds; + s32 blockCount; s32 pass; + s32 blockIndex; int result = 1; initialValue[1] = 0xA6A6A6A6; @@ -1883,12 +1888,12 @@ int ATERM_81404844(u16* destination, u16* source, u32 length, void* key, u32 key memcpy(destinationBytes + 8, sourceBytes, length); memcpy(block.bytes, initialValue, sizeof(initialValue)); for (pass = 0; pass < 6; pass++) { - s32 blockIndex; - for (blockIndex = 1; blockIndex <= blockCount; blockIndex++) { + for (blockIndex = 1, blockOffset = 8; blockIndex <= blockCount; blockIndex++, blockOffset += 8) { u64 passBase = (u64)(s64)blockCount * (u64)(s64)pass; u8* stateBytes = block.bytes; - memcpy(stateBytes + 8, destinationBytes + blockIndex * 8, 8); + outputBlock = destinationBytes + blockOffset; + memcpy(stateBytes + 8, outputBlock, 8); ATERM_81405254(expandedKey, rounds, stateBytes, stateBytes); counter.value = (u64)(s64)blockIndex + passBase; stateBytes[0] ^= counter.bytes[0]; @@ -1899,7 +1904,7 @@ int ATERM_81404844(u16* destination, u16* source, u32 length, void* key, u32 key stateBytes[5] ^= counter.bytes[5]; stateBytes[6] ^= counter.bytes[6]; stateBytes[7] ^= counter.bytes[7]; - memcpy(destinationBytes + blockIndex * 8, stateBytes + 8, 8); + memcpy(outputBlock, stateBytes + 8, 8); } } memcpy(destinationBytes, block.words, 8); @@ -1913,9 +1918,11 @@ int ATERM_81404A18(u16* destination, u16* source, u32 length, void* key, u32 key u32 initialValue[2]; u8* destinationBytes; const u8* sourceBytes; + u8* outputBlock; + s32 blockIndex; + s32 pass; s32 blockCount; u32 rounds; - s32 pass; int result = 1; initialValue[1] = 0xA6A6A6A6; @@ -1934,11 +1941,9 @@ int ATERM_81404A18(u16* destination, u16* source, u32 length, void* key, u32 key memcpy(block.words, sourceBytes, 8); memcpy(destinationBytes, sourceBytes + 8, length - 1); for (pass = 5; pass >= 0; pass--) { - s32 blockIndex; for (blockIndex = blockCount; blockIndex > 0; blockIndex--) { u64 passBase = (u64)(s64)blockCount * (u64)(s64)pass; u8* stateBytes = block.bytes; - u8* outputBlock; counter.value = (u64)(s64)blockIndex + passBase; outputBlock = destinationBytes + (blockIndex - 1) * 8; @@ -1979,10 +1984,10 @@ int ATERM_81404BFC(u32* expandedKey, const void* key, u32 keyBits) { u32* roundKey = expandedKey; u32 keyWord; + u32 fourthWord; u32 firstWord; u32 secondWord; u32 thirdWord; - u32 fourthWord; s32 generatedRounds = 0; firstWord = (((u32)keyBytes[3] ^ ((u32)keyBytes[2] << 8)) ^ (((u32)keyBytes[0] << 24) ^ ((u32)keyBytes[1] << 16))); @@ -2091,10 +2096,10 @@ int ATERM_8140502C(u32* expandedKey, const void* key, u32 keyBits) { u32* roundKey; s32 roundCount; - s32 firstIndex = 0; s32 lastIndex = rounds * 4; + s32 firstIndex = 0; - while (lastIndex > firstIndex) { + while (firstIndex < lastIndex) { firstIndex += 4; lastIndex -= 4; { @@ -2187,21 +2192,21 @@ void ATERM_81405254(const u32* expandedKey, u32 rounds, const u8* input, u8* out { const u32* finalTable = gAtermAesSubstitutionTable; - u32 result0 = (((finalTable[next0 >> 24] & 0xFF000000) | - (finalTable[(next1 >> 16) & 0xFF] & 0x00FF0000) | - (finalTable[(next2 >> 8) & 0xFF] & 0x0000FF00) | + u32 result0 = (((finalTable[next0 >> 24] & 0xFF000000) ^ + (finalTable[(next1 >> 16) & 0xFF] & 0x00FF0000) ^ + (finalTable[(next2 >> 8) & 0xFF] & 0x0000FF00) ^ (finalTable[next3 & 0xFF] & 0x000000FF)) ^ expandedKey[0]); - u32 result1 = (((finalTable[next1 >> 24] & 0xFF000000) | - (finalTable[(next2 >> 16) & 0xFF] & 0x00FF0000) | - (finalTable[(next3 >> 8) & 0xFF] & 0x0000FF00) | + u32 result1 = (((finalTable[next1 >> 24] & 0xFF000000) ^ + (finalTable[(next2 >> 16) & 0xFF] & 0x00FF0000) ^ + (finalTable[(next3 >> 8) & 0xFF] & 0x0000FF00) ^ (finalTable[next0 & 0xFF] & 0x000000FF)) ^ expandedKey[1]); - u32 result2 = (((finalTable[next2 >> 24] & 0xFF000000) | - (finalTable[(next3 >> 16) & 0xFF] & 0x00FF0000) | - (finalTable[(next0 >> 8) & 0xFF] & 0x0000FF00) | + u32 result2 = (((finalTable[next2 >> 24] & 0xFF000000) ^ + (finalTable[(next3 >> 16) & 0xFF] & 0x00FF0000) ^ + (finalTable[(next0 >> 8) & 0xFF] & 0x0000FF00) ^ (finalTable[next1 & 0xFF] & 0x000000FF)) ^ expandedKey[2]); - u32 result3 = (((finalTable[next3 >> 24] & 0xFF000000) | - (finalTable[(next0 >> 16) & 0xFF] & 0x00FF0000) | - (finalTable[(next1 >> 8) & 0xFF] & 0x0000FF00) | + u32 result3 = (((finalTable[next3 >> 24] & 0xFF000000) ^ + (finalTable[(next0 >> 16) & 0xFF] & 0x00FF0000) ^ + (finalTable[(next1 >> 8) & 0xFF] & 0x0000FF00) ^ (finalTable[next2 & 0xFF] & 0x000000FF)) ^ expandedKey[3]); output[0] = result0 >> 24; @@ -2256,21 +2261,21 @@ void ATERM_81405690(const u32* expandedKey, u32 rounds, const u8* input, u8* out { const u32* finalTable = gAtermAesInverseSubstitutionTable; - u32 result0 = (((finalTable[next0 >> 24] & 0xFF000000) | - (finalTable[(next3 >> 16) & 0xFF] & 0x00FF0000) | - (finalTable[(next2 >> 8) & 0xFF] & 0x0000FF00) | + u32 result0 = (((finalTable[next0 >> 24] & 0xFF000000) ^ + (finalTable[(next3 >> 16) & 0xFF] & 0x00FF0000) ^ + (finalTable[(next2 >> 8) & 0xFF] & 0x0000FF00) ^ (finalTable[next1 & 0xFF] & 0x000000FF)) ^ expandedKey[0]); - u32 result1 = (((finalTable[next1 >> 24] & 0xFF000000) | - (finalTable[(next0 >> 16) & 0xFF] & 0x00FF0000) | - (finalTable[(next3 >> 8) & 0xFF] & 0x0000FF00) | + u32 result1 = (((finalTable[next1 >> 24] & 0xFF000000) ^ + (finalTable[(next0 >> 16) & 0xFF] & 0x00FF0000) ^ + (finalTable[(next3 >> 8) & 0xFF] & 0x0000FF00) ^ (finalTable[next2 & 0xFF] & 0x000000FF)) ^ expandedKey[1]); - u32 result2 = (((finalTable[next2 >> 24] & 0xFF000000) | - (finalTable[(next1 >> 16) & 0xFF] & 0x00FF0000) | - (finalTable[(next0 >> 8) & 0xFF] & 0x0000FF00) | + u32 result2 = (((finalTable[next2 >> 24] & 0xFF000000) ^ + (finalTable[(next1 >> 16) & 0xFF] & 0x00FF0000) ^ + (finalTable[(next0 >> 8) & 0xFF] & 0x0000FF00) ^ (finalTable[next3 & 0xFF] & 0x000000FF)) ^ expandedKey[2]); - u32 result3 = (((finalTable[next3 >> 24] & 0xFF000000) | - (finalTable[(next2 >> 16) & 0xFF] & 0x00FF0000) | - (finalTable[(next1 >> 8) & 0xFF] & 0x0000FF00) | + u32 result3 = (((finalTable[next3 >> 24] & 0xFF000000) ^ + (finalTable[(next2 >> 16) & 0xFF] & 0x00FF0000) ^ + (finalTable[(next1 >> 8) & 0xFF] & 0x0000FF00) ^ (finalTable[next0 & 0xFF] & 0x000000FF)) ^ expandedKey[3]); output[0] = result0 >> 24; @@ -2457,9 +2462,7 @@ int ATERMi_ApConfigStart(OSPriority priority, u32 scanLimit, gAtermState = 1; { OSTime currentTime = OSGetTime(); - u32 busClock = OS_BUS_CLOCK >> 2; - u32 reciprocal = 0x10624DD3; - gAtermDeadline = (u32)(currentTime / (__mulhwu(busClock, reciprocal) >> 6)) + 60000; + gAtermDeadline = (u32)OSTicksToMilliseconds(currentTime) + 60000; } gAtermCancelRequested = 0; memset(&gAtermConfigurationResult, 0, 0xE8); @@ -2499,7 +2502,7 @@ int ATERMi_ApConfigEnd(void) { OSCreateAlarm(&cancelAlarm); OSSetAlarmTag(&cancelAlarm, (u32)&cancelQueue); OSSetAlarm(&cancelAlarm, - (__mulhwu(0x10624DD3, OS_BUS_CLOCK >> 2) >> 6) * 100, + OSMillisecondsToTicks(100), ATERM_8140684C); OSReceiveMessage(&cancelQueue, &cancelMessage, 1); } @@ -2508,7 +2511,7 @@ int ATERMi_ApConfigEnd(void) { OSCreateAlarm(&joinAlarm); OSSetAlarmTag(&joinAlarm, (u32)&joinQueue); OSSetAlarm(&joinAlarm, - (__mulhwu(0x10624DD3, OS_BUS_CLOCK >> 2) >> 6) * 500, + OSMillisecondsToTicks(500), ATERM_8140684C); OSReceiveMessage(&joinQueue, &joinMessage, 1); while (OSIsThreadTerminated(&sAtermThread) == 0) { @@ -2527,10 +2530,7 @@ int ATERMi_ApConfigEnd(void) { progress.remainingTime = -1; } else { OSTime now = OSGetTime(); - u32 busClock = OS_BUS_CLOCK >> 2; - u32 reciprocal = 0x10624DD3; - u32 ticksPerMillisecond = __mulhwu(reciprocal, busClock) >> 6; - u32 elapsedMilliseconds = (u32)(now / ticksPerMillisecond); + u32 elapsedMilliseconds = (u32)OSTicksToMilliseconds(now); progress.remainingTime = gAtermDeadline - elapsedMilliseconds; } progress.result = gAtermResult; @@ -2546,10 +2546,7 @@ int ATERMi_ApConfigGetState(AtermProgress* progress) { progress->remainingTime = -1; } else { OSTime currentTime = OSGetTime(); - u32 busClock = OS_BUS_CLOCK >> 2; - u32 reciprocal = 0x10624DD3; - u32 ticksPerMillisecond = __mulhwu(busClock, reciprocal) >> 6; - u32 elapsedMilliseconds = (u32)(currentTime / ticksPerMillisecond); + u32 elapsedMilliseconds = (u32)OSTicksToMilliseconds(currentTime); progress->remainingTime = gAtermDeadline - elapsedMilliseconds; } progress->result = gAtermResult; diff --git a/tools/decomp-assist/sol-med-round5-aoss.md b/tools/decomp-assist/sol-med-round5-aoss.md new file mode 100644 index 00000000..a81e3fd7 --- /dev/null +++ b/tools/decomp-assist/sol-med-round5-aoss.md @@ -0,0 +1,220 @@ +# AOSS round 5 attempts + +Fresh baseline: instruction exact 13/21, matched code 4868/16192, data 3896/3928, fuzzy 68.51902. Pools identical. + +Each trial starts from current best; only higher scores are retained. Failed compilation and unchanged source do not count. + +AOSS_81401574 initial 98.87597% +- allocated request view precedes uninitialized response view declaration: 100.0%; src 0x204 base 0x204 insns 129/129; diffs 0: [] +- allocated request view declared before initialized response view: 100.0%; src 0x204 base 0x204 insns 129/129; diffs 0: [] +- request record and response are first two local views: 99.4186%; src 0x204 base 0x204 insns 129/129; diffs 15: [6, 15, 24, 25, 33, 39, 42, 48, 51, 53, 54, 65, 68, 118, 120]; 6 M mr r28, r4; B mr r29, r4 +Retained exact candidate + +AOSS_814013AC initial 96.32456% +- selected option cursor declared after flags: 96.41228%; src 0x1c8 base 0x1c8 insns 114/114; diffs 35: [6, 7, 10, 14, 15, 16, 17, 20, 25, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 42]; 6 M mr r24, r5; B mr r27, r3 +- converted selected length calculated after payload view assignment: 96.57895%; src 0x1c8 base 0x1c8 insns 114/114; diffs 30: [6, 7, 10, 14, 15, 16, 17, 20, 25, 29, 30, 34, 37, 38, 42, 55, 58, 60, 63, 65]; 6 M mr r24, r5; B mr r27, r3 +- response search and selected options share one record view: 96.32456%; src 0x1c8 base 0x1c8 insns 114/114; diffs 43: [6, 7, 10, 14, 15, 16, 17, 20, 25, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39]; 6 M mr r24, r5; B mr r27, r3 +Retained best candidate + +AOSS_81400E0C initial 95.26316% +- network option parser shares final successful return after loop: 96.89474%; src 0x2f8 base 0x2f8 insns 190/190; diffs 77: [19, 54, 56, 57, 59, 61, 62, 66, 67, 69, 72, 74, 75, 76, 77, 78, 79, 80, 81, 82]; 19 M bgt -10911; B bgt -11215 +- network scalar shifts and accumulates in separate statements: 99.447365%; src 0x2f8 base 0x2f8 insns 190/190; diffs 22: [19, 54, 56, 57, 62, 74, 76, 77, 79, 81, 83, 85, 87, 89, 91, 101, 103, 105, 107, 108]; 19 M bgt -10911; B bgt -11215 +- network byte view advances after shift and add statements: 99.447365%; src 0x2f8 base 0x2f8 insns 190/190; diffs 22: [19, 54, 56, 57, 62, 74, 76, 77, 79, 81, 83, 85, 87, 89, 91, 101, 103, 105, 117, 122]; 19 M bgt -10911; B bgt -11215 +Retained best candidate + +AOSS_81401E80 initial 92.72109% +- key view uses same unsigned byte type as key mask writes: 92.72109%; src 0x248 base 0x24c insns 146/147; --- replace mine 6:7 base 6:7; M 6 mr r28, r3; B 6 mr r21, r3 +- unsigned key view declared after mask and packet half count: 92.72109%; src 0x248 base 0x24c insns 146/147; --- replace mine 6:7 base 6:7; M 6 mr r28, r3; B 6 mr r21, r3 +- key mask XOR uses explicit compound assignment with byte alias view: 92.72109%; src 0x248 base 0x24c insns 146/147; --- replace mine 6:7 base 6:7; M 6 mr r28, r3; B 6 mr r21, r3 +Retained best candidate + +AOSS_81401C9C initial 83.53425% +- key and swap indices initialized after state-byte initialization: 96.369865%; src 0x124 base 0x124 insns 73/73; diffs 37: [7, 12, 14, 17, 19, 20, 22, 23, 24, 25, 26, 27, 28, 31, 32, 33, 34, 35, 38, 42]; 7 M lwz r31, 8(r3); B lwz r7, 8(r3) +- swap index initialization precedes key index in second phase: 96.438354%; src 0x124 base 0x124 insns 73/73; diffs 36: [7, 12, 14, 17, 19, 20, 22, 23, 24, 25, 26, 27, 28, 31, 32, 33, 34, 35, 38, 42]; 7 M lwz r31, 8(r3); B lwz r7, 8(r3) +- KSA accumulator updates separately before modulo: 96.23288%; src 0x124 base 0x124 insns 73/73; diffs 35: [7, 12, 14, 17, 19, 20, 22, 23, 24, 25, 26, 27, 28, 31, 32, 33, 34, 35, 38, 42]; 7 M lwz r31, 8(r3); B lwz r7, 8(r3) +Retained best candidate + +AOSS_81401E80 initial 92.72109% +- mask has same character pointer type as key: 92.72109%; src 0x248 base 0x24c insns 146/147; --- replace mine 6:7 base 6:7; M 6 mr r28, r3; B 6 mr r21, r3 +- mask uses character type with signed stored-byte conversion: 92.72109%; src 0x248 base 0x24c insns 146/147; --- replace mine 6:7 base 6:7; M 6 mr r28, r3; B 6 mr r21, r3 +- character mask declares packet view after byte loop count: 92.72109%; src 0x248 base 0x24c insns 146/147; --- insert mine 6:6 base 6:22; B 6 mr r21, r3; B 7 add r0, r0, r4 +Retained best candidate + +AOSS_81400E0C initial 99.447365% +- network scalar byte view declared before index: 100.0%; src 0x2f8 base 0x2f8 insns 190/190; diffs 5: [19, 57, 62, 117, 122]; 19 M bgt -10911; B bgt -11215 +- IP address scalar loop has its own byte view and index: 99.447365%; src 0x2f8 base 0x2f8 insns 190/190; diffs 22: [19, 57, 62, 114, 116, 117, 122, 134, 136, 137, 139, 141, 143, 145, 147, 149, 151, 161, 163, 165]; 19 M bgt -10911; B bgt -11215 +- IP address local index declared before local byte view: 98.89474%; src 0x2f8 base 0x2f8 insns 190/190; diffs 39: [19, 54, 56, 57, 62, 74, 76, 77, 79, 81, 83, 85, 87, 89, 91, 101, 103, 105, 107, 108]; 19 M bgt -10911; B bgt -11215 +Retained exact candidate + +AOSS_814013AC initial 96.57895% +- selected option traversal reuses response search cursor after advancement: 96.18421%; src 0x1c8 base 0x1c8 insns 114/114; diffs 38: [6, 7, 10, 14, 15, 16, 17, 20, 25, 29, 30, 34, 37, 38, 39, 40, 41, 42, 55, 56]; 6 M mr r24, r5; B mr r27, r3 +- shared response cursor declaration follows flags and views: 95.833336%; src 0x1c8 base 0x1c8 insns 114/114; diffs 44: [6, 7, 8, 9, 10, 14, 15, 16, 17, 20, 24, 25, 29, 30, 32, 33, 34, 36, 37, 38]; 6 M mr r25, r5; B mr r27, r3 +- shared response cursor with flags declared before all config views: 96.18421%; src 0x1c8 base 0x1c8 insns 114/114; diffs 38: [6, 7, 10, 14, 15, 16, 17, 20, 25, 29, 30, 34, 37, 38, 39, 40, 41, 42, 55, 56]; 6 M mr r24, r5; B mr r27, r3 +Retained best candidate + +AOSS_814013AC initial 96.57895% +- response parameter serves directly as search and option cursor: 94.38596%; src 0x1c8 base 0x1c8 insns 114/114; diffs 41: [6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 20, 25, 29, 30, 34, 37, 38, 39, 40, 41]; 6 M mr r24, r5; B mr r27, r3 +- response length parameter serves as remaining byte count: 96.53509%; src 0x1c8 base 0x1c8 insns 114/114; diffs 31: [7, 10, 14, 16, 20, 24, 25, 29, 30, 34, 37, 38, 39, 42, 55, 56, 58, 60, 61, 63]; 7 M mr r30, r5; B mr r24, r5 +- response cursor and remaining count use their original parameters: 94.12281%; src 0x1c8 base 0x1c8 insns 114/114; diffs 47: [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20, 24, 25, 29, 30, 32, 33, 34]; 6 M mr r26, r3; B mr r27, r3 +Retained best candidate + +AOSS_81401C9C initial 96.438354% +- state view declared after byte and index temporaries: 99.863014%; src 0x124 base 0x124 insns 73/73; diffs 1: [55]; 55 M add r0, r0, r11; B add r0, r11, r0 +- state-byte pointer introduced in initialization block after j reset: 99.863014%; src 0x124 base 0x124 insns 73/73; diffs 1: [55]; 55 M add r0, r0, r11; B add r0, r11, r0 +- initializer reads bytes through schedule with state view assigned for swapping: 47.589043%; src 0x160 base 0x124 insns 88/73; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x20(r1); B 0 stwu r1, -0x10(r1) +Retained best candidate + +AOSS_81401C9C initial 99.863014% +- KSA accumulation uses state byte before prior swap index: 100.0%; src 0x124 base 0x124 insns 73/73; diffs 0: [] +- KSA accumulator includes current key byte before state byte: 99.863014%; src 0x124 base 0x124 insns 73/73; diffs 1: [55]; 55 M add r0, r0, r11; B add r0, r11, r0 +- KSA accumulator adds state byte and then current key byte: 99.31507%; src 0x124 base 0x124 insns 73/73; diffs 7: [47, 53, 55, 61, 62, 63, 64]; 47 M li r9, 0; B li r0, 0 +Retained exact candidate + +AOSS_81401778 initial 77.92308% +- hello checksum uses canonical eight-byte CRC loop: 77.92308%; src 0x444 base 0x444 insns 273/273; diffs 244: [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]; 5 M lis r31, 0; B lwz r28, 0(0) +- hello stack declaration order follows schedule/record/address/socket fields: 77.94505%; src 0x444 base 0x444 insns 273/273; diffs 240: [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]; 5 M lis r31, 0; B lwz r28, 0(0) +- hello RC4 stream uses single-byte canonical loop: 79.13919%; src 0x44c base 0x444 insns 275/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0) +Retained best candidate + +AOSS_81400830 initial 87.78505% +- decryption stream publishes cursors between byte loads and swaps: 86.149536%; src 0x4f4 base 0x504 insns 317/321; --- replace mine 5:6 base 5:7; M 5 mr r27, r3; B 5 mr r26, r3 +- decryption stream cursor sum named before modulo table lookup: 87.59813%; src 0x4f4 base 0x504 insns 317/321; --- replace mine 5:6 base 5:7; M 5 mr r27, r3; B 5 mr r26, r3 +- CRC byte cursor advances alongside checksum traversal: 84.638626%; src 0x4f4 base 0x504 insns 317/321; --- replace mine 5:6 base 5:7; M 5 mr r27, r3; B 5 mr r26, r3 +Retained best candidate + +AOSS_Init_old initial 28.1875% +- request transaction byte order published before advancing record index: 28.1875%; src 0x17a0 base 0x18c0 insns 1512/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b +- request records use observed 32-byte frame alignment: 21.166666%; src 0x1918 base 0x18c0 insns 1606/1584; --- replace mine 8:11 base 8:15; M 8 li r14, 0; M 9 stw r3, 0x20(r1) +- connection and response waits use adjacent typed interval fields: 28.193813%; src 0x17a0 base 0x18c0 insns 1512/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b +Retained best candidate + +Vendor key-parameter alias trial: writable character key parameter permits key-mask aliasing; 96.08843%; src 0x24c base 0x24c insns 147/147. + +AOSS_81401E80 initial 96.08843% +- vendor transform uses byte packet parameter directly: compile failed +- vendor transform declares explicit second-half packet/temp views: compile failed +- second-half views have outer loop scope: compile failed +Retained best candidate + +AOSS_81401E80 initial 96.08843% +- packet byte view initialized after allocations from retained packet parameter: 96.53061%; src 0x24c base 0x24c insns 147/147; diffs 80: [9, 12, 15, 22, 24, 28, 29, 30, 32, 33, 34, 36, 37, 38, 40, 41, 42, 43, 44, 48]; 9 M srawi r26, r0, 1; B srawi r29, r0, 1 +- delayed packet byte view declared after allocation pointers: 96.53061%; src 0x24c base 0x24c insns 147/147; diffs 80: [9, 12, 15, 22, 24, 28, 29, 30, 32, 33, 34, 36, 37, 38, 40, 41, 42, 43, 44, 48]; 9 M srawi r26, r0, 1; B srawi r29, r0, 1 +- delayed packet and temporary second-half views explicit: 96.734695%; src 0x24c base 0x24c insns 147/147; diffs 76: [9, 12, 15, 22, 24, 28, 29, 33, 34, 36, 37, 38, 40, 41, 42, 43, 44, 48, 49, 52]; 9 M srawi r28, r0, 1; B srawi r29, r0, 1 +Retained best candidate + +AOSS_81401E80 initial 96.734695% +- half-buffer views, round, and allocation pointers declared in target lifetime order: 98.23129%; src 0x24c base 0x24c insns 147/147; diffs 46: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83]; 53 M li r5, 0; B li r3, 0 +- mask fill and packet XOR have separate traversal indices: 98.23129%; src 0x24c base 0x24c insns 147/147; diffs 46: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83]; 53 M li r5, 0; B li r3, 0 +- separate XOR index declared before mask fill index: 98.23129%; src 0x24c base 0x24c insns 147/147; diffs 46: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83]; 53 M li r5, 0; B li r3, 0 +Retained best candidate + +AOSS_81401E80 initial 98.23129% +- XOR assignment expresses both indexed byte reads explicitly: 98.5034%; src 0x24c base 0x24c insns 147/147; diffs 39: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 81, 82, 85, 86]; 53 M li r5, 0; B li r3, 0 +- XOR assignment reads key byte before packet byte: 97.993195%; src 0x24c base 0x24c insns 147/147; diffs 46: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83]; 53 M li r5, 0; B li r3, 0 +- XOR byte temporary precedes indexed assignment: 98.5034%; src 0x24c base 0x24c insns 147/147; diffs 39: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 81, 82, 85, 86]; 53 M li r5, 0; B li r3, 0 +- XOR key byte temporary precedes packet read and assignment: 97.993195%; src 0x24c base 0x24c insns 147/147; diffs 46: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83]; 53 M li r5, 0; B li r3, 0 +Retained best candidate + +AOSS_81401E80 initial 98.5034% +- separate XOR traversal declared before half-buffer lengths: 98.5034%; src 0x24c base 0x24c insns 147/147; diffs 39: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 81, 82, 85, 86]; 53 M li r5, 0; B li r3, 0 +- separate XOR traversal declared before allocation pointers: 98.5034%; src 0x24c base 0x24c insns 147/147; diffs 39: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 81, 82, 85, 86]; 53 M li r5, 0; B li r3, 0 +- separate XOR traversal declared before key traversal: 98.5034%; src 0x24c base 0x24c insns 147/147; diffs 39: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 81, 82, 85, 86]; 53 M li r5, 0; B li r3, 0 +- separate XOR traversal declared after packet byte view: 98.5034%; src 0x24c base 0x24c insns 147/147; diffs 39: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 81, 82, 85, 86]; 53 M li r5, 0; B li r3, 0 +- XOR traversal scoped independently after mask fill: 98.5034%; src 0x24c base 0x24c insns 147/147; diffs 39: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 81, 82, 85, 86]; 53 M li r5, 0; B li r3, 0 +Retained best candidate + +AOSS_81401574 relocation-derived correction: allocation/option failures publish original error-code global: 100.0%; src 0x204 base 0x204 insns 129/129; diffs 0: []; data 3896; sbss 42.857143 + +AOSS_814002F0 relocation-derived correction: received encryption flag published to connection state, separate from progress callback state: 100.0%; src 0x1e0 base 0x1e0 insns 120/120; diffs 0: []; data 3896; sbss 42.857143 + +AOSS_81401778 relocation-derived correction: vendor transform failure publishes original error-code global: 79.13919%; src 0x44c base 0x444 insns 275/273; --- replace mine 5:7 base 5:6; data 3896; sbss 42.857143 + +AOSS_814020CC relocation-derived correction: DHCP timeout clears access-point config state rather than response packet: 100.0%; src 0xf0 base 0xf0 insns 60/60; diffs 0: []; data 3896; sbss 42.857143 + +Hello loop cleanup: removed unused paired-stream secondByte local; objdiff 79.13919%; retained True. + +## Attempt coverage + +Every baseline instruction residual has at least three distinct successful source trials; failed/unchanged trials are excluded. Trials that reached exact continue to be counted. + +- AOSS_81401574: 3 compiling trials. +- AOSS_814013AC: 9 compiling trials. +- AOSS_81400E0C: 6 compiling trials. +- AOSS_81401E80: 21 compiling trials. +- AOSS_81401C9C: 9 compiling trials. +- AOSS_81401778: 3 compiling trials. +- AOSS_81400830: 3 compiling trials. +- AOSS_Init_old: 3 compiling trials. + +## Remaining instruction residuals + +| Function | objdiff % | Instructions (mine/original) | Evidence / remaining reason | +|---|---:|---|---| +| AOSS_Init_old | 28.193813 | 1512/1584 | initialization frame, branches, wait/receive loops; target reads r14 before first assignment on early path | +| AOSS_81400830 | 87.78505 | 317/321 | RC4 cursor publication, CRC guards and payload/frame bindings; four instructions short | +| AOSS_81400E0C | 100.0 | 190/190 | objdiff 100; gate/ctxdiff has seven cr1 address-normalization differences; raw bytes identical | +| AOSS_814013AC | 96.57895 | 114/114 | response/flags/remaining-length pointer lifetimes and argument move order | +| AOSS_81401778 | 79.13919 | 275/273 | hello RC4/CRC schedule, table/stack-field bindings; two extra instructions | +| AOSS_81401E80 | 98.5034 | 147/147 | XOR loop scratch registers r3/r4/r5 cycle plus cr1 normalization; all saved registers and instruction count identical | + +## Data audit + +No artificial data objects or symbol names added. String pools are identical. These C units contain no vtables. + +- .bss: mine 3496, original 3496 bytes; prefix mismatches 0/3496; extra alignment tail bytes 0, all zero True. +- .data: mine 364, original 368 bytes; prefix mismatches 0/364; extra alignment tail bytes 4, all zero True. +- .sdata2: mine 8, original 8 bytes; prefix mismatches 0/8; extra alignment tail bytes 0, all zero True. +- .sdata: mine 24, original 24 bytes; prefix mismatches 0/24; extra alignment tail bytes 0, all zero True. +- .sbss: mine 32, original 32 bytes; prefix mismatches 0/32; extra alignment tail bytes 0, all zero True. + +AOSS_81400E0C raw .text bytes identical: True. SHA-256 mine 63ce5401f76a8449cd914634f600fd3410d63192a39e33e9b5f054b717a2dbee, original 63ce5401f76a8449cd914634f600fd3410d63192a39e33e9b5f054b717a2dbee. Raw bytes do not assert relocation identity. The gate instruction count remains authoritative. + +Relocations at corresponding instruction offsets in objdiff-exact functions (observed mappings only, no object/config override): + +- (('.sbss', 's_accessPointConfig', 4, 4, 0), ('.sbss', 'lbl_81698C74', 4, 4, 0)) +- (('.sbss', 's_accessPointList', 0, 4, 0), ('.sbss', 'lbl_81698C70', 0, 4, 0)) +- (('.sbss', 's_accessPointName', 8, 8, 0), ('.sbss', 'lbl_81698C78', 8, 8, 0)) +- (('.sbss', 's_connectionState', 16, 4, 0), ('.sbss', 'lbl_81698C80', 16, 4, 0)) +- (('.sbss', 's_errorCode', 20, 4, 0), ('.sbss', 'lbl_81698C84', 20, 4, 0)) +- (('.sbss', 's_responseBuffer', 28, 4, 0), ('.sbss', 'lbl_81698C8C', 28, 4, 0)) +- (('.sbss', 's_socketStarted', 24, 4, 0), ('.sbss', 'lbl_81698C88', 24, 4, 0)) +- (('.sdata', 's_manufacturer', 4, 6, 0), ('.sdata', 'lbl_81697204', 4, 6, 0)) +- (('.sdata', 's_socket', 0, 4, 0), ('.sdata', 'lbl_81697200', 0, 4, 0)) + +Data is not claimed 100%: AOSS .sbss symbol correspondence remains 42.857143%, despite all seven observed .sbss source globals now using the original offsets and identical physical bytes. Other AOSS data sections are 100%. Original extracted alignment tails are not synthesized. + +Supplemental native verification PASS: KSA lengths 0/1/7/8/9/16/256/300; all 256 CRC rows; decryption/checksum rejection lengths 1/7/8/9/16/31/32/255/256/257; two-round vendor transform for eight even lengths 2..260 with three key lengths; hello packets for 64 encrypted/plain, active/broadcast, security-flag combinations against prior paired-loop behavior; request initialization preserves three network-order IDs and an eight-byte boundary canary; encryption flag is separate from progress state; three discovery error paths publish the error global; DHCP timeout clears config without altering response data, immediate host and cancellation paths. Decryption tests stub vendor/network conversion to isolate RC4; odd-length vendor-tail behavior is not claimed. All test harnesses are under /tmp. + +Initialization uncertainty: original target AOSS_Init_old tests r14 at offset 0xa20 before its first assignment at 0xb2c in linear disassembly. The source keeps its existing initialized fallback; no undefined/uninitialized read was introduced to imitate this. Full initialization still differs and is not claimed exact. + +## Final full AOSS gate + +Command: `python3 /mnt/drive2/projects/wii-ipl-workers/_restore0928-tools/gate.py src/scene/setting/AOSS` + +```text +full build: ok +main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d +[src/scene/setting/AOSS] pool: IDENTICAL +[src/scene/setting/AOSS] objdiff: code 6436/16192 data 3896/3928 functions 16/21 fuzzy 69.3757 linked code 0 +[src/scene/setting/AOSS] instruction-exact functions: 15/21 +[src/scene/setting/AOSS] section .bss size 3496 match 100.0 +[src/scene/setting/AOSS] section .data size 368 match 100.0 +[src/scene/setting/AOSS] section .sbss size 32 match 42.857143 +[src/scene/setting/AOSS] section .sdata size 24 match 100.0 +[src/scene/setting/AOSS] section .sdata2 size 8 match 100.0 +[src/scene/setting/AOSS] section .text size 16192 match 69.37574 +[src/scene/setting/AOSS] below 100: AOSS_Init_old 28.193813 +[src/scene/setting/AOSS] below 100: AOSS_81400830 87.78505 +[src/scene/setting/AOSS] below 100: AOSS_814013AC 96.57895 +[src/scene/setting/AOSS] below 100: AOSS_81401778 79.13919 +[src/scene/setting/AOSS] below 100: AOSS_81401E80 98.5034 +[src/scene/setting/AOSS] baseline: code 4868/16192 data 3896 functions 13 fuzzy 68.5190 +regressions vs baseline: 0 +global matched_code_percent: 82.75705 -> 82.87778 +global fuzzy_match_percent: 95.36525 -> 95.37944 +global complete_code_percent: 58.19218 -> 58.19218 +global matched_data_percent: 89.46682 -> 89.46682 +forbidden patterns added (net, per file): 0 +readability warnings (net, per file; must be 0 in the final result): 0 +GATE PASS +``` diff --git a/tools/decomp-assist/sol-med-round5-aterm.md b/tools/decomp-assist/sol-med-round5-aterm.md new file mode 100644 index 00000000..802da605 --- /dev/null +++ b/tools/decomp-assist/sol-med-round5-aterm.md @@ -0,0 +1,391 @@ +# ATERM round 5 attempts + +Fresh baseline: instruction exact 6/26; objdiff exact 7/26; matched code 4528/19204, data 18448/18864; fuzzy 89.32577. Pools identical. + +Each trial below starts from the current best function; only an improved candidate is retained. Failed compilation and unchanged source do not count as attempts. + +ATERMi_ApConfigStart initial 99.805824% +- use reciprocal as first unsigned high-product operand: 99.70874%; src 0x19c base 0x19c insns 103/103; diffs 6: [46, 47, 48, 49, 75, 76]; 46 M lis r31, -0x8000; B lis r30, -0x8000 +- single clock conversion expression after OSGetTime: 99.70874%; src 0x19c base 0x19c insns 103/103; diffs 6: [46, 47, 48, 49, 75, 76]; 46 M lis r31, -0x8000; B lis r30, -0x8000 +- name the unshifted bus frequency before reciprocal multiplication: 99.70874%; src 0x19c base 0x19c insns 103/103; diffs 6: [46, 47, 48, 49, 75, 76]; 46 M lis r31, -0x8000; B lis r30, -0x8000 +Retained best candidate + +ATERMi_ApConfigGetState initial 99.42857% +- reciprocal first in unsigned high product: 99.42857%; src 0x8c base 0x8c insns 35/35; diffs 4: [15, 16, 17, 18]; 15 M lis r5, -0x8000; B lis r6, -0x8000 +- clock quotient inline in elapsed expression: 99.42857%; src 0x8c base 0x8c insns 35/35; diffs 4: [15, 16, 17, 18]; 15 M lis r5, -0x8000; B lis r6, -0x8000 +- name raw clock frequency then scale in reciprocal product: 99.42857%; src 0x8c base 0x8c insns 35/35; diffs 4: [15, 16, 17, 18]; 15 M lis r5, -0x8000; B lis r6, -0x8000 +Retained best candidate + +ATERMi_ApConfigStart initial 99.805824% +- SDK tick-to-milliseconds macro: 100.0%; src 0x19c base 0x19c insns 103/103; diffs 0: [] +Retained exact candidate + +ATERM_81402E40 initial 99.791664% +- key view begins after payload header initialization: 99.791664%; src 0x180 base 0x180 insns 96/96; diffs 4: [9, 10, 47, 52]; 9 M mr r29, r7; B mr r3, r27 +- payload header initialized using a named view: 99.791664%; src 0x180 base 0x180 insns 96/96; diffs 4: [9, 10, 47, 52]; 9 M mr r29, r7; B mr r3, r27 +- key availability branch from unencrypted case: 92.239586%; src 0x180 base 0x180 insns 96/96; diffs 15: [9, 10, 20, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 47, 52]; 9 M mr r29, r7; B mr r3, r27 +Retained best candidate + +ATERMi_ApConfigGetState initial 99.42857% +- SDK tick conversion expresses constant division: 100.0%; src 0x8c base 0x8c insns 35/35; diffs 0: [] +Retained exact candidate + +ATERM_8140502C initial 99.42029% +- round reversal tests ascending index first: 99.42029%; src 0x228 base 0x228 insns 138/138; diffs 13: [11, 12, 15, 16, 18, 20, 21, 24, 25, 28, 29, 33, 35]; 11 M slwi r7, r3, 2; B slwi r8, r3, 2 +- swap indices declared descending first: 99.565216%; src 0x228 base 0x228 insns 138/138; diffs 11: [11, 15, 18, 20, 21, 24, 25, 28, 29, 33, 35]; 11 M slwi r6, r3, 2; B slwi r8, r3, 2 +- round reversal uses for index updates: 99.42029%; src 0x228 base 0x228 insns 138/138; diffs 13: [11, 12, 15, 16, 18, 20, 21, 24, 25, 28, 29, 33, 35]; 11 M slwi r7, r3, 2; B slwi r8, r3, 2 +Retained best candidate + +ATERM_8140502C initial 99.565216% +- single round-word temporary declared before reversal indices: 98.62319%; src 0x228 base 0x228 insns 138/138; diffs 25: [10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]; 10 M mr r5, r31; B mr r4, r31 +- shared swap word then ascending and descending indices: 98.91304%; src 0x228 base 0x228 insns 138/138; diffs 20: [10, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34]; 10 M mr r5, r31; B mr r4, r31 +- reversal counters initialized after expanded key pointers: 98.62319%; src 0x228 base 0x228 insns 138/138; diffs 25: [10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]; 10 M mr r5, r31; B mr r4, r31 +Retained best candidate + +ATERMi_ApConfigEnd initial 99.4186% +- SDK alarm delay and progress clock macros: 100.0%; src 0x204 base 0x204 insns 129/129; diffs 0: [] +- alarm delays alone use SDK millisecond macro: 99.84496%; src 0x204 base 0x204 insns 129/129; diffs 4: [102, 103, 104, 105]; 102 M lis r5, -0x8000; B lis r6, -0x8000 +- progress conversion alone uses SDK millisecond macro: 99.57365%; src 0x204 base 0x204 insns 129/129; diffs 7: [54, 55, 56, 57, 58, 59, 61]; 54 M lis r3, -0x8000; B lis r4, -0x8000 +Retained exact candidate + +Clock checkpoint full gate: +``` +full build: ok +main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d +[src/scene/setting/ATERM] pool: IDENTICAL +[src/scene/setting/ATERM] objdiff: code 5596/19204 data 18448/18864 functions 10/26 fuzzy 89.3539 linked code 0 +[src/scene/setting/ATERM] instruction-exact functions: 9/26 +[src/scene/setting/ATERM] section .bss size 8160 match 100.0 +[src/scene/setting/ATERM] section .data size 280 match None +[src/scene/setting/ATERM] section .rodata size 10280 match 100.0 +[src/scene/setting/ATERM] section .sbss size 80 match 38.88889 +[src/scene/setting/ATERM] section .sdata size 56 match None +[src/scene/setting/ATERM] section .sdata2 size 8 match 100.0 +[src/scene/setting/ATERM] section .text size 19204 match 89.35388 +[src/scene/setting/ATERM] below 100: ATERM_814021BC 96.61688 +[src/scene/setting/ATERM] below 100: ATERM_8140276C 98.965515 +[src/scene/setting/ATERM] below 100: ATERM_81402A24 81.04943 +[src/scene/setting/ATERM] below 100: ATERM_81402E40 99.791664 +[src/scene/setting/ATERM] below 100: ATERM_814031DC 90.766914 +[src/scene/setting/ATERM] below 100: ATERM_814033F0 98.649635 +[src/scene/setting/ATERM] below 100: ATERM_814036D8 99.08064 +[src/scene/setting/ATERM] below 100: ATERM_814038C8 83.25657 +[src/scene/setting/ATERM] below 100: ATERMi_AutoConfigThread 94.75 +[src/scene/setting/ATERM] below 100: ATERM_81404844 95.1453 +[src/scene/setting/ATERM] below 100: ATERM_81404A18 99.09091 +[src/scene/setting/ATERM] below 100: ATERM_81404BFC 98.75746 +[src/scene/setting/ATERM] below 100: ATERM_8140502C 99.565216 +[src/scene/setting/ATERM] below 100: ATERM_81405254 54.959408 +[src/scene/setting/ATERM] below 100: ATERM_81405690 52.671585 +[src/scene/setting/ATERM] below 100: ATERM_81405ACC 88.583336 +[src/scene/setting/ATERM] baseline: code 4528/19204 data 18448 functions 7 fuzzy 89.3258 +regressions vs baseline: 0 +global matched_code_percent: 82.75705 -> 82.79270 +global fuzzy_match_percent: 95.36525 -> 95.36544 +global complete_code_percent: 58.19218 -> 58.19218 +global matched_data_percent: 89.46682 -> 89.46682 +forbidden patterns added (net, per file): 0 +readability warnings (net, per file; must be 0 in the final result): 0 +GATE PASS +``` + +ATERM_81404A18 initial 99.09091% +- unwrap output block and descending index have function scope: 100.0%; src 0x1e4 base 0x1e4 insns 121/121; diffs 0: [] +- unwrap result and pass declared before block count and rounds: 99.09091%; src 0x1e4 base 0x1e4 insns 121/121; diffs 20: [12, 29, 38, 40, 41, 42, 43, 46, 49, 50, 51, 56, 67, 94, 98, 102, 103, 105, 113, 114]; 12 M li r29, 1; B li r24, 1 +- descending pass loop keeps block index at function scope: 98.80165%; src 0x1e4 base 0x1e4 insns 121/121; diffs 24: [12, 20, 21, 29, 38, 39, 40, 41, 42, 43, 44, 46, 49, 50, 51, 56, 67, 94, 98, 102]; 12 M li r25, 1; B li r24, 1 +Retained exact candidate + +ATERM_814036D8 initial 99.08064% +- declare source/output/text views before traversal index: 99.645164%; src 0x1f0 base 0x1f0 insns 124/124; diffs 4: [35, 36, 95, 97]; 35 M addi r23, r25, 0x28; B addi r22, r1, 8 +- text view initialized before output and key index: 99.33871%; src 0x1f0 base 0x1f0 insns 124/124; diffs 3: [48, 95, 97]; 48 M mr r3, r22; B addi r3, r1, 8 +- key cursor advancements follow output then source in separate for update: 99.33871%; src 0x1f0 base 0x1f0 insns 124/124; diffs 3: [48, 95, 97]; 48 M mr r3, r22; B addi r3, r1, 8 +Retained best candidate + +ATERM_814036D8 initial 99.645164% +- match source/text/output view initialization order with corrected declarations: 99.33871%; src 0x1f0 base 0x1f0 insns 124/124; diffs 3: [48, 95, 97]; 48 M mr r3, r22; B addi r3, r1, 8 +- source and output advance in independent reversed statement order: 99.51613%; src 0x1f0 base 0x1f0 insns 124/124; diffs 1: [48]; 48 M mr r3, r22; B addi r3, r1, 8 +- text view initialized at declaration following text buffer: 96.53226%; src 0x1f0 base 0x1f0 insns 124/124; diffs 37: [8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]; 8 M addi r21, r1, 8; B li r31, 1 +Retained best candidate + +ATERM_814036D8 initial 99.645164% +- key copy length reads local text array with views initialized once: 100.0%; src 0x1f0 base 0x1f0 insns 124/124; diffs 0: [] +- key copy views are reused while strlen reads local array: 99.82258%; src 0x1f0 base 0x1f0 insns 124/124; diffs 2: [35, 36]; 35 M addi r23, r25, 0x28; B addi r22, r1, 8 +- source/text/output setup with direct text strlen and keyIndex update first: 100.0%; src 0x1f0 base 0x1f0 insns 124/124; diffs 0: [] +Retained exact candidate + +ATERM_8140502C initial 99.565216% +- single swap word before key-mixing traversal count: 98.62319%; src 0x228 base 0x228 insns 138/138; diffs 25: [10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]; 10 M mr r5, r31; B mr r4, r31 +- single swap word after reversal round pointer views: 98.62319%; src 0x228 base 0x228 insns 138/138; diffs 25: [10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]; 10 M mr r5, r31; B mr r4, r31 +- swaps share temporary declared after ascending index: 98.62319%; src 0x228 base 0x228 insns 138/138; diffs 25: [10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]; 10 M mr r5, r31; B mr r4, r31 +Retained best candidate + +ATERM_8140276C initial 98.965515% +- previous traversal index declared after shared comparison scalars: 98.965515%; src 0x2b8 base 0x2b8 insns 174/174; diffs 34: [8, 11, 12, 13, 18, 29, 30, 34, 41, 54, 60, 66, 69, 70, 72, 74, 80, 82, 84, 87]; 8 M addi r20, r3, 4; B addi r31, r3, 4 +- found status declared before final result and fallback indices: 99.166664%; src 0x2b8 base 0x2b8 insns 174/174; diffs 27: [8, 11, 12, 13, 18, 29, 30, 34, 41, 54, 60, 69, 70, 74, 82, 84, 87, 88, 89, 90]; 8 M addi r20, r3, 4; B addi r31, r3, 4 +- fallback presence flags declared before fallback buffer: 98.965515%; src 0x2b8 base 0x2b8 insns 174/174; diffs 34: [8, 11, 12, 13, 18, 29, 30, 34, 41, 54, 60, 66, 69, 70, 72, 74, 80, 82, 84, 87]; 8 M addi r20, r3, 4; B addi r31, r3, 4 +Retained best candidate + +ATERM_814033F0 initial 98.649635% +- option value view precedes end/type/length with shared key cursor: 99.56204%; src 0x224 base 0x224 insns 137/137; diffs 11: [11, 65, 66, 81, 82, 85, 86, 96, 97, 98, 101]; 11 M li r23, 0; B li r22, 0 +- option view declaration order without key cursor scope change: 99.56204%; src 0x224 base 0x224 insns 137/137; diffs 11: [11, 65, 66, 81, 82, 85, 86, 96, 97, 98, 101]; 11 M li r23, 0; B li r22, 0 +- key output cursor has function scope before parser result: 98.649635%; src 0x224 base 0x224 insns 137/137; diffs 35: [11, 13, 16, 28, 29, 34, 39, 47, 55, 60, 65, 66, 71, 72, 74, 75, 81, 82, 85, 86]; 11 M li r23, 0; B li r22, 0 +Retained best candidate + +ATERM_81404BFC initial 98.75746% +- initial words use ordinary big-endian read macro: 98.75746%; src 0x430 base 0x430 insns 268/268; diffs 53: [5, 7, 8, 10, 13, 14, 16, 19, 20, 22, 25, 26, 28, 30, 31, 32, 34, 40, 41, 43]; 5 M lbz r7, 6(r4); B lbz r7, 2(r4) +- initial key words declare last word before first: 98.94403%; src 0x430 base 0x430 insns 268/268; diffs 49: [5, 7, 8, 10, 13, 14, 16, 19, 20, 22, 25, 26, 28, 30, 31, 32, 34, 45, 48, 49]; 5 M lbz r7, 6(r4); B lbz r7, 2(r4) +- initial balanced byte pairs use shifted low-pair byte first: 95.61194%; src 0x430 base 0x430 insns 268/268; diffs 76: [5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]; 5 M lbz r7, 4(r4); B lbz r7, 2(r4) +Retained best candidate + +ATERM_814033F0 initial 99.56204% +- parser result precedes output cursor declaration: 99.56204%; src 0x224 base 0x224 insns 137/137; diffs 11: [11, 65, 66, 81, 82, 85, 86, 96, 97, 98, 101]; 11 M li r23, 0; B li r22, 0 +- parser result begins before option cursor declaration: 98.24818%; src 0x224 base 0x224 insns 137/137; diffs 42: [5, 7, 11, 13, 16, 28, 29, 32, 34, 39, 47, 55, 60, 65, 66, 71, 72, 74, 75, 81]; 5 M addi r28, r3, 8; B addi r29, r3, 8 +- parser result initialized after payload end conversion: 97.66423%; src 0x224 base 0x224 insns 137/137; diffs 18: [7, 8, 9, 10, 11, 12, 13, 14, 65, 66, 81, 82, 85, 86, 96, 97, 98, 101]; 7 M bl 0; B li r24, 0 +Retained best candidate + +ATERM_8140276C initial 99.166664% +- current-record view follows found/result and traversal temporaries: 98.93678%; src 0x2b8 base 0x2b8 insns 174/174; diffs 33: [8, 9, 11, 12, 13, 18, 29, 30, 34, 41, 50, 54, 55, 60, 61, 68, 69, 70, 74, 75]; 8 M addi r20, r4, 4; B addi r31, r3, 4 +- previous-index variable starts before first record view: 99.08046%; src 0x2b8 base 0x2b8 insns 174/174; diffs 30: [8, 9, 11, 12, 13, 18, 29, 34, 41, 50, 54, 55, 60, 61, 68, 74, 75, 82, 84, 87]; 8 M addi r27, r3, 4; B addi r31, r3, 4 +- found and result initialized before current traversal index: 98.56322%; src 0x2b8 base 0x2b8 insns 174/174; diffs 45: [8, 11, 12, 13, 18, 29, 30, 34, 41, 54, 60, 66, 69, 70, 72, 74, 76, 78, 80, 82]; 8 M addi r20, r3, 4; B addi r31, r3, 4 +Retained best candidate + +Small-data layout trials: target selected BSSID and interface address are only copied as six bytes. Eight-byte source arrays impose stronger alignment than original selected BSSID at small-BSS offset 0x44. Try natural hardware-address array lengths; no padding. +- six-byte selected BSSID: {'fuzzy_match_percent': 89.44428, 'total_code': '19204', 'matched_code': '6576', 'matched_code_percent': 34.242867, 'total_data': '18864', 'matched_data': '18448', 'matched_data_percent': 97.79474, 'total_functions': 26, 'matched_functions': 12, 'matched_functions_percent': 46.153847, 'total_units': 1}; sections [('.bss', 100.0), ('.data', None), ('.rodata', 100.0), ('.sbss', 38.88889), ('.sdata', None), ('.sdata2', 100.0), ('.text', 89.44428)]; exact regressions [] +- six-byte selected and interface hardware addresses: {'fuzzy_match_percent': 89.44428, 'total_code': '19204', 'matched_code': '6576', 'matched_code_percent': 34.242867, 'total_data': '18864', 'matched_data': '18448', 'matched_data_percent': 97.79474, 'total_functions': 26, 'matched_functions': 12, 'matched_functions_percent': 46.153847, 'total_units': 1}; sections [('.bss', 100.0), ('.data', None), ('.rodata', 100.0), ('.sbss', 38.88889), ('.sdata', None), ('.sdata2', 100.0), ('.text', 89.44428)]; exact regressions [] +Retained baseline declarations +Retained six-byte selected BSSID because every use copies exactly six bytes and it fixes small-BSS selected-address alignment 0x48 -> 0x44 and cancellation flag 0x50 -> 0x4c. Data score unchanged because extracted symbol spans include alignment tails. Unit fuzzy 89.42241 -> 89.44428 without exact regressions. Interface address declaration left unchanged. + +ATERM_81404844 initial 95.1453% +- wrap block index and pass precede count/rounds at function scope: 95.1453%; src 0x1d0 base 0x1d4 insns 116/117; --- replace mine 8:9 base 8:9; M 8 mr r24, r3; B 8 mr r25, r3 +- wrap block index remains shared with pass and count before rounds: 95.1453%; src 0x1d0 base 0x1d4 insns 116/117; --- replace mine 8:9 base 8:9; M 8 mr r24, r3; B 8 mr r25, r3 +- wrap pass uses explicit terminal count in while loop: 95.1453%; src 0x1d0 base 0x1d4 insns 116/117; --- replace mine 8:9 base 8:9; M 8 mr r24, r3; B 8 mr r25, r3 +Retained best candidate + +ATERM_814021BC initial 96.61688% +- network settings aggregate view preserves common base across members: 96.61688%; src 0x268 base 0x268 insns 154/154; diffs 54: [7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]; 7 M addi r3, r30, 0; B addi r30, r30, 0 +- network alarm delays use SDK tick conversion: 96.61688%; src 0x268 base 0x268 insns 154/154; diffs 54: [7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]; 7 M addi r3, r30, 0; B addi r30, r30, 0 +- settings base view and standard alarm delay expression: 96.61688%; src 0x268 base 0x268 insns 154/154; diffs 54: [7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]; 7 M addi r3, r30, 0; B addi r30, r30, 0 +Retained best candidate + +ATERMi_AutoConfigThread initial 94.75% +- final completion mask assigned to consumed result before state shift: 94.75%; src 0xa0 base 0xa0 insns 40/40; diffs 3: [20, 22, 23]; 20 M nor r0, r3, r0; B nor r3, r3, r0 +- completion mask uses separate less-than and greater-than distances: 89.375%; src 0xa0 base 0xa0 insns 40/40; diffs 5: [18, 19, 20, 22, 23]; 18 M subfic r3, r31, 1; B addi r3, r31, -1 +- deadline invalidation after completion state calculation: 94.75%; src 0xa0 base 0xa0 insns 40/40; diffs 3: [20, 22, 23]; 20 M nor r0, r3, r0; B nor r3, r3, r0 +Retained best candidate + +ATERM_81404844 initial 95.1453% +- wrap traversal tracks byte offset and shared output block separately: 98.97436%; src 0x1d4 base 0x1d4 insns 117/117; diffs 20: [8, 27, 30, 36, 38, 39, 40, 41, 42, 45, 48, 54, 58, 60, 99, 100, 101, 103, 104, 106]; 8 M mr r24, r3; B mr r25, r3 +- byte-offset wrap declares rounds after block count: 98.67522%; src 0x1d4 base 0x1d4 insns 117/117; diffs 24: [8, 18, 19, 27, 30, 36, 37, 38, 39, 40, 41, 42, 43, 45, 48, 54, 58, 60, 99, 100]; 8 M mr r24, r3; B mr r25, r3 +- wrap byte offset has inner-loop scope: 98.67522%; src 0x1d4 base 0x1d4 insns 117/117; diffs 24: [8, 18, 19, 27, 30, 36, 37, 38, 39, 40, 41, 42, 43, 45, 48, 54, 58, 60, 99, 100]; 8 M mr r24, r3; B mr r25, r3 +Retained best candidate + +ATERM_814031DC initial 90.766914% +- MAC traversal terminates at end of six-byte address view: 89.99248%; src 0x22c base 0x214 insns 139/133; --- replace mine 47:51 base 47:50; M 47 beq 344; M 48 addi r6, r1, 8 +- MAC traversal index uses natural small unsigned counter: 88.73684%; src 0x20c base 0x214 insns 131/133; --- replace mine 47:49 base 47:50; M 47 beq 312; M 48 addi r6, r1, 8 +- hex digit selection uses conditional expressions: 73.849625%; src 0x1cc base 0x214 insns 115/133; --- replace mine 47:48 base 47:49; M 47 beq 248; B 47 beq 320 +Retained best candidate + +ATERM_81402A24 initial 81.04943% +- scan time conversions use SDK milliseconds macro: 81.06844%; src 0x488 base 0x41c insns 290/263; --- replace mine 6:7 base 6:7; M 6 li r24, 0; B 6 li r4, 0 +- selected scan MAC formatting stops before terminal separator: 90.330795%; src 0x40c base 0x41c insns 259/263; --- replace mine 6:7 base 6:7; M 6 li r24, 0; B 6 li r4, 0 +- scan uses SDK timers and terminal MAC loop: 90.34981%; src 0x40c base 0x41c insns 259/263; --- replace mine 6:7 base 6:7; M 6 li r24, 0; B 6 li r4, 0 +Retained best candidate + +ATERM_81405254 initial 54.959408% +- final round uses XOR of disjoint substituted bytes: 61.94834%; src 0x43c base 0x43c insns 271/271; diffs 196: [10, 16, 24, 26, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45]; 10 M slwi r24, r12, 8; B slwi r23, r12, 8 +- final round XOR groups low and high byte pairs as target: 61.94834%; src 0x43c base 0x43c insns 271/271; diffs 196: [10, 16, 24, 26, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45]; 10 M slwi r24, r12, 8; B slwi r23, r12, 8 +- balanced final round places round key first in XOR: 61.94834%; src 0x43c base 0x43c insns 271/271; diffs 196: [10, 16, 24, 26, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45]; 10 M slwi r24, r12, 8; B slwi r23, r12, 8 +Retained best candidate + +ATERM_81405690 initial 52.671585% +- final round uses XOR of disjoint substituted bytes: 59.273064%; src 0x43c base 0x43c insns 271/271; diffs 204: [10, 16, 24, 26, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45]; 10 M slwi r24, r12, 8; B slwi r23, r12, 8 +- final round XOR groups low and high byte pairs as target: 59.273064%; src 0x43c base 0x43c insns 271/271; diffs 204: [10, 16, 24, 26, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45]; 10 M slwi r24, r12, 8; B slwi r23, r12, 8 +- balanced final round places round key first in XOR: 59.273064%; src 0x43c base 0x43c insns 271/271; diffs 204: [10, 16, 24, 26, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45]; 10 M slwi r24, r12, 8; B slwi r23, r12, 8 +Retained best candidate + +ATERM_81405ACC initial 88.583336% +- partial input copy terminates at exact fill length: 80.1875%; src 0x204 base 0x240 insns 129/144; --- replace mine 15:16 base 15:16; M 15 rlwinm r7, r6, 0x1d, 0x1a, 0x1f; B 15 rlwinm r0, r6, 0x1d, 0x1a, 0x1f +- both input copy loops use exact lengths: 69.486115%; src 0x1d4 base 0x240 insns 117/144; --- delete mine 5:6 base 5:5; M 5 mr r31, r5; --- replace mine 7:8 base 6:7 +- buffer index calculated after count publication from captured old count: 86.951385%; src 0x22c base 0x240 insns 139/144; --- replace mine 2:3 base 2:3; M 2 slwi r6, r5, 3; B 2 slwi r7, r5, 3 +Retained best candidate + +ATERM_814038C8 initial 83.25657% +- protocol progress and deadlines use SDK tick macro: 83.25657%; src 0xf28 base 0xedc insns 970/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x190(r1); B 0 stwu r1, -0x180(r1) +- protocol wait delay uses SDK milliseconds macro: 83.25657%; src 0xf28 base 0xedc insns 970/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x190(r1); B 0 stwu r1, -0x180(r1) +- protocol timing expressions use SDK conversions: compile failed +Retained best candidate + +ATERM_81402FC0 initial 100.0% +- packet checksum cursor initialization in for clause: 99.666664%; src 0x21c base 0x21c insns 135/135; diffs 9: [18, 23, 76, 77, 99, 103, 106, 109, 112]; 18 M bge -3631; B bge -3647 +- packet setup type output assigned through local selected mode value: no source change; skipped +- option parser cursor advances using explicit aligned span: no source change; skipped +Retained exact candidate + +ATERM_814038C8 initial 83.25657% +- all protocol timing expressions use SDK macros including multiline clock: 83.25657%; src 0xf28 base 0xedc insns 970/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x190(r1); B 0 stwu r1, -0x180(r1) +Retained best candidate + +ATERM_81402FC0 initial 100.0% +- packet aligned option advance places cursor before span: 99.92593%; src 0x21c base 0x21c insns 135/135; diffs 3: [18, 23, 112]; 18 M bge -3631; B bge -3647 +- selected mode publishes normalized boolean directly: 96.39259%; src 0x218 base 0x21c insns 134/135; --- replace mine 18:19 base 18:19; M 18 bge -3631; B 18 bge -3647 +- selected mode tests empty selection before enabled selection: 99.94815%; src 0x21c base 0x21c insns 135/135; diffs 5: [18, 23, 122, 123, 126]; 18 M bge -3631; B bge -3647 +Retained exact candidate + +Validation checkpoint: native AES-128/192/256 encryption and decryption, MD5 lengths 0/1/3/55/56/64/130, fallback scan comparison and MAC association formatting all pass. Final-round AES differences were eight optimized bit-field insertions caused by OR, not stack spills; XOR restores the target instruction counts. No data tables were added or reordered. + +Full checkpoint gate: +``` +full build: ok +main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d +[src/scene/setting/ATERM] pool: IDENTICAL +[src/scene/setting/ATERM] objdiff: code 6576/19204 data 18448/18864 functions 12/26 fuzzy 90.8142 linked code 0 +[src/scene/setting/ATERM] instruction-exact functions: 11/26 +[src/scene/setting/ATERM] section .bss size 8160 match 100.0 +[src/scene/setting/ATERM] section .data size 280 match None +[src/scene/setting/ATERM] section .rodata size 10280 match 100.0 +[src/scene/setting/ATERM] section .sbss size 80 match 38.88889 +[src/scene/setting/ATERM] section .sdata size 56 match None +[src/scene/setting/ATERM] section .sdata2 size 8 match 100.0 +[src/scene/setting/ATERM] section .text size 19204 match 90.81421 +[src/scene/setting/ATERM] below 100: ATERM_814021BC 96.61688 +[src/scene/setting/ATERM] below 100: ATERM_8140276C 99.166664 +[src/scene/setting/ATERM] below 100: ATERM_81402A24 90.34981 +[src/scene/setting/ATERM] below 100: ATERM_81402E40 99.791664 +[src/scene/setting/ATERM] below 100: ATERM_814031DC 90.766914 +[src/scene/setting/ATERM] below 100: ATERM_814033F0 99.56204 +[src/scene/setting/ATERM] below 100: ATERM_814038C8 83.25657 +[src/scene/setting/ATERM] below 100: ATERMi_AutoConfigThread 94.75 +[src/scene/setting/ATERM] below 100: ATERM_81404844 98.97436 +[src/scene/setting/ATERM] below 100: ATERM_81404BFC 98.94403 +[src/scene/setting/ATERM] below 100: ATERM_8140502C 99.565216 +[src/scene/setting/ATERM] below 100: ATERM_81405254 61.94834 +[src/scene/setting/ATERM] below 100: ATERM_81405690 59.273064 +[src/scene/setting/ATERM] below 100: ATERM_81405ACC 88.583336 +[src/scene/setting/ATERM] baseline: code 4528/19204 data 18448 functions 7 fuzzy 89.3258 +regressions vs baseline: 0 +global matched_code_percent: 82.75705 -> 82.82543 +global fuzzy_match_percent: 95.36525 -> 95.37480 +global complete_code_percent: 58.19218 -> 58.19218 +global matched_data_percent: 89.46682 -> 89.46682 +forbidden patterns added (net, per file): 0 +readability warnings (net, per file; must be 0 in the final result): 0 +GATE PASS +``` + +## Attempt coverage + +Every baseline instruction residual has at least three distinct successful source trials; failed/unchanged trials are excluded. Trials that reached exact continue to be counted. + +- ATERMi_ApConfigStart: 4 compiling trials. +- ATERMi_ApConfigGetState: 4 compiling trials. +- ATERM_81402E40: 3 compiling trials. +- ATERM_8140502C: 9 compiling trials. +- ATERMi_ApConfigEnd: 3 compiling trials. +- ATERM_81404A18: 3 compiling trials. +- ATERM_814036D8: 9 compiling trials. +- ATERM_8140276C: 6 compiling trials. +- ATERM_814033F0: 6 compiling trials. +- ATERM_81404BFC: 3 compiling trials. +- ATERM_81404844: 6 compiling trials. +- ATERM_814021BC: 3 compiling trials. +- ATERMi_AutoConfigThread: 3 compiling trials. +- ATERM_814031DC: 3 compiling trials. +- ATERM_81402A24: 3 compiling trials. +- ATERM_81405254: 3 compiling trials. +- ATERM_81405690: 3 compiling trials. +- ATERM_81405ACC: 3 compiling trials. +- ATERM_814038C8: 3 compiling trials. +- ATERM_81402FC0: 4 compiling trials. + +## Remaining instruction residuals + +| Function | objdiff % | Instructions (mine/original) | Evidence / remaining reason | +|---|---:|---|---| +| ATERM_814021BC | 96.61688 | 154/154 | settings aggregate base-address scheduling and temporary register allocation | +| ATERM_8140276C | 99.166664 | 174/174 | current/previous record and fallback flag register cycles | +| ATERM_81402A24 | 90.34981 | 259/263 | scan descriptor-view scheduling, alignment expression and MAC-loop guard; four instructions short | +| ATERM_81402E40 | 99.791664 | 96/96 | two argument-move ordering differences plus two cr1 normalization differences | +| ATERM_81402FC0 | 100.0 | 135/135 | objdiff 100; gate/ctxdiff has two cr1 address-normalization differences; raw bytes identical | +| ATERM_814031DC | 90.766914 | 129/133 | explicit terminal MAC break versus original CTR loop; four instructions short | +| ATERM_814033F0 | 99.56204 | 137/137 | result/key pointer register cycle | +| ATERM_814038C8 | 83.25657 | 970/951 | protocol frame and option/authentication loop scheduling; 19 extra instructions | +| ATERMi_AutoConfigThread | 94.75 | 40/40 | NOR mask temporary and result-load scheduling | +| ATERM_81404844 | 98.97436 | 117/117 | wrap pass/block/output/byte-offset register allocation | +| ATERM_81404BFC | 98.94403 | 268/268 | initial key byte-load order and AES-128 substitution view allocation | +| ATERM_8140502C | 99.565216 | 138/138 | round-reversal index/swap register allocation | +| ATERM_81405254 | 61.94834 | 271/271 | AES input, round and final XOR scheduling/register allocation; instruction count now identical | +| ATERM_81405690 | 59.273064 | 271/271 | inverse AES input, round and final XOR scheduling/register allocation; instruction count now identical | +| ATERM_81405ACC | 88.583336 | 139/144 | MD5 input-copy guards and state/index scheduling; five instructions short | + +## Data audit + +No artificial data objects or symbol names added. String pools are identical. These C units contain no vtables. + +- .bss: mine 8144, original 8160 bytes; prefix mismatches 0/8144; extra alignment tail bytes 16, all zero True. +- .rodata: mine 10280, original 10280 bytes; prefix mismatches 0/10280; extra alignment tail bytes 0, all zero True. +- .data: mine 280, original 280 bytes; prefix mismatches 0/280; extra alignment tail bytes 0, all zero True. +- .sdata2: mine 7, original 8 bytes; prefix mismatches 0/7; extra alignment tail bytes 1, all zero True. +- .sdata: mine 53, original 56 bytes; prefix mismatches 0/53; extra alignment tail bytes 3, all zero True. +- .sbss: mine 80, original 80 bytes; prefix mismatches 0/80; extra alignment tail bytes 0, all zero True. + +ATERM_81402FC0 raw .text bytes identical: True. SHA-256 mine 91a60a7585553b8702d6f6ff83d5a91eedfd3cbaf3a04fb25501c637a6f84acd, original 91a60a7585553b8702d6f6ff83d5a91eedfd3cbaf3a04fb25501c637a6f84acd. Raw bytes do not assert relocation identity. The gate instruction count remains authoritative. + +Relocations at corresponding instruction offsets in objdiff-exact functions (observed mappings only, no object/config override): + +- (('.sbss', 'gAtermAllocate', 12, 4, 0), ('.sbss', 'lbl_81698C9C', 12, 4, 0)) +- (('.sbss', 'gAtermAllocation', 20, 4, 0), ('.sbss', 'lbl_81698CA4', 20, 4, 0)) +- (('.sbss', 'gAtermCancelRequested', 76, 4, 0), ('.sbss', 'lbl_81698CDC', 76, 4, 0)) +- (('.sbss', 'gAtermProgressCallback', 8, 4, 0), ('.sbss', 'lbl_81698C98', 8, 4, 0)) +- (('.sbss', 'gAtermRelease', 16, 4, 0), ('.sbss', 'lbl_81698CA0', 16, 4, 0)) +- (('.sbss', 'gAtermResult', 4, 4, 0), ('.sbss', 'lbl_81698C94', 4, 4, 0)) +- (('.sbss', 'gAtermState', 0, 4, 0), ('.sbss', 'lbl_81698C90', 0, 4, 0)) +- (('.sbss', 'gAtermThreadStarted', 24, 4, 0), ('.sbss', 'lbl_81698CA8', 24, 4, 0)) +- (('.sdata', 'gAtermDeadline', 0, 4, 0), ('.sdata', 'lbl_81697218', 0, 4, 0)) +- (('.sdata', 'gAtermScanBufferSize', 8, 4, 0), ('.sdata', 'lbl_81697220', 8, 4, 0)) +- (('.sdata', 'gAtermScanLimit', 4, 4, 0), ('.sdata', 'lbl_8169721C', 4, 4, 0)) + +Data is not claimed 100%: ATERM switch-table/initialized-small-data symbol correspondence and anonymous small-BSS mappings remain incomplete. Original extracted alignment tails are not synthesized. + +Supplemental native verification PASS: AES-128/192/256 encrypt/decrypt, MD5 lengths 0/1/3/55/56/64/130, scan-list fallback/reset transitions, normalized BSSID and six-byte MAC formatting. Native verification checks behavior; the MWCC/object gate checks matching. + +## Final full ATERM gate + +Command: `python3 /mnt/drive2/projects/wii-ipl-workers/_restore0928-tools/gate.py src/scene/setting/ATERM` + +```text +full build: ok +main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d +[src/scene/setting/ATERM] pool: IDENTICAL +[src/scene/setting/ATERM] objdiff: code 6576/19204 data 18448/18864 functions 12/26 fuzzy 90.8142 linked code 0 +[src/scene/setting/ATERM] instruction-exact functions: 11/26 +[src/scene/setting/ATERM] section .bss size 8160 match 100.0 +[src/scene/setting/ATERM] section .data size 280 match None +[src/scene/setting/ATERM] section .rodata size 10280 match 100.0 +[src/scene/setting/ATERM] section .sbss size 80 match 38.88889 +[src/scene/setting/ATERM] section .sdata size 56 match None +[src/scene/setting/ATERM] section .sdata2 size 8 match 100.0 +[src/scene/setting/ATERM] section .text size 19204 match 90.81421 +[src/scene/setting/ATERM] below 100: ATERM_814021BC 96.61688 +[src/scene/setting/ATERM] below 100: ATERM_8140276C 99.166664 +[src/scene/setting/ATERM] below 100: ATERM_81402A24 90.34981 +[src/scene/setting/ATERM] below 100: ATERM_81402E40 99.791664 +[src/scene/setting/ATERM] below 100: ATERM_814031DC 90.766914 +[src/scene/setting/ATERM] below 100: ATERM_814033F0 99.56204 +[src/scene/setting/ATERM] below 100: ATERM_814038C8 83.25657 +[src/scene/setting/ATERM] below 100: ATERMi_AutoConfigThread 94.75 +[src/scene/setting/ATERM] below 100: ATERM_81404844 98.97436 +[src/scene/setting/ATERM] below 100: ATERM_81404BFC 98.94403 +[src/scene/setting/ATERM] below 100: ATERM_8140502C 99.565216 +[src/scene/setting/ATERM] below 100: ATERM_81405254 61.94834 +[src/scene/setting/ATERM] below 100: ATERM_81405690 59.273064 +[src/scene/setting/ATERM] below 100: ATERM_81405ACC 88.583336 +[src/scene/setting/ATERM] baseline: code 4528/19204 data 18448 functions 7 fuzzy 89.3258 +regressions vs baseline: 0 +global matched_code_percent: 82.75705 -> 82.87778 +global fuzzy_match_percent: 95.36525 -> 95.37944 +global complete_code_percent: 58.19218 -> 58.19218 +global matched_data_percent: 89.46682 -> 89.46682 +forbidden patterns added (net, per file): 0 +readability warnings (net, per file; must be 0 in the final result): 0 +GATE PASS +```