#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 GaussSeidelSeqLoop(double **, int, int, double, int, int, int *);
double GaussSeidelSeqLoopErr(double **, int, int, double, int, int, int *);
double omp_get_wtime();
double GaussSeidel(double **u, int m, int n, int sqrerr, double eps, int maxit,
                   int iterations_print, int *iterations, double *wtime) {
  double err;
  *iterations = 0;
  *wtime = omp_get_wtime();
  if (sqrerr == 0)
    err = GaussSeidelSeqLoop(u, m, n, eps, maxit, iterations_print, iterations);
  else
    err = GaussSeidelSeqLoopErr(u, m, n, eps, maxit, iterations_print,
                                iterations);
  *wtime = omp_get_wtime() - *wtime;
  return err;
}


x86 assembly (clang, -O0):
<GaussSeidel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
cmpl   $0x0,-0x14(%rbp)
jne    11a6 <GaussSeidel+0x76>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movsd  -0x20(%rbp),%xmm0
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    0x10(%rbp),%r9
call   1040 <GaussSeidelSeqLoop@plt>
movsd  %xmm0,-0x30(%rbp)
jmp    11ca <GaussSeidel+0x9a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movsd  -0x20(%rbp),%xmm0
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    0x10(%rbp),%r9
call   1050 <GaussSeidelSeqLoopErr@plt>
movsd  %xmm0,-0x30(%rbp)
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
mov    0x18(%rbp),%rax
subsd  (%rax),%xmm0
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GaussSeidel>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,0x8(%rsp)
mov    %r8d,%r12d
movsd  %xmm0,0x10(%rsp)
mov    %ecx,%r14d
mov    %edx,%r13d
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x58(%rsp),%r15
mov    0x50(%rsp),%rax
movl   $0x0,(%rax)
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,(%r15)
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r13d,%edx
test   %r14d,%r14d
je     119a <GaussSeidel+0x6a>
movsd  0x10(%rsp),%xmm0
mov    %r12d,%ecx
mov    0x8(%rsp),%r8d
mov    0x50(%rsp),%r9
call   1050 <GaussSeidelSeqLoopErr@plt>
jmp    11b2 <GaussSeidel+0x82>
movsd  0x10(%rsp),%xmm0
mov    %r12d,%ecx
mov    0x8(%rsp),%r8d
mov    0x50(%rsp),%r9
call   1040 <GaussSeidelSeqLoop@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
mov    0x58(%rsp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @GaussSeidel(double** %0, i32 %1, i32 %2, i32 %3, double %4, i32 %5, i32 %6, i32* %7, double* %8) {
%10 = alloca double**
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32*
%18 = alloca double*
%19 = alloca double
store double** %0, double*** %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store i32 %3, i32* %13
store double %4, double* %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32* %7, i32** %17
store double* %8, double** %18
%20 = load i32*, i32** %17
store i32 0, i32* %20
%21 = call double (...) @omp_get_wtime()
%22 = load double*, double** %18
store double %21, double* %22
%23 = load i32, i32* %13
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %34
25: ; preds = %9
%26 = load double**, double*** %10
%27 = load i32, i32* %11
%28 = load i32, i32* %12
%29 = load double, double* %14
%30 = load i32, i32* %15
%31 = load i32, i32* %16
%32 = load i32*, i32** %17
%33 = call double @GaussSeidelSeqLoop(double** %26, i32 %27, i32 %28, double %29, i32 %30, i32 %31, i32* %32)
store double %33, double* %19
br label %43
34: ; preds = %9
%35 = load double**, double*** %10
%36 = load i32, i32* %11
%37 = load i32, i32* %12
%38 = load double, double* %14
%39 = load i32, i32* %15
%40 = load i32, i32* %16
%41 = load i32*, i32** %17
%42 = call double @GaussSeidelSeqLoopErr(double** %35, i32 %36, i32 %37, double %38, i32 %39, i32 %40, i32* %41)
store double %42, double* %19
br label %43
43: ; preds = %34, %25
%44 = call double (...) @omp_get_wtime()
%45 = load double*, double** %18
%46 = load double, double* %45
%47 = fsub double %44, %46
%48 = load double*, double** %18
store double %47, double* %48
%49 = load double, double* %19
ret double %49
}

LLVM IR (-O2):
define double @GaussSeidel(double** %0, i32 %1, i32 %2, i32 %3, double %4, i32 %5, i32 %6, i32* %7, double* nocapture %8) {
store i32 0, i32* %7
%10 = tail call double (...) @omp_get_wtime()
store double %10, double* %8
%11 = icmp eq i32 %3, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call double @GaussSeidelSeqLoop(double** %0, i32 %1, i32 %2, double %4, i32 %5, i32 %6, i32* %7)
br label %16
14: ; preds = %9
%15 = tail call double @GaussSeidelSeqLoopErr(double** %0, i32 %1, i32 %2, double %4, i32 %5, i32 %6, i32* %7)
br label %16
16: ; preds = %14, %12
%17 = phi double [ %13, %12 ], [ %15, %14 ]
%18 = tail call double (...) @omp_get_wtime()
%19 = load double, double* %8
%20 = fsub double %18, %19
store double %20, double* %8
ret double %17
}