#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 fabs(double);
int /*<<< orphan*/ printf(char *, ...);
int matInfinityNormCheckResultGMDP(double *h_Mat, int rows, int cols,
                                   double *cal_norm) {
  int currRow, iCol, flag = 0;
  double temp_norm = 0.0, myRowSum = 0.0;
  double eps = 1.0e-15;
  double relativeError = 0.0;
  double errorNorm = 0.0;
  for (currRow = 0; currRow < rows; currRow++) {
    myRowSum = 0;
    for (iCol = 0; iCol < cols; iCol++)
      myRowSum += h_Mat[currRow * cols + iCol];
    if (temp_norm < myRowSum)
      temp_norm = myRowSum;
  }
  if (fabs(temp_norm) > fabs(*cal_norm))
    relativeError = fabs((temp_norm - *cal_norm) / temp_norm);
  else
    relativeError = fabs((*cal_norm - temp_norm) / *cal_norm);
  if (relativeError > eps && relativeError != 0.0e+00) {
    if (errorNorm < relativeError) {
      errorNorm = relativeError;
      flag = 1;
    }
  }
  if (flag == 1) {
    printf(" \n \t\t Results verfication : Failed\n");
    printf(" \n \t\t Considered machine precision : %e\n", eps);
    printf(" \n \t\t Relative Error                  : %e\n", errorNorm);
  } else {
    printf("\n \n\t\tResults verfication : Success\n\n");
  }
}


