static char rcsid[] = "$Id: test1.c,v 1.3 1999/07/22 06:12:36 msato Exp $";
/* 
 * $RWC_Release: Omni-1.6 $
 * $RWC_Copyright:
 *  Omni Compiler Software Version 1.5-1.6
 *  Copyright (C) 2002 PC Cluster Consortium
 *  
 *  This software is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License version
 *  2.1 published by the Free Software Foundation.
 *  
 *  Omni Compiler Software Version 1.0-1.4
 *  Copyright (C) 1999, 2000, 2001.
 *   Tsukuba Research Center, Real World Computing Partnership, Japan.
 *  
 *  Please check the Copyright and License information in the files named
 *  COPYRIGHT and LICENSE under the top  directory of the Omni Compiler
 *  Software release kit.
 *  
 *  
 *  $
 */
/* original code:
int a[100];

main()
{
    int s,s1,s2,i;
    int n; int *p;

    n = 100;
    for(i = 0; i < n; i++) a[i] = i;
    s1 = 0;
    for(i = 0; i < n; i++) s1 += a[i];

    s2 = 0;
#pragma OMP parallel private(s)
    {
	s = 0;
#pragma OMP for 
	for(i = 0; i < n; i++) s += a[i];
#pramga OMP barrier
	printf("id = %d, s=%d\n",omp_get_thread_num(),s);
#pragma OMP atomic
	s2 += s;
    }
    printf("exit s1=%d, s2=%d ...\n",s1,s2);
}
*/

/* compiled code */
/* decompile from '<stdin>' */
int _ompc_default_sched();
int _ompc_barrier();
static int _p_alock_5;
int _ompc_atomic_lock();
int _ompc_atomic_unlock();
static void __ompc_func_6();
int _ompc_do_parallel();
void _ompc_main();
int a[100];
void __ompc_func_6(__ompc_args)
void **__ompc_args;
{
auto int _p_s;
auto int *_pp_n;
auto int *_pp_s2;
(_pp_n)=(((int *)*((__ompc_args)+(0))));
(_pp_s2)=(((int *)*((__ompc_args)+(1))));
{
(_p_s)=(0);
{
auto int _p_i;
auto int _p_i_0;
auto int _p_i_1;
auto int _p_i_2;
(_p_i_0)=(0);
(_p_i_1)=(*_pp_n);
(_p_i_2)=(1);
_ompc_default_sched(&_p_i_0,&_p_i_1,&_p_i_2);
for((_p_i)=(_p_i_0);(_p_i)<(_p_i_1);(_p_i)+=(_p_i_2)){
(_p_s)+=(*((a)+(_p_i)));
}
_ompc_barrier();
}
printf("id = %d, s=%d\n",omp_get_thread_num(),_p_s);
{
auto int t_3;
auto int *t_4;
(t_3)=(_p_s);
(t_4)=(&(*_pp_s2));
_ompc_atomic_lock(&_p_alock_5);
(*t_4)+=(t_3);
_ompc_atomic_unlock(&_p_alock_5);
}
}
}
void _ompc_main()
{
auto int s;
auto int s1;
auto int s2;
auto int i;
auto int n;
auto int *p;
(n)=(100);
for((i)=(0);(i)<(n);(i)++){
(*((a)+(i)))=(i);
}
(s1)=(0);
for((i)=(0);(i)<(n);(i)++){
(s1)+=(*((a)+(i)));
}
(s2)=(0);
{
auto void *__ompc_argv[2];
(*((__ompc_argv)+(0)))=(((void *)&n));
(*((__ompc_argv)+(1)))=(((void *)&s2));
_ompc_do_parallel(__ompc_func_6,__ompc_argv);
}
printf("exit s1=%d, s2=%d ...\n",s1,s2);
}
