typedef unsigned uintptr_t;
extern void __assert_fail (__const char *__assertion, __const char *__file,
unsigned int __line, __const char *__function)
__attribute__ ((__noreturn__));
#define assert(expr) \
((expr) ? (void)(0) : __assert_fail (#expr, __FILE__, __LINE__, __func__))
void f1(int *p) {
if (p) *p = 1;
else *p = 0; }
struct foo_struct {
int x;
};
int f2(struct foo_struct* p) {
if (p)
p->x = 1;
return p->x++; }
int f3(char* x) {
int i = 2;
if (x)
return x[i - 1];
return x[i+1]; }
int f3_b(char* x) {
int i = 2;
if (x)
return x[i - 1];
return x[i+1]++; }
int f4(int *p) {
uintptr_t x = (uintptr_t) p;
if (x)
return 1;
int *q = (int*) x;
return *q; }
int f4_b(void) {
short array[2];
uintptr_t x = array;
short *p = x;
if (!(p == &array[0])) {
p = 0;
*p = 1; }
if (p) {
*p = 5; p = 0;
}
else return;
*p += 10; return 0;
}
int f5(void) {
char *s = "hello world";
return s[0]; }
int bar(int* p, int q) __attribute__((nonnull));
int f6(int *p) {
return !p ? bar(p, 1) : bar(p, 0); }
int bar2(int* p, int q) __attribute__((nonnull(1)));
int f6b(int *p) {
return !p ? bar2(p, 1) : bar2(p, 0); }
int bar3(int*p, int q, int *r) __attribute__((nonnull(1,3)));
int f6c(int *p, int *q) {
return !p ? bar3(q, 2, p) : bar3(p, 2, q); }
void f6d(int *p) {
bar(p, 0);
if (!p) {
int *q = 0;
*q = 0xDEADBEEF; }
}
void f6e(int *p, int offset) {
bar((p+offset)+1, 0); }
int* qux();
int f7(int x) {
int* p = 0;
if (0 == x)
p = qux();
if (0 == x)
*p = 1;
return x;
}
int* f7b(int *x) {
int* p = 0;
if (((void*)0) == x)
p = qux();
if (((void*)0) == x)
*p = 1;
return x;
}
int* f7c(int *x) {
int* p = 0;
if (((void*)0) == x)
p = qux();
if (((void*)0) != x)
return x;
*p = 1; return x;
}
int* f7c2(int *x) {
int* p = 0;
if (((void*)0) == x)
p = qux();
if (((void*)0) == x)
return x;
*p = 1; return x;
}
void f8(int *p, int *q) {
if (!p)
if (p)
*p = 1;
if (q)
if (!q)
*q = 1; }
int* qux();
int f9(unsigned len) {
assert (len != 0);
int *p = 0;
unsigned i;
for (i = 0; i < len; ++i)
p = qux(i);
return *p++; }
int f9b(unsigned len) {
assert (len > 0); int *p = 0;
unsigned i;
for (i = 0; i < len; ++i)
p = qux(i);
return *p++; }
int* f10(int* p, signed char x, int y) {
x &= y;
if (!x) {
if (!p) return 0;
*p = 10;
}
else p = 0;
if (!x)
*p = 5;
return p;
}
void f11(unsigned i) {
int *x = 0;
if (i >= 0) { } else {
*x = 42; }
}
void f11b(unsigned i) {
int *x = 0;
if (i <= ~(unsigned)0) {
} else {
*x = 42; }
}
typedef int BOOL, *PBOOL, *LPBOOL;
typedef long LONG_PTR, *PLONG_PTR;
typedef unsigned long ULONG_PTR, *PULONG_PTR;
typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
typedef LONG_PTR LRESULT;
typedef struct _F12ITEM *HF12ITEM;
void f12(HF12ITEM i, char *q) {
char *p = 0;
switch ((DWORD_PTR) i) {
case 0 ... 10:
p = q;
break;
case (DWORD_PTR) ((HF12ITEM) - 65535):
return;
default:
return;
}
*p = 1; }
void f13(void) {
int *x = 0;
if (((((int) x) << 2) + 1) >> 1) *x = 1;
}
void pr4759_aux(int *p) __attribute__((nonnull));
void pr4759(void) {
int *p;
pr4759_aux(p); }
void ttt(const int *nptr);
void ttt2(const int *nptr);
typedef void (*NoConstType)(int*);
int foo10595327(int b) {
void (*fp)(int *);
if (b > 5)
fp = (NoConstType)ttt2;
else
fp = (NoConstType)ttt;
int x = 3;
int y = x + 1;
int *p = 0;
fp(&y);
if (x == y)
return *p; return 0;
}
#define AS_ATTRIBUTE volatile __attribute__((address_space(256)))
#define _get_base() ((void * AS_ATTRIBUTE *)0)
void* test_address_space_array(unsigned long slot) {
return _get_base()[slot]; }
void test_address_space_condition(int AS_ATTRIBUTE *cpu_data) {
if (cpu_data == 0) {
*cpu_data = 3; }
}
struct X { int member; };
int test_address_space_member(void) {
struct X AS_ATTRIBUTE *data = (struct X AS_ATTRIBUTE *)0UL;
int ret;
ret = data->member; return ret;
}