x86 assembly (clang, -O0):
<matInfinityNormCheckResultGMDP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xebb(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e7 <matInfinityNormCheckResultGMDP+0xd7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11b6 <matInfinityNormCheckResultGMDP+0xa6>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    117c <matInfinityNormCheckResultGMDP+0x6c>
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11d4 <matInfinityNormCheckResultGMDP+0xc4>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11d9 <matInfinityNormCheckResultGMDP+0xc9>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1161 <matInfinityNormCheckResultGMDP+0x51>
movsd  -0x38(%rbp),%xmm0
movaps 0xe1d(%rip),%xmm1
pand   %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
movaps 0xe0a(%rip),%xmm2
pand   %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    123b <matInfinityNormCheckResultGMDP+0x12b>
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
divsd  -0x38(%rbp),%xmm0
movaps 0xde3(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1260 <matInfinityNormCheckResultGMDP+0x150>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
divsd  (%rax),%xmm0
movaps 0xdb9(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    12b7 <matInfinityNormCheckResultGMDP+0x1a7>
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    128d <matInfinityNormCheckResultGMDP+0x17d>
jp     128d <matInfinityNormCheckResultGMDP+0x17d>
jmp    12b7 <matInfinityNormCheckResultGMDP+0x1a7>
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12b2 <matInfinityNormCheckResultGMDP+0x1a2>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    12b7 <matInfinityNormCheckResultGMDP+0x1a7>
cmpl   $0x1,-0x2c(%rbp)
jne    12fa <matInfinityNormCheckResultGMDP+0x1ea>
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x48(%rbp),%xmm0
lea    0xd69(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x58(%rbp),%xmm0
lea    0xd7f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1308 <matInfinityNormCheckResultGMDP+0x1f8>
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matInfinityNormCheckResultGMDP>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %esi,%esi
jle    11d0 <matInfinityNormCheckResultGMDP+0xb0>
movslq %edx,%r10
mov    %esi,%r8d
mov    %r10d,%r11d
lea    -0x1(%r11),%r9
mov    %r11d,%r15d
and    $0x3,%r15d
and    $0xfffffffc,%r11d
lea    0x18(%rdi),%rax
shl    $0x3,%r10
xorpd  %xmm1,%xmm1
xor    %r14d,%r14d
jmp    1177 <matInfinityNormCheckResultGMDP+0x57>
nopw   0x0(%rax,%rax,1)
maxsd  %xmm1,%xmm0
add    $0x1,%r14
add    %r10,%rax
add    %r10,%rdi
movapd %xmm0,%xmm1
cmp    %r8,%r14
je     11d4 <matInfinityNormCheckResultGMDP+0xb4>
xorpd  %xmm0,%xmm0
test   %edx,%edx
jle    1160 <matInfinityNormCheckResultGMDP+0x40>
xorpd  %xmm0,%xmm0
xor    %ebx,%ebx
cmp    $0x3,%r9
jb     11b0 <matInfinityNormCheckResultGMDP+0x90>
nopl   0x0(%rax,%rax,1)
addsd  -0x18(%rax,%rbx,8),%xmm0
addsd  -0x10(%rax,%rbx,8),%xmm0
addsd  -0x8(%rax,%rbx,8),%xmm0
addsd  (%rax,%rbx,8),%xmm0
add    $0x4,%rbx
cmp    %rbx,%r11
jne    1190 <matInfinityNormCheckResultGMDP+0x70>
test   %r15,%r15
je     1160 <matInfinityNormCheckResultGMDP+0x40>
lea    (%rdi,%rbx,8),%rbx
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
addsd  (%rbx,%rsi,8),%xmm0
add    $0x1,%rsi
cmp    %rsi,%r15
jne    11c0 <matInfinityNormCheckResultGMDP+0xa0>
jmp    1160 <matInfinityNormCheckResultGMDP+0x40>
xorpd  %xmm0,%xmm0
movapd 0xe24(%rip),%xmm1
movapd %xmm0,%xmm3
andpd  %xmm1,%xmm3
movsd  (%rcx),%xmm2
andpd  %xmm2,%xmm1
ucomisd %xmm1,%xmm3
jbe    1200 <matInfinityNormCheckResultGMDP+0xe0>
movapd %xmm0,%xmm1
subsd  %xmm2,%xmm1
divsd  %xmm0,%xmm1
jmp    120c <matInfinityNormCheckResultGMDP+0xec>
movapd %xmm2,%xmm1
subsd  %xmm0,%xmm1
divsd  %xmm2,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
je     1274 <matInfinityNormCheckResultGMDP+0x154>
movapd 0xde2(%rip),%xmm2
andpd  %xmm1,%xmm2
ucomisd 0xde6(%rip),%xmm2
jbe    1274 <matInfinityNormCheckResultGMDP+0x154>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1238 <matInfinityNormCheckResultGMDP+0x118>
jnp    1274 <matInfinityNormCheckResultGMDP+0x154>
lea    0xe52(%rip),%rdi
movapd %xmm2,(%rsp)
call   1030 <puts@plt>
lea    0xdc8(%rip),%rdi
movsd  0xdb8(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xddb(%rip),%rdi
movapd (%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1280 <matInfinityNormCheckResultGMDP+0x160>
lea    0xdf2(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [36 x i8] c" \0A \09\09 Results verfication : Failed\0A\00"
@.str.1 = [41 x i8] c" \0A \09\09 Considered machine precision : %e\0A\00"
@.str.2 = [44 x i8] c" \0A \09\09 Relative Error : %e\0A\00"
@.str.3 = [37 x i8] c"\0A \0A\09\09Results verfication : Success\0A\0A\00"
define i32 @matInfinityNormCheckResultGMDP(double* %0, i32 %1, i32 %2, double* %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store double* %0, double** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store double* %3, double** %9
store i32 0, i32* %12
store double 0.000000e+00, double* %13
store double 0.000000e+00, double* %14
store double 1.000000e-15, double* %15
store double 0.000000e+00, double* %16
store double 0.000000e+00, double* %17
store i32 0, i32* %10
br label %18
18: ; preds = %49, %4
%19 = load i32, i32* %10
%20 = load i32, i32* %7
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %52
22: ; preds = %18
store double 0.000000e+00, double* %14
store i32 0, i32* %11
br label %23
23: ; preds = %39, %22
%24 = load i32, i32* %11
%25 = load i32, i32* %8
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %42
27: ; preds = %23
%28 = load double*, double** %6
%29 = load i32, i32* %10
%30 = load i32, i32* %8
%31 = mul nsw i32 %29, %30
%32 = load i32, i32* %11
%33 = add nsw i32 %31, %32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %28, i64 %34
%36 = load double, double* %35
%37 = load double, double* %14
%38 = fadd double %37, %36
store double %38, double* %14
br label %39
39: ; preds = %27
%40 = load i32, i32* %11
%41 = add nsw i32 %40, 1
store i32 %41, i32* %11
br label %23
42: ; preds = %23
%43 = load double, double* %13
%44 = load double, double* %14
%45 = fcmp olt double %43, %44
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = load double, double* %14
store double %47, double* %13
br label %48
48: ; preds = %46, %42
br label %49
49: ; preds = %48
%50 = load i32, i32* %10
%51 = add nsw i32 %50, 1
store i32 %51, i32* %10
br label %18
52: ; preds = %18
%53 = load double, double* %13
%54 = call double @llvm.fabs.f64(double %53)
%55 = load double*, double** %9
%56 = load double, double* %55
%57 = call double @llvm.fabs.f64(double %56)
%58 = fcmp ogt double %54, %57
br i1 %58, label %59, label %67
59: ; preds = %52
%60 = load double, double* %13
%61 = load double*, double** %9
%62 = load double, double* %61
%63 = fsub double %60, %62
%64 = load double, double* %13
%65 = fdiv double %63, %64
%66 = call double @llvm.fabs.f64(double %65)
store double %66, double* %16
br label %76
67: ; preds = %52
%68 = load double*, double** %9
%69 = load double, double* %68
%70 = load double, double* %13
%71 = fsub double %69, %70
%72 = load double*, double** %9
%73 = load double, double* %72
%74 = fdiv double %71, %73
%75 = call double @llvm.fabs.f64(double %74)
store double %75, double* %16
br label %76
76: ; preds = %67, %59
%77 = load double, double* %16
%78 = load double, double* %15
%79 = fcmp ogt double %77, %78
br i1 %79, label %80, label %90
80: ; preds = %76
%81 = load double, double* %16
%82 = fcmp une double %81, 0.000000e+00
br i1 %82, label %83, label %90
83: ; preds = %80
%84 = load double, double* %17
%85 = load double, double* %16
%86 = fcmp olt double %84, %85
br i1 %86, label %87, label %89
87: ; preds = %83
%88 = load double, double* %16
store double %88, double* %17
store i32 1, i32* %12
br label %89
89: ; preds = %87, %83
br label %90
90: ; preds = %89, %80, %76
%91 = load i32, i32* %12
%92 = icmp eq i32 %91, 1
br i1 %92, label %93, label %99
93: ; preds = %90
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%95 = load double, double* %15
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), double %95)
%97 = load double, double* %17
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), double %97)
br label %101
99: ; preds = %90
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
br label %101
101: ; preds = %99, %93
%102 = load i32, i32* %5
ret i32 %102
}

LLVM IR (-O2):
@.str.1 = [41 x i8] c" \0A \09\09 Considered machine precision : %e\0A\00"
@.str.2 = [44 x i8] c" \0A \09\09 Relative Error : %e\0A\00"
@str = [36 x i8] c"\0A \0A\09\09Results verfication : Success\0A\00"
@str.4 = [35 x i8] c" \0A \09\09 Results verfication : Failed\00"
define i32 @matInfinityNormCheckResultGMDP(double* nocapture %0, i32 %1, i32 %2, double* nocapture %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %68
6: ; preds = %4
%7 = icmp sgt i32 %2, 0
%8 = sext i32 %2 to i64
%9 = zext i32 %1 to i64
%10 = zext i32 %2 to i64
%11 = add nsw i64 %10, -1
%12 = and i64 %10, 3
%13 = icmp ult i64 %11, 3
%14 = and i64 %10, 4294967292
%15 = icmp eq i64 %12, 0
br label %16
16: ; preds = %6, %62
%17 = phi i64 [ 0, %6 ], [ %66, %62 ]
%18 = phi double [ 0.000000e+00, %6 ], [ %65, %62 ]
br i1 %7, label %19, label %62
19: ; preds = %16
%20 = mul nsw i64 %17, %8
br i1 %13, label %47, label %21
21: ; preds = %19, %21
%22 = phi i64 [ %44, %21 ], [ 0, %19 ]
%23 = phi double [ %43, %21 ], [ 0.000000e+00, %19 ]
%24 = phi i64 [ %45, %21 ], [ 0, %19 ]
%25 = add nsw i64 %22, %20
%26 = getelementptr inbounds double, double* %0, i64 %25
%27 = load double, double* %26
%28 = fadd double %23, %27
%29 = or i64 %22, 1
%30 = add nsw i64 %29, %20
%31 = getelementptr inbounds double, double* %0, i64 %30
%32 = load double, double* %31
%33 = fadd double %28, %32
%34 = or i64 %22, 2
%35 = add nsw i64 %34, %20
%36 = getelementptr inbounds double, double* %0, i64 %35
%37 = load double, double* %36
%38 = fadd double %33, %37
%39 = or i64 %22, 3
%40 = add nsw i64 %39, %20
%41 = getelementptr inbounds double, double* %0, i64 %40
%42 = load double, double* %41
%43 = fadd double %38, %42
%44 = add nuw nsw i64 %22, 4
%45 = add i64 %24, 4
%46 = icmp eq i64 %45, %14
br i1 %46, label %47, label %21
47: ; preds = %21, %19
%48 = phi double [ undef, %19 ], [ %43, %21 ]
%49 = phi i64 [ 0, %19 ], [ %44, %21 ]
%50 = phi double [ 0.000000e+00, %19 ], [ %43, %21 ]
br i1 %15, label %62, label %51
51: ; preds = %47, %51
%52 = phi i64 [ %59, %51 ], [ %49, %47 ]
%53 = phi double [ %58, %51 ], [ %50, %47 ]
%54 = phi i64 [ %60, %51 ], [ 0, %47 ]
%55 = add nsw i64 %52, %20
%56 = getelementptr inbounds double, double* %0, i64 %55
%57 = load double, double* %56
%58 = fadd double %53, %57
%59 = add nuw nsw i64 %52, 1
%60 = add i64 %54, 1
%61 = icmp eq i64 %60, %12
br i1 %61, label %62, label %51
62: ; preds = %47, %51, %16
%63 = phi double [ 0.000000e+00, %16 ], [ %48, %47 ], [ %58, %51 ]
%64 = fcmp olt double %18, %63
%65 = select i1 %64, double %63, double %18
%66 = add nuw nsw i64 %17, 1
%67 = icmp eq i64 %66, %9
br i1 %67, label %68, label %16
68: ; preds = %62, %4
%69 = phi double [ 0.000000e+00, %4 ], [ %65, %62 ]
%70 = tail call double @llvm.fabs.f64(double %69)
%71 = load double, double* %3
%72 = tail call double @llvm.fabs.f64(double %71)
%73 = fcmp ogt double %70, %72
br i1 %73, label %74, label %77
74: ; preds = %68
%75 = fsub double %69, %71
%76 = fdiv double %75, %69
br label %80
77: ; preds = %68
%78 = fsub double %71, %69
%79 = fdiv double %78, %71
br label %80
80: ; preds = %77, %74
%81 = phi double [ %79, %77 ], [ %76, %74 ]
%82 = tail call double @llvm.fabs.f64(double %81)
%83 = fcmp ogt double %82, 1.000000e-15
%84 = fcmp une double %81, 0.000000e+00
%85 = and i1 %83, %84
%86 = fcmp one double %81, 0.000000e+00
%87 = and i1 %86, %85
br i1 %87, label %88, label %92
88: ; preds = %80
%89 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.4, i64 0, i64 0))
%90 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), double 1.000000e-15)
%91 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), double %82)
br label %94
92: ; preds = %80
%93 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %94
94: ; preds = %92, %88
ret i32 undef
}