#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 diff_mats(int, int, double *, int, int, double *, int, int);
int /*<<< orphan*/ printf(char *, char *, ...);
void test_mats_diff(int m, int n, double *a, int a_row_stride, int a_col_stride,
                    double *b, int b_row_stride, int b_col_stride,
                    char *test_name) {
  double diff = diff_mats(m, n, a, a_row_stride, a_col_stride, b, b_row_stride,
                          b_col_stride);
  if (diff != 0.0) {
    printf("\n\nERROR in %s: diff = %f\n\n", test_name, diff);
  } else {
    printf("%s PASSED\n", test_name);
  }
}


x86 assembly (clang, -O0):
<test_mats_diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x20(%rbp),%r9
mov    0x10(%rbp),%r10d
mov    0x18(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <diff_mats@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1192 <test_mats_diff+0x72>
jp     1192 <test_mats_diff+0x72>
jmp    11ae <test_mats_diff+0x8e>
mov    0x20(%rbp),%rsi
movsd  -0x28(%rbp),%xmm0
lea    0xe5e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11c0 <test_mats_diff+0xa0>
mov    0x20(%rbp),%rsi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mats_diff>:
push   %r14
push   %rbx
push   %rax
mov    0x30(%rsp),%r14
mov    0x20(%rsp),%eax
mov    0x28(%rsp),%ebx
push   %rbx
push   %rax
call   1040 <diff_mats@plt>
add    $0x10,%rsp
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1148 <test_mats_diff+0x28>
jnp    1160 <test_mats_diff+0x40>
lea    0xeb1(%rip),%rdi
mov    %r14,%rsi
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>
lea    0xeb4(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"\0A\0AERROR in %s: diff = %f\0A\0A\00"
@.str.1 = [11 x i8] c"%s PASSED\0A\00"
define void @test_mats_diff(i32 %0, i32 %1, double* %2, i32 %3, i32 %4, double* %5, i32 %6, i32 %7, i8* %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca double*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca double
store i32 %0, i32* %10
store i32 %1, i32* %11
store double* %2, double** %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store double* %5, double** %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i8* %8, i8** %18
%20 = load i32, i32* %10
%21 = load i32, i32* %11
%22 = load double*, double** %12
%23 = load i32, i32* %13
%24 = load i32, i32* %14
%25 = load double*, double** %15
%26 = load i32, i32* %16
%27 = load i32, i32* %17
%28 = call double @diff_mats(i32 %20, i32 %21, double* %22, i32 %23, i32 %24, double* %25, i32 %26, i32 %27)
store double %28, double* %19
%29 = load double, double* %19
%30 = fcmp une double %29, 0.000000e+00
br i1 %30, label %31, label %35
31: ; preds = %9
%32 = load i8*, i8** %18
%33 = load double, double* %19
%34 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %32, double %33)
br label %38
35: ; preds = %9
%36 = load i8*, i8** %18
%37 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %36)
br label %38
38: ; preds = %35, %31
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"\0A\0AERROR in %s: diff = %f\0A\0A\00"
@.str.1 = [11 x i8] c"%s PASSED\0A\00"
define void @test_mats_diff(i32 %0, i32 %1, double* %2, i32 %3, i32 %4, double* %5, i32 %6, i32 %7, i8* %8) {
%10 = tail call double @diff_mats(i32 %0, i32 %1, double* %2, i32 %3, i32 %4, double* %5, i32 %6, i32 %7)
%11 = fcmp une double %10, 0.000000e+00
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %8, double %10)
br label %16
14: ; preds = %9
%15 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %16
16: ; preds = %14, %12
ret void
}