7 #define ldiv(n,d) ({ldiv_t __r;long __n=(n),__d=(d);asm("move.l 0xC8,%%a5;move.l %2,%%d1;move.l %3,%%d0;move.l (%%a5,2720),%%a0;jsr (%%a0);move.l %%d1,%0;move.l %2,%%d1;move.l %3,%%d0;move.l (%%a5,2724),%%a0;jsr (%%a0);move.l %%d1,%1" : "=&g"(__r.quot),"=g"(__r.rem) : "g"(__n),"g"(__d) : "a0","a1","a5","d0","d1","d2");__r;})
9 #define ldiv(n,d) ({ldiv_t __r;long __n=(n),__d=(d);asm("move.l %2,%%d1;move.l %3,%%d0;jsr _ROM_CALL_2A8;move.l %%d1,%0;move.l %2,%%d1;move.l %3,%%d0;jsr _ROM_CALL_2A9;move.l %%d1,%1" : "=&g"(__r.quot),"=g"(__r.rem) : "g"(__n),"g"(__d) : "a0","a1","d0","d1","d2");__r;})
12 #ifndef NO_EXIT_SUPPORT
13 extern void __exit(void)__ATTR_LIB_ASM_NORETURN__
;
16 extern long __randseed
;
18 /* Begin Auto-Generated Part */
19 #define NULL ((void*)0)
20 #define RAND_MAX 32767
23 typedef unsigned long size_t;
25 typedef CALLBACK
void(*atexit_t
)(void);
26 typedef CALLBACK
short(*compare_t
)(const void*elem1
,const void*elem2
);
29 typedef struct{short quot
,rem
;}div_t;
33 typedef struct{long quot
,rem
;}ldiv_t;
35 #define abort() (_rom_call(void,(const char*),E6)("ABNORMAL PROGRAM TERMINATION"),exit(0))
36 #define abs(x) ({typeof(x) __x = (x); __x >= 0 ? __x : -__x;})
39 void *alloca(long)__ATTR_GCC__
;
41 extern short atexit(atexit_t
)__ATTR_LIB_ASM__
;
42 extern short atoi(const char*)__ATTR_LIB_C__
;
43 extern long atol(const char*)__ATTR_LIB_C__
;
44 extern void *bsearch(const void* asm("a0"),const void* asm("a1"),short asm("d0"),short asm("d1"),compare_t
asm("a2")) __ATTR_LIB_ASM__
;
47 extern void *calloc(short asm("d0"),short asm("d1"))__ATTR_LIB_ASM__
;
49 #define div(n,d) ({short __n=(n),__d=(d);div_t __r;__r.quot=__n/__d;__r.rem=__n%__d;__r;})
50 #define exit(n) ({(n)?_rom_call(void,(short),152)(n):0;__exit();})
51 #define fabs(x) _tios_float_1(106,x,float)
52 #define free _rom_call(void,(void*),A3)
55 long labs(long)__ATTR_GCC__
;
57 #define malloc _rom_call(void*,(long),A2)
58 #define max(a,b) ({typeof(a) __a = (a); typeof(b) __b = (b); (__a > __b) ? __a : __b;})
59 #define min(a,b) ({typeof(a) __a = (a); typeof(b) __b = (b); (__a < __b) ? __a : __b;})
60 extern void qsort(void* asm("a0"),short asm("d0"),short asm("d1"),compare_t
asm("a2"))__ATTR_LIB_ASM__
;
61 extern short rand(void)__ATTR_LIB_ASM__
;
62 #define random(x) ((short)((long)(unsigned short)rand()*(unsigned short)(x)/32768))
63 #define randomize() srand(*(volatile unsigned char*)0x600017)
64 #ifndef __HAVE_realloc
65 #define __HAVE_realloc
66 extern void *realloc(void* asm("a0"),long asm("d0"))__ATTR_LIB_ASM__
;
68 #define srand(x) (__randseed=(x))
69 extern long strtol(const char*,char**,short)__ATTR_LIB_C__
;
70 extern unsigned long strtoul(const char*,char**,short)__ATTR_LIB_C__
;
74 extern float atof(const char*)__ATTR_LIB_ASM__
;
77 /* End Auto-Generated Part */