[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Prolangs-C/football/Makefile common.c common.h definitions.h io.c io.h sort.c sort.h stats stats.c stats.h

Chris Lattner lattner at cs.uiuc.edu
Tue Oct 5 14:05:48 PDT 2004



Changes in directory llvm-test/MultiSource/Benchmarks/Prolangs-C/football:

Makefile added (r1.1)
common.c added (r1.1)
common.h added (r1.1)
definitions.h added (r1.1)
io.c added (r1.1)
io.h added (r1.1)
sort.c added (r1.1)
sort.h added (r1.1)
stats added (r1.1)
stats.c added (r1.1)
stats.h added (r1.1)
---
Log message:

New program


---
Diffs of the changes:  (+2266 -0)

Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/football/Makefile
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/football/Makefile:1.1
*** /dev/null	Tue Oct  5 16:05:47 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/football/Makefile	Tue Oct  5 16:05:36 2004
***************
*** 0 ****
--- 1,5 ----
+ LEVEL = ../../../..
+ 
+ PROG = football
+ include $(LEVEL)/MultiSource/Makefile.multisrc
+ 


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/football/common.c
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/football/common.c:1.1
*** /dev/null	Tue Oct  5 16:05:47 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/football/common.c	Tue Oct  5 16:05:36 2004
***************
*** 0 ****
--- 1,388 ----
+ /* %%%%%%%%%%%%%%%%%%%% (c) William Landi 1991 %%%%%%%%%%%%%%%%%%%%%%%%%%%% */
+ /* Permission to use this code is granted as long as the copyright */
+ /* notice remains in place. */
+ #include <stdio.h>
+ #include "definitions.h"
+ #include "stats.h"
+ 
+ TEAMS_STATS common_games;
+ TEAM common_teams[NUM_TEAMS+1];
+ 
+ extern void display_split(FILE *stream,TEAM *teams,int split,int num);
+ 
+ BOOL matches_any_team(int num,TEAM code)
+ {
+   int i;
+   for (i=1;i<=num;i++)
+     if (common_teams[i] == code)
+       return i;
+   return NO;
+ }
+ 
+ void common(int num)
+ {
+   TEAM tmp_team,temp;
+   int week,game,i;
+   int in_common[NUM_TEAMS+1];
+   TEAM team1,team2;
+   int site1,site2;
+ 
+   for (tmp_team=1;tmp_team<=NUM_TEAMS; tmp_team++)
+     in_common[tmp_team] = 0;
+ 
+   for (temp=1;temp<=num;temp++)
+     for (tmp_team=1;tmp_team<=NUM_TEAMS; tmp_team++)
+       in_common[tmp_team] += team_plays[common_teams[temp]][tmp_team];
+ 
+   for (temp=1;temp<=NUM_TEAMS;temp++) {
+     if (in_common[temp] < num)
+       in_common[temp] = NO;
+     else in_common[temp] = YES;
+   }
+ /* stats */
+   for (team1=1;team1<=NUM_TEAMS; team1++) {
+     common_games[team1].wins = common_games[team1].loses = 0;
+     common_games[team1].ties = 0;
+     common_games[team1].points_for = common_games[team1].points_against = 0;
+   }
+    
+   for (week = 1; week <= num_games;week++) 
+     for (game = 1;game<=NUM_TEAMS/2; game++) 
+       for (i = 1; i<=2; i++) {
+ 	if ( i == 1) {
+ 	  team1 = sched[week][game][HOST]; site1 = HOST;
+ 	  team2 = sched[week][game][VISITOR]; site2 = VISITOR;
+ 	} else {
+ 	  team1 = sched[week][game][VISITOR]; site1 = VISITOR;
+ 	  team2 = sched[week][game][HOST]; site2 = HOST;
+ 	}
+ 	if ( team1 != 0 && in_common[team1] )
+ 	  if (matches_any_team(num,team2)) 
+ 	    if (scores[week][game][HOST] >= 0 &&
+ 		scores[week][game][VISITOR] >=0) {
+ 	      if (scores[week][game][site1] < scores[week][game][site2])
+ 		common_games[team2].wins ++;
+ 	      else if (scores[week][game][site1] > scores[week][game][site2])
+ 		common_games[team2].loses ++;
+ 	      else common_games[team2].ties ++;
+ 	    } else common_games[team2].points_for ++;
+       } 
+   for (team1=1;team1<=28;team1++)
+     if (common_games[team1].wins + common_games[team1].loses +
+ 	common_games[team1].ties + common_games[team1].points_for < 4)
+       common_games[team1].wins = -1;
+ }
+ 
+ 
+ int head_to_head_sweap(TEAM *teams,int num)
+ {
+   TEAM temp1,temp2;
+   BOOL sweap_win=YES,sweap_lose=YES;
+ 
+   for (temp1=0;temp1<num;temp1++) {
+       sweap_win = sweap_lose = YES;
+       for (temp2=0;temp2<num;temp2++) 
+ 	if (temp1 != temp2) {
+ 	  if (h_to_h_stats[teams[temp1]][teams[temp2]].ties == 0 &&
+ 	      h_to_h_stats[teams[temp1]][teams[temp2]].wins == 0 &&
+ 	      h_to_h_stats[teams[temp1]][teams[temp2]].loses == 0)
+ 	    sweap_win = sweap_lose = NO;
+ 	  if (h_to_h_stats[teams[temp1]][teams[temp2]].ties != 0 )
+ 	    sweap_win = sweap_lose = NO;
+ 	  if (h_to_h_stats[teams[temp1]][teams[temp2]].loses != 0)
+ 	    sweap_win = NO;
+ 	  if (h_to_h_stats[teams[temp1]][teams[temp2]].wins != 0)
+ 	    sweap_lose = NO;
+ 	}
+       if (sweap_win) {
+ 	TEAM tmp_team;
+ 	tmp_team = teams[0];
+ 	teams[0] = teams[temp1];
+ 	teams[temp1] = tmp_team;
+ 	return 1;
+       }
+       if (sweap_lose) {
+ 	TEAM tmp_team;
+ 	tmp_team = teams[num-1];
+ 	teams[num-1] = teams[temp1];
+ 	teams[temp1] = tmp_team;
+ 	return num-1;
+       }
+     }
+   return num;
+ }
+ 
+ void split_around(TEAM *teams,int num_best,int num,double *pct,double best_pct)
+ {
+   int t1,t2;
+   int i;
+   TEAM temp[NUM_TEAMS];
+ 
+   t1 = t2 = 0;
+   for (i=0;i<num;i++) 
+     if (pct[i] == best_pct) {
+       temp[t1] = teams[i];
+       t1 ++;
+     } else {
+       temp[t2+num_best] = teams[i];
+       t2 ++;
+     }
+   for (i=0;i<num;i++)
+     teams[i] = temp[i];
+ }
+ 
+ int head_to_head(TEAM *teams,int num)
+ {
+   int i,j;
+   double best_pct,pct[MAX_TEAMS_DIV];
+   int num_best;
+   int wins,loses,ties;
+   
+   if (num > MAX_TEAMS_DIV) {
+     (void) printf("ERROR in head_to_head (common.c). Assumption violated.\n");
+     exit(1);
+   }
+ 
+   best_pct = 0.0;
+   num_best = 0;
+   for (i=0;i<num;i++) {
+     wins = loses = ties = 0;
+     for (j=0;j<num;j++) 
+       if (i != j) {
+ 	wins += h_to_h_stats[teams[i]][teams[j]].wins;
+ 	loses += h_to_h_stats[teams[i]][teams[j]].loses;
+ 	ties += h_to_h_stats[teams[i]][teams[j]].ties;
+       }
+     pct[i] = (wins+loses+ties == 0 ? 0.0 :
+ 	      ((double) wins + 0.5 * ties) / ((double) (wins + loses + ties)));
+     if (pct[i] > best_pct) {
+       best_pct = pct[i];
+       num_best = 0;
+     }
+     if (pct[i] == best_pct) num_best++;
+   }
+ 
+   split_around(teams,num_best,num,pct,best_pct);
+   return num_best;
+ }
+ 
+ 
+ /* */
+ int break_common(TEAM *teams,int num)
+ {
+   int i;
+   double best_pct,pct[NUM_TEAMS];
+   int num_best;
+   
+   if (num > NUM_TEAMS) {
+     (void) printf("ERROR in break_common (common.c). Assumption violated.\n");
+     exit(1);
+   }
+ 
+   for (i=0;i<num;i++)
+     common_teams[i+1] = teams[i];
+   common(num);
+   for (i=0;i<num;i++) {
+     if (common_games[teams[i]].wins == -1) return num;
+   }
+   best_pct = 0.0;
+   num_best = 0;
+   for (i=0;i<num;i++) {
+     pct[i] = WIN_PCT(common_games[teams[i]]);
+     if (pct[i] > best_pct) {
+       best_pct = pct[i];
+       num_best = 0;
+     }
+     if (pct[i] == best_pct) num_best++;
+   }
+ 
+   split_around(teams,num_best,num,pct,best_pct);
+   return num_best;
+ }
+ 
+ /* */
+ int div_conf_rec(TEAM *teams,int num,int which)
+ {
+   int i;
+   double best_pct,pct[NUM_TEAMS];
+   int num_best;
+   
+   if (num > NUM_TEAMS) {
+     (void) printf("ERROR in div_conf_rec (common.c). Assumption violated.\n");
+     exit(1);
+   }
+ 
+   best_pct = 0.0;
+   num_best = 0;
+   for (i=0;i<num;i++) { 
+     if (which == DIVISION)
+       pct[i] = WIN_PCT(team_info_wi_div[teams[i]]);
+     else pct[i] = WIN_PCT(team_info_wi_conf[teams[i]]);
+     if (pct[i] > best_pct) {
+       best_pct = pct[i];
+       num_best = 0;
+     }
+     if (pct[i] == best_pct) num_best++;
+   }
+ 
+   split_around(teams,num_best,num,pct,best_pct);
+   return num_best;
+ }
+ 
+ int break_net_points(TEAM *teams,int num,int which)
+ {
+   int i;
+   double best_pct,pct[NUM_TEAMS];
+   int num_best;
+   
+   if (num > NUM_TEAMS) {
+     (void) printf("ERROR in break_net_points (common.c). Assumption violated.\n");
+     exit(1);
+   }
+ 
+   best_pct = -10000.0;
+   num_best = 0;
+   for (i=0;i<num;i++) { 
+     if (which == DIVISION)
+       pct[i] = (double) NET_POINTS(team_info_wi_div,teams[i]);
+     else if (which == CONFERENCE)
+       pct[i] = (double) NET_POINTS(team_info_wi_conf,teams[i]);
+     else pct[i] = (double) NET_POINTS(team_info,teams[i]);
+     if (pct[i] > best_pct) {
+       best_pct = pct[i];
+       num_best = 0;
+     }
+     if (pct[i] == best_pct) num_best++;
+   }
+ 
+   split_around(teams,num_best,num,pct,best_pct);
+   return num_best;
+ }
+ 
+ void break_a_tie(TEAM *teams,int num,BOOL display)
+ {
+   BOOL ALL_SAME_DIV;
+   int value,i;
+ 
+   if (num <= 1) return;
+   
+   ALL_SAME_DIV = YES;
+   for (i=1;i<num;i++)
+     ALL_SAME_DIV = ALL_SAME_DIV && (divisions[teams[0]][DIVISION] ==
+ 				     divisions[teams[i]][DIVISION]);
+   if (display) {
+     (void) printf("------ Break a tie (all same div: %d) -------\n",
+ 		  ALL_SAME_DIV);
+     display_split(stdout,teams,num,num);
+   }
+ 
+   if (ALL_SAME_DIV || num == 2) {
+     value = head_to_head(teams,num);
+     if (value != num) {
+       if (display) {
+ 	display_split(stdout,teams,value,num);
+ 	(void) printf("Split because of head to head record.\n");
+       }
+       break_a_tie(teams,value,display);
+       break_a_tie(&(teams[value]),num-value,display);
+       return;
+     }
+   } else {
+     value = head_to_head_sweap(teams,num);
+     if (value != num) {
+       if (display) {
+ 	display_split(stdout,teams,value,num);
+ 	(void) printf("Split because of head to head sweap.\n");
+       }
+       break_a_tie(teams,value,display);
+       break_a_tie(&(teams[value]),num-value,display);
+       return;
+     }
+   }
+ 
+   if (ALL_SAME_DIV) { 
+     value = div_conf_rec(teams,num,DIVISION);
+     if (value != num) {
+       if (display) {
+ 	display_split(stdout,teams,value,num);
+ 	(void) printf("Split because of divisional record.\n");
+       }
+       break_a_tie(teams,value,display);
+       break_a_tie(&(teams[value]),num-value,display);
+       return;
+     }
+   }
+ 
+   value = div_conf_rec(teams,num,CONFERENCE);
+   if (value != num) {
+     if (display) {
+       display_split(stdout,teams,value,num);
+       (void) printf("Split because of conference record.\n");
+     } 
+     break_a_tie(teams,value,display);
+     break_a_tie(&(teams[value]),num-value,display);
+     return;
+   }
+ 
+   value = break_common(teams,num);
+   if (value != num) {
+     if (display) {
+       display_split(stdout,teams,value,num);
+       (void) printf("Split because of common game record.\n");
+     }
+     break_a_tie(teams,value,display);
+     break_a_tie(&(teams[value]),num-value,display);
+     return;
+   }
+ 
+ 
+   if (ALL_SAME_DIV) { 
+     value = break_net_points(teams,num,DIVISION);
+     if (value != num) {
+       if (display) {
+ 	display_split(stdout,teams,value,num);
+ 	(void) printf("Split because of division net points.\n");
+       }
+       break_a_tie(teams,value,display);
+       break_a_tie(&(teams[value]),num-value,display);
+       return;
+     }
+   } else {
+     value = break_net_points(teams,num,CONFERENCE);
+     if (value != num) {
+       if (display) {
+ 	display_split(stdout,teams,value,num);
+ 	(void) printf("Split because of conference net points.\n");
+       }
+       break_a_tie(teams,value,display);
+       break_a_tie(&(teams[value]),num-value,display);
+       return;
+     }
+   }
+   value = break_net_points(teams,num,NFL_0);
+   if (value != num) {
+     if (display) {
+       display_split(stdout,teams,value,num);
+       (void) printf("Split because of net points.\n");
+     } 
+     break_a_tie(teams,value,display);
+     break_a_tie(&(teams[value]),num-value,display);
+     return;
+   }
+ 
+     if (display)
+       (void) printf("Ordered by COIN TOSS.\n");
+ }
+ 
+ 
+ void display_split(FILE *stream,TEAM *teams,int split,int num)
+ {
+   int i;
+ 
+   for (i=0;i<num;i++) {
+     (void) fprintf(stream,"%s ",team[teams[i]][FULL_NAME_0]);
+     if (i==(split-1) && split != num)
+       (void) fprintf(stream,"  *   ");
+   }
+   (void) fprintf(stream,"\n");
+ }


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/football/common.h
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/football/common.h:1.1
*** /dev/null	Tue Oct  5 16:05:47 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/football/common.h	Tue Oct  5 16:05:36 2004
***************
*** 0 ****
--- 1,4 ----
+ extern TEAM common_teams[NUM_TEAMS+1];
+ extern TEAMS_STATS common_games;
+ extern void common(int num);
+ extern void break_a_tie(TEAM *teams,int num,BOOL display);


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/football/definitions.h
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/football/definitions.h:1.1
*** /dev/null	Tue Oct  5 16:05:47 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/football/definitions.h	Tue Oct  5 16:05:36 2004
***************
*** 0 ****
--- 1,88 ----
+ #define DEBUG_FLAG 1
+ 
+ #define NUM_PRESEASON_GAMES 5
+ 
+ #define NUM_GAMES_78_89 16
+ #define NUM_GAMES 17
+ 
+ #define MAX_NAME_LENGTH 15
+ #define NUM_TEAMS 28
+ #define MAX_TEAMS_DIV 5
+ #define NONE_0 NUM_TEAMS+1
+ #define VISITOR 1
+ #define HOST 2
+ #define BOOL int
+ #define YES 1
+ #define NO 0
+ #define ERROR_0 0
+ 
+ #define ABBR_0 0
+ #define FULL_NAME_0 1
+ 
+ typedef int TEAM;
+ 
+ typedef int 
+    SCHED_TYPE[NUM_GAMES+1][(int) NUM_TEAMS/2 +1 ][3];
+ 
+ typedef int 
+    SCORES_TYPE[NUM_GAMES+2][(int) NUM_TEAMS/2 +1 ][3];
+ 
+ typedef char
+   TEAM_TYPE [NUM_TEAMS+2][2][MAX_NAME_LENGTH];
+ 
+ typedef struct info {
+   int wins;
+   int loses;
+   int ties;
+   int points_for;
+   int points_against;
+   int game[NUM_GAMES+1];
+ } TEAM_INFO;
+ 
+ typedef TEAM_INFO TEAMS_STATS[NUM_TEAMS+1];
+ typedef TEAM_INFO H_TO_H_STATS[NUM_TEAMS+1][NUM_TEAMS+1];
+ 
+ #define WILD_CARD 999
+ #define CONFERENCE 0
+ #define DIVISION 1
+ #define NFL_0 2
+ #define NFC_0 0
+ #define AFC_0 1
+ #define EAST_0 0
+ #define CENTRAL_0 1
+ #define WEST_0 2
+ 
+ #define CONF_STR(x) (divisions[x][CONFERENCE] == NFC_0 ? "NFC" : "AFC")
+ #define DIVISION_STR(x) (divisions[x][DIVISION] == EAST_0 ? "East   " : \
+ 			 (divisions[x][DIVISION] == CENTRAL_0 ? \
+ 						 "Central" : "West   "))
+ 
+ typedef int DIVISION_TYPE[NUM_TEAMS+1][2];
+ typedef int TEAM_ORDERING[NUM_TEAMS+1];
+ typedef int ORDERING[NUM_TEAMS+1];
+ #define WIN_PCT(A) ((A.wins+A.loses+A.ties)==0 ? 0.0 : ((A.wins + .5*A.ties)/(A.wins+A.loses+A.ties)))
+ #define DISP1_PCT(X) (WIN_PCT(X) >= 1.0 ? "1" : " ")
+ #define DISP2_PCT(X) (WIN_PCT(X) >= 1.0 ? 0 : (int) (WIN_PCT(X)*1000+.5))
+ 
+ #define DISP_REC_HEADER(output)   (void) fprintf(output,"                 W  L  T  Pct.  PF  PA")
+ #define DISP_RECORD(output,teamcode) (void) fprintf(output, \
+ 	     "%- 14s%1s %2d %2d %2d %s.%03d %3d %3d", \
+ 	    team[teamcode][FULL_NAME_0], \
+ 	    (a_champ(teamcode) ? "*" : \
+ 		   (a_wild_card(teamcode) ? "+" : " ")), \
+ 	    team_info[teamcode].wins,team_info[teamcode].loses, \
+ 	    team_info[teamcode].ties, \
+ 	    DISP1_PCT(team_info[teamcode]), \
+ 	    DISP2_PCT(team_info[teamcode]), \
+ 	    team_info[teamcode].points_for, \
+ 	    team_info[teamcode].points_against)
+ 
+ #define PER_GAME(info,N,T) ((info[T].wins + info[T].loses + info[T].ties) == 0 ? 0.0 : ((double) N / (info[T].wins + info[T].loses + info[T].ties)))
+ 
+ #define NET_POINTS(info,A) (info[A].points_for-info[A].points_against)
+ 
+ #define sort(A,lt,lower,upper,O) {int i,j; BOOL flag; int temp;\
+      flag = YES; for (i=lower; i<=upper && flag; i ++) {flag = NO;\
+        for (j=upper; j>i; j --) \
+ 	 if (lt(A,O[j],O[j-1])) { \
+ 	     temp = O[j-1]; O[j-1]=O[j]; O[j]=temp; flag = YES;}}}


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/football/io.c
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/football/io.c:1.1
*** /dev/null	Tue Oct  5 16:05:47 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/football/io.c	Tue Oct  5 16:05:36 2004
***************
*** 0 ****
--- 1,1041 ----
+ /* %%%%%%%%%%%%%%%%%%%% (c) William Landi 1991 %%%%%%%%%%%%%%%%%%%%%%%%%%%% */
+ /* Permission to use this code is granted as long as the copyright */
+ /* notice remains in place. */
+ #include <stdio.h>
+ #include <string.h>
+ #include "definitions.h"
+ #include "stats.h"
+ #include "sort.h"
+ #include "common.h"
+ 
+ #define MAX_RESP_LEN 50
+ char responce[MAX_RESP_LEN+1];
+ BOOL got_unused_responce = NO;
+ 
+ extern char *strcat(char *s1, const char *s2);
+ extern int strncmp(const char *s1, const char *s2, size_t n);
+ 
+ void prompt(FILE *output,FILE *input)
+ {
+   extern char *get_responce(FILE *input);
+   char *str;
+ 
+   (void) fprintf(output,"Hit return to continue: ");
+   str = get_responce(input);
+   if (*str != '\0')
+     got_unused_responce = YES; 
+ }
+ 
+ #define find_conf_rank(r,t) (divisions[t][CONFERENCE] == NFC_0 ? \
+ 			     find_teams_rank(r,t) : \
+ 			     find_teams_rank(r,t) - NUM_TEAMS/2)
+ 
+ int str_to_int(char *s)
+ {
+   int value;
+   char *temp;
+ 
+   value=0;
+   for (temp=s; *temp != '\0'; temp++)
+     {value = value*10 + (( (*temp >= '0') && (*temp <= '9') ) ?
+ 			 (*temp) - '0' : 0);
+    }  
+   return value;
+ }
+ 
+ int find_teams_rank(ORDERING rank,int team_code)
+ {
+   int i;
+ 
+   for (i=1;i<=NUM_TEAMS;i++)
+     if (rank[i]==team_code) return i;
+   return 0;
+ }
+ 
+ int white_space(char A)
+ {
+   static int commentP=0;
+   if (A == '%') {commentP = YES; return 1;}
+   if (commentP) {
+     if (A == '\n') commentP = 0;
+     return 1;
+   }
+ 
+   if (A == ' ' || A == '\n' || A == '\t')
+     return 1;
+   else return 0;
+ }
+ 
+ void clear_screen(FILE *output)
+ {
+   (void) fprintf(output,"\n\n=========================================\n");
+ }
+ 
+ void lower_case(char *str)
+ {
+   for (;*str != '\0';str++)
+     if ( 'A' <= *str && *str <= 'Z')
+       *str = *str + ('a' - 'A');
+ }
+ 
+ char *skip_white_space(char *str)
+ {
+   for (;white_space(*str) && *str != '\0'; str ++);
+   return str;
+ }
+ BOOL end_of_line(char *str)
+ {
+   return *str == '\0';
+ }
+ 
+ TEAM find_next_name(FILE *output,char *str)
+ {
+   char *last,last_ch;
+   TEAM value;
+ 
+   str = skip_white_space(str);
+   for (last = str; !white_space(*last); last++) {}
+   last_ch = *last;
+   *last = '\0';
+   value = find_name(output,str);
+   *last = last_ch;
+   return value;
+ }
+ 
+ BOOL matches(char *str1,char *comm, int min_len_for_match)
+ {
+   int length;
+ 
+   for (length=0;!white_space(*(str1+length)) && *(str1+length) != '\0'; 
+        length ++);
+ 
+   if (length < min_len_for_match)
+     return NO;
+   else
+     if (length > strlen(comm))
+       return (!strncmp(str1,comm,strlen(comm))) && white_space(*(str1+strlen(comm)));
+     else
+       return (!strncmp(str1,comm,length));
+ }
+ 
+ char *skip_first(char *str)
+ {
+       for (;!white_space(*str) && *str != '\0'; str ++);
+       for (;white_space(*str) && *str != '\0'; str ++);
+       return (str);
+ }
+ 
+ char *get_responce(FILE *input)
+ {
+   char *resp;
+   extern int in_fileP;
+ 
+   if (!got_unused_responce) {
+     (void) fgets(responce,MAX_RESP_LEN,input);
+     if (in_fileP) (void) fprintf(stdout,"%s\n",responce);
+ 
+     lower_case(responce);
+ 
+     for (resp=responce+strlen(responce)-1;
+ 	 resp >= responce && white_space(*resp);
+ 	 resp --)
+ 	*resp = '\0';
+   }
+   else got_unused_responce = NO;
+ 
+   for (resp=responce; *resp != '\0' && white_space(*resp); resp++);
+   return(resp);
+ }
+ 
+ int find_nth_place_team(ORDERING standings,int conf,int div,int place)
+ {
+   int team_code;
+   int next_found_is;
+ 
+   next_found_is = 1;
+   
+   for (team_code=1; team_code <= NUM_TEAMS; team_code ++)
+     if ((divisions[standings[team_code]][CONFERENCE] == conf || 
+ 	 conf == WILD_CARD) &&
+ 	(divisions[standings[team_code]][DIVISION] == div ||
+ 	 div == WILD_CARD))
+       if (next_found_is == place) return standings[team_code];
+       else next_found_is ++;
+   return 0;
+ }
+ 
+ #define PRINT_RESULT(week) \
+   if (week > num_games) (void) fprintf(output, \
+ 	"                            "); \
+   else { int i,score,opp_score; \
+     for (i=1;sched[week][i][HOST] != team_code && \
+ 	 sched[week][i][VISITOR] != team_code && i <= NUM_TEAMS/2; i++) ; \
+     if (i == NUM_TEAMS/2+1) \
+       (void) fprintf(output,"                            "); \
+     else {if (sched[week][i][VISITOR] == team_code) {\
+       (void) fprintf(output,"at %-15s ", \
+ 		     team[sched[week][i][HOST]][FULL_NAME_0]); \
+       score = scores[week][i][VISITOR]; \
+       opp_score = scores[week][i][HOST]; } \
+       else {(void) fprintf(output,"%-15s    ", \
+ 		     team[sched[week][i][VISITOR]][FULL_NAME_0]); \
+       score = scores[week][i][HOST]; \
+       opp_score = scores[week][i][VISITOR]; } \
+     if (score == -1 || opp_score == -1 ) \
+       (void) fprintf(output,"         "); \
+     else {if (score == opp_score) \
+              (void) fprintf(output,"T"); \
+ 	  else if (score > opp_score) \
+ 		(void) fprintf(output,"W"); \
+ 	  else (void) fprintf(output,"L"); \
+ 	    (void) fprintf(output,"%2d-%2d   ",score,opp_score);} \
+ 	  }} 
+ 
+ void display_info(FILE *output,int team_code)
+ {
+   int week;
+   int tmp_team;
+ 
+   clear_screen(output);
+ 
+   (void) fprintf(output,"%s team information.\n\n",
+ 		 team[team_code][FULL_NAME_0]);
+ 
+   for (week=1;week <= 21; week ++) {
+     PRINT_RESULT(week); 
+     switch (week) {
+     case 1:
+       (void) fprintf(output,"%s %s",CONF_STR(team_code),
+ 		     DIVISION_STR(team_code));
+       break;
+     case 2:
+       DISP_REC_HEADER(output); break;
+     case 3: case 4: case 5: case 6: case 7:
+       if (tmp_team = find_nth_place_team(standings,
+ 					 divisions[team_code][CONFERENCE],
+ 					 divisions[team_code][DIVISION],
+ 					 week-2))
+ 	DISP_RECORD(output,tmp_team);
+       break;
+     case 9:
+       (void) fprintf(output,"Record           %2d-%d-%d      %sRank %d/%d",
+ 		     team_info[team_code].wins,
+ 		     team_info[team_code].loses,team_info[team_code].ties,
+ 		     (team_info[team_code].wins < 10 && 
+ 		      team_info[team_code].loses < 10 ? "  " : " "),
+ 		     find_conf_rank(conf_standings,team_code),
+ 		     find_teams_rank(abs_standings,team_code));
+       break;
+     case 10:
+       (void) fprintf(output,"Points scored   %3d [%6.1f]   Rank %d/%d",
+ 		     team_info[team_code].points_for,
+ 		     PER_GAME(team_info,team_info[team_code].points_for,
+ 			      team_code),
+ 		     find_conf_rank(offence_ranks,team_code),
+ 		     find_teams_rank(offence_ranks_nfl,team_code));
+       break;
+     case 11:
+       (void) fprintf(output,"Points allowed  %3d [%6.1f]   Rank %d/%d",
+ 		     team_info[team_code].points_against,
+ 		     PER_GAME(team_info,team_info[team_code].points_against,
+ 			      team_code),
+ 		     find_conf_rank(defence_ranks,team_code),
+ 		     find_teams_rank(defence_ranks_nfl,team_code));
+       break;
+     case 12:
+       (void) fprintf(output,"Net Points     %4d [%6.1f]   Rank %d/%d",
+ 		     NET_POINTS(team_info,team_code),
+ 		     PER_GAME(team_info,NET_POINTS(team_info,team_code),
+ 			      team_code),
+ 		     find_conf_rank(net_ranks,team_code),
+ 		     find_teams_rank(net_ranks_nfl,team_code));
+       break;
+     case 14: 
+       (void) fprintf(output,"Major Tie-breakers:"); break;
+     case 15:
+      (void) fprintf(output,"-(1/1) Head to Head"); break;
+     case 16: 
+       (void) fprintf(output,"-(2/ ) Divisional Record          %d-%d-%d",
+ 		     team_info_wi_div[team_code].wins,
+ 		     team_info_wi_div[team_code].loses,
+ 		     team_info_wi_div[team_code].ties);
+       break;
+     case 17:
+       (void) fprintf(output,"-(3/2) Conference Record          %d-%d-%d",
+ 		     team_info_wi_conf[team_code].wins,
+ 		     team_info_wi_conf[team_code].loses,
+ 		     team_info_wi_conf[team_code].ties);
+       break;
+     case 18:
+       (void) fprintf(output,"-(4/3) Common Games"); break;
+     case 19:
+       (void) fprintf(output,"-(5/ ) Net points in %s %s  %d [%3.1f]",
+ 		     CONF_STR(team_code),DIVISION_STR(team_code),
+ 		     NET_POINTS(team_info_wi_div,team_code),
+ 		     PER_GAME(team_info_wi_div,
+ 			      NET_POINTS(team_info_wi_div,team_code),
+ 			      team_code));
+       break;
+     case 20:
+       (void) fprintf(output,"-( /4) Avg. net points in %s     %3.1f",
+ 		     CONF_STR(team_code),
+ 		     PER_GAME(team_info_wi_conf,
+ 			      NET_POINTS(team_info_wi_conf,team_code),
+ 			      team_code));
+       break;
+     case 21:
+       (void) fprintf(output,"-(6/5) Total net points           %d [%3.1f]",
+ 		     NET_POINTS(team_info,team_code),
+ 		     PER_GAME(team_info,NET_POINTS(team_info,team_code),
+ 			      team_code));
+       break;
+     default: 
+       break;
+     }
+ 
+     (void) fprintf(output,"\n");
+   }
+ }
+ 
+ BOOL is_any(TEAM *teams,int num,TEAM code)
+ {
+   int i;
+   for (i=0;i<num;i++)
+     if (teams[i] == code) return YES;
+   return NO;
+ }
+ 
+ /* ===================================================== */
+ void display_multi_tiebreaker(FILE *output,TEAM *teams,int num)
+ {
+   int i;
+   BOOL same_conf,same_div;
+   TEAM tmp_team,tmp_team1;
+ 
+   same_conf = same_div = YES;
+ 
+   if (num < 2) return;
+   
+   common_teams[1] = teams[0];
+   for (i=1;i<num;i++) {
+     common_teams[i+1] = teams[i];
+     same_conf = same_conf && (divisions[teams[i]][CONFERENCE] ==
+ 			      divisions[teams[0]][CONFERENCE]);
+     same_div = same_div && (divisions[teams[i]][DIVISION] ==
+ 			    divisions[teams[0]][DIVISION]);
+   }
+   if (!same_conf) {
+     (void) fprintf(output,"ERROR: All teams must be from the same conference.\n");
+     return;
+   }
+   clear_screen(output);
+ 
+   if (!same_div) {
+     return;
+   }
+ 
+   (void) fprintf(output,"                                          ");
+   (void) fprintf(output,"            Div\n");
+   (void) fprintf(output,"                             Div.   Conf. ");
+   (void) fprintf(output,"Common      Net  Net\n");
+   (void) fprintf(output,"Team           Record HtoH  Record Record ");
+   (void) fprintf(output,"Games       Pts  Pts\n\n");
+   for (tmp_team1=1; tmp_team1 <= NUM_TEAMS; tmp_team1 ++) {
+     tmp_team= conf_standings[tmp_team1];
+     if (is_any(teams,num,tmp_team)) {
+       (void) fprintf(output,"%-13s %2d-%2d-%1d ",
+ 		     team[tmp_team][FULL_NAME_0],
+ 		     team_info[tmp_team].wins,
+ 		     team_info[tmp_team].loses,
+ 		     team_info[tmp_team].ties);
+       {
+ 	int wins,loses,ties;
+ 	int tmp;
+ 
+ 	wins = loses = ties = 0;
+ 	for (tmp=0;tmp<num;tmp++)
+ 	  if (teams[tmp] != tmp_team) {
+ 	    wins += h_to_h_stats[tmp_team][teams[tmp]].wins;
+ 	    loses += h_to_h_stats[tmp_team][teams[tmp]].loses;
+ 	    ties += h_to_h_stats[tmp_team][teams[tmp]].ties;
+ 	  }
+ 	(void) fprintf(output,"%1d-%1d-%1d",wins,loses,ties);
+       }      
+       (void) fprintf(output," %1d-%1d-%1d",
+ 		   team_info_wi_div[tmp_team].wins,
+ 		   team_info_wi_div[tmp_team].loses,
+ 		   team_info_wi_div[tmp_team].ties);
+       (void) fprintf(output," %2d-%2d-%1d",
+ 		   team_info_wi_conf[tmp_team].wins,
+ 		   team_info_wi_conf[tmp_team].loses,
+ 		   team_info_wi_conf[tmp_team].ties);
+ 
+       common(num);
+       if ( (common_games[tmp_team].wins != -1)) {
+ 	(void) fprintf(output,"%2d-%2d-%1d[%2d]",
+ 	       common_games[tmp_team].wins,common_games[tmp_team].loses,
+ 	       common_games[tmp_team].ties,common_games[tmp_team].points_for);
+       } else                /* 123456789012 */
+ 	(void) fprintf(output,"            ");
+ 
+       (void) fprintf(output,"%4d", NET_POINTS(team_info_wi_div,tmp_team));
+       (void) fprintf(output," %4d",NET_POINTS(team_info,tmp_team));
+       (void) fprintf(output,"\n");
+     }
+   }
+ }
+ 
+ /* ===================================================== */
+ void display_tiebreaker(FILE *output,TEAM team_code)
+ {
+   TEAM tmp_team,tmp_team1;
+ 
+ 
+   clear_screen(output);
+ 
+   common_teams[1] = team_code;
+   (void) fprintf(output,"                                          ");
+   (void) fprintf(output,"Common Games Rec.[left] Div Conf\n");
+   (void) fprintf(output,"                       vs.   Div.   Conf. ");
+   (void) fprintf(output,"----------------------- Net  Net  Net\n");
+   (void) fprintf(output,"Team           Record  %3s  Record Record ",
+ 		 team[team_code][ABBR_0]);
+   (void) fprintf(output,"   Team         %3s     Pts  Pts  Pts\n\n",
+ 		 team[team_code][ABBR_0]);
+   for (tmp_team1=1; tmp_team1 <= NUM_TEAMS; tmp_team1 ++) {
+     tmp_team= conf_standings[tmp_team1];
+     if (divisions[tmp_team][CONFERENCE] == divisions[team_code][CONFERENCE]){
+       common_teams[2] = tmp_team;
+       (void) fprintf(output,"%-13s %2d-%2d-%1d ",
+ 		     team[tmp_team][FULL_NAME_0],
+ 		     team_info[tmp_team].wins,
+ 		     team_info[tmp_team].loses,
+ 		     team_info[tmp_team].ties);
+       if (team_code != tmp_team) 
+ 	(void) fprintf(output,"%1d-%1d-%1d",
+ 		       h_to_h_stats[tmp_team][team_code].wins,
+ 		       h_to_h_stats[tmp_team][team_code].loses,
+ 		       h_to_h_stats[tmp_team][team_code].ties);
+       else (void) fprintf(output,"     ");
+       
+     if (divisions[tmp_team][DIVISION] == divisions[team_code][DIVISION])
+       (void) fprintf(output," %1d-%1d-%1d",
+ 		   team_info_wi_div[tmp_team].wins,
+ 		   team_info_wi_div[tmp_team].loses,
+ 		   team_info_wi_div[tmp_team].ties);
+       else (void) fprintf(output,"      ");
+       (void) fprintf(output," %2d-%2d-%1d",
+ 		   team_info_wi_conf[tmp_team].wins,
+ 		   team_info_wi_conf[tmp_team].loses,
+ 		   team_info_wi_conf[tmp_team].ties);
+ 
+       common(2);
+       if ( tmp_team != team_code && (common_games[team_code].wins != -1 &&
+ 	  common_games[tmp_team].wins != -1)) {
+ 	(void) fprintf(output," %2d-%2d-%1d[%2d] %2d-%2d-%1d[%2d]",
+ 	       common_games[tmp_team].wins,common_games[tmp_team].loses,
+ 	       common_games[tmp_team].ties,common_games[tmp_team].points_for,
+ 	       common_games[team_code].wins,common_games[team_code].loses,
+ 	       common_games[team_code].ties,common_games[team_code].points_for
+ 		       );
+       } else                /* 123456789012345678901234 */
+ 	(void) fprintf(output,"                        ");
+ 
+       if (divisions[tmp_team][DIVISION] == divisions[team_code][DIVISION])
+ 	(void) fprintf(output,"%4d", NET_POINTS(team_info_wi_div,tmp_team));
+       else (void) fprintf(output,"    ");
+ 
+       (void) fprintf(output,"%5.1f",
+ 		     PER_GAME(team_info_wi_conf,
+ 			      NET_POINTS(team_info_wi_conf,tmp_team),
+ 			      tmp_team));
+ 
+       (void) fprintf(output," %4d",NET_POINTS(team_info,tmp_team));
+       (void) fprintf(output,"\n");
+ 
+     }
+   }
+ }
+       
+ /* ===================================================== */
+ void display_records(FILE *output)
+ {
+   TEAM tmp_team,tmp_team1;
+ 
+ 
+   clear_screen(output);
+   (void) fprintf(output,"                 NFC                 ");
+   (void) fprintf(output,"    ");
+   (void) fprintf(output,"                 AFC\n\n"); 
+   (void) fprintf(output,"                        W  L  T  Pct.");
+   (void) fprintf(output,"    ");
+   (void) fprintf(output,"                        W  L  T  Pct.\n");
+   for (tmp_team1=1; tmp_team1 <= NUM_TEAMS/2; tmp_team1 ++) {
+     tmp_team = conf_standings[tmp_team1];
+     (void) fprintf(output,"%2d/%2d) %-14s",tmp_team1,
+ 		   find_teams_rank(abs_standings,tmp_team),
+ 		   team[tmp_team][FULL_NAME_0]); 
+     if (a_champ(tmp_team)) (void) fprintf(output,"*");
+     else if (a_wild_card(tmp_team)) (void) fprintf(output,"+");
+     else (void) fprintf(output," ");
+     (void) fprintf(output," %2d-%2d-%2d %s.%03d",
+ 		     team_info[tmp_team].wins,
+ 		     team_info[tmp_team].loses,
+ 		     team_info[tmp_team].ties,
+ 		     DISP1_PCT(team_info[tmp_team]), 
+ 		     DISP2_PCT(team_info[tmp_team]));
+     (void) fprintf(output,"    ");
+     tmp_team = conf_standings[tmp_team1+NUM_TEAMS/2];
+     (void) fprintf(output,"%2d/%2d) %-14s",tmp_team1,
+ 		   find_teams_rank(abs_standings,tmp_team),
+ 		   team[tmp_team][FULL_NAME_0]);
+     if (a_champ(tmp_team)) (void) fprintf(output,"*");
+     else if (a_wild_card(tmp_team)) (void) fprintf(output,"+");
+     else (void) fprintf(output," ");
+     (void) fprintf(output," %2d-%2d-%2d %s.%03d\n",
+ 		     team_info[tmp_team].wins,
+ 		     team_info[tmp_team].loses,
+ 		     team_info[tmp_team].ties,
+ 		     DISP1_PCT(team_info[tmp_team]), 
+ 		     DISP2_PCT(team_info[tmp_team]));
+   }
+   (void) fprintf(output,"\n* Division winner\n+ Wildcard\n");
+ }
+ 
+ void display_week(FILE *output,int week)
+ {
+   int game;
+ 
+   clear_screen(output);
+   (void) fprintf(output,"                                    Week %d\n\n",week);
+ 
+   for (game=1;game < NUM_TEAMS /2 + 2; game += 3) {
+     (void) fprintf(output,"%-16s",team[sched[week][game][VISITOR]][FULL_NAME_0]);
+     if (scores[week][game][VISITOR] < 0)
+       (void) fprintf(output,"          ");
+     else (void) fprintf(output,"  %2d      ",scores[week][game][VISITOR]);
+     if (game + 1 <= NUM_TEAMS/2) {
+       (void) fprintf(output,"%-16s",team[sched[week][game+1][VISITOR]][FULL_NAME_0]);
+       if (scores[week][game+1][VISITOR] < 0)
+ 	(void) fprintf(output,"          ");
+       else (void) fprintf(output,"  %2d      ",scores[week][game+1][VISITOR]);
+     }
+     if (game + 2 <= NUM_TEAMS/2) {
+       (void) fprintf(output,"%-16s",team[sched[week][game+2][VISITOR]][FULL_NAME_0]);
+       if (scores[week][game+2][VISITOR] < 0)
+ 	(void) fprintf(output,"          ");
+       else (void) fprintf(output,"  %2d      ",scores[week][game+2][VISITOR]);
+     }
+     (void) fprintf(output,"\n");
+     (void) fprintf(output,"%-16s",team[sched[week][game][HOST]][FULL_NAME_0]);
+     if (scores[week][game][HOST] < 0)
+       (void) fprintf(output,"          ");
+     else (void) fprintf(output,"  %2d      ",scores[week][game][HOST]);
+     if (game + 1 <= NUM_TEAMS/2) {
+       (void) fprintf(output,"%-16s",team[sched[week][game+1][HOST]][FULL_NAME_0]);
+       if (scores[week][game+1][HOST] < 0)
+ 	(void) fprintf(output,"          ");
+       else (void) fprintf(output,"  %2d      ",scores[week][game+1][HOST]);
+     }
+     if (game + 2 <= NUM_TEAMS/2) {
+       (void) fprintf(output,"%-16s",team[sched[week][game+2][HOST]][FULL_NAME_0]);
+       if (scores[week][game+2][HOST] < 0)
+ 	(void) fprintf(output,"          ");
+       else (void) fprintf(output,"  %2d       ",scores[week][game+2][HOST]);
+     }
+     (void) fprintf(output,"\n\n");
+   }
+ }
+ 
+ void enter_prompt_week(FILE *output,FILE *input,int week)
+ {
+   int game;
+   char *resp;
+   BOOL ABORT;
+ 
+   clear_screen(output);
+   (void) fprintf(output, "Enter blank line to leave a score unchanged, \n");
+   (void) fprintf(output, "QUIT to return to menu, or new value for the score.\n");
+   (void) fprintf(output,"\nWeek %d\n\n",week);
+ 
+   ABORT = NO;
+   for (game=1;game <= NUM_TEAMS /2; game ++) {
+     if (!ABORT && sched[week][game][VISITOR] != 0 &&
+ 	sched[week][game][HOST] != 0) {
+ 
+       (void) fprintf(output,"%-16s",team[sched[week][game][VISITOR]][FULL_NAME_0]);
+       if (scores[week][game][VISITOR] < 0)
+ 	(void) fprintf(output,"         ? ");
+       else (void) fprintf(output,"  %2d     ? ",scores[week][game][VISITOR]);
+       resp = get_responce(input);
+       if (matches(resp,"quit",1)) ABORT = YES;
+       if ( *resp != '\0' && !ABORT) {
+ 	(void) sscanf(resp,"%d",&(scores[week][game][VISITOR]));
+ 	current_with_disk = NO;
+       }
+ 
+       if (!ABORT) {
+ 	(void) fprintf(output,"%-16s",team[sched[week][game][HOST]][FULL_NAME_0]);
+ 	if (scores[week][game][HOST] < 0)
+ 	  (void) fprintf(output,"         ? ");
+ 	else (void) fprintf(output,"  %2d     ? ",scores[week][game][HOST]);
+ 	resp = get_responce(input);
+ 	if (matches(resp,"quit",1)) ABORT = YES;
+ 	if ( *resp != '\0' && !ABORT) {
+ 	  (void) sscanf(resp,"%d",&(scores[week][game][HOST]));
+ 	  current_with_disk = NO;
+ 	}
+       }
+       (void) fprintf(output,"\n");
+     }
+   }
+ }
+ 
+ void enter_week(FILE *output,FILE *input,int week)
+ {
+   int game;
+   char *resp;
+   BOOL ABORT;
+   TEAM team_code;
+   BOOL FOUND_GAME;
+   int FIRST,SECOND;
+ 
+   clear_screen(output);
+   (void) fprintf(output, "Enter blank line to leave a score unchanged, \n");
+   (void) fprintf(output, "QUIT to return to menu, or new value for the score.\n");
+   (void) fprintf(output,"\nWeek %d\n\n",week);
+ 
+   ABORT = NO;
+   while (!ABORT) {
+     team_code = 0;
+     while (((team_code == 0) || (team_code == NONE_0)) && !ABORT) {
+       (void) fprintf(output,"Enter either team: ");
+       resp = get_responce(input);
+       if (end_of_line(responce) || matches(responce,"quit",1))
+ 	ABORT = YES;
+       else
+ 	team_code = find_name(output,resp);
+     }
+ 
+     FOUND_GAME=NO;
+     for (game=1;(!ABORT && (game<=NUM_TEAMS/2) && !FOUND_GAME);game++)
+ 	 {
+ 	   if ((sched[week][game][HOST] == team_code) &&
+ 	       (sched[week][game][VISITOR] != NONE_0)) {
+ 	     FIRST = HOST;
+ 	     SECOND = VISITOR;
+ 	     FOUND_GAME=YES;
+ 	   }
+ 	   if ((sched[week][game][VISITOR] == team_code) &&
+ 	       (sched[week][game][HOST] != NONE_0)) {
+ 	     FIRST = VISITOR;
+ 	     SECOND = HOST;
+ 	     FOUND_GAME=YES;
+ 	   }
+ 	 }
+     if (!ABORT)
+       if (!FOUND_GAME) 
+ 	(void) fprintf(output,"No game found for %s in week %d\n",
+ 		       team[team_code][FULL_NAME_0], week);
+       else {
+ 	game --;
+ 	(void) fprintf(output,"%-16s",team[sched[week][game][FIRST]][FULL_NAME_0]);
+ 	if (scores[week][game][FIRST] < 0)
+ 	  (void) fprintf(output,"         ? ");
+ 	else (void) fprintf(output,"  %2d     ? ",scores[week][game][FIRST]);
+ 	resp = get_responce(input);
+ 	if (matches(resp,"quit",1)) ABORT = YES;
+ 	if ( *resp != '\0' && !ABORT) {
+ 	  (void) sscanf(resp,"%d",&(scores[week][game][FIRST]));
+ 	  current_with_disk = NO;
+ 	}
+ 	
+ 	if (!ABORT) {
+ 	  (void) fprintf(output,"%-16s",team[sched[week][game][SECOND]][FULL_NAME_0]);
+ 	  if (scores[week][game][SECOND] < 0)
+ 	    (void) fprintf(output,"         ? ");
+ 	  else (void) fprintf(output,"  %2d     ? ",scores[week][game][SECOND]);
+ 	  resp = get_responce(input);
+ 	  if (matches(resp,"quit",1)) ABORT = YES;
+ 	  if ( *resp != '\0' && !ABORT) {
+ 	    (void) sscanf(resp,"%d",&(scores[week][game][SECOND]));
+ 	    current_with_disk = NO;
+ 	  }
+ 	}
+ 	(void) fprintf(output,"\n");
+       }
+   } 
+ }
+ 	 
+ 
+ void display_rankings(FILE *output)
+ {
+   int t;
+ 
+   clear_screen(output);
+ 
+   (void) fprintf(output,"\n");
+   (void) fprintf(output,"                                  Rankings\n");
+   (void) fprintf(output,"                   NFC                                       AFC\n");
+   (void) fprintf(output,"                 REC.  OFF.  DEF.  NET                    REC.  OFF.  DEF.  NET\n\n");
+   for (t=1;t<=NUM_TEAMS/2;t++) {
+     (void) fprintf(output,"%-14s%1s %2d/%-2d %2d/%-2d %2d/%-2d %2d/%-2d %-14s%1s %2d/%-2d %2d/%-2d %2d/%-2d %2d/%-2d\n",
+ 		   team[t][FULL_NAME_0],
+ 		   (a_champ(t) ? "*" : (a_wild_card(t) ? "+" : " ")),
+ 		   find_teams_rank(conf_standings,t),
+ 		   find_teams_rank(abs_standings,t),
+ 		   find_teams_rank(offence_ranks,t),
+ 		   find_teams_rank(offence_ranks_nfl,t),
+ 		   find_teams_rank(defence_ranks,t),
+ 		   find_teams_rank(defence_ranks_nfl,t),
+ 		   find_teams_rank(net_ranks,t),
+ 		   find_teams_rank(net_ranks_nfl,t),
+ 		   team[t+NUM_TEAMS/2][FULL_NAME_0],
+ 		   (a_champ(t+NUM_TEAMS/2) ? "*" : 
+ 		    (a_wild_card(t+NUM_TEAMS/2) ? "+" : " ")),
+ 		   find_teams_rank(conf_standings,t+NUM_TEAMS/2)-NUM_TEAMS/2,
+ 		   find_teams_rank(abs_standings,t+NUM_TEAMS/2),
+ 		   find_teams_rank(offence_ranks,t+NUM_TEAMS/2)-NUM_TEAMS/2,
+ 		   find_teams_rank(offence_ranks_nfl,t+NUM_TEAMS/2),
+ 		   find_teams_rank(defence_ranks,t+NUM_TEAMS/2)-NUM_TEAMS/2,
+ 		   find_teams_rank(defence_ranks_nfl,t+NUM_TEAMS/2),
+ 		   find_teams_rank(net_ranks,t+NUM_TEAMS/2)-NUM_TEAMS/2,
+ 		   find_teams_rank(net_ranks_nfl,t+NUM_TEAMS/2));
+   }
+   (void) fprintf(output,"\n");
+ }
+ 
+ void display_defence(FILE *output)
+ {
+   int t;
+ 
+   clear_screen(output);
+ 
+   (void) fprintf(output,"\n");
+   (void) fprintf(output,"                            Defensive Rankings\n");
+   (void) fprintf(output,"                NFC                              AFC\n\n");
+ 
+   for (t=1;t<=NUM_TEAMS/2;t++) {
+     (void) fprintf(output,"%2d/%-2d) %-15s %-5.1f %3d   %2d/%-2d) %-15s %-5.1f %3d\n",
+ 		   t,find_teams_rank(defence_ranks_nfl,defence_ranks[t]),
+ 		   team[defence_ranks[t]][FULL_NAME_0],
+ 		   PER_GAME(team_info,
+ 			    team_info[defence_ranks[t]].points_against,
+ 			    defence_ranks[t]),
+ 		   team_info[defence_ranks[t]].points_against,
+ 		   t,
+ 		   find_teams_rank(defence_ranks_nfl,
+ 				   defence_ranks[t+NUM_TEAMS/2]),
+ 		   team[defence_ranks[t+NUM_TEAMS/2]][FULL_NAME_0],
+ 		   PER_GAME(team_info,
+ 			    team_info[defence_ranks[t+NUM_TEAMS/2]].points_against,
+ 			    defence_ranks[t+NUM_TEAMS/2]),
+ 		   team_info[defence_ranks[t+NUM_TEAMS/2]].points_against);
+ 
+   }
+   (void) fprintf(output,"\n");
+ }
+ 
+ void display_offence(FILE *output)
+ {
+   int t;
+ 
+   clear_screen(output);
+ 
+   (void) fprintf(output,"\n");
+   (void) fprintf(output,"                            Offensive Rankings\n");
+   (void) fprintf(output,"                NFC                              AFC\n\n");
+ 
+   for (t=1;t<=NUM_TEAMS/2;t++) {
+     (void) fprintf(output,"%2d/%-2d) %-15s %-5.1f %3d   %2d/%-2d) %-15s %-5.1f %3d\n",
+ 		   t,find_teams_rank(offence_ranks_nfl,offence_ranks[t]),
+ 		   team[offence_ranks[t]][FULL_NAME_0],
+ 		   PER_GAME(team_info,team_info[offence_ranks[t]].points_for,
+ 			    offence_ranks[t]),
+ 		   team_info[offence_ranks[t]].points_for,
+ 		   t,
+ 		   find_teams_rank(offence_ranks_nfl,
+ 				   offence_ranks[t+NUM_TEAMS/2]),
+ 		   team[offence_ranks[t+NUM_TEAMS/2]][FULL_NAME_0],
+ 		   PER_GAME(team_info,
+ 			    team_info[offence_ranks[t+NUM_TEAMS/2]].points_for,
+ 			    offence_ranks[t+NUM_TEAMS/2]),
+ 		   team_info[offence_ranks[t+NUM_TEAMS/2]].points_for);
+ 
+   }
+   (void) fprintf(output,"\n");
+ }
+ 
+ void display_net(FILE *output)
+ {
+   int t;
+ 
+   clear_screen(output);
+ 
+   (void) fprintf(output,"\n");
+   (void) fprintf(output,"                            Net Points Rankings\n");
+   (void) fprintf(output,"                NFC                              AFC\n\n");
+ 
+   for (t=1;t<=NUM_TEAMS/2;t++) {
+     (void) fprintf(output,"%2d/%-2d) %-15s %-5.1f %4d   %2d/%-2d) %-15s %-5.1f %4d\n",
+ 		   t,find_teams_rank(net_ranks_nfl,net_ranks[t]),
+ 		   team[net_ranks[t]][FULL_NAME_0],
+ 		   PER_GAME(team_info,
+ 			    NET_POINTS(team_info,net_ranks[t]),net_ranks[t]),
+ 		   NET_POINTS(team_info,net_ranks[t]),
+ 		   t,
+ 		   find_teams_rank(net_ranks_nfl,net_ranks[t+NUM_TEAMS/2]),
+ 		   team[net_ranks[t+NUM_TEAMS/2]][FULL_NAME_0],
+ 		   PER_GAME(team_info,
+ 			    NET_POINTS(team_info,net_ranks[t+NUM_TEAMS/2]),
+ 			    net_ranks[t+NUM_TEAMS/2]),
+ 		   NET_POINTS(team_info,net_ranks[t+NUM_TEAMS/2]));
+ 
+   }
+   (void) fprintf(output,"\n");
+ }
+ 
+ void display_standings(FILE *output)
+ {
+   int t;
+ 
+   clear_screen(output);
+ 
+   (void) fprintf(output,
+     "\n                   NFC                                      AFC\n");
+   (void) fprintf(output,
+     "\n                  EAST                                     EAST\n");
+   DISP_REC_HEADER(output); 
+   (void) fprintf(output,"   ");
+   DISP_REC_HEADER(output); 
+   (void) fprintf(output,"\n");
+ 
+   for (t = 1 ; t <= 5; t ++) {
+     DISP_RECORD(output,standings[t]);
+     (void) fprintf(output,"   ");
+     DISP_RECORD(output,standings[t+14]);
+     (void) fprintf(output,"\n");
+   }
+   (void) fprintf(output,
+       "\n                 CENTRAL                                  CENTRAL\n");
+   for (t = 6 ; t <= 9; t ++) {
+     DISP_RECORD(output,standings[t]);
+     (void) fprintf(output,"   ");
+     DISP_RECORD(output,standings[t+14]);
+     (void) fprintf(output,"\n");
+   }
+   DISP_RECORD(output,standings[10]);
+   (void) fprintf(output,"\n");
+   (void) fprintf(output,
+ 	  "                                                           WEST\n");
+   (void) fprintf(output,"                  WEST                   ");
+   DISP_RECORD(output,standings[24]);
+   (void) fprintf(output,"\n");
+   for (t = 11 ; t <= 14; t ++) {
+     DISP_RECORD(output,standings[t]);
+     (void) fprintf(output,"   ");
+     DISP_RECORD(output,standings[t+14]);
+     (void) fprintf(output,"\n");
+   }
+   (void) fprintf(output,"\n");
+ }
+ 
+ void display_team(FILE *output)
+ {
+   int team_code;
+ 
+   clear_screen(output);
+ 
+   for (team_code=1; team_code <= NUM_TEAMS/2; team_code ++)
+     (void) fprintf(output,"%-15s [%-3s]     %-15s [%-3s]\n",
+ 		   team[team_code][FULL_NAME_0],team[team_code][ABBR_0],
+ 		   team[team_code+NUM_TEAMS/2][FULL_NAME_0],
+ 		   team[team_code+NUM_TEAMS/2][ABBR_0]);
+ }
+ 
+ void display_main_menu(FILE *output,FILE *input)
+ {
+   char *resp;
+   BOOL valid_input;
+ 
+   valid_input=NO;
+ 
+   if (!got_unused_responce) {
+     clear_screen(output);
+ 
+     (void) fprintf(output,"Enter week <num>\n");
+     (void) fprintf(output,"Enter week <num> with-prompts\n");
+     (void) fprintf(output,"Display all-ranks\n");
+     (void) fprintf(output,"Display defensive-rank\n");
+     (void) fprintf(output,"Display information-about <team-name/abbr>\n");
+     (void) fprintf(output,"Display menu\n");
+     (void) fprintf(output,"Display offensive-rank\n");
+     (void) fprintf(output,"Display net-rank\n");
+     (void) fprintf(output,"Display records\n");
+     (void) fprintf(output,"Display standings\n");
+     (void) fprintf(output,"Display team-names/abbr\n");
+     (void) fprintf(output,"Display tie-breaker-information-for <team-name/abbr>\n");
+     (void) fprintf(output,"Display week <num>\n");
+     (void) fprintf(output,"How-ties-broken conference\n");
+     (void) fprintf(output,"How-ties-broken division\n");
+     (void) fprintf(output,"Quit\n");
+     (void) fprintf(output,"Save\n");
+     if (!current_with_disk)
+       (void) fprintf(output,"[WARNING: Database is not current with disk.]\n");
+   }
+ 
+   while (!valid_input) {
+     if (!got_unused_responce) 
+       (void) fprintf(output,"\n                Enter option: ");
+ 
+     resp = get_responce(input);
+ 
+     if (matches(resp,"quit",1) || feof(input)) {
+       (void) fprintf(output,"\n");
+       terminate = YES;
+       valid_input = YES;
+     }
+     if (matches(resp,"how-ties-broken",1)) {
+       resp = skip_first(resp);
+       if (matches(resp,"division",1)) {
+ 	(void) fprintf(output,"\n");
+ 	valid_input = YES;
+ 	break_ties(team_info,standings,DIVISION,YES);
+       } else if (matches(resp,"conference",1)) {
+ 	(void) fprintf(output,"\n");
+ 	valid_input = YES;
+ 	break_ties(team_info,conf_standings,CONFERENCE,YES);
+       }
+     } else
+     if (matches(resp,"display",1)) {
+ 
+       resp = skip_first(resp);
+       if (matches(resp,"menu",1)) 
+ 	valid_input = YES;
+       else if (matches(resp,"standings",1)) {
+ 	valid_input = YES;
+ 	display_standings(output);
+ 	prompt(output,input);
+       }
+       else if (matches(resp,"information-about",1)) {
+ 	int team_code;
+ 
+ 	resp = skip_first(resp);
+ 	if ((team_code = find_name(output,resp))) {
+ 	  valid_input = YES;
+ 	  display_info(output,team_code);
+ 	  prompt(output,input);
+ 	}
+       }
+       else if (matches(resp,"tie-breaker-information-for",2)) {
+ 	TEAM code,team_code[NUM_TEAMS];
+ 	int num,i;
+ 	num = 0;
+ 	resp = skip_first(resp);
+ 	resp = skip_white_space(resp);
+ 	while (*resp != '\0')
+ 	  if ((code = find_next_name(output,resp))) {
+ 	    BOOL temp;
+ 	    temp = YES;
+ 	    for (i=0;i<num;i++) if (team_code[i] == code) temp = NO;
+ 	    if (temp) {
+ 	      team_code[num] = code;
+ 	      num ++;
+ 	    }
+ 	    resp = skip_first(resp);
+ 	    resp = skip_white_space(resp);
+ 	    if (*resp == '\0') valid_input = YES;
+ 	  } else {*resp = '\0'; num = 0;}
+ 
+ 	if (num == 1 && valid_input) {
+ 	  display_tiebreaker(output,team_code[0]); 
+ 	  prompt(output,input);
+ 	}
+ 	else if (valid_input) {
+ 	  display_multi_tiebreaker(output,team_code,num); 
+ 	  prompt(output,input);
+ 	}
+       }
+       else if (matches(resp,"records",1)) {
+ 	valid_input = YES;
+ 	display_records(output);
+ 	prompt(output,input);
+       }
+       else if (matches(resp,"all-ranks",1)) {
+ 	valid_input = YES;
+ 	display_rankings(output);
+ 	prompt(output,input);
+       }
+       else if (matches(resp,"defensive-rank",1)) {
+ 	valid_input = YES;
+ 	display_defence(output);
+ 	prompt(output,input);
+       }
+       else if (matches(resp,"offensive-rank",1)) {
+ 	valid_input = YES;
+ 	display_offence(output);
+ 	prompt(output,input);
+       }
+       else if (matches(resp,"net-rank",1)) {
+ 	valid_input = YES;
+ 	display_net(output);
+ 	prompt(output,input);
+       }
+       else if (matches(resp,"week",1)) {
+ 	int week;
+ 
+ 	resp = skip_first(resp);
+ 	(void) sscanf(resp,"%d",&week);
+ 	if (1 <= week && week <= num_games) {
+ 	  display_week(output,week);
+ 	  prompt(output,input);
+ 	  valid_input = YES;
+ 	}
+       }
+       else if (matches(resp,"team-name/abbr",2)) {
+ 	valid_input = YES;
+ 	display_team(output);
+ 	prompt(output,input);
+       }
+ 
+       if (!valid_input)
+ 	(void) fprintf(output,"Illegal display command.\n");
+     }
+     else
+     if (matches(resp,"enter",1)) {
+ 
+       resp = skip_first(resp);
+       if (matches(resp,"week",1)) {
+ 	int week;
+ 
+ 	resp = skip_first(resp);
+ 	(void) sscanf(resp,"%d",&week);
+ 	if (1 <= week && week <= num_games) {
+ 	  resp = skip_first(resp);
+ 	  if (end_of_line(resp)) {
+ 	    enter_week(output,input,week);
+ 	    compute_team_info ();
+ 	    sort_all();
+ 	    prompt(output,input);
+ 	    valid_input = YES;
+ 	  } else if (matches(resp,"with-prompts",1)) {
+ 	    enter_prompt_week(output,input,week);
+ 	    compute_team_info ();
+ 	    sort_all();
+ 	    prompt(output,input);
+ 	    valid_input = YES;
+ 	  }
+ 	} 
+      } 
+       if (!valid_input)
+ 	(void) fprintf(output,"Illegal enter command.\n");
+     }
+     else
+       if (matches(resp,"save",1)) {
+ 	valid_input = YES;
+ 	save_scores(output,input_score); 
+       }
+ 
+     
+   }
+ }


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/football/io.h
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/football/io.h:1.1
*** /dev/null	Tue Oct  5 16:05:47 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/football/io.h	Tue Oct  5 16:05:36 2004
***************
*** 0 ****
--- 1,5 ----
+ extern int str_to_int(char *s);
+ extern void display_main_menu(FILE *output,FILE *input);
+ extern int white_space (char A);
+ extern void lower_case(char *str);
+ extern void prompt(FILE *output,FILE *input);


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/football/sort.c
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/football/sort.c:1.1
*** /dev/null	Tue Oct  5 16:05:47 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/football/sort.c	Tue Oct  5 16:05:36 2004
***************
*** 0 ****
--- 1,215 ----
+ /* %%%%%%%%%%%%%%%%%%%% (c) William Landi 1991 %%%%%%%%%%%%%%%%%%%%%%%%%%%% */
+ /* Permission to use this code is granted as long as the copyright */
+ /* notice remains in place. */
+ #include <stdio.h>
+ #include "definitions.h"
+ #include "stats.h"
+ #include "common.h"
+ #include "io.h"
+ 
+ BOOL absolute_standing_lt(TEAMS_STATS info,int team1,int team2)
+ {
+   if (WIN_PCT(info[team1]) != WIN_PCT(info[team2]))
+     return (WIN_PCT(info[team1]) > WIN_PCT(info[team2]));
+ 
+   if (info[team1].loses == 0 && info[team2].loses == 0)
+     return (info[team1].wins > info[team2].wins);
+ 
+   if (info[team1].wins == 0 && info[team2].wins == 0)
+     return (info[team1].loses < info[team2].loses);
+ 
+   if (a_champ(team1) != a_champ(team2))
+     return a_champ(team1);
+   if (a_wild_card(team1) != a_wild_card(team2))
+     return a_wild_card(team1);
+   if (divisions[team1][CONFERENCE] != divisions[team2][CONFERENCE])
+         return( divisions[team1][CONFERENCE] < divisions[team2][CONFERENCE] );
+   return(team1 < team2);
+ }
+ 
+ BOOL standing_lt(TEAMS_STATS info,int team1,int team2)
+ {
+   if (divisions[team1][CONFERENCE] != divisions[team2][CONFERENCE]) 
+     return( divisions[team1][CONFERENCE] < divisions[team2][CONFERENCE] );
+   
+   if (divisions[team1][DIVISION] != divisions[team2][DIVISION]) 
+     return( divisions[team1][DIVISION] < divisions[team2][DIVISION] );
+   
+   return absolute_standing_lt(info,team1,team2);
+ }
+ 
+ BOOL conf_standing_lt(TEAMS_STATS info,int team1,int team2)
+ {
+   if (divisions[team1][CONFERENCE] != divisions[team2][CONFERENCE]) 
+     return( divisions[team1][CONFERENCE] < divisions[team2][CONFERENCE] );
+ 
+   return absolute_standing_lt(info,team1,team2);
+ }
+ 
+ BOOL defence_lt(TEAMS_STATS info,int team1,int team2)
+ {
+   if (divisions[team1][CONFERENCE] != divisions[team2][CONFERENCE]) 
+     return( divisions[team1][CONFERENCE] < divisions[team2][CONFERENCE] );
+   
+   if (PER_GAME(info,info[team1].points_against,team1) != 
+       PER_GAME(info,info[team2].points_against,team2))
+     return (PER_GAME(info,info[team1].points_against,team1) < 
+       PER_GAME(info,info[team2].points_against,team2));
+ 
+   return (team1 < team2);
+ }
+ 
+ BOOL defence_nfl_lt(TEAMS_STATS info,int team1,int team2)
+ {
+   if (PER_GAME(info,info[team1].points_against,team1) != 
+       PER_GAME(info,info[team2].points_against,team2))
+     return (PER_GAME(info,info[team1].points_against,team1) < 
+       PER_GAME(info,info[team2].points_against,team2));
+ 
+   return (team1 < team2);
+ }
+ 
+ BOOL offence_lt(TEAMS_STATS info,int team1,int team2)
+ {
+   if (divisions[team1][CONFERENCE] != divisions[team2][CONFERENCE]) 
+     return( divisions[team1][CONFERENCE] < divisions[team2][CONFERENCE] );
+   
+   if (PER_GAME(info,info[team1].points_for,team1) != 
+       PER_GAME(info,info[team2].points_for,team2))
+     return (PER_GAME(info,info[team1].points_for,team1) > 
+       PER_GAME(info,info[team2].points_for,team2));
+ 
+   return (team1 < team2);
+ }
+ 
+ BOOL offence_nfl_lt(TEAMS_STATS info,int team1,int team2)
+ {
+   if (PER_GAME(info,info[team1].points_for,team1) != 
+       PER_GAME(info,info[team2].points_for,team2))
+     return (PER_GAME(info,info[team1].points_for,team1) > 
+       PER_GAME(info,info[team2].points_for,team2));
+ 
+   return (team1 < team2);
+ }
+ 
+ 
+ BOOL net_nfl_lt(TEAMS_STATS info,int team1,int team2)
+ {
+   if (PER_GAME(info,NET_POINTS(info,team1),team1) != 
+       PER_GAME(info,NET_POINTS(info,team2),team2))
+     return (PER_GAME(info,NET_POINTS(info,team1),team1) > 
+       PER_GAME(info,NET_POINTS(info,team2),team2));
+ 
+   return (team1 < team2);
+ }
+ 
+ BOOL net_lt(TEAMS_STATS info,int team1,int team2)
+ {
+   if (divisions[team1][CONFERENCE] != divisions[team2][CONFERENCE]) 
+     return( divisions[team1][CONFERENCE] < divisions[team2][CONFERENCE] );
+   
+   return net_nfl_lt(info,team1,team2);
+ }
+ 
+ BOOL tied(TEAMS_STATS info,int team1,int team2)
+ {
+   if (WIN_PCT(info[team1]) != WIN_PCT(info[team2]))
+     return NO;
+ 
+   if (info[team1].loses == 0 && info[team2].loses == 0)
+     return (info[team1].wins == info[team2].wins);
+ 
+   if (info[team1].wins == 0 && info[team2].wins == 0)
+     return (info[team1].loses == info[team2].loses);
+ 
+   return YES;
+ }
+ 
+ 
+ #define CHAMP(champ,conf,div) if ( (champ == ERROR_0) && \
+ 			  (divisions[rank[team_c]][CONFERENCE] == conf) && \
+ 			  (divisions[rank[team_c]][DIVISION] == div) ) \
+                                   champ = rank[team_c]
+ 
+ 
+ void break_ties(TEAMS_STATS info,ORDERING rank,int within,BOOL display)
+ {
+   int i,first_of_equals;
+   int team_c;
+   int afc,nfc;
+ 
+   if (within == DIVISION && !display) {
+     nfc_east_champ = nfc_central_champ = nfc_west_champ = ERROR_0;
+     afc_east_champ = afc_central_champ = afc_west_champ = ERROR_0;
+   }
+   if (within != NFL_0 && !display) {
+     nfc_wild_card1 = nfc_wild_card2 = nfc_wild_card3 = ERROR_0;
+     afc_wild_card1 = afc_wild_card2 = afc_wild_card3 = ERROR_0;
+   }
+   first_of_equals = 1;
+   for (i=1; i <= NUM_TEAMS; i ++) 
+     if ( !((i == NUM_TEAMS) ? NO :
+ 	  (tied(info,rank[i],rank[i+1]) ? 
+ 	   (within == DIVISION ? 
+ 	    (divisions[rank[i]][DIVISION] == divisions[rank[i+1]][DIVISION] &&
+ 	     divisions[rank[i]][CONFERENCE]==divisions[rank[i+1]][CONFERENCE])
+ 	    :(within == CONFERENCE ? 
+ 	      (divisions[rank[i]][CONFERENCE]==divisions[rank[i+1]][CONFERENCE]
+ 	      && (a_champ(rank[i]) == a_champ(rank[i+1])))
+ 	    : (a_champ(rank[i]) == a_champ(rank[i+1])) &&
+ 	      (a_wild_card(rank[i]) == a_wild_card(rank[i+1]))
+ 	      )) : NO)) ) {
+       if ( i != first_of_equals) {
+ 	break_a_tie(&(rank[first_of_equals]),i-first_of_equals+1,display);
+ 	if (display) {
+ 	  extern BOOL got_unused_responce;
+ 
+ 	  prompt(stdout,stdin);
+ 	  if (got_unused_responce) display = NO;
+ 	}
+       }
+       first_of_equals = i+1;
+     } 
+ 
+   afc = nfc = 0;
+   if (within == DIVISION)
+     for (team_c=1; team_c <= NUM_TEAMS; team_c ++) {
+       CHAMP(nfc_east_champ,NFC_0,EAST_0);
+       CHAMP(nfc_central_champ,NFC_0,CENTRAL_0);
+       CHAMP(nfc_west_champ,NFC_0,WEST_0);
+       CHAMP(afc_east_champ,AFC_0,EAST_0);
+       CHAMP(afc_central_champ,AFC_0,CENTRAL_0);
+       CHAMP(afc_west_champ,AFC_0,WEST_0);
+     } else if (within == CONFERENCE)
+       for (team_c=1; team_c <= NUM_TEAMS; team_c ++) {
+ 	if (divisions[conf_standings[team_c]][CONFERENCE] == NFC_0) {
+ 	  if (!(a_champ(conf_standings[team_c])))
+ 	   if (nfc == 0) {nfc++; nfc_wild_card1 = conf_standings[team_c];}
+ 	   else if (nfc == 1) {nfc++; nfc_wild_card2 = conf_standings[team_c];}
+ 	   else if (nfc == 2 && (iyear >= 90 || iyear <=70)) 
+ 	     {nfc++; nfc_wild_card3 = conf_standings[team_c];}
+ 	} else {
+ 	  if (!(a_champ(conf_standings[team_c])))
+ 	  if (afc == 0) {afc++; afc_wild_card1 = conf_standings[team_c];}
+ 	  else if (afc == 1) {afc++; afc_wild_card2 = conf_standings[team_c];}
+ 	  else if (afc == 2 && (iyear >= 90 || iyear <= 70)) 
+ 	    {afc++; afc_wild_card3 = conf_standings[team_c];}
+ 	}
+       }
+ }
+ 
+ void sort_all(void) 
+ {
+   sort(team_info,standing_lt,1,NUM_TEAMS,standings);
+   break_ties(team_info,standings,DIVISION,NO);
+   sort(team_info,conf_standing_lt,1,NUM_TEAMS,conf_standings);
+   break_ties(team_info,conf_standings,CONFERENCE,NO);
+   sort(team_info,absolute_standing_lt,1,NUM_TEAMS,abs_standings);
+   break_ties(team_info,abs_standings,NFL_0,NO); 
+   sort(team_info,defence_lt,1,NUM_TEAMS,defence_ranks);
+   sort(team_info,defence_nfl_lt,1,NUM_TEAMS,defence_ranks_nfl);
+   sort(team_info,offence_lt,1,NUM_TEAMS,offence_ranks);
+   sort(team_info,offence_nfl_lt,1,NUM_TEAMS,offence_ranks_nfl);
+   sort(team_info,net_lt,1,NUM_TEAMS,net_ranks);
+   sort(team_info,net_nfl_lt,1,NUM_TEAMS,net_ranks_nfl);
+ }


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/football/sort.h
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/football/sort.h:1.1
*** /dev/null	Tue Oct  5 16:05:47 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/football/sort.h	Tue Oct  5 16:05:36 2004
***************
*** 0 ****
--- 1,5 ----
+ extern BOOL standing_lt(TEAMS_STATS info,int team1,int team2);
+ extern BOOL defence_lt(TEAMS_STATS info,int team1,int team2);
+ extern BOOL defence_nfl_lt(TEAMS_STATS info,int team1,int team2);
+ extern void sort_all(void);
+ extern void break_ties(TEAMS_STATS info,ORDERING rank,int within,BOOL display);


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/football/stats


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/football/stats.c
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/football/stats.c:1.1
*** /dev/null	Tue Oct  5 16:05:48 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/football/stats.c	Tue Oct  5 16:05:37 2004
***************
*** 0 ****
--- 1,488 ----
+ /* %%%%%%%%%%%%%%%%%%%% (c) William Landi 1991 %%%%%%%%%%%%%%%%%%%%%%%%%%%% */
+ /* Permission to use this code is granted as long as the copyright */
+ /* notice remains in place. */
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include "definitions.h"
+ #include "io.h"
+ #include "sort.h"
+ 
+ #define MAX_FILE_NAME_LEN 100
+ 
+ extern char *strcat(char *s1, const char *s2);
+ 
+ BOOL preseason = NO;
+ int num_games;
+ 
+ BOOL terminate = NO;
+ 
+ FILE *schedule;
+ #define SCHED_0 "data/sched.19"
+ char inp_sched[MAX_FILE_NAME_LEN+1];
+ 
+ FILE *the_scores;
+ #define SCORE_0 "data/scores.19"
+ char input_score[MAX_FILE_NAME_LEN+1];
+ 
+ SCHED_TYPE sched;
+ SCORES_TYPE scores;
+ TEAMS_STATS team_info,team_info_wi_conf,team_info_wi_div;
+ BOOL team_plays[NUM_TEAMS+1][NUM_TEAMS+1];
+ H_TO_H_STATS h_to_h_stats;
+ 
+ BOOL current_with_disk;
+ 
+ TEAM_TYPE team= {{"error","   "},
+                        {"min","Minnesota"},
+ 		       {"atl","Atlanta"},
+ 		       {"chi","Chicago"},
+ 		       {"dal","Dallas"},
+ 		       {"det","Detroit"},
+ 		       {"gb","Green Bay"},
+ 		       {"ram","L.A. Rams"},
+ 		       {"no","New Orleans"},
+ 		       {"gia","N.Y. Giants"},
+ 		       {"phi","Philadelphia"},
+ 		       {"pho","Phoenix"},
+ 		       {"sf","San Francisco"},
+ 		       {"tb","Tampa Bay"},
+ 		       {"was","Washington"},
+ 		       {"buf","Buffalo"},
+ 		       {"cin","Cincinnati"},
+ 		       {"cle","Cleveland"},
+ 		       {"den","Denver"},
+ 		       {"hou","Houston"},
+ 		       {"ind","Indianapolis"},
+ 		       {"kc","Kansas City"},
+ 		       {"rai","L.A. Raiders"},
+ 		       {"mia","Miami"},
+ 		       {"ne","New England"},
+ 		       {"jet","N.Y. Jets"},
+ 		       {"pit","Pittsburgh"},
+ 		       {"sd","San Diego"},
+ 		       {"sea","Seattle"},
+ 		       {"none","None"}};
+ 
+ DIVISION_TYPE divisions = {{0,0}, {NFC_0,CENTRAL_0}, {NFC_0,WEST_0},
+ 		 {NFC_0,CENTRAL_0}, {NFC_0,EAST_0}, {NFC_0,CENTRAL_0},
+ 		 {NFC_0,CENTRAL_0}, {NFC_0,WEST_0}, {NFC_0,WEST_0},
+  		 {NFC_0,EAST_0}, {NFC_0,EAST_0}, {NFC_0,EAST_0},
+ 		 {NFC_0,WEST_0}, {NFC_0,CENTRAL_0}, {NFC_0,EAST_0},
+ 		 {AFC_0,EAST_0}, {AFC_0,CENTRAL_0}, {AFC_0,CENTRAL_0},
+ 		 {AFC_0,WEST_0}, {AFC_0,CENTRAL_0}, {AFC_0,EAST_0},
+ 		 {AFC_0,WEST_0}, {AFC_0,WEST_0}, {AFC_0,EAST_0},
+   	         {AFC_0,EAST_0}, {AFC_0,EAST_0}, {AFC_0,CENTRAL_0},
+ 		 {AFC_0,WEST_0}, {AFC_0,WEST_0}};
+ 
+ ORDERING standings,conf_standings,abs_standings;
+ ORDERING defence_ranks,defence_ranks_nfl;
+ ORDERING offence_ranks,offence_ranks_nfl;
+ ORDERING net_ranks,net_ranks_nfl;
+ 
+ TEAM nfc_east_champ, nfc_central_champ, nfc_west_champ;
+ TEAM afc_east_champ, afc_central_champ, afc_west_champ;
+ TEAM nfc_wild_card1, nfc_wild_card2,nfc_wild_card3;
+ TEAM afc_wild_card1, afc_wild_card2,afc_wild_card3;
+ 
+ int iyear;
+ 
+ BOOL a_wild_card(TEAM team)
+ {
+   return (team == nfc_wild_card1 || team == nfc_wild_card2 ||
+ 	  team == nfc_wild_card3 || team == afc_wild_card1 ||
+ 	  team == afc_wild_card2 || team == afc_wild_card3);
+ }
+ 
+ BOOL a_champ(TEAM team)
+ {
+   return (team == nfc_east_champ || team == nfc_central_champ || 
+ 	  team == nfc_west_champ || team == afc_east_champ ||
+ 	  team == afc_central_champ || team == afc_west_champ);
+ }
+ 
+ int find_name(FILE *output,char name[])
+ {
+   int i;
+   char full_name[MAX_NAME_LENGTH];
+ 
+   for (i = 1;i<=NUM_TEAMS+1;i++) {
+     (void) strcpy(full_name,team[i][FULL_NAME_0]);
+     lower_case(full_name);
+     if (! strcmp(team[i][ABBR_0],name) || !strcmp(full_name,name)) 
+       return i;
+   }
+  (void) fprintf(output,"No such team %s\n",name);
+   return 0;
+ }
+ 
+ void compute_team_info(void) 
+ {
+   int week,game,team,i;
+ 
+   for (team=1;team<=NUM_TEAMS; team++)
+     for (i=1;i<=NUM_TEAMS;i++)
+       team_plays[team][i] = 0;
+ 
+   for (team=1;team<=NUM_TEAMS; team++) {
+     team_info[team].wins = team_info[team].loses = team_info[team].ties = 0;
+     team_info[team].points_for = team_info[team].points_against = 0;
+ 
+     team_info_wi_conf[team].wins = 0;
+     team_info_wi_conf[team].loses = 0;
+     team_info_wi_conf[team].ties = 0;
+     team_info_wi_conf[team].points_for = 0;
+     team_info_wi_conf[team].points_against = 0;
+ 
+     team_info_wi_div[team].wins = 0;
+     team_info_wi_div[team].loses = 0;
+     team_info_wi_div[team].ties = 0;
+     team_info_wi_div[team].points_for = 0;
+     team_info_wi_div[team].points_against = 0;
+ 
+     for (i=1;i<=NUM_TEAMS; i++) {
+       h_to_h_stats[team][i].wins = h_to_h_stats[team][i].loses =
+ 	h_to_h_stats[team][i].ties = h_to_h_stats[team][i].points_for =
+ 	  h_to_h_stats[team][i].points_against = 0;
+     }
+   }
+ 
+   for (week=1;week<=num_games; week++) 
+     for (game=1;game<=NUM_TEAMS/2; game++) {  
+       team_plays[sched[week][game][HOST]][sched[week][game][VISITOR]] = YES;
+       team_plays[sched[week][game][VISITOR]][sched[week][game][HOST]] = YES;
+       if (scores[week][game][HOST] >= 0 && scores[week][game][VISITOR] >=0) {
+ 
+ 	h_to_h_stats[sched[week][game][HOST]]
+ 	  [sched[week][game][VISITOR]].points_for += scores[week][game][HOST];
+ 	h_to_h_stats[sched[week][game][HOST]]
+ 	  [sched[week][game][VISITOR]].points_against += 
+ 	    scores[week][game][VISITOR];
+ 	h_to_h_stats[sched[week][game][VISITOR]]
+ 	  [sched[week][game][HOST]].points_for += scores[week][game][VISITOR];
+ 	h_to_h_stats[sched[week][game][VISITOR]]
+ 	  [sched[week][game][HOST]].points_against += 
+ 	    scores[week][game][HOST];
+ 
+ 	if (scores[week][game][HOST] < scores[week][game][VISITOR]) {
+ 	  team_info[sched[week][game][HOST]].loses ++;
+ 	  team_info[sched[week][game][VISITOR]].wins ++;
+ 
+ 	  h_to_h_stats[sched[week][game][HOST]]
+ 	    [sched[week][game][VISITOR]].loses ++;
+ 	  h_to_h_stats[sched[week][game][VISITOR]]
+ 	    [sched[week][game][HOST]].wins ++;
+ 
+ 	  if (divisions[sched[week][game][HOST]][CONFERENCE] ==
+ 	      divisions[sched[week][game][VISITOR]][CONFERENCE]) {
+ 	    team_info_wi_conf[sched[week][game][HOST]].loses ++;
+ 	    team_info_wi_conf[sched[week][game][VISITOR]].wins ++;
+ 	    if (divisions[sched[week][game][HOST]][DIVISION] ==
+ 		divisions[sched[week][game][VISITOR]][DIVISION]) {
+ 	      team_info_wi_div[sched[week][game][HOST]].loses ++;
+ 	      team_info_wi_div[sched[week][game][VISITOR]].wins ++;
+ 	    }
+ 	  }
+ 	}
+ 	else
+ 	if (scores[week][game][HOST] > scores[week][game][VISITOR]) {
+ 	  team_info[sched[week][game][HOST]].wins ++;
+ 	  team_info[sched[week][game][VISITOR]].loses ++;
+ 
+ 	  h_to_h_stats[sched[week][game][HOST]]
+ 	    [sched[week][game][VISITOR]].wins ++;
+ 	  h_to_h_stats[sched[week][game][VISITOR]]
+ 	    [sched[week][game][HOST]].loses ++;
+ 
+ 	  if (divisions[sched[week][game][HOST]][CONFERENCE] ==
+ 	      divisions[sched[week][game][VISITOR]][CONFERENCE]) {
+ 	    team_info_wi_conf[sched[week][game][HOST]].wins ++;
+ 	    team_info_wi_conf[sched[week][game][VISITOR]].loses ++;
+ 
+ 	    if (divisions[sched[week][game][HOST]][DIVISION] ==
+ 		divisions[sched[week][game][VISITOR]][DIVISION]) {
+ 	      team_info_wi_div[sched[week][game][HOST]].wins ++;
+ 	      team_info_wi_div[sched[week][game][VISITOR]].loses ++;
+ 	    }
+ 	  }
+ 	}
+ 	else {
+ 	  team_info[sched[week][game][HOST]].ties ++;
+ 	  team_info[sched[week][game][VISITOR]].ties ++;
+ 
+ 	  h_to_h_stats[sched[week][game][HOST]]
+ 	    [sched[week][game][VISITOR]].ties ++;
+ 	  h_to_h_stats[sched[week][game][VISITOR]]
+ 	    [sched[week][game][HOST]].ties ++;
+ 
+ 	  if (divisions[sched[week][game][HOST]][CONFERENCE] ==
+ 	      divisions[sched[week][game][VISITOR]][CONFERENCE]) {
+ 	    team_info_wi_conf[sched[week][game][HOST]].ties ++;
+ 	    team_info_wi_conf[sched[week][game][VISITOR]].ties ++;
+ 
+ 	    if (divisions[sched[week][game][HOST]][DIVISION] ==
+ 		divisions[sched[week][game][VISITOR]][DIVISION]) {
+ 	      team_info_wi_div[sched[week][game][HOST]].ties ++;
+ 	      team_info_wi_div[sched[week][game][VISITOR]].ties ++;
+ 	    }
+ 	  }
+ 	}
+ 	team_info[sched[week][game][HOST]].points_for +=
+ 	  scores[week][game][HOST];
+ 	team_info[sched[week][game][HOST]].points_against +=
+ 	  scores[week][game][VISITOR];
+ 	team_info[sched[week][game][VISITOR]].points_for +=
+ 	  scores[week][game][VISITOR];
+ 	team_info[sched[week][game][VISITOR]].points_against +=
+ 	  scores[week][game][HOST];
+ 
+ 	if (divisions[sched[week][game][HOST]][CONFERENCE] ==
+ 	    divisions[sched[week][game][VISITOR]][CONFERENCE]) {
+ 	  team_info_wi_conf[sched[week][game][HOST]].points_for +=
+ 	    scores[week][game][HOST];
+ 	  team_info_wi_conf[sched[week][game][HOST]].points_against +=
+ 	    scores[week][game][VISITOR];
+ 	  team_info_wi_conf[sched[week][game][VISITOR]].points_for +=
+ 	    scores[week][game][VISITOR];
+ 	  team_info_wi_conf[sched[week][game][VISITOR]].points_against +=
+ 	    scores[week][game][HOST];
+ 
+ 	  if (divisions[sched[week][game][HOST]][DIVISION] ==
+ 	      divisions[sched[week][game][VISITOR]][DIVISION]) {
+ 	    team_info_wi_div[sched[week][game][HOST]].points_for +=
+ 	      scores[week][game][HOST];
+ 	    team_info_wi_div[sched[week][game][HOST]].points_against +=
+ 	      scores[week][game][VISITOR];
+ 	    team_info_wi_div[sched[week][game][VISITOR]].points_for +=
+ 	      scores[week][game][VISITOR];
+ 	    team_info_wi_div[sched[week][game][VISITOR]].points_against +=
+ 	      scores[week][game][HOST];
+ 	  }
+ 	}
+       }
+     }
+ }
+ 
+ void read_sched_into(FILE *STREAM,SCHED_TYPE sched)
+ {
+   BOOL error;
+   int num_seen[NUM_GAMES+1];
+   int team_code,week_num,temp;
+   int AWAY,HOME,TEAM_FIELD,opponent,OPPON_FIELD,find_game;
+   char CH;
+   char str[10];
+ 
+   error = NO;
+   for (week_num=1;week_num<=num_games;week_num++)
+     num_seen[week_num] = 1;
+ 
+   for (team_code=1;team_code<=NUM_TEAMS;team_code++) {
+     for (week_num=1;week_num<=num_games;week_num++) {
+       CH = (char) getc(STREAM);
+       while (white_space(CH)) CH = (char) getc(STREAM);
+       temp = 0;
+       while (!(white_space(CH))) {
+ 	str[temp] = CH;
+ 	temp ++;
+ 	CH = (char) getc(STREAM);
+       }
+       str[temp] = 0;
+       if (str[0] != '@') {
+ 	HOME = team_code;
+ 	TEAM_FIELD = HOST;
+ 	OPPON_FIELD = VISITOR;
+ 	AWAY = opponent = find_name(stderr,str);
+       }
+       else {
+ 	AWAY = team_code;
+ 	TEAM_FIELD = VISITOR;
+ 	OPPON_FIELD = HOST;
+ 	HOME = opponent = find_name(stderr,str+1);
+       }
+       if (opponent < team_code) /* already read in opponents information */
+       {
+ 	for (find_game = 1; find_game<=num_seen[week_num]-1;find_game++) {
+ 	  if (sched[week_num][find_game][TEAM_FIELD] == team_code) {
+ 	    if (sched[week_num][find_game][OPPON_FIELD] != opponent) {
+ 	      (void) printf("Error in opponent for %s(%d). Expected %s(%d), Found %s(%d). Week #%d\n"
+ 			    ,team[team_code][FULL_NAME_0], team_code,
+ 			    team[sched[week_num][find_game][OPPON_FIELD]][FULL_NAME_0],
+ 			    sched[week_num][find_game][OPPON_FIELD],
+ 			    team[opponent][FULL_NAME_0],opponent,week_num);
+ 	      error = YES;
+ 	    }
+ 	    find_game = num_seen[week_num] + 2;
+ 	  }
+ 	}
+ 	if (find_game == num_seen[week_num]) {
+ 	  (void) printf("%s(%d) not found yet: team: %s(%d); week# %d; opp. str: %s\n", 
+ 		 team[opponent][FULL_NAME_0],opponent,team[team_code][FULL_NAME_0],
+ 		 team_code,week_num,str);
+ 	  error = YES;
+ 	}
+       }
+       else if (opponent != NUM_TEAMS + 1) {
+ 	int first_time;
+ 
+ 	first_time = 0;
+ 	for (find_game = 1; find_game<=num_seen[week_num]-1;find_game++) {
+ 	  if (sched[week_num][find_game][VISITOR] == team_code)
+ 	    	    first_time = sched[week_num][find_game][HOST];
+ 	  if (sched[week_num][find_game][HOST] == team_code)
+ 	    	    first_time = sched[week_num][find_game][VISITOR];
+ 	}
+ 	if (first_time) {
+ 	  (void) printf("%s(%d) has opponent %s(%d), but wants %s(%d); \n          week# %d\n",
+ 			team[team_code][FULL_NAME_0],team_code,
+ 			team[first_time][FULL_NAME_0],first_time,
+ 			team[opponent][FULL_NAME_0],opponent,week_num);
+ 	  error = YES;
+ 	} 
+ 	else if ( num_seen[week_num] > NUM_TEAMS/2) {
+ 	  (void) printf("ERROR: Week %d, to many games seen.\n",week_num);
+ 	  error = YES;
+ 	} else {
+ 	  sched[week_num][num_seen[week_num]][VISITOR] = AWAY;
+ 	  sched[week_num][num_seen[week_num]][HOST] = HOME;
+ 	  num_seen[week_num] ++;
+ 	}
+       }
+     }
+   }
+ 
+ if (error) exit(1);
+ }
+ 
+ void save_scores (FILE *msg_stream,char *file_name)
+ {
+   int game,week;
+   FILE *OUTPUT;
+ 
+   if (!(OUTPUT = fopen(file_name,"w"))) {
+     (void) fprintf(msg_stream,"Can not write to %s. Not saved.\n",file_name);
+   } else {
+     for (week=1;week<=num_games+1; week++) {
+       for (game=1;game<=NUM_TEAMS/2; game++) {
+ 	(void) fprintf(OUTPUT," %d %d",scores[week][game][HOST],
+ 		      scores[week][game][VISITOR]); 
+       }
+       (void) fprintf(OUTPUT,"\n");
+     }
+     (void) fclose(the_scores);
+     (void) fprintf(msg_stream,"Saved in %s.\n",file_name);
+     current_with_disk = YES;
+   }
+ }
+ 
+ int in_fileP = 0;
+ 
+ int main(int argc, char *argv[])
+ {
+   BOOL argument_error = NO;
+   char *year;
+   FILE *in_file;
+ 
+   {int i;
+    for (i=1;i<=NUM_TEAMS;i++) {
+      standings[i]=i;
+      conf_standings[i]=abs_standings[i]=i;
+      defence_ranks[i]=defence_ranks_nfl[i]=i;
+      offence_ranks[i]=offence_ranks_nfl[i]=i;
+      net_ranks[i]=net_ranks_nfl[i]=i;
+    }
+  }
+ 
+   if (argc < 2) argument_error = YES;
+   else if (!strcmp(argv[1],"-p")) {
+       if (argc > 4) argument_error = YES;
+       preseason=YES;
+       year = argv[2];
+       iyear = str_to_int(year);
+       num_games = NUM_PRESEASON_GAMES;
+       if (argc == 4) in_fileP = 3;
+   }
+   else if (argc <= 3) {
+       year = argv[1];
+       iyear = str_to_int(year);
+       num_games = ( ((iyear >=78) && (iyear <= 89)) ? 
+ 		   NUM_GAMES_78_89 : NUM_GAMES);
+       if (argc == 3) in_fileP = 2;
+   }
+   else argument_error = YES;
+ 
+   if (argument_error) {
+     (void) fprintf(stderr,"Usage: stats [-p] <yy> [input-file]\n   <yy> is 2 digit year code.\n");
+     exit(1);
+   }
+ 
+   if (iyear <= 87) {
+     (void) strcpy(team[11][0],"sl");
+     (void) strcpy(team[11][1],"St. Louis");
+   }
+ 
+   (void) strcpy(inp_sched,SCHED_0);
+   (void) strcat(inp_sched,year);
+ 
+ if (preseason)
+   (void) strcat(inp_sched,".pre");
+ 
+   if (! (schedule = fopen(inp_sched,"r"))) {
+     (void) fprintf(stderr,"ERROR: Can not open %s.\n",inp_sched);
+     exit(1);
+   }
+ 
+   read_sched_into(schedule,sched);
+   (void) fclose(schedule);
+ 
+   if (in_fileP) {
+       in_file = fopen(argv[in_fileP],"r");
+       if (!in_file) {
+ 	  (void) fprintf(stderr,"ERROR: Can not open input file %s.\n",
+ 			 argv[in_fileP]);
+ 	  exit(1);
+       }
+   }
+ 
+   (void) strcpy(input_score,SCORE_0);
+   (void) strcat(input_score,year);
+ 
+ if (preseason)
+   (void) strcat(input_score,".pre");
+ 
+   if (! (the_scores = fopen(input_score,"r"))) {
+     int game,week;
+ 
+     for (week=1;week<=num_games+1; week++) 
+       for (game=1;game<=NUM_TEAMS/2; game++) {
+ 	scores[week][game][HOST] = -1;
+ 	scores[week][game][VISITOR] = -1;
+       }
+     (void) fprintf(stderr,"No score file. Creating one.\n");
+     save_scores (stdout,input_score); 
+     current_with_disk = NO;
+   } else {
+     int game,week;
+ 
+     for (week=1;week<=num_games+1; week++) 
+       for (game=1;game<=NUM_TEAMS/2; game++) {
+ 	if (feof(the_scores)) {
+ 	  (void) fprintf(stderr,"ERROR: %s is not a legally formated score file.\n",input_score);
+ 	  exit(1);
+ 	}
+ 	(void) fscanf(the_scores,"%d %d",&(scores[week][game][HOST]),
+ 		      &(scores[week][game][VISITOR]));
+       }
+     (void) fclose(the_scores);
+     current_with_disk = YES;
+   }
+   compute_team_info ();
+   sort_all ();
+ 
+   while ( !terminate ) {
+       if (in_fileP)
+ 	  display_main_menu(stdout,in_file);
+       else display_main_menu(stdout,stdin);
+   }
+   if (in_fileP) (void) fclose(in_file);
+   return 0;
+ }


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/football/stats.h
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/football/stats.h:1.1
*** /dev/null	Tue Oct  5 16:05:48 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/football/stats.h	Tue Oct  5 16:05:37 2004
***************
*** 0 ****
--- 1,27 ----
+ extern BOOL terminate;
+ extern int num_games;
+ extern int iyear;
+ extern BOOL a_wild_card(TEAM team);
+ extern BOOL a_champ(TEAM team);
+ extern int find_name(FILE *output,char name[]);
+ extern BOOL current_with_disk;
+ extern void save_scores(FILE *msg_stream,char *file_name);
+ extern char input_score[];
+ extern SCHED_TYPE sched;
+ extern SCORES_TYPE scores;
+ extern TEAM_TYPE team;
+ extern void compute_team_info(void);
+ extern TEAMS_STATS team_info,team_info_wi_conf,team_info_wi_div;
+ extern ORDERING standings,conf_standings,abs_standings;
+ extern ORDERING defence_ranks,defence_ranks_nfl;
+ extern ORDERING offence_ranks,offence_ranks_nfl;
+ extern ORDERING net_ranks,net_ranks_nfl;
+ extern DIVISION_TYPE divisions;
+ 
+ extern TEAM nfc_east_champ, nfc_central_champ, nfc_west_champ;
+ extern TEAM afc_east_champ, afc_central_champ, afc_west_champ;
+ extern TEAM nfc_wild_card1, nfc_wild_card2,nfc_wild_card3;
+ extern TEAM afc_wild_card1, afc_wild_card2,afc_wild_card3;
+ 
+ extern BOOL team_plays[NUM_TEAMS+1][NUM_TEAMS+1];
+ extern H_TO_H_STATS h_to_h_stats;






More information about the llvm-commits mailing list