#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double atan(double);
double omp_get_wtime();
int /*<<< orphan*/ printf(char *, ...);
double sin(double const);
int sor(double **, double **, double **, double const, double const, int const);
int main(void) {
  const int m = 100;
  double unew[100 + 2][100 + 2] = {{0}};
  double solution[100 + 2][100 + 2] = {{0}};
  double uold[100 + 2][100 + 2] = {{0}};
  int i, j;
  const double begin = omp_get_wtime();
  const double pi = 4.0 * atan(1.0);
  const double h = pi / (m + 1);
  for (i = 0; i < m + 2; ++i) {
    uold[i][100 + 1] = sin(i * h);
  }
  for (i = 0; i < m + 2; ++i) {
    for (j = 0; j < m + 1; ++j) {
      uold[i][j] = j * h * uold[i][100 + 1];
    }
  }
  const double omega = 2.0 / (1.0 + sin(pi / (m + 1)));
  const double tol = 0.001;
  const int iters = sor(unew, uold, solution, omega, tol, m);
  const double end = omp_get_wtime();
  printf(" \n");
  printf(" Omega = %f\n", omega);
  printf(" It took %d iterations.\n", iters);
  printf("Total time = %f\n\n\n", end - begin);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3cfb0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
lea    -0x14530(%rbp),%rdi
xor    %esi,%esi
mov    $0x14520,%edx
call   1050 <memset@plt>
lea    -0x28a50(%rbp),%rdi
xor    %esi,%esi
mov    $0x14520,%edx
call   1050 <memset@plt>
lea    -0x3cf70(%rbp),%rdi
xor    %esi,%esi
mov    $0x14520,%edx
call   1050 <memset@plt>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x3cf80(%rbp)
ff
movsd  0xe47(%rip),%xmm0
call   1070 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xe2f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x3cf88(%rbp)
ff
movsd  -0x3cf88(%rbp),%xmm0
ff
movsd  0xe0b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x3cf90(%rbp)
movl   $0x0,-0x3cf74(%rbp)
cmpl   $0x66,-0x3cf74(%rbp)
jge    1261 <main+0x101>
cvtsi2sdl -0x3cf74(%rbp),%xmm0
ff
mulsd  -0x3cf90(%rbp),%xmm0
ff
call   1060 <sin@plt>
movslq -0x3cf74(%rbp),%rcx
lea    -0x3cf70(%rbp),%rax
imul   $0x330,%rcx,%rcx
add    %rcx,%rax
movsd  %xmm0,0x328(%rax)
mov    -0x3cf74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3cf74(%rbp)
jmp    120b <main+0xab>
movl   $0x0,-0x3cf74(%rbp)
cmpl   $0x66,-0x3cf74(%rbp)
jge    1310 <main+0x1b0>
movl   $0x0,-0x3cf78(%rbp)
cmpl   $0x65,-0x3cf78(%rbp)
jge    12f7 <main+0x197>
cvtsi2sdl -0x3cf78(%rbp),%xmm0
ff
mulsd  -0x3cf90(%rbp),%xmm0
ff
movslq -0x3cf74(%rbp),%rcx
lea    -0x3cf70(%rbp),%rax
imul   $0x330,%rcx,%rcx
add    %rcx,%rax
mulsd  0x328(%rax),%xmm0
movslq -0x3cf74(%rbp),%rcx
lea    -0x3cf70(%rbp),%rax
imul   $0x330,%rcx,%rcx
add    %rcx,%rax
movslq -0x3cf78(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3cf78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3cf78(%rbp)
jmp    1282 <main+0x122>
jmp    12fc <main+0x19c>
mov    -0x3cf74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3cf74(%rbp)
jmp    126b <main+0x10b>
movsd  -0x3cf88(%rbp),%xmm0
ff
movsd  0xce0(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <sin@plt>
movsd  0xcdf(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xce3(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x3cf98(%rbp)
ff
movsd  0xcc7(%rip),%xmm0
movsd  %xmm0,-0x3cfa0(%rbp)
ff
lea    -0x14530(%rbp),%rdi
lea    -0x3cf70(%rbp),%rsi
lea    -0x28a50(%rbp),%rdx
movsd  -0x3cf98(%rbp),%xmm0
ff
movsd  0xc9a(%rip),%xmm1
mov    $0x64,%ecx
call   1080 <sor@plt>
mov    %eax,-0x3cfa4(%rbp)
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x3cfb0(%rbp)
ff
lea    0xc84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x3cf98(%rbp),%xmm0
ff
lea    0xc71(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x3cfa4(%rbp),%esi
lea    0xc6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x3cfb0(%rbp),%xmm0
ff
subsd  -0x3cf80(%rbp),%xmm0
ff
lea    0xc65(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x3cfb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3cf78,%rsp
lea    0x28a50(%rsp),%rdi
xor    %r14d,%r14d
mov    $0x14520,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x14530(%rsp),%rdi
mov    $0x14520,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x10(%rsp),%rdi
mov    $0x14520,%edx
xor    %esi,%esi
call   1060 <memset@plt>
xor    %eax,%eax
call   1040 <omp_get_wtime@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xe35(%rip),%xmm0
call   1080 <atan@plt>
lea    0x998(%rsp),%rbx
movsd  0xe28(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
mulsd  %xmm1,%xmm0
call   1070 <sin@plt>
movsd  %xmm0,-0x660(%rbx)
ff
lea    0x1(%r14),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xdfc(%rip),%xmm0
call   1070 <sin@plt>
movsd  %xmm0,-0x330(%rbx)
ff
lea    0x2(%r14),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xddc(%rip),%xmm0
call   1070 <sin@plt>
movsd  0xdcf(%rip),%xmm1
movsd  %xmm0,(%rbx)
add    $0x3,%r14
add    $0x990,%rbx
cmp    $0x66,%r14
jne    11e0 <main+0x70>
lea    0x18(%rsp),%rax
xor    %ecx,%ecx
jmp    1270 <main+0x100>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rcx
add    $0x330,%rax
cmp    $0x66,%rcx
je     12cc <main+0x15c>
imul   $0x330,%rcx,%rdx
add    %rsp,%rdx
add    $0x338,%rdx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xorps  %xmm0,%xmm0
cvtsi2sd %esi,%xmm0
mulsd  %xmm1,%xmm0
mulsd  (%rdx),%xmm0
movsd  %xmm0,-0x8(%rax,%rsi,8)
lea    0x1(%rsi),%rdi
cmp    $0x65,%rdi
je     1260 <main+0xf0>
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
mulsd  %xmm1,%xmm0
mulsd  (%rdx),%xmm0
movsd  %xmm0,(%rax,%rsi,8)
add    $0x1,%rdi
mov    %rdi,%rsi
jmp    1290 <main+0x120>
lea    0x28a50(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x14530(%rsp),%rdx
movsd  0xd27(%rip),%xmm0
movsd  0xd27(%rip),%xmm1
mov    $0x64,%ecx
call   1090 <sor@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <omp_get_wtime@plt>
movsd  %xmm0,(%rsp)
lea    0xd49(%rip),%rdi
call   1030 <puts@plt>
lea    0xd04(%rip),%rdi
movsd  0xcec(%rip),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xcfb(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
lea    0xcf9(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x3cf78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c" \0A\00"
@.str.1 = [13 x i8] c" Omega = %f\0A\00"
@.str.2 = [25 x i8] c" It took %d iterations.\0A\00"
@.str.3 = [19 x i8] c"Total time = %f\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [102 x [102 x double]]
%4 = alloca [102 x [102 x double]]
%5 = alloca [102 x [102 x double]]
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca i32
%14 = alloca double
store i32 0, i32* %1
store i32 100, i32* %2
%15 = bitcast [102 x [102 x double]]* %3 to i8*
%16 = bitcast [102 x [102 x double]]* %4 to i8*
%17 = bitcast [102 x [102 x double]]* %5 to i8*
%18 = call double (...) @omp_get_wtime()
store double %18, double* %8
%19 = call double @atan(double 1.000000e+00)
%20 = fmul double 4.000000e+00, %19
store double %20, double* %9
%21 = load double, double* %9
%22 = fdiv double %21, 1.010000e+02
store double %22, double* %10
store i32 0, i32* %6
br label %23
23: ; preds = %36, %0
%24 = load i32, i32* %6
%25 = icmp slt i32 %24, 102
br i1 %25, label %26, label %39
26: ; preds = %23
%27 = load i32, i32* %6
%28 = sitofp i32 %27 to double
%29 = load double, double* %10
%30 = fmul double %28, %29
%31 = call double @sin(double %30)
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [102 x [102 x double]], [102 x [102 x double]]* %5, i64 0, i64 %33
%35 = getelementptr inbounds [102 x double], [102 x double]* %34, i64 0, i64 101
store double %31, double* %35
br label %36
36: ; preds = %26
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %23
39: ; preds = %23
store i32 0, i32* %6
br label %40
40: ; preds = %68, %39
%41 = load i32, i32* %6
%42 = icmp slt i32 %41, 102
br i1 %42, label %43, label %71
43: ; preds = %40
store i32 0, i32* %7
br label %44
44: ; preds = %64, %43
%45 = load i32, i32* %7
%46 = icmp slt i32 %45, 101
br i1 %46, label %47, label %67
47: ; preds = %44
%48 = load i32, i32* %7
%49 = sitofp i32 %48 to double
%50 = load double, double* %10
%51 = fmul double %49, %50
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [102 x [102 x double]], [102 x [102 x double]]* %5, i64 0, i64 %53
%55 = getelementptr inbounds [102 x double], [102 x double]* %54, i64 0, i64 101
%56 = load double, double* %55
%57 = fmul double %51, %56
%58 = load i32, i32* %6
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [102 x [102 x double]], [102 x [102 x double]]* %5, i64 0, i64 %59
%61 = load i32, i32* %7
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [102 x double], [102 x double]* %60, i64 0, i64 %62
store double %57, double* %63
br label %64
64: ; preds = %47
%65 = load i32, i32* %7
%66 = add nsw i32 %65, 1
store i32 %66, i32* %7
br label %44
67: ; preds = %44
br label %68
68: ; preds = %67
%69 = load i32, i32* %6
%70 = add nsw i32 %69, 1
store i32 %70, i32* %6
br label %40
71: ; preds = %40
%72 = load double, double* %9
%73 = fdiv double %72, 1.010000e+02
%74 = call double @sin(double %73)
%75 = fadd double 1.000000e+00, %74
%76 = fdiv double 2.000000e+00, %75
store double %76, double* %11
store double 1.000000e-03, double* %12
%77 = getelementptr inbounds [102 x [102 x double]], [102 x [102 x double]]* %3, i64 0, i64 0
%78 = bitcast [102 x double]* %77 to double**
%79 = getelementptr inbounds [102 x [102 x double]], [102 x [102 x double]]* %5, i64 0, i64 0
%80 = bitcast [102 x double]* %79 to double**
%81 = getelementptr inbounds [102 x [102 x double]], [102 x [102 x double]]* %4, i64 0, i64 0
%82 = bitcast [102 x double]* %81 to double**
%83 = load double, double* %11
%84 = call i32 @sor(double** %78, double** %80, double** %82, double %83, double 1.000000e-03, i32 100)
store i32 %84, i32* %13
%85 = call double (...) @omp_get_wtime()
store double %85, double* %14
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%87 = load double, double* %11
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %87)
%89 = load i32, i32* %13
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %89)
%91 = load double, double* %14
%92 = load double, double* %8
%93 = fsub double %91, %92
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %93)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c" Omega = %f\0A\00"
@.str.2 = [25 x i8] c" It took %d iterations.\0A\00"
@.str.3 = [19 x i8] c"Total time = %f\0A\0A\0A\00"
@str = [2 x i8] c" \00"
define i32 @main() {
%1 = alloca [102 x [102 x double]]
%2 = alloca [102 x [102 x double]]
%3 = alloca [102 x [102 x double]]
%4 = bitcast [102 x [102 x double]]* %1 to i8*
%5 = bitcast [102 x [102 x double]]* %2 to i8*
%6 = bitcast [102 x [102 x double]]* %3 to i8*
%7 = tail call double (...) @omp_get_wtime()
%8 = tail call double @atan(double 1.000000e+00)
br label %9
9: ; preds = %9, %0
%10 = phi i64 [ 0, %0 ], [ %28, %9 ]
%11 = trunc i64 %10 to i32
%12 = sitofp i32 %11 to double
%13 = fmul double %12, 0x3F9FD9F502DF45D2
%14 = tail call double @sin(double %13)
%15 = getelementptr inbounds [102 x [102 x double]], [102 x [102 x double]]* %3, i64 0, i64 %10, i64 101
store double %14, double* %15
%16 = add nuw nsw i64 %10, 1
%17 = trunc i64 %16 to i32
%18 = sitofp i32 %17 to double
%19 = fmul double %18, 0x3F9FD9F502DF45D2
%20 = tail call double @sin(double %19)
%21 = getelementptr inbounds [102 x [102 x double]], [102 x [102 x double]]* %3, i64 0, i64 %16, i64 101
store double %20, double* %21
%22 = add nuw nsw i64 %10, 2
%23 = trunc i64 %22 to i32
%24 = sitofp i32 %23 to double
%25 = fmul double %24, 0x3F9FD9F502DF45D2
%26 = tail call double @sin(double %25)
%27 = getelementptr inbounds [102 x [102 x double]], [102 x [102 x double]]* %3, i64 0, i64 %22, i64 101
store double %26, double* %27
%28 = add nuw nsw i64 %10, 3
%29 = icmp eq i64 %28, 102
br i1 %29, label %30, label %9
30: ; preds = %9, %51
%31 = phi i64 [ %52, %51 ], [ 0, %9 ]
%32 = getelementptr inbounds [102 x [102 x double]], [102 x [102 x double]]* %3, i64 0, i64 %31, i64 101
br label %33
33: ; preds = %43, %30
%34 = phi i64 [ 0, %30 ], [ %50, %43 ]
%35 = trunc i64 %34 to i32
%36 = sitofp i32 %35 to double
%37 = fmul double %36, 0x3F9FD9F502DF45D2
%38 = load double, double* %32
%39 = fmul double %37, %38
%40 = getelementptr inbounds [102 x [102 x double]], [102 x [102 x double]]* %3, i64 0, i64 %31, i64 %34
store double %39, double* %40
%41 = or i64 %34, 1
%42 = icmp eq i64 %41, 101
br i1 %42, label %51, label %43
43: ; preds = %33
%44 = trunc i64 %41 to i32
%45 = sitofp i32 %44 to double
%46 = fmul double %45, 0x3F9FD9F502DF45D2
%47 = load double, double* %32
%48 = fmul double %46, %47
%49 = getelementptr inbounds [102 x [102 x double]], [102 x [102 x double]]* %3, i64 0, i64 %31, i64 %41
store double %48, double* %49
%50 = add nuw nsw i64 %34, 2
br label %33
51: ; preds = %33
%52 = add nuw nsw i64 %31, 1
%53 = icmp eq i64 %52, 102
br i1 %53, label %54, label %30
54: ; preds = %51
%55 = bitcast [102 x [102 x double]]* %1 to double**
%56 = bitcast [102 x [102 x double]]* %3 to double**
%57 = bitcast [102 x [102 x double]]* %2 to double**
%58 = call i32 @sor(double** %55, double** %56, double** %57, double 0x3FFF08EA0CFE007E, double 1.000000e-03, i32 100)
%59 = call double (...) @omp_get_wtime()
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double 0x3FFF08EA0CFE007E)
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %58)
%63 = fsub double %59, %7
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %63)
ret i32 0
}