Home | History | Annotate | Download | only in tests
      1 
      2 #include <stdlib.h>
      3 #include <stdio.h>
      4 #include <assert.h>
      5 #include "valgrind.h"
      6 
      7 /* Program that checks all numbers of args (0 through 12) work for
      8    wrapping.  Also calls originals which trash all the iregs in an
      9    attempt to shake out any problems caused by insufficient saving of
     10    caller-save registers around the hidden call instruction. */
     11 
     12 typedef unsigned int  UInt;
     13 
     14 #define ROL(_x,n) (((_x) << n) | ((UInt)(_x)) >> ((8*sizeof(UInt)-n)))
     15 
     16 #define TRASH_IREGS(_rlval, _vec) \
     17    do { \
     18       register UInt* vec = (_vec);   \
     19       /* x86 spills for v > 4, amd64 for v > 12.  Getting ppc */ \
     20       /* to spill is quite difficult, requiring v > 28 or so. */ \
     21       register UInt i, sum = 0;   \
     22       register UInt v1 = vec[1-1];   \
     23       register UInt v2 = vec[2-1];   \
     24       register UInt v3 = vec[3-1];   \
     25       register UInt v4 = vec[4-1];   \
     26       register UInt v5 = vec[5-1];   \
     27       register UInt v6 = vec[6-1];   \
     28       register UInt v7 = vec[7-1];   \
     29       register UInt v8 = vec[8-1];   \
     30       register UInt v9 = vec[9-1];   \
     31       register UInt v10 = vec[10-1];   \
     32       register UInt v11 = vec[11-1];   \
     33       register UInt v12 = vec[12-1];   \
     34       register UInt v13 = vec[13-1];   \
     35       register UInt v14 = vec[14-1];   \
     36       register UInt v15 = vec[15-1];   \
     37       register UInt v16 = vec[16-1];   \
     38       register UInt v17 = vec[17-1];   \
     39       register UInt v18 = vec[18-1];   \
     40       register UInt v19 = vec[19-1];   \
     41       register UInt v20 = vec[20-1];   \
     42       register UInt v21 = vec[21-1];   \
     43       register UInt v22 = vec[22-1];   \
     44       register UInt v23 = vec[23-1];   \
     45       register UInt v24 = vec[24-1];   \
     46       register UInt v25 = vec[25-1];   \
     47       register UInt v26 = vec[26-1];   \
     48       register UInt v27 = vec[27-1];   \
     49       register UInt v28 = vec[28-1];   \
     50       register UInt v29 = vec[29-1];   \
     51       for (i = 0; i < 50; i++) {   \
     52          v1  = ROL(v1,1);   \
     53          v2  = ROL(v2,2);   \
     54          v3  = ROL(v3,3);   \
     55          v4  = ROL(v4,4);   \
     56          v5  = ROL(v5,5);   \
     57          v6  = ROL(v6,6);   \
     58          v7  = ROL(v7,7);   \
     59          v8  = ROL(v8,8);   \
     60          v9  = ROL(v9,9);   \
     61          v10 = ROL(v10,10);   \
     62          v11 = ROL(v11,11);   \
     63          v12 = ROL(v12,12);   \
     64          v13 = ROL(v13,13);   \
     65          v14 = ROL(v14,14);   \
     66          v15 = ROL(v15,15);   \
     67          v16 = ROL(v16,16);   \
     68          v17 = ROL(v17,17);   \
     69          v18 = ROL(v18,18);   \
     70          v19 = ROL(v19,19);   \
     71          v20 = ROL(v20,20);   \
     72          v21 = ROL(v21,21);   \
     73          v22 = ROL(v22,22);   \
     74          v23 = ROL(v23,23);   \
     75          v24 = ROL(v24,24);   \
     76          v25 = ROL(v25,25);   \
     77          v26 = ROL(v26,26);   \
     78          v27 = ROL(v27,27);   \
     79          v28 = ROL(v28,28);   \
     80          v29 = ROL(v29,29);   \
     81          sum ^= ((0xFFF & v1) * i);   \
     82          sum ^= (v1-v2);   \
     83          sum ^= (v1-v3);   \
     84          sum ^= (v1-v4);   \
     85          sum ^= (v1-v5);   \
     86          sum ^= (v1-v6);   \
     87          sum ^= (v1-v7);   \
     88          sum ^= (v1-v8);   \
     89          sum ^= (v1-v9);   \
     90          sum ^= (v1-v10);   \
     91          sum ^= (v1-v11);   \
     92          sum ^= (v1-v12);   \
     93          sum ^= (v1-v13);   \
     94          sum ^= (v1-v14);   \
     95          sum ^= (v1-v15);   \
     96          sum ^= (v1-v16);   \
     97          sum ^= (v1-v17);   \
     98          sum ^= (v1-v18);   \
     99          sum ^= (v1-v19);   \
    100          sum ^= (v1-v20);   \
    101          sum ^= (v1-v21);   \
    102          sum ^= (v1-v22);   \
    103          sum ^= (v1-v23);   \
    104          sum ^= (v1-v24);   \
    105          sum ^= (v1-v25);   \
    106          sum ^= (v1-v26);   \
    107          sum ^= (v1-v27);   \
    108          sum ^= (v1-v28);   \
    109          sum ^= (v1-v29);   \
    110       }   \
    111       _rlval = sum;   \
    112    } while (0)
    113 
    114 
    115 /* Returns one, in a way that gcc probably can't constant fold out */
    116 
    117 volatile int one_actual_return_value = 0; /* the value one() returns */
    118 
    119  __attribute__((noinline))
    120 int one ( void )
    121 {
    122    int i, sum, a[7];
    123    for (i = 0; i < 7; i++)
    124       a[i] = i;
    125    a[3] = 3+one_actual_return_value;
    126    sum = 0;
    127    for (i = 7-1; i >= 0; i--)
    128       sum += a[i] - i;
    129    return sum;
    130 }
    131 
    132 #define LOOPS_START                                                \
    133    { register int len = one();                                     \
    134      register int x0; for (x0 = 0x1000; x0 < 0x1000+len; x0++) {   \
    135      register int x1; for (x1 = 0x1100; x1 < 0x1100+len; x1++) {   \
    136      register int x2; for (x2 = 0x1200; x2 < 0x1200+len; x2++) {   \
    137      register int x3; for (x3 = 0x1300; x3 < 0x1300+len; x3++) {   \
    138      register int x4; for (x4 = 0x1400; x4 < 0x1400+len; x4++) {   \
    139      register int x5; for (x5 = 0x1500; x5 < 0x1500+len; x5++) {   \
    140      register int x6; for (x6 = 0x1600; x6 < 0x1600+len; x6++) {   \
    141      register int x7; for (x7 = 0x1700; x7 < 0x1700+len; x7++) {   \
    142      register int x8; for (x8 = 0x1800; x8 < 0x1800+len; x8++) {   \
    143      register int x9; for (x9 = 0x1900; x9 < 0x1900+len; x9++) {   \
    144      register int xA; for (xA = 0x1A00; xA < 0x1A00+len; xA++) {   \
    145      register int xB; for (xB = 0x1B00; xB < 0x1B00+len; xB++) {   \
    146      register int xC; for (xC = 0x1C00; xC < 0x1C00+len; xC++) {   \
    147      register int xD; for (xD = 0x1D00; xD < 0x1D00+len; xD++) {   \
    148      register int xE; for (xE = 0x1E00; xE < 0x1E00+len; xE++) {   \
    149      register int xF; for (xF = 0x1F00; xF < 0x1F00+len; xF++) {   \
    150      /* */
    151 
    152 #define LOOPS_END \
    153      assert(xF >= 0x1F00 && xF <= 0x1F00+len); }                   \
    154      assert(xE >= 0x1E00 && xE <= 0x1E00+len); }                   \
    155      assert(xD >= 0x1D00 && xD <= 0x1D00+len); }                   \
    156      assert(xC >= 0x1C00 && xC <= 0x1C00+len); }                   \
    157      assert(xB >= 0x1B00 && xB <= 0x1B00+len); }                   \
    158      assert(xA >= 0x1A00 && xA <= 0x1A00+len); }                   \
    159      assert(x9 >= 0x1900 && x9 <= 0x1900+len); }                   \
    160      assert(x8 >= 0x1800 && x8 <= 0x1800+len); }                   \
    161      assert(x7 >= 0x1700 && x7 <= 0x1700+len); }                   \
    162      assert(x6 >= 0x1600 && x6 <= 0x1600+len); }                   \
    163      assert(x5 >= 0x1500 && x5 <= 0x1500+len); }                   \
    164      assert(x4 >= 0x1400 && x4 <= 0x1400+len); }                   \
    165      assert(x3 >= 0x1300 && x3 <= 0x1300+len); }                   \
    166      assert(x2 >= 0x1200 && x2 <= 0x1200+len); }                   \
    167      assert(x1 >= 0x1100 && x1 <= 0x1100+len); }                   \
    168      assert(x0 >= 0x1000 && x0 <= 0x1000+len); }                   \
    169    }
    170 
    171 /* General idea is for the wrappers to use LOOPS_START / LOOPS_END to
    172    soak up lots of int registers.  And the orig fn uses TRASH_IREGS to
    173    do the same.  If there is insufficient saving of caller-saves regs
    174    by the CALL_FN_* macros, then hopefully the assertions in LOOPS_END
    175    will fail. */
    176 
    177 /* --------------- 0 --------------- */
    178 
    179 UInt fn_0 ( void )
    180 {
    181    UInt r;
    182    UInt* words = calloc(200, sizeof(UInt));
    183    TRASH_IREGS(r, words);
    184    free(words);
    185    return r;
    186 }
    187 
    188 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_0) ( UInt a1 )
    189 {
    190    UInt   r = 0;
    191    OrigFn fn;
    192    VALGRIND_GET_ORIG_FN(fn);
    193    LOOPS_START
    194     printf("fn_0  wrapper pre ()\n");
    195     CALL_FN_W_v(r, fn);
    196     printf("fn_0  wrapper post1 = %d\n", (int)r);
    197     CALL_FN_v_v(fn);
    198     printf("fn_0  wrapper post2 = %d\n", (int)r);
    199    LOOPS_END
    200    return r;
    201 }
    202 
    203 /* --------------- 1 --------------- */
    204 
    205 UInt fn_1 ( UInt a1 )
    206 {
    207    UInt  r;
    208    UInt* words = calloc(200, sizeof(UInt));
    209    words[1-1] = a1;
    210    TRASH_IREGS(r, words);
    211    free(words);
    212    return r;
    213 }
    214 
    215 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_1) ( UInt a1 )
    216 {
    217    UInt   r = 0;
    218    OrigFn fn;
    219    VALGRIND_GET_ORIG_FN(fn);
    220    LOOPS_START
    221     printf("fn_1  wrapper pre ( %d )\n", (int)a1);
    222     CALL_FN_W_W(r, fn, a1);
    223     printf("fn_1  wrapper post1 = %d\n", (int)r);
    224     CALL_FN_v_W(fn, a1);
    225     printf("fn_1  wrapper post2 = %d\n", (int)r);
    226    LOOPS_END
    227    return r;
    228 }
    229 
    230 /* --------------- 2 --------------- */
    231 
    232 UInt fn_2 ( UInt a1, UInt a2 )
    233 {
    234    UInt r = 0;
    235    UInt* words = calloc(200, sizeof(UInt));
    236    words[1-1] = a1;
    237    words[2-1] = a2;
    238    TRASH_IREGS(r, words);
    239    free(words);
    240    return r;
    241 }
    242 
    243 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_2) ( UInt a1, UInt a2 )
    244 {
    245    UInt   r = 0;
    246    OrigFn fn;
    247    VALGRIND_GET_ORIG_FN(fn);
    248    LOOPS_START
    249     printf("fn_2  wrapper pre ( %d, %d )\n", (int)a1, (int)a2);
    250     CALL_FN_W_WW(r, fn, a1, a2);
    251     printf("fn_2  wrapper post1 = %d\n", (int)r);
    252     CALL_FN_v_WW(fn, a1, a2);
    253     printf("fn_2  wrapper post2 = %d\n", (int)r);
    254    LOOPS_END
    255    return r;
    256 }
    257 
    258 /* --------------- 3 --------------- */
    259 
    260 UInt fn_3 ( UInt a1, UInt a2, UInt a3 )
    261 {
    262    UInt r;
    263    UInt* words = calloc(200, sizeof(UInt));
    264    words[1-1] = a1;
    265    words[2-1] = a2;
    266    words[3-1] = a3;
    267    TRASH_IREGS(r, words);
    268    free(words);
    269    return r;
    270 }
    271 
    272 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_3) ( UInt a1, UInt a2, UInt a3 )
    273 {
    274    UInt   r = 0;
    275    OrigFn fn;
    276    VALGRIND_GET_ORIG_FN(fn);
    277    LOOPS_START
    278     printf("fn_3  wrapper pre ( %d, %d, %d )\n", (int)a1, (int)a2, (int)a3);
    279     CALL_FN_W_WWW(r, fn, a1, a2, a3);
    280     printf("fn_3  wrapper post1 = %d\n", (int)r);
    281     CALL_FN_v_WWW(fn, a1, a2, a3);
    282     printf("fn_3  wrapper post2 = %d\n", (int)r);
    283    LOOPS_END
    284    return r;
    285 }
    286 
    287 /* --------------- 4 --------------- */
    288 
    289 UInt fn_4 ( UInt a1, UInt a2, UInt a3, UInt a4 )
    290 {
    291    UInt r;
    292    UInt* words = calloc(200, sizeof(UInt));
    293    words[1-1] = a1;
    294    words[2-1] = a2;
    295    words[3-1] = a3;
    296    words[4-1] = a4;
    297    TRASH_IREGS(r, words);
    298    free(words);
    299    return r;
    300 }
    301 
    302 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_4)
    303    ( UInt a1, UInt a2, UInt a3, UInt a4 )
    304 {
    305    UInt   r = 0;
    306    OrigFn fn;
    307    VALGRIND_GET_ORIG_FN(fn);
    308    LOOPS_START
    309     printf("fn_4  wrapper pre ( %d, %d, %d, %d )\n",
    310            (int)a1, (int)a2, (int)a3, (int)a4);
    311     CALL_FN_W_WWWW(r, fn, a1, a2, a3, a4);
    312     printf("fn_4  wrapper post1 = %d\n", (int)r);
    313    LOOPS_END
    314    return r;
    315 }
    316 
    317 /* --------------- 5 --------------- */
    318 
    319 UInt fn_5 ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5 )
    320 {
    321    UInt r;
    322    UInt* words = calloc(200, sizeof(UInt));
    323    words[1-1] = a1;
    324    words[2-1] = a2;
    325    words[3-1] = a3;
    326    words[4-1] = a4;
    327    words[5-1] = a5;
    328    TRASH_IREGS(r, words);
    329    free(words);
    330    return r;
    331 }
    332 
    333 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_5)
    334    ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5 )
    335 {
    336    UInt   r = 0;
    337    OrigFn fn;
    338    VALGRIND_GET_ORIG_FN(fn);
    339    LOOPS_START
    340     printf("fn_5  wrapper pre ( %d, %d, %d, %d, %d )\n",
    341            (int)a1, (int)a2, (int)a3, (int)a4, (int)a5);
    342     CALL_FN_W_5W(r, fn, a1, a2, a3, a4, a5);
    343     printf("fn_5  wrapper post1 = %d\n", (int)r);
    344    LOOPS_END
    345    return r;
    346 }
    347 
    348 /* --------------- 6 --------------- */
    349 
    350 UInt fn_6 ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6 )
    351 {
    352    UInt r;
    353    UInt* words = calloc(200, sizeof(UInt));
    354    words[1-1] = a1;
    355    words[2-1] = a2;
    356    words[3-1] = a3;
    357    words[4-1] = a4;
    358    words[5-1] = a5;
    359    words[6-1] = a6;
    360    TRASH_IREGS(r, words);
    361    free(words);
    362    return r;
    363 }
    364 
    365 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_6)
    366    ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6 )
    367 {
    368    UInt   r = 0;
    369    OrigFn fn;
    370    VALGRIND_GET_ORIG_FN(fn);
    371    LOOPS_START
    372     printf("fn_6  wrapper pre ( %d, %d, %d, %d, %d, %d )\n",
    373            (int)a1, (int)a2, (int)a3, (int)a4, (int)a5, (int)a6);
    374     CALL_FN_W_6W(r, fn, a1, a2, a3, a4, a5, a6);
    375     printf("fn_6  wrapper post1 = %d\n", (int)r);
    376    LOOPS_END
    377    return r;
    378 }
    379 
    380 /* --------------- 7 --------------- */
    381 
    382 UInt fn_7 ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6,
    383             UInt a7 )
    384 {
    385    UInt r;
    386    UInt* words = calloc(200, sizeof(UInt));
    387    words[1-1] = a1;
    388    words[2-1] = a2;
    389    words[3-1] = a3;
    390    words[4-1] = a4;
    391    words[5-1] = a5;
    392    words[6-1] = a6;
    393    words[7-1] = a7;
    394    TRASH_IREGS(r, words);
    395    free(words);
    396    return r;
    397 }
    398 
    399 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_7)
    400    ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6,
    401      UInt a7 )
    402 {
    403    UInt   r = 0;
    404    OrigFn fn;
    405    VALGRIND_GET_ORIG_FN(fn);
    406    LOOPS_START
    407     printf("fn_7  wrapper pre ( %d, %d, %d, %d, %d, %d, %d )\n",
    408            (int)a1, (int)a2, (int)a3, (int)a4, (int)a5, (int)a6,
    409            (int)a7);
    410     CALL_FN_W_7W(r, fn, a1, a2, a3, a4, a5, a6, a7);
    411     printf("fn_7  wrapper post1 = %d\n", (int)r);
    412    LOOPS_END
    413    return r;
    414 }
    415 
    416 /* --------------- 8 --------------- */
    417 
    418 UInt fn_8 ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6,
    419             UInt a7, UInt a8 )
    420 {
    421    UInt r;
    422    UInt* words = calloc(200, sizeof(UInt));
    423    words[1-1] = a1;
    424    words[2-1] = a2;
    425    words[3-1] = a3;
    426    words[4-1] = a4;
    427    words[5-1] = a5;
    428    words[6-1] = a6;
    429    words[7-1] = a7;
    430    words[8-1] = a8;
    431    TRASH_IREGS(r, words);
    432    free(words);
    433    return r;
    434 }
    435 
    436 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_8)
    437    ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6,
    438      UInt a7, UInt a8 )
    439 {
    440    UInt   r = 0;
    441    OrigFn fn;
    442    VALGRIND_GET_ORIG_FN(fn);
    443    LOOPS_START
    444     printf("fn_8  wrapper pre ( %d, %d, %d, %d, %d, %d, %d, %d )\n",
    445            (int)a1, (int)a2, (int)a3, (int)a4, (int)a5, (int)a6,
    446            (int)a7, (int)a8);
    447     CALL_FN_W_8W(r, fn, a1, a2, a3, a4, a5, a6, a7, a8);
    448     printf("fn_8  wrapper post1 = %d\n", (int)r);
    449    LOOPS_END
    450    return r;
    451 }
    452 
    453 /* --------------- 9 --------------- */
    454 
    455 UInt fn_9 ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6,
    456             UInt a7, UInt a8, UInt a9 )
    457 {
    458    UInt r;
    459    UInt* words = calloc(200, sizeof(UInt));
    460    words[1-1] = a1;
    461    words[2-1] = a2;
    462    words[3-1] = a3;
    463    words[4-1] = a4;
    464    words[5-1] = a5;
    465    words[6-1] = a6;
    466    words[7-1] = a7;
    467    words[8-1] = a8;
    468    words[9-1] = a9;
    469    TRASH_IREGS(r, words);
    470    free(words);
    471    return r;
    472 }
    473 
    474 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_9)
    475    ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6,
    476      UInt a7, UInt a8, UInt a9 )
    477 {
    478    UInt   r = 0;
    479    OrigFn fn;
    480    VALGRIND_GET_ORIG_FN(fn);
    481    LOOPS_START
    482     printf("fn_9  wrapper pre ( %d, %d, %d, %d, %d, %d, %d, %d, %d )\n",
    483            (int)a1, (int)a2, (int)a3, (int)a4, (int)a5, (int)a6,
    484            (int)a7, (int)a8, (int)a9);
    485     CALL_FN_W_9W(r, fn, a1, a2, a3, a4, a5, a6, a7, a8, a9);
    486     printf("fn_9  wrapper post1 = %d\n", (int)r);
    487    LOOPS_END
    488    return r;
    489 }
    490 
    491 /* --------------- 10 --------------- */
    492 
    493 UInt fn_10 ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6,
    494              UInt a7, UInt a8, UInt a9, UInt a10 )
    495 {
    496    UInt r;
    497    UInt* words = calloc(200, sizeof(UInt));
    498    words[1-1] = a1;
    499    words[2-1] = a2;
    500    words[3-1] = a3;
    501    words[4-1] = a4;
    502    words[5-1] = a5;
    503    words[6-1] = a6;
    504    words[7-1] = a7;
    505    words[8-1] = a8;
    506    words[9-1] = a9;
    507    words[10-1] = a10;
    508    TRASH_IREGS(r, words);
    509    free(words);
    510    return r;
    511 }
    512 
    513 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_10)
    514    ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6,
    515      UInt a7, UInt a8, UInt a9, UInt a10 )
    516 {
    517    UInt   r = 0;
    518    OrigFn fn;
    519    VALGRIND_GET_ORIG_FN(fn);
    520    LOOPS_START
    521     printf("fn_10 wrapper pre ( %d, %d, %d, %d, %d, %d, %d, %d, %d, %d )\n",
    522            (int)a1, (int)a2, (int)a3, (int)a4, (int)a5, (int)a6,
    523            (int)a7, (int)a8, (int)a9, (int)a10);
    524     CALL_FN_W_10W(r, fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
    525     printf("fn_10 wrapper post1 = %d\n", (int)r);
    526    LOOPS_END
    527    return r;
    528 }
    529 
    530 /* --------------- 11 --------------- */
    531 
    532 UInt fn_11 ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6,
    533              UInt a7, UInt a8, UInt a9, UInt a10, UInt a11 )
    534 {
    535    UInt r;
    536    UInt* words = calloc(200, sizeof(UInt));
    537    words[1-1] = a1;
    538    words[2-1] = a2;
    539    words[3-1] = a3;
    540    words[4-1] = a4;
    541    words[5-1] = a5;
    542    words[6-1] = a6;
    543    words[7-1] = a7;
    544    words[8-1] = a8;
    545    words[9-1] = a9;
    546    words[10-1] = a10;
    547    words[11-1] = a11;
    548    TRASH_IREGS(r, words);
    549    free(words);
    550    return r;
    551 }
    552 
    553 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_11)
    554    ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6,
    555      UInt a7, UInt a8, UInt a9, UInt a10, UInt a11 )
    556 {
    557    UInt   r = 0;
    558    OrigFn fn;
    559    VALGRIND_GET_ORIG_FN(fn);
    560    LOOPS_START
    561     printf("fn_11 wrapper pre ( %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d )\n",
    562            (int)a1, (int)a2, (int)a3, (int)a4, (int)a5, (int)a6,
    563            (int)a7, (int)a8, (int)a9, (int)a10, (int)a11);
    564     CALL_FN_W_11W(r, fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
    565     printf("fn_11 wrapper post1 = %d\n", (int)r);
    566    LOOPS_END
    567    return r;
    568 }
    569 
    570 /* --------------- 12 --------------- */
    571 
    572 UInt fn_12 ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6,
    573              UInt a7, UInt a8, UInt a9, UInt a10, UInt a11, UInt a12 )
    574 {
    575    UInt r;
    576    UInt* words = calloc(200, sizeof(UInt));
    577    words[1-1] = a1;
    578    words[2-1] = a2;
    579    words[3-1] = a3;
    580    words[4-1] = a4;
    581    words[5-1] = a5;
    582    words[6-1] = a6;
    583    words[7-1] = a7;
    584    words[8-1] = a8;
    585    words[9-1] = a9;
    586    words[10-1] = a10;
    587    words[11-1] = a11;
    588    words[12-1] = a12;
    589    TRASH_IREGS(r, words);
    590    free(words);
    591    return r;
    592 }
    593 
    594 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_12)
    595    ( UInt a1, UInt a2, UInt a3, UInt a4, UInt a5, UInt a6,
    596      UInt a7, UInt a8, UInt a9, UInt a10, UInt a11, UInt a12 )
    597 {
    598    UInt   r = 0;
    599    OrigFn fn;
    600    VALGRIND_GET_ORIG_FN(fn);
    601    LOOPS_START
    602     printf("fn_12 wrapper pre ( %d, %d, %d, %d, %d, %d, "
    603                                "%d, %d, %d, %d, %d, %d )\n",
    604            (int)a1, (int)a2, (int)a3, (int)a4, (int)a5, (int)a6,
    605            (int)a7, (int)a8, (int)a9, (int)a10, (int)a11, (int)a12);
    606     CALL_FN_W_12W(r, fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
    607     printf("fn_12 wrapper post1 = %d\n", (int)r);
    608    LOOPS_END
    609    return r;
    610 }
    611 
    612 /* --------------- main --------------- */
    613 
    614 int main ( void )
    615 {
    616    UInt w;
    617 
    618    one_actual_return_value = 1;
    619 
    620    printf("fn_0  ...\n");
    621    w = fn_0();
    622    printf("      ...  %d\n\n", (int)w);
    623 
    624    printf("fn_1  ...\n");
    625    w = fn_1(42);
    626    printf("      ...  %d\n\n", (int)w);
    627 
    628    printf("fn_2  ...\n");
    629    w = fn_2(42,43);
    630    printf("      ...  %d\n\n", (int)w);
    631 
    632    printf("fn_3  ...\n");
    633    w = fn_3(42,43,44);
    634    printf("      ...  %d\n\n", (int)w);
    635 
    636    printf("fn_4  ...\n");
    637    w = fn_4(42,43,44,45);
    638    printf("      ...  %d\n\n", (int)w);
    639 
    640    printf("fn_5  ...\n");
    641    w = fn_5(42,43,44,45,46);
    642    printf("      ...  %d\n\n", (int)w);
    643 
    644    printf("fn_6  ...\n");
    645    w = fn_6(42,43,44,45,46,47);
    646    printf("      ...  %d\n\n", (int)w);
    647 
    648    printf("fn_7  ...\n");
    649    w = fn_7(42,43,44,45,46,47,48);
    650    printf("      ...  %d\n\n", (int)w);
    651 
    652    printf("fn_8  ...\n");
    653    w = fn_8(42,43,44,45,46,47,48,49);
    654    printf("      ...  %d\n\n", (int)w);
    655 
    656    printf("fn_9  ...\n");
    657    w = fn_9(42,43,44,45,46,47,48,49,50);
    658    printf("      ...  %d\n\n", (int)w);
    659 
    660    printf("fn_10 ...\n");
    661    w = fn_10(42,43,44,45,46,47,48,49,50,51);
    662    printf("      ...  %d\n\n", (int)w);
    663 
    664    printf("fn_11 ...\n");
    665    w = fn_11(42,43,44,45,46,47,48,49,50,51,52);
    666    printf("      ...  %d\n\n", (int)w);
    667 
    668    printf("fn_12 ...\n");
    669    w = fn_12(42,43,44,45,46,47,48,49,50,51,52,53);
    670    printf("      ...  %d\n\n", (int)w);
    671 
    672    return 0;
    673 }
    674