int func(int time_no){
int flug;
double ave_new_interval,new_interval;
static double p_next_os_time,p_last_os_time,p_last_ms_os_time;
if(time_no==0){
hogehoge;
}else{
if(time_s>=p_next_os_time){
new_interval=interval_1(ave_new_interval);
p_next_os_time=p_last_ms_os_time+new_interval;
p_last_os_time=p[time_no];
flug=1;
}else{/*次の発火前なら*/
if(((time_s<start_time)&&(time_s<0.128*5))||((start_time<time_s)&&(time_s<end_time)&&(time_s<t1*5+start_time))||((end_time<time_s)&&(time_s<t1*5+end_time))){
new_interval=interval_2(ave_new_interval);
p_next_os_time=p_last_ms_os_time+new_interval;
flug=0;
if(time_s>=p_next_os_time){
flug=1;
p_last_ms_os_time=time_s;
new_interval=interval3(ave_new_interval);
p_next_os_time=p_last_ms_os_time+new_interval;
p_last_os_time=p[time_no];
  }
}else{
  p_next_os_time=p_next_os_time;

  flug=0;

}

}

}

return(flug);

}


-----------------------
int main(){
hogehoge;
for(time_no=0;time_no<N;time_no++){
time=time_no*0.1;
time_s=time/1000;
alpha[time_no]=flug(time_no);
}
}

こんな感じです。mainとfuncは別のファイルで、
ここで定義してない変数とかは全部定義してあります。
でコンパイルしてとおります。