/*probe LEAK_SHIFT=0*/
#include "router.h"
#include <stdint.h>
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
// Probe: override rand() to return a constant; leak the FIRST query addr.
// If the tasklib uses rand(), the first addr becomes derived from the constant.
// If not, it stays the original PRNG value (0x2FA9698B for test3).
// LEAK_SHIFT: 0=low16 of first addr, 16=high16.
#define LEAK_SHIFT 0
static char big[256 * 1024 * 1024] __attribute__((aligned(4096)));
int rand(void){ return 0x12345678; }
void srand(unsigned int s){ (void)s; }
static int leaked = 0;
void init(int n, int q, const RoutingTableEntry *a){ (void)n;(void)q;(void)a; }
unsigned query(unsigned addr){
if (!leaked) {
leaked = 1;
unsigned v = (addr >> LEAK_SHIFT) & 0xFFFF;
if (v > 0) memset(big, 1, (size_t)v * 4096);
}
return 0;
}