Fixture 186
defaultless guarded switch
C · 5 functions · 4 lanes · 20 of 20 function-lanes behave identically
All 4 lanes recompile and return the same results as the original.
A switch with NO default label, guarded by an explicit range test.
COVERAGE TARGET: ir::guarded_switch. When a switch has no default, falling off the end is not an error — control simply continues after the statement — so the compiler emits a range check that jumps PAST the whole switch rather than into a default arm. Every switch fixture in the corpus has a default, which means the recovery has only ever seen the shape where the out-of-range edge lands on a real block. The defaultless shape is the one where a recovery that invents a default arm silently changes what the function returns for an out-of-range discriminant.
Each function makes the fall-through observable: a value is set before the switch and returned after it, so "no arm ran" is a distinct answer from every arm's answer.
#include <stdint.h>
/* A switch with NO `default` label, guarded by an explicit range test.
*
* COVERAGE TARGET: `ir::guarded_switch`. When a switch has no default, falling
* off the end is not an error — control simply continues after the statement —
* so the compiler emits a range check that jumps PAST the whole switch rather
* than into a default arm. Every switch fixture in the corpus has a default,
* which means the recovery has only ever seen the shape where the out-of-range
* edge lands on a real block. The defaultless shape is the one where a recovery
* that invents a default arm silently changes what the function returns for an
* out-of-range discriminant.
*
* Each function makes the fall-through observable: a value is set before the
* switch and returned after it, so "no arm ran" is a distinct answer from every
* arm's answer. */
#define SWITCH186_LIMIT 8
/* Dense, defaultless, with a value that survives the fall-through. */
__attribute__((noinline)) int32_t dense_no_default(int32_t selector) {
int32_t result = -1;
switch (selector) {
case 0:
result = 100;
break;
case 1:
result = 101;
break;
case 2:
result = 102;
break;
case 3:
result = 103;
break;
case 4:
result = 104;
break;
case 5:
result = 105;
break;
case 6:
result = 106;
break;
case 7:
result = 107;
break;
}
return result;
}
/* Sparse and defaultless: the compiler emits a comparison ladder or a shifted
* table, and the out-of-range edge still leaves `result` untouched. */
__attribute__((noinline)) int32_t sparse_no_default(int32_t selector) {
int32_t result = -7;
switch (selector) {
case -1000:
result = 1;
break;
case 0:
result = 2;
break;
case 17:
result = 3;
break;
case 4096:
result = 4;
break;
case 1000000:
result = 5;
break;
}
return result;
}
/* Defaultless with FALL-THROUGH between arms, so the recovery cannot model each
* case as an independent block. */
__attribute__((noinline)) int32_t fallthrough_no_default(int32_t selector) {
int32_t accumulated = 0;
switch (selector & 7) {
case 0:
accumulated += 1;
/* fall through */
case 1:
accumulated += 2;
/* fall through */
case 2:
accumulated += 4;
break;
case 5:
accumulated += 8;
/* fall through */
case 6:
accumulated += 16;
break;
}
return accumulated;
}
/* Defaultless inside a loop: the out-of-range edge is a `continue`, not a
* return, so the jump target is the loop latch rather than the epilogue. */
__attribute__((noinline)) int32_t loop_switch_no_default(const int32_t *codes,
int32_t count) {
int32_t total = 0;
int32_t index;
if (codes == 0 || count < 0 || count > SWITCH186_LIMIT) {
return -1;
}
for (index = 0; index < count; ++index) {
switch (codes[index] & 3) {
case 0:
total += 1;
break;
case 1:
total += 10;
break;
case 3:
total += 1000;
break;
}
total += 1;
}
return total;
}
/* Every arm returns, and there is still no default — so the function's only
* fall-through path is the one the range check takes. A recovery that turns the
* range check into a default arm has to invent a return value here, and any
* value it invents is wrong for some input. */
__attribute__((noinline)) int32_t returning_arms_no_default(int32_t selector) {
switch (selector) {
case 10:
return 1;
case 11:
return 2;
case 12:
return 3;
case 13:
return 4;
}
return -99;
} 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
5/5dense_no_default pass 34 lines
// glaurung: dense_no_default @ 0x1100
int32_t dense_no_default(int32_t arg0) {
int result;
// x86-64 prologue: save rbp
result = -1;
switch ((unsigned int)(arg0)) {
case 0:
result = 100;
break;
case 1:
result = 101;
break;
case 2:
result = 102;
break;
case 3:
result = 103;
break;
case 4:
result = 104;
break;
case 5:
result = 105;
break;
case 6:
result = 106;
break;
case 7:
result = 107;
break;
}
// x86-64 epilogue: restore rbp
return (unsigned int)(result);
} fallthrough_no_default pass 33 lines
// glaurung: fallthrough_no_default @ 0x1250
int32_t fallthrough_no_default(int32_t arg0) {
int accumulated;
long local_10;
// x86-64 prologue: save rbp
accumulated = 0;
local_10 = (unsigned int)(((unsigned long)((unsigned int)(arg0)) & 7));
switch (local_10) {
case 0:
accumulated = ((unsigned int)(accumulated) + 1);
goto L_128e;
case 1:
L_128e: ;
accumulated = ((unsigned int)(accumulated) + 2);
goto L_1297;
case 2:
L_1297: ;
accumulated = ((unsigned int)(accumulated) + 4);
// x86-64 epilogue: restore rbp
return (unsigned int)(accumulated);
case 5:
accumulated = ((unsigned int)(accumulated) + 8);
goto L_12ae;
case 6:
L_12ae: ;
accumulated = ((unsigned int)(accumulated) + 16);
// x86-64 epilogue: restore rbp
return (unsigned int)(accumulated);
default:
// x86-64 epilogue: restore rbp
return (unsigned int)(accumulated);
}
} loop_switch_no_default pass 45 lines
// glaurung: loop_switch_no_default @ 0x12c0
int32_t loop_switch_no_default(const int32_t * arg0, int32_t arg1) {
int total;
int index;
int local_20;
int local_4;
int var4;
// x86-64 prologue: save rbp
total = 0;
if ((arg0 == 0)) {
local_4 = -1;
// x86-64 epilogue: restore rbp
return (unsigned int)(local_4);
}
if (((long)(arg1) < 0)) {
local_4 = -1;
// x86-64 epilogue: restore rbp
return (unsigned int)(local_4);
}
if (((((unsigned long)((unsigned int)(arg1)) == 8) | ((long)(arg1) < 8)) == 0)) {
local_4 = -1;
// x86-64 epilogue: restore rbp
return (unsigned int)(local_4);
}
for (index = 0; (index < arg1); index++) {
var4 = ((unsigned int)(arg0[(long)(index)]) & 3);
local_20 = var4;
if (((unsigned long)((unsigned int)(var4)) == 0)) {
total = ((unsigned int)(total) + 1);
} else {
if (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)(local_20)) - 1))) == 0)) {
total = ((unsigned int)(total) + 10);
} else {
if (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)(local_20)) - 3))) == 0)) {
total = ((unsigned int)(total) + 1000);
} else {
}
}
}
total = ((unsigned int)(total) + 1);
}
local_4 = total;
// x86-64 epilogue: restore rbp
return (unsigned int)(local_4);
} returning_arms_no_default pass 28 lines
// glaurung: returning_arms_no_default @ 0x13a0
int32_t returning_arms_no_default(int32_t arg0) {
long local_10;
int local_4;
int var1;
// x86-64 prologue: save rbp
var1 = ((unsigned int)(arg0) - 10);
local_10 = (unsigned int)(var1);
if (((((unsigned long)((unsigned long)((unsigned int)(var1))) < (unsigned long)(3)) | ((unsigned long)((unsigned int)(((unsigned long)((unsigned int)(var1)) - 3))) == 0)) == 0)) {
return (unsigned int)(-99);
}
switch (local_10) {
case 0:
local_4 = 1;
break;
case 1:
local_4 = 2;
break;
case 2:
local_4 = 3;
break;
case 3:
local_4 = 4;
break;
}
// x86-64 epilogue: restore rbp
return (unsigned int)(local_4);
} sparse_no_default pass 23 lines
// glaurung: sparse_no_default @ 0x11a0
int32_t sparse_no_default(int32_t arg0) {
int result;
// x86-64 prologue: save rbp
result = -7;
if (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)(arg0)) + 1000))) == 0)) {
return 1;
}
if (((unsigned long)((unsigned int)(arg0)) == 0)) {
return 2;
}
if (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)(arg0)) - 17))) == 0)) {
return 3;
}
if (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)(arg0)) - 4096))) == 0)) {
return 4;
}
if (((unsigned long)((unsigned int)(((unsigned long)((unsigned int)(arg0)) - 0xf4240))) == 0)) {
return 5;
}
// x86-64 epilogue: restore rbp
return (unsigned int)(result);
} clang -O2
5/5dense_no_default pass 5 lines
// glaurung: dense_no_default @ 0x1100
int32_t dense_no_default(int32_t arg0) {
int result;
return (((unsigned long)((unsigned long)((unsigned int)(arg0))) < (unsigned long)(8)) ? (unsigned long)((unsigned int)((arg0 + 100))) : 0xffffffff);
} fallthrough_no_default pass 18 lines
// glaurung: fallthrough_no_default @ 0x1160
int32_t fallthrough_no_default(int32_t arg0) {
int accumulated;
switch ((unsigned long)((unsigned int)((arg0 & 7)))) {
case 0:
return 7;
case 1:
return 6;
case 2:
return 4;
case 5:
return 24;
case 6:
return 16;
default:
return 0;
}
} loop_switch_no_default pass 241 lines
// glaurung: loop_switch_no_default @ 0x11a0
int32_t loop_switch_no_default(const int32_t * arg0, int32_t arg1) {
int index;
int total;
long ret;
long var0;
long var10;
long var11;
long var18;
long var19;
int var21;
long var22;
long var24;
long var3;
int var30;
long var31;
long var33;
long var38;
int var40;
long var41;
long var43;
int var49;
long var5;
long var50;
long var52;
long var57;
int var59;
long var60;
long var62;
int var68;
long var69;
long var71;
int var9;
var0 = 0xffffffff;
ret = 0xffffffff;
if ((arg0 == 0)) {
goto L_1310;
}
ret = var0;
if (((unsigned long)(8) < (unsigned long)((unsigned long)((unsigned int)(arg1))))) {
goto L_1310;
}
if (((unsigned long)((unsigned int)(arg1)) != 0)) {
var3 = (unsigned long)((unsigned int)(((unsigned long)((unsigned int)(*(int *)(((long)arg0)))) & 3)));
if (((unsigned long)((unsigned int)(var3)) == 3)) {
goto L_11e6;
}
if (((unsigned long)((unsigned int)(var3)) == 1)) {
goto L_11f5;
}
ret = 1;
if (((unsigned long)((unsigned int)(var3)) != 0)) {
goto L_11eb;
}
ret = 2;
if (((unsigned long)((unsigned int)(arg1)) == 1)) {
goto L_1310;
}
var5 = ret;
goto L_1203;
}
return 0;
L_11e6: ;
ret = 1001;
L_11eb: ;
var5 = ret;
if (((unsigned long)((unsigned int)(arg1)) != 1)) {
goto L_1203;
}
goto L_1310;
L_11f5: ;
ret = 11;
var5 = 11;
if (((unsigned long)((unsigned int)(arg1)) == 1)) {
goto L_1310;
}
L_1203: ;
var9 = ((unsigned int)(*(int *)(((long)arg0 + 0x4))) & 3);
var10 = (unsigned long)((unsigned int)(var9));
if (((unsigned long)((unsigned int)(var9)) != 0)) {
if (((unsigned long)((unsigned int)(var10)) == 1)) {
goto L_1221;
}
var11 = var5;
if (((unsigned long)((unsigned int)(var10)) != 3)) {
goto L_1224;
}
var11 = (unsigned long)((unsigned int)((var5 + 1000)));
goto L_1224;
}
var11 = (unsigned long)((unsigned int)((var5 + 1)));
goto L_1224;
L_1221: ;
var11 = (unsigned long)((unsigned int)((var5 + 10)));
L_1224: ;
var18 = (unsigned long)((unsigned int)((var11 + 1)));
var19 = var18;
if (((unsigned long)((unsigned int)(arg1)) == 2)) {
goto L_12e2;
}
var21 = ((unsigned int)(*(int *)(((long)arg0 + 0x8))) & 3);
var22 = (unsigned long)((unsigned int)(var21));
if (((unsigned long)((unsigned int)(var21)) != 0)) {
if (((unsigned long)((unsigned int)(var22)) == 1)) {
goto L_124e;
}
if (((unsigned long)((unsigned int)(var22)) != 3)) {
goto L_1253;
}
var24 = (unsigned long)((unsigned int)((var11 + 1001)));
goto L_1251;
}
var24 = (unsigned long)((unsigned int)((var11 + 2)));
goto L_1251;
L_124e: ;
var24 = (unsigned long)((unsigned int)((var11 + 11)));
L_1251: ;
var18 = (unsigned long)((unsigned int)(var24));
L_1253: ;
ret = (unsigned long)((unsigned int)((var18 + 1)));
if (((unsigned long)((unsigned int)(arg1)) == 3)) {
goto L_1310;
}
var30 = ((unsigned int)(*(int *)(((long)arg0 + 0xc))) & 3);
var31 = (unsigned long)((unsigned int)(var30));
if (((unsigned long)((unsigned int)(var30)) != 0)) {
if (((unsigned long)((unsigned int)(var31)) == 1)) {
goto L_127e;
}
if (((unsigned long)((unsigned int)(var31)) != 3)) {
goto L_1283;
}
var33 = (unsigned long)((unsigned int)((var18 + 1001)));
goto L_1281;
}
var33 = (unsigned long)((unsigned int)((var18 + 2)));
goto L_1281;
L_127e: ;
var33 = (unsigned long)((unsigned int)((var18 + 11)));
L_1281: ;
ret = (unsigned long)((unsigned int)(var33));
L_1283: ;
var38 = (unsigned long)((unsigned int)((ret + 1)));
var19 = var38;
if (((unsigned long)((unsigned int)(arg1)) == 4)) {
goto L_12e2;
}
var40 = ((unsigned int)(*(int *)(((long)arg0 + 0x10))) & 3);
var41 = (unsigned long)((unsigned int)(var40));
if (((unsigned long)((unsigned int)(var40)) != 0)) {
if (((unsigned long)((unsigned int)(var41)) == 1)) {
goto L_12a9;
}
if (((unsigned long)((unsigned int)(var41)) != 3)) {
goto L_12ae;
}
var43 = (unsigned long)((unsigned int)((ret + 1001)));
goto L_12ac;
}
var43 = (unsigned long)((unsigned int)((ret + 2)));
goto L_12ac;
L_12a9: ;
var43 = (unsigned long)((unsigned int)((ret + 11)));
L_12ac: ;
var38 = (unsigned long)((unsigned int)(var43));
L_12ae: ;
ret = (unsigned long)((unsigned int)((var38 + 1)));
if (((unsigned long)((unsigned int)(arg1)) == 5)) {
goto L_1310;
}
var49 = ((unsigned int)(*(int *)(((long)arg0 + 0x14))) & 3);
var50 = (unsigned long)((unsigned int)(var49));
if (((unsigned long)((unsigned int)(var49)) != 0)) {
if (((unsigned long)((unsigned int)(var50)) == 1)) {
goto L_12d5;
}
if (((unsigned long)((unsigned int)(var50)) != 3)) {
goto L_12da;
}
var52 = (unsigned long)((unsigned int)((var38 + 1001)));
goto L_12d8;
}
var52 = (unsigned long)((unsigned int)((var38 + 2)));
goto L_12d8;
L_12d5: ;
var52 = (unsigned long)((unsigned int)((var38 + 11)));
L_12d8: ;
ret = (unsigned long)((unsigned int)(var52));
L_12da: ;
var57 = (unsigned long)((unsigned int)((ret + 1)));
var19 = var57;
if (((unsigned long)((unsigned int)(arg1)) != 6)) {
goto L_12e5;
}
L_12e2: ;
return (unsigned int)(var19);
L_12e5: ;
var59 = ((unsigned int)(*(int *)(((long)arg0 + 0x18))) & 3);
var60 = (unsigned long)((unsigned int)(var59));
if (((unsigned long)((unsigned int)(var59)) != 0)) {
if (((unsigned long)((unsigned int)(var60)) == 1)) {
goto L_1303;
}
if (((unsigned long)((unsigned int)(var60)) != 3)) {
goto L_1308;
}
var62 = (unsigned long)((unsigned int)((ret + 1001)));
goto L_1306;
}
var62 = (unsigned long)((unsigned int)((ret + 2)));
goto L_1306;
L_1303: ;
var62 = (unsigned long)((unsigned int)((ret + 11)));
L_1306: ;
var57 = (unsigned long)((unsigned int)(var62));
L_1308: ;
ret = (unsigned long)((unsigned int)((var57 + 1)));
if (((unsigned long)((unsigned int)(arg1)) != 7)) {
goto L_1311;
}
L_1310: ;
return ret;
L_1311: ;
var68 = ((unsigned int)(*(int *)(((long)arg0 + 0x1c))) & 3);
var69 = (unsigned long)((unsigned int)(var68));
if (((unsigned long)((unsigned int)(var68)) == 0)) {
var71 = (unsigned long)((unsigned int)((var57 + 2)));
ret = (unsigned long)((unsigned int)(var71));
return (unsigned int)(((unsigned long)((unsigned int)(var71)) + 1));
}
if (((unsigned long)((unsigned int)(var69)) == 1)) {
var71 = (unsigned long)((unsigned int)((var57 + 11)));
ret = (unsigned long)((unsigned int)(var71));
return (unsigned int)(((unsigned long)((unsigned int)(var71)) + 1));
}
if (((unsigned long)((unsigned int)(var69)) == 3)) {
var71 = (unsigned long)((unsigned int)((var57 + 1001)));
ret = (unsigned long)((unsigned int)(var71));
}
return (unsigned int)((ret + 1));
} returning_arms_no_default pass 4 lines
// glaurung: returning_arms_no_default @ 0x1340
int32_t returning_arms_no_default(int32_t arg0) {
return (((unsigned long)((unsigned long)((unsigned int)((arg0 - 10)))) < (unsigned long)(4)) ? (unsigned long)((unsigned int)((arg0 - 9))) : 0xffffff9d);
} sparse_no_default pass 27 lines
// glaurung: sparse_no_default @ 0x1110
int32_t sparse_no_default(int32_t arg0) {
int result;
long var0;
var0 = 0xfffffff9;
if (((((unsigned long)((unsigned int)(arg0)) == 16) | ((long)(arg0) < 16)) == 0)) {
if (((unsigned long)((unsigned int)(arg0)) == 17)) {
return 3;
}
if (((unsigned long)((unsigned int)(arg0)) == 4096)) {
return 4;
}
result = var0;
if (((unsigned long)((unsigned int)(arg0)) != 0xf4240)) {
return result;
}
return 5;
}
if (((unsigned long)((unsigned int)(arg0)) == 0xfffffc18)) {
return 1;
}
result = var0;
if (((unsigned long)((unsigned int)(arg0)) != 0)) {
return result;
}
return 2;
} gcc -O0
5/5dense_no_default pass 34 lines
// glaurung: dense_no_default @ 0x10f9
int32_t dense_no_default(int32_t arg0) {
int result;
// x86-64 prologue: save rbp
result = -1;
switch ((unsigned long)((unsigned int)(arg0))) {
case 0:
result = 100;
break;
case 1:
result = 101;
break;
case 2:
result = 102;
break;
case 3:
result = 103;
break;
case 4:
result = 104;
break;
case 5:
result = 105;
break;
case 6:
result = 106;
break;
case 7:
result = 107;
break;
}
// x86-64 epilogue: restore rbp
return (unsigned int)(result);
} fallthrough_no_default pass 31 lines
// glaurung: fallthrough_no_default @ 0x1205
int32_t fallthrough_no_default(int32_t arg0) {
int accumulated;
// x86-64 prologue: save rbp
accumulated = 0;
switch ((unsigned long)((unsigned int)(((unsigned long)((unsigned int)(arg0)) & 7)))) {
case 0:
accumulated = (accumulated + 1);
goto L_1249;
case 1:
L_1249: ;
accumulated = (accumulated + 2);
goto L_124d;
case 2:
L_124d: ;
accumulated = (accumulated + 4);
// x86-64 epilogue: restore rbp
return (unsigned int)(accumulated);
case 5:
accumulated = (accumulated + 8);
goto L_1257;
case 6:
L_1257: ;
accumulated = (accumulated + 16);
// x86-64 epilogue: restore rbp
return (unsigned int)(accumulated);
default:
// x86-64 epilogue: restore rbp
return (unsigned int)(accumulated);
}
} loop_switch_no_default pass 40 lines
// glaurung: loop_switch_no_default @ 0x1261
int32_t loop_switch_no_default(const int32_t * arg0, int32_t arg1) {
int total;
int index;
long var8;
// x86-64 prologue: save rbp
total = 0;
if ((arg0 == 0)) {
// x86-64 epilogue: restore rbp
return 0xffffffff;
}
if (((long)(arg1) < 0)) {
// x86-64 epilogue: restore rbp
return 0xffffffff;
}
if (((((unsigned long)((unsigned int)(arg1)) == 8) | ((long)(arg1) < 8)) == 0)) {
// x86-64 epilogue: restore rbp
return 0xffffffff;
}
for (index = 0; (index < arg1); index++) {
var8 = (unsigned long)((unsigned int)(((unsigned long)((unsigned int)(arg0[(long)(index)])) & 3)));
if (((unsigned long)((unsigned int)(var8)) == 3)) {
total = (total + 1000);
} else {
if (((((unsigned long)((unsigned int)(var8)) == 3) | ((long)((int)(var8)) < 3)) != 0)) {
if (((unsigned long)((unsigned int)(var8)) == 0)) {
total = (total + 1);
} else {
if (((unsigned long)((unsigned int)(var8)) == 1)) {
total = (total + 10);
} else {
}
}
}
}
total = (total + 1);
}
// x86-64 epilogue: restore rbp
return (unsigned int)(total);
} returning_arms_no_default pass 18 lines
// glaurung: returning_arms_no_default @ 0x12f1
int32_t returning_arms_no_default(int32_t arg0) {
// x86-64 prologue: save rbp
switch (arg0) {
case 13:
return 4;
case 12:
return 3;
case 10:
return 1;
case 11:
return 2;
default:
// x86-64 epilogue: restore rbp
return 0xffffff9d;
}
// x86-64 epilogue: restore rbp
} sparse_no_default pass 40 lines
// glaurung: sparse_no_default @ 0x1181
int32_t sparse_no_default(int32_t arg0) {
int result;
// x86-64 prologue: save rbp
result = -7;
if (((unsigned long)((unsigned int)(arg0)) == 0xf4240)) {
result = 5;
} else {
if (((((unsigned long)((unsigned int)(arg0)) == 0xf4240) | ((long)(arg0) < 0xf4240)) == 0)) {
// x86-64 epilogue: restore rbp
return (unsigned int)(result);
}
if (((unsigned long)((unsigned int)(arg0)) == 4096)) {
result = 4;
} else {
if (((((unsigned long)((unsigned int)(arg0)) == 4096) | ((long)(arg0) < 4096)) == 0)) {
// x86-64 epilogue: restore rbp
return (unsigned int)(result);
}
if (((unsigned long)((unsigned int)(arg0)) == 17)) {
result = 3;
} else {
if (((((unsigned long)((unsigned int)(arg0)) == 17) | ((long)(arg0) < 17)) == 0)) {
// x86-64 epilogue: restore rbp
return (unsigned int)(result);
}
if (((unsigned long)((unsigned int)(arg0)) == 0xfffffc18)) {
result = 1;
} else {
if (((unsigned long)((unsigned int)(arg0)) == 0)) {
result = 2;
} else {
}
}
}
}
}
// x86-64 epilogue: restore rbp
return (unsigned int)(result);
} gcc -O2
5/5dense_no_default pass 4 lines
// glaurung: dense_no_default @ 0x1100
int32_t dense_no_default(int32_t arg0) {
return (((unsigned long)(8) <= (unsigned long)((unsigned long)((unsigned int)(arg0)))) ? 0xffffffff : (unsigned long)((unsigned int)((arg0 + 100))));
} fallthrough_no_default pass 19 lines
// glaurung: fallthrough_no_default @ 0x1180
int32_t fallthrough_no_default(int32_t arg0) {
int accumulated;
switch ((unsigned long)((unsigned int)((arg0 & 7)))) {
case 0:
return 7;
case 1:
return 6;
case 2:
return 4;
case 5:
return 24;
case 6:
return 16;
default:
return 0;
}
return 0;
} loop_switch_no_default pass 47 lines
// glaurung: loop_switch_no_default @ 0x11f0
int32_t loop_switch_no_default(const int32_t * arg0, int32_t arg1) {
int total;
int index;
long ret;
int var18;
long var2;
int var21;
long var6;
long var9;
if ((arg0 == 0)) {
return 0xffffffff;
}
if (((unsigned long)(8) < (unsigned long)((unsigned long)((unsigned int)(arg1))))) {
return 0xffffffff;
}
if (((unsigned long)((unsigned int)(arg1)) == 0)) {
return 0;
}
var2 = (long)((((long)arg0 + ((unsigned long)((unsigned int)((arg1 - 1))) * 4)) + 4));
total = 0;
var6 = (long)arg0;
L_122f: ;
while (1) {
var9 = (unsigned long)((unsigned int)(((unsigned long)((unsigned int)(*(int *)((var6)))) & 3)));
if (((unsigned long)((unsigned int)(var9)) != 1)) {
var6 = (var6 + 4);
var18 = ((((unsigned long)((unsigned int)(var9)) != 3) ? (unsigned int)(((unsigned int)(total) + ((unsigned long)((unsigned long)((unsigned int)(var9))) < (unsigned long)(1)))) : (unsigned long)((unsigned int)((total + 1000)))) + 1);
ret = (unsigned long)((unsigned int)(var18));
total = (unsigned long)((unsigned int)(var18));
if ((var6 == var2)) {
goto L_1248;
}
goto L_122f;
}
var6 = (var6 + 4);
var21 = ((unsigned int)((total + 10)) + 1);
ret = (unsigned long)((unsigned int)(var21));
total = (unsigned long)((unsigned int)(var21));
if ((var6 != var2)) {
goto L_122f;
}
goto L_1248;
}
L_1248: ;
return ret;
} returning_arms_no_default pass 4 lines
// glaurung: returning_arms_no_default @ 0x1260
int32_t returning_arms_no_default(int32_t arg0) {
return (((unsigned long)((unsigned long)((unsigned int)((arg0 - 10)))) < (unsigned long)(4)) ? (unsigned long)((unsigned int)((arg0 - 9))) : 0xffffff9d);
} sparse_no_default pass 21 lines
// glaurung: sparse_no_default @ 0x1120
int32_t sparse_no_default(int32_t arg0) {
long ret;
long t33;
t33 = ((unsigned long)((unsigned int)(arg0)) - 17);
if (((unsigned long)((unsigned int)(arg0)) == 17)) {
return 3;
}
if (((((unsigned long)((unsigned int)(arg0)) == 17) | ((long)(arg0) < 17)) == 0)) {
ret = 4;
if (((unsigned long)((unsigned int)(arg0)) == 4096)) {
return ret;
}
return (((unsigned long)((unsigned int)(arg0)) == 0xf4240) ? 5 : 0xfffffff9);
}
ret = 1;
if (((unsigned long)((unsigned int)(arg0)) == 0xfffffc18)) {
return ret;
}
return (unsigned int)(((unsigned long)((unsigned int)(((unsigned int)((0 - ((unsigned long)((unsigned long)((unsigned int)(arg0))) < (unsigned long)(1)))) & 9))) - 7));
}