Fixture 193
mapped constant roles
C · 6 functions · 4 lanes · 24 of 24 function-lanes behave identically
All 4 lanes recompile and return the same results as the original.
The same machine bits mean different things at different use sites, and a decompiler that decides from the bits alone gets exactly half of this file wrong.
Targets program::references (the use-site reference resolver) and its first consumer in ir::readonly_fold.
POSITIVE — MC193_NAMES is a static const char *const table. Under -shared -fPIC it lands in .data.rel.ro with one R_*_RELATIVE per slot, so each word is a *reference* that the loader writes, not a datum. Two readings are available and both are wrong:
- leave it alone -> *(long *)(0x3da0 + i * 8) - read the bytes as numbers -> (i == 0) ? 0x200b : ...
Neither address exists in the rebuilt unit, so both crash or return garbage. Only "slot i holds the string \"alpha\"" recompiles and executes.
CONTROL — MC193_OFFSETS has the same shape (a static const table indexed by a masked argument) and its entries are deliberately chosen to look like addresses in this object's own mapped range. They are numbers. A symbolizer that promotes a constant because it falls inside a mapped section turns these into pointers and the arithmetic below returns something else. So does mc193_scaled_constant, where the address-shaped value is an immediate the function multiplies.
The pairing is what gives the fixture teeth in both directions: a decompiler that transforms nothing fails the positives, and one that symbolizes on mapped-range membership fails the controls.
#include <stdint.h>
/* The same machine bits mean different things at different use sites, and a
* decompiler that decides from the bits alone gets exactly half of this file
* wrong.
*
* Targets `program::references` (the use-site reference resolver) and its first
* consumer in `ir::readonly_fold`.
*
* POSITIVE — `MC193_NAMES` is a `static const char *const` table. Under
* `-shared -fPIC` it lands in `.data.rel.ro` with one `R_*_RELATIVE` per slot,
* so each word is a *reference* that the loader writes, not a datum. Two
* readings are available and both are wrong:
*
* - leave it alone -> `*(long *)(0x3da0 + i * 8)`
* - read the bytes as numbers -> `(i == 0) ? 0x200b : ...`
*
* Neither address exists in the rebuilt unit, so both crash or return garbage.
* Only "slot i holds the string \"alpha\"" recompiles and executes.
*
* CONTROL — `MC193_OFFSETS` has the same shape (a `static const` table indexed
* by a masked argument) and its entries are deliberately chosen to look like
* addresses in this object's own mapped range. They are numbers. A symbolizer
* that promotes a constant because it falls inside a mapped section turns these
* into pointers and the arithmetic below returns something else. So does
* `mc193_scaled_constant`, where the address-shaped value is an immediate the
* function multiplies.
*
* The pairing is what gives the fixture teeth in both directions: a decompiler
* that transforms nothing fails the positives, and one that symbolizes on
* mapped-range membership fails the controls.
*/
#define MC193_SLOT_LENGTH 0
#define MC193_SLOT_FIRST 1
#define MC193_SLOT_LAST 2
/* Distinct lengths, distinct first and last bytes, and no entry is a suffix of
* another: a table that resolves to the wrong slot cannot produce the right
* observables by accident. Every entry clears the string pool's three-character
* floor, because one unproved slot correctly aborts the whole fold. */
static const char *const MC193_NAMES[4] = {"alpha", "bravo!", "charlie", "kilo"};
/* Every one of these values is inside a PT_LOAD of this very object in all four
* lanes -- checked against `readelf -lW`, whose common mapped ranges are
* 0x0-0x5c8, 0x1000-0x1271, 0x2000-0x214c and 0x3e50-0x4028. They are still
* integers, and the arithmetic below is the only thing that says so. */
static const uint32_t MC193_OFFSETS[4] = {0x00f0u, 0x1140u, 0x2008u, 0x2100u};
/* POSITIVE: the selected slot must be the real string, or the length is not
* the source's length. */
__attribute__((noinline)) int32_t mc193_name_length(int32_t which) {
const char *name = MC193_NAMES[which & 3];
int32_t length = 0;
while (name[length] != '\0') {
length += 1;
}
return length;
}
/* POSITIVE: every observable byte of the selected string, written into the
* caller's buffer so a table that resolves to the wrong entry is visible
* rather than merely a different total. */
__attribute__((noinline)) int32_t mc193_name_bytes(int32_t which, int32_t *witness) {
const char *name;
int32_t length = 0;
if (witness == 0) {
return -1;
}
name = MC193_NAMES[which & 3];
while (name[length] != '\0') {
length += 1;
}
witness[MC193_SLOT_LENGTH] = length;
witness[MC193_SLOT_FIRST] = (int32_t)(uint8_t)name[0];
witness[MC193_SLOT_LAST] = (int32_t)(uint8_t)name[length - 1];
return witness[MC193_SLOT_FIRST] * 31 + witness[MC193_SLOT_LAST];
}
/* POSITIVE: a slot read whose result is compared, not dereferenced. The two
* entries are distinct strings, so a table that collapses them changes the
* answer. */
__attribute__((noinline)) int32_t mc193_names_differ(int32_t left, int32_t right) {
const char *a = MC193_NAMES[left & 3];
const char *b = MC193_NAMES[right & 3];
int32_t index = 0;
while (a[index] != '\0' && b[index] != '\0') {
if (a[index] != b[index]) {
return index + 1;
}
index += 1;
}
return (a[index] == b[index]) ? 0 : -(index + 1);
}
/* CONTROL: address-shaped table entries consumed by arithmetic. Must remain
* numbers. */
__attribute__((noinline)) uint32_t mc193_offset_sum(uint32_t which) {
uint32_t first = MC193_OFFSETS[which & 3u];
uint32_t second = MC193_OFFSETS[(which + 1u) & 3u];
return first * 3u + second;
}
/* CONTROL: an address-shaped table entry compared against a caller value. A
* promoted entry changes which comparisons hold. */
__attribute__((noinline)) int32_t mc193_offset_matches(uint32_t which, uint32_t probe) {
uint32_t entry = MC193_OFFSETS[which & 3u];
if (entry == probe) {
return 1;
}
return (entry > probe) ? 2 : 3;
}
/* CONTROL: an address-shaped immediate, never loaded from anywhere, used only
* as a multiplier and an addend. */
__attribute__((noinline)) uint64_t mc193_scaled_constant(uint64_t value) {
return value * 0x2008u + 0x1140u;
} Recovered C
Generated by glaurung decompile --style decbench at b47f6b43.
baseline.json records the result after recompiling the C and calling it beside the
original with seeded inputs.
clang -O0
6/6mc193_name_bytes pass 19 lines
// glaurung: mc193_name_bytes @ 0x1150
int32_t mc193_name_bytes(int32_t arg0, int32_t * arg1) {
int length;
char * name;
// x86-64 prologue: save rbp
length = 0;
if ((arg1 != 0)) {
name = (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 0) ? "alpha" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 1) ? "bravo!" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 2) ? "charlie" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 3) ? "kilo" : (char *)(*(long *)((0x3e30 + ((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) * 8))))))));
while (((unsigned long)((unsigned int)((signed char)(name[length]))) != 0)) {
length = ((unsigned int)(length) + 1);
}
*(int *)((long)arg1) = length;
*(int *)(((long)arg1 + 0x4)) = (unsigned char)(*(char *)(name));
*(int *)(((long)arg1 + 0x8)) = (unsigned char)(name[(long)((int)(((unsigned long)((unsigned int)(length)) - 1)))]);
return (unsigned int)(((*(int *)(((long)arg1 + 0x4)) * 31) + *(int *)(((long)arg1 + 0x8))));
} else {
return (unsigned int)(-1);
}
} mc193_name_length pass 11 lines
// glaurung: mc193_name_length @ 0x1100
int32_t mc193_name_length(int32_t arg0) {
char * name;
int length;
// x86-64 prologue: save rbp
name = (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 0) ? "alpha" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 1) ? "bravo!" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 2) ? "charlie" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 3) ? "kilo" : (char *)(*(long *)((0x3e30 + ((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) * 8))))))));
for (length = 0; ((unsigned long)((unsigned int)((signed char)(name[length]))) != 0); length++) {
}
// x86-64 epilogue: restore rbp
return (unsigned int)(length);
} mc193_names_differ pass 37 lines
// glaurung: mc193_names_differ @ 0x1200
int32_t mc193_names_differ(int32_t arg0, int32_t arg1) {
char * a;
char * b;
int index;
signed char local_25;
int local_2c;
int local_4;
int var14;
a = (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 0) ? "alpha" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 1) ? "bravo!" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 2) ? "charlie" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 3) ? "kilo" : (char *)(*(long *)((0x3e30 + ((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) * 8))))))));
b = (((long)((int)(((unsigned long)((unsigned int)(arg1)) & 3))) == 0) ? "alpha" : (((long)((int)(((unsigned long)((unsigned int)(arg1)) & 3))) == 1) ? "bravo!" : (((long)((int)(((unsigned long)((unsigned int)(arg1)) & 3))) == 2) ? "charlie" : (((long)((int)(((unsigned long)((unsigned int)(arg1)) & 3))) == 3) ? "kilo" : (char *)(*(long *)((0x3e30 + ((long)((int)(((unsigned long)((unsigned int)(arg1)) & 3))) * 8))))))));
index = 0;
L_1241: ;
var14 = (int)((signed char)(a[index]));
local_25 = 0;
if (((unsigned long)((unsigned int)(var14)) != 0)) {
local_25 = ((unsigned long)((unsigned int)((signed char)(b[index]))) != 0);
}
if (((unsigned long)((unsigned char)((local_25 & 1))) != 0)) {
if (((unsigned int)((signed char)(a[index])) != (unsigned int)((signed char)(b[index])))) {
local_4 = ((unsigned int)(index) + 1);
// x86-64 epilogue: restore rbp
return (unsigned int)(local_4);
}
index = ((unsigned int)(index) + 1);
goto L_1241;
}
if (((unsigned int)((signed char)(a[index])) == (unsigned int)((signed char)(b[index])))) {
local_2c = 0;
goto L_12f3;
}
local_2c = (0 - (unsigned int)(((unsigned long)((unsigned int)(index)) + 1)));
L_12f3: ;
local_4 = local_2c;
// x86-64 epilogue: restore rbp
return (unsigned int)(local_4);
} mc193_offset_matches pass 11 lines
// glaurung: mc193_offset_matches @ 0x1350
int32_t mc193_offset_matches(uint32_t arg0, uint32_t arg1) {
unsigned int entry;
// x86-64 prologue: save rbp
entry = (((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? 240 : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? 0x1140 : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? 0x2008 : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? 0x2100 : *(int *)((0x2000 + ((unsigned long)((unsigned int)((arg0 & 3))) * 4)))))));
if ((entry != arg1)) {
return (unsigned int)(((unsigned long)(arg1) < (unsigned long)(entry)) ? 2 : 3);
} else {
return 1;
}
} mc193_offset_sum pass 10 lines
// glaurung: mc193_offset_sum @ 0x1300
uint32_t mc193_offset_sum(uint32_t arg0) {
unsigned int first;
unsigned int second;
// x86-64 prologue: save rbp
first = (((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? 240 : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? 0x1140 : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? 0x2008 : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? 0x2100 : *(int *)((0x2000 + ((unsigned long)((unsigned int)((arg0 & 3))) * 4)))))));
second = (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 0) ? 240 : (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 1) ? 0x1140 : (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 2) ? 0x2008 : (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 3) ? 0x2100 : *(int *)((0x2000 + ((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) * 4)))))));
// x86-64 epilogue: restore rbp
return (unsigned int)(((first * 3) + second));
} mc193_scaled_constant pass 6 lines
// glaurung: mc193_scaled_constant @ 0x13b0
uint64_t mc193_scaled_constant(uint64_t arg0) {
// x86-64 prologue: save rbp
// x86-64 epilogue: restore rbp
return ((arg0 * 0x2008) + 0x1140);
} clang -O2
6/6mc193_name_bytes pass 29 lines
// glaurung: mc193_name_bytes @ 0x1130
int32_t mc193_name_bytes(int32_t arg0, int32_t * arg1) {
char * name;
int length;
long t10;
int var10;
int var12;
long var4;
long var6;
long var7;
if ((arg1 == 0)) {
return 0xffffffff;
}
name = (((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? "alpha" : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? "bravo!" : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? "charlie" : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? "kilo" : (char *)(*(long *)((0x3e30 + ((unsigned long)((unsigned int)((arg0 & 3))) * 8))))))));
var4 = -0x200000000LL;
var6 = 0;
var7 = 0x100000000;
do {
var4 = (var4 + var7);
t10 = *(char *)((name + var6));
var6 = (var6 + 1);
} while (((unsigned long)((unsigned char)(t10)) != 0));
*(int *)(((long)arg1)) = (var6 - 1);
var10 = (unsigned int)((unsigned char)(*(char *)((name))));
*(int *)(((long)arg1 + 0x4)) = var10;
var12 = (unsigned int)((unsigned char)(name[((long)(var4) >> 32)]));
*(int *)(((long)arg1 + 0x8)) = var12;
return (unsigned int)(((unsigned long)((unsigned int)(((unsigned long)((unsigned int)(((unsigned long)((unsigned int)(var10)) << 5))) - var10))) + var12));
} mc193_name_length pass 15 lines
// glaurung: mc193_name_length @ 0x1100
int32_t mc193_name_length(int32_t arg0) {
char * name;
long ret;
long t10;
long var3;
var3 = (((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? (long)("alpha") : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? (long)("bravo!") : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? (long)("charlie") : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? (long)("kilo") : *(long *)((0x3e30 + ((unsigned long)((unsigned int)((arg0 & 3))) * 8)))))));
ret = 0xffffffff;
do {
ret = (unsigned long)((unsigned int)((ret + 1)));
t10 = *(char *)((var3));
var3 = (var3 + 1);
} while (((unsigned long)((unsigned char)(t10)) != 0));
return ret;
} mc193_names_differ pass 50 lines
// glaurung: mc193_names_differ @ 0x11a0
int32_t mc193_names_differ(int32_t arg0, int32_t arg1) {
char * a;
char * b;
int index;
long t151;
long var10;
long var12;
long var16;
long var18;
long var20;
int var21;
int var23;
a = (((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? "alpha" : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? "bravo!" : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? "charlie" : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? "kilo" : (char *)(*(long *)((0x3e30 + ((unsigned long)((unsigned int)((arg0 & 3))) * 8))))))));
b = (((unsigned long)((unsigned int)((arg1 & 3))) == 0) ? "alpha" : (((unsigned long)((unsigned int)((arg1 & 3))) == 1) ? "bravo!" : (((unsigned long)((unsigned int)((arg1 & 3))) == 2) ? "charlie" : (((unsigned long)((unsigned int)((arg1 & 3))) == 3) ? "kilo" : (char *)(*(long *)((0x3e30 + ((unsigned long)((unsigned int)((arg1 & 3))) * 8))))))));
var20 = (*(char *)((a)) & 255);
var10 = 0;
var12 = 0;
if (((unsigned long)((unsigned char)((var20 & 255))) == 0)) {
var16 = 0;
t151 = b[(unsigned long)((unsigned int)(var12))];
var18 = (~var12);
return ((0 == (unsigned long)((unsigned char)(t151))) ? var10 : var18);
}
index = var12;
while (1) {
var21 = (unsigned int)((unsigned char)(*(char *)((b + index))));
var12 = (unsigned long)((unsigned int)(index));
var16 = var20;
if (((unsigned long)((unsigned char)((var21 & 255))) == 0)) {
break;
}
if (((unsigned char)((var20 & 255)) != (unsigned char)((var21 & 255)))) {
return (unsigned int)((index + 1));
}
var23 = (unsigned int)((unsigned char)(*(char *)((a + index + 0x1))));
index = (index + 1);
var20 = (unsigned long)((unsigned int)(var23));
var12 = (unsigned long)((unsigned int)(index));
if (((unsigned long)((unsigned char)((var23 & 255))) == 0)) {
var16 = 0;
t151 = b[(unsigned long)((unsigned int)(var12))];
var18 = (~var12);
return ((0 == (unsigned long)((unsigned char)(t151))) ? var10 : var18);
}
}
t151 = b[(unsigned long)((unsigned int)(var12))];
var18 = (~var12);
return (((unsigned char)((var16 & 255)) == (unsigned char)(t151)) ? var10 : var18);
} mc193_offset_matches pass 6 lines
// glaurung: mc193_offset_matches @ 0x1220
int32_t mc193_offset_matches(uint32_t arg0, uint32_t arg1) {
unsigned int entry;
entry = (unsigned long)((unsigned int)((((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? 240 : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? 0x1140 : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? 0x2008 : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? 0x2100 : *(int *)((0x2000 + ((unsigned long)((unsigned int)((arg0 & 3))) * 4)))))))));
return ((entry != arg1) ? (unsigned long)((unsigned int)((((unsigned long)(arg1) < (unsigned long)(entry)) ^ 3))) : 1);
} mc193_offset_sum pass 6 lines
// glaurung: mc193_offset_sum @ 0x1200
uint32_t mc193_offset_sum(uint32_t arg0) {
unsigned int first;
first = (unsigned long)((unsigned int)((((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? 240 : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? 0x1140 : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? 0x2008 : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? 0x2100 : *(int *)((0x2000 + ((unsigned long)((unsigned int)((arg0 & 3))) * 4)))))))));
return (unsigned int)(((unsigned long)((unsigned int)((first + (first * 2)))) + (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 0) ? 240 : (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 1) ? 0x1140 : (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 2) ? 0x2008 : (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 3) ? 0x2100 : *(int *)((0x2000 + ((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) * 4)))))))));
} mc193_scaled_constant pass 4 lines
// glaurung: mc193_scaled_constant @ 0x1250
uint64_t mc193_scaled_constant(uint64_t arg0) {
return (((arg0 << 13) + (arg0 * 8)) + 0x1140);
} gcc -O0
6/6mc193_name_bytes pass 21 lines
// glaurung: mc193_name_bytes @ 0x1149
int32_t mc193_name_bytes(int32_t arg0, int32_t * arg1) {
int length;
char * name;
long var32;
// x86-64 prologue: save rbp
length = 0;
if ((arg1 != 0)) {
name = (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 0) ? "alpha" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 1) ? "bravo!" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 2) ? "charlie" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 3) ? "kilo" : (char *)(*(long *)((((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) * 8) + 0x3e60)))))));
while (((unsigned long)((unsigned char)(((unsigned int)((unsigned char)(name[length])) & 255))) != 0)) {
length = (length + 1);
}
*(int *)((long)arg1) = length;
*(int *)((arg1 + 1)) = (unsigned char)(((unsigned long)((unsigned int)((unsigned char)(*(char *)(name)))) & 255));
*(int *)((arg1 + 2)) = (unsigned char)(((unsigned long)((unsigned int)((unsigned char)(name[((long)(length) - 1)]))) & 255));
var32 = (unsigned long)((unsigned int)(*(int *)((arg1 + 1))));
return (unsigned int)(((unsigned long)((unsigned int)(*(int *)((arg1 + 2)))) + (unsigned long)((unsigned int)(((unsigned long)((unsigned int)(((unsigned long)((unsigned int)(var32)) << 5))) - var32)))));
} else {
return 0xffffffff;
}
} mc193_name_length pass 11 lines
// glaurung: mc193_name_length @ 0x10f9
int32_t mc193_name_length(int32_t arg0) {
char * name;
int length;
// x86-64 prologue: save rbp
name = (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 0) ? "alpha" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 1) ? "bravo!" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 2) ? "charlie" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 3) ? "kilo" : (char *)(*(long *)((((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) * 8) + 0x3e60)))))));
for (length = 0; ((unsigned long)((unsigned char)(((unsigned int)((unsigned char)(name[length])) & 255))) != 0); length++) {
}
// x86-64 epilogue: restore rbp
return (unsigned int)(length);
} mc193_names_differ pass 28 lines
// glaurung: mc193_names_differ @ 0x120b
int32_t mc193_names_differ(int32_t arg0, int32_t arg1) {
char * a;
char * b;
int index;
a = (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 0) ? "alpha" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 1) ? "bravo!" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 2) ? "charlie" : (((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) == 3) ? "kilo" : (char *)(*(long *)((((long)((int)(((unsigned long)((unsigned int)(arg0)) & 3))) * 8) + 0x3e60)))))));
b = (((long)((int)(((unsigned long)((unsigned int)(arg1)) & 3))) == 0) ? "alpha" : (((long)((int)(((unsigned long)((unsigned int)(arg1)) & 3))) == 1) ? "bravo!" : (((long)((int)(((unsigned long)((unsigned int)(arg1)) & 3))) == 2) ? "charlie" : (((long)((int)(((unsigned long)((unsigned int)(arg1)) & 3))) == 3) ? "kilo" : (char *)(*(long *)((((long)((int)(((unsigned long)((unsigned int)(arg1)) & 3))) * 8) + 0x3e60)))))));
index = 0;
goto L_1290;
L_1260: ;
if (((unsigned char)(((unsigned int)((unsigned char)(a[index])) & 255)) != (unsigned char)(((unsigned int)((unsigned char)(b[index])) & 255)))) {
// x86-64 epilogue: restore rbp
return (unsigned int)(((unsigned long)((unsigned int)(index)) + 1));
}
index = (index + 1);
L_1290: ;
if (((unsigned long)((unsigned char)(((unsigned int)((unsigned char)(a[index])) & 255))) != 0)) {
if (((unsigned long)((unsigned char)(((unsigned int)((unsigned char)(b[index])) & 255))) != 0)) {
goto L_1260;
}
}
if (((unsigned char)(((unsigned int)((unsigned char)(a[index])) & 255)) == (unsigned char)(((unsigned int)((unsigned char)(b[index])) & 255)))) {
// x86-64 epilogue: restore rbp
return 0;
}
// x86-64 epilogue: restore rbp
return (~(unsigned long)((unsigned int)(index)));
} mc193_offset_matches pass 15 lines
// glaurung: mc193_offset_matches @ 0x1342
int32_t mc193_offset_matches(uint32_t arg0, uint32_t arg1) {
unsigned int entry;
// x86-64 prologue: save rbp
entry = (((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? 240 : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? 0x1140 : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? 0x2008 : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? 0x2100 : *(int *)((((unsigned long)((unsigned int)((arg0 & 3))) * 4) + 0x2020))))));
if ((entry != arg1)) {
if (((unsigned long)(entry) <= (unsigned long)(arg1))) {
return 3;
} else {
return 2;
}
} else {
return 1;
}
} mc193_offset_sum pass 10 lines
// glaurung: mc193_offset_sum @ 0x12ea
uint32_t mc193_offset_sum(uint32_t arg0) {
unsigned int first;
unsigned int second;
// x86-64 prologue: save rbp
first = (((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? 240 : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? 0x1140 : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? 0x2008 : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? 0x2100 : *(int *)((((unsigned long)((unsigned int)((arg0 & 3))) * 4) + 0x2020))))));
second = (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 0) ? 240 : (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 1) ? 0x1140 : (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 2) ? 0x2008 : (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 3) ? 0x2100 : *(int *)((((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) * 4) + 0x2020))))));
// x86-64 epilogue: restore rbp
return (unsigned int)(((unsigned long)(second) + (unsigned long)((unsigned int)(((unsigned long)(first) + (unsigned long)((unsigned int)(((unsigned long)(first) + (unsigned long)(first)))))))));
} mc193_scaled_constant pass 6 lines
// glaurung: mc193_scaled_constant @ 0x1392
uint64_t mc193_scaled_constant(uint64_t arg0) {
// x86-64 prologue: save rbp
// x86-64 epilogue: restore rbp
return ((((arg0 << 10) + arg0) << 3) + 0x1140);
} gcc -O2
6/6mc193_name_bytes pass 32 lines
// glaurung: mc193_name_bytes @ 0x1140
int32_t mc193_name_bytes(int32_t arg0, int32_t * arg1) {
char * name;
int length;
long var10;
int var11;
int var13;
long var4;
long var7;
if ((arg1 == 0)) {
return 0xffffffff;
}
name = (((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? "alpha" : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? "bravo!" : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? "charlie" : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? "kilo" : (char *)(*(long *)((0x3e60 + ((unsigned long)((unsigned int)((arg0 & 3))) * 8))))))));
if (((unsigned long)((unsigned char)(*(char *)((name)))) == 0)) {
var4 = -1;
var7 = 0;
} else {
length = 1;
do {
var7 = (unsigned long)((unsigned int)(length));
var10 = (unsigned long)((unsigned int)(length));
length = (length + 1);
} while (((unsigned long)((unsigned char)(*(char *)((name + length - 0x1)))) != 0));
var4 = (var10 - 1);
}
*(int *)(((long)arg1)) = var7;
var11 = (unsigned int)((unsigned char)(*(char *)((name))));
*(int *)(((long)arg1 + 0x4)) = var11;
var13 = (unsigned int)((unsigned char)(*(char *)((name + var4))));
*(int *)(((long)arg1 + 0x8)) = var13;
return (unsigned int)(((unsigned long)((unsigned int)(((unsigned long)((unsigned int)(((unsigned long)((unsigned int)(var11)) << 5))) - var11))) + var13));
} mc193_name_length pass 16 lines
// glaurung: mc193_name_length @ 0x1100
int32_t mc193_name_length(int32_t arg0) {
char * name;
int length;
long var8;
name = (((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? "alpha" : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? "bravo!" : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? "charlie" : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? "kilo" : (char *)(*(long *)((0x3e60 + ((unsigned long)((unsigned int)((arg0 & 3))) * 8))))))));
if (((unsigned long)((unsigned char)(*(char *)((name)))) == 0)) {
return 0;
}
length = 1;
do {
var8 = (unsigned long)((unsigned int)(length));
length = (length + 1);
} while (((unsigned long)((unsigned char)(*(char *)((name + length - 0x1)))) != 0));
return (unsigned int)(var8);
} mc193_names_differ pass 53 lines
// glaurung: mc193_names_differ @ 0x11b0
int32_t mc193_names_differ(int32_t arg0, int32_t arg1) {
char * a;
char * b;
int index;
long var11;
int var12;
long var13;
long var14;
int var16;
int var9;
a = (((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? "alpha" : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? "bravo!" : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? "charlie" : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? "kilo" : (char *)(*(long *)((0x3e60 + ((unsigned long)((unsigned int)((arg0 & 3))) * 8))))))));
b = (((unsigned long)((unsigned int)((arg1 & 3))) == 0) ? "alpha" : (((unsigned long)((unsigned int)((arg1 & 3))) == 1) ? "bravo!" : (((unsigned long)((unsigned int)((arg1 & 3))) == 2) ? "charlie" : (((unsigned long)((unsigned int)((arg1 & 3))) == 3) ? "kilo" : (char *)(*(long *)((0x3e60 + ((unsigned long)((unsigned int)((arg1 & 3))) * 8))))))));
var9 = (unsigned int)((unsigned char)(*(char *)((a))));
index = 0;
if (((unsigned long)((unsigned char)((var9 & 255))) != 0)) {
goto L_11ec;
}
goto L_120f;
L_11d8: ;
var11 = (unsigned long)((unsigned int)((index + 1)));
var13 = var11;
if (((unsigned char)((var12 & 255)) != (unsigned char)((var9 & 255)))) {
goto L_11fa;
}
var14 = ((unsigned long)((unsigned int)(index)) + 1);
var9 = (unsigned int)((unsigned char)(*(char *)((a + var14))));
index = var14;
if (((unsigned long)((unsigned char)((var9 & 255))) == 0)) {
goto L_1200;
}
L_11ec: ;
var12 = (unsigned int)((unsigned char)(*(char *)((b + index))));
var11 = (unsigned long)((unsigned int)(index));
if (((unsigned long)((unsigned char)((var12 & 255))) != 0)) {
goto L_11d8;
}
L_11f7: ;
var13 = (~var11);
L_11fa: ;
return (unsigned int)(var13);
L_1200: ;
var16 = (unsigned int)((unsigned char)(*(char *)((b + var14))));
L_1204: ;
if (((unsigned long)((unsigned char)((var16 & 255))) != 0)) {
goto L_11f7;
}
return 0;
L_120f: ;
var16 = (unsigned int)((unsigned char)(*(char *)((b))));
var11 = 0;
goto L_1204;
} mc193_offset_matches pass 15 lines
// glaurung: mc193_offset_matches @ 0x1240
int32_t mc193_offset_matches(uint32_t arg0, uint32_t arg1) {
long cf_2;
long ret;
long t10;
long zf_2;
ret = 1;
t10 = (((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? 240 : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? 0x1140 : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? 0x2008 : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? 0x2100 : *(int *)((0x2000 + ((unsigned long)((unsigned int)((arg0 & 3))) * 4)))))));
zf_2 = ((unsigned long)((unsigned int)(t10)) == arg1);
cf_2 = ((unsigned long)((unsigned long)((unsigned int)(t10))) < (unsigned long)(arg1));
if (((unsigned long)((unsigned int)(t10)) != arg1)) {
ret = (unsigned long)((unsigned int)(((unsigned int)((unsigned char)(((cf_2 | zf_2) & 255))) + 2)));
}
return ret;
} mc193_offset_sum pass 6 lines
// glaurung: mc193_offset_sum @ 0x1220
uint32_t mc193_offset_sum(uint32_t arg0) {
long var8;
var8 = (unsigned long)((unsigned int)((((unsigned long)((unsigned int)((arg0 & 3))) == 0) ? 240 : (((unsigned long)((unsigned int)((arg0 & 3))) == 1) ? 0x1140 : (((unsigned long)((unsigned int)((arg0 & 3))) == 2) ? 0x2008 : (((unsigned long)((unsigned int)((arg0 & 3))) == 3) ? 0x2100 : *(int *)((0x2000 + ((unsigned long)((unsigned int)((arg0 & 3))) * 4)))))))));
return (unsigned int)(((unsigned long)((unsigned int)((var8 + (var8 * 2)))) + (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 0) ? 240 : (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 1) ? 0x1140 : (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 2) ? 0x2008 : (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) == 3) ? 0x2100 : *(int *)((0x2000 + ((unsigned long)((unsigned int)(((unsigned long)((unsigned int)((arg0 + 1))) & 3))) * 4)))))))));
} mc193_scaled_constant pass 4 lines
// glaurung: mc193_scaled_constant @ 0x1270
uint64_t mc193_scaled_constant(uint64_t arg0) {
return ((((arg0 << 10) + arg0) * 8) + 0x1140);
}