#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 */
scalar_t__ fabsf(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, float, int, float, int);
int /*<<< orphan*/ mult_m4m4(float *, float *, float *);
int /*<<< orphan*/ stderr;
bool test_mult_m4m4() {
  bool result = true;
  float d[16];
  float m1[] = {0.1f, -0.5f, -1.0f, 2.5f,  -0.5f, 3.0f,  -10.f, 7.0f,
                4.2f, 6.3f,  -7.1f, -8.8f, 1.8f,  -2.2f, 3.1f,  -2.1f};
  float m2[] = {5.3f,  0.3f, -1.4f, 5.6f,  3.3f, -2.4f, 7.1f, -2.9f,
                -6.4f, 2.3f, 8.6f,  -4.4f, 6.6f, 3.7f,  1.6f, -9.6f};
  mult_m4m4(d, m1, m2);
  float e[] = {4.58f,       -22.889999f, 18.999998f,  15.910001f,
               26.129997f,  42.259998f,  -38.699997f, -64.940002f,
               26.409998f,  73.960007f,  -91.300003f, -66.340012f,
               -11.750001f, 39.0f,       -84.720001f, 48.48f};
  for (int i = 0; i < 16; i++) {
    while (fabsf((e)[i] - (d)[i]) > fabsf(0.01 * (e)[i])) {
      fprintf(stderr,
              "compare failed: value:    "
              "%f ("
              "d"
              "[%d])\n"
              "                expected: "
              "%f ("
              "e"
              "[%d])\n",
              (d)[i], i, (e)[i], i);
      result = false;
      break;
    };
  }
  return result;
}


x86 assembly (clang, -O0):
<test_mult_m4m4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x1,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x40,%edx
call   1060 <memcpy@plt>
lea    -0xd0(%rbp),%rdi
lea    0xed8(%rip),%rsi
mov    $0x40,%edx
call   1060 <memcpy@plt>
lea    -0x50(%rbp),%rdi
lea    -0x90(%rbp),%rsi
lea    -0xd0(%rbp),%rdx
call   1040 <mult_m4m4@plt>
lea    -0x110(%rbp),%rdi
lea    0xee9(%rip),%rsi
mov    $0x40,%edx
call   1060 <memcpy@plt>
movl   $0x0,-0x114(%rbp)
cmpl   $0x10,-0x114(%rbp)
jge    1290 <test_mult_m4m4+0x150>
jmp    11cd <test_mult_m4m4+0x8d>
movslq -0x114(%rbp),%rax
movss  -0x110(%rbp,%rax,4),%xmm0
ff ff
movslq -0x114(%rbp),%rax
subss  -0x50(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <fabsf@plt>
mov    %rax,-0x120(%rbp)
movslq -0x114(%rbp),%rax
movss  -0x110(%rbp,%rax,4),%xmm0
ff ff
cvtss2sd %xmm0,%xmm1
movsd  0xdea(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <fabsf@plt>
mov    %rax,%rcx
mov    -0x120(%rbp),%rax
cmp    %rcx,%rax
jle    1277 <test_mult_m4m4+0x137>
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
movslq -0x114(%rbp),%rax
movss  -0x50(%rbp,%rax,4),%xmm0
mov    -0x114(%rbp),%edx
movslq -0x114(%rbp),%rax
movss  -0x110(%rbp,%rax,4),%xmm1
ff ff
mov    -0x114(%rbp),%ecx
lea    0xe65(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    127c <test_mult_m4m4+0x13c>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    11bb <test_mult_m4m4+0x7b>
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mult_m4m4>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
movaps 0xef8(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xea1(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movapd 0xeb0(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
lea    0x90(%rsp),%rdi
lea    0x50(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1040 <mult_m4m4@plt>
mov    $0x1,%r15d
lea    0xec6(%rip),%rbp
xor    %ebx,%ebx
mov    0x2e0d(%rip),%r13
lea    0xef6(%rip),%r14
jmp    11ee <test_mult_m4m4+0xbe>
nopl   0x0(%rax)
add    $0x1,%rbx
add    $0x4,%rbp
cmp    $0x10,%rbx
je     124e <test_mult_m4m4+0x11e>
movss  0x0(%rbp),%xmm0
movss  %xmm0,0xc(%rsp)
subss  0x90(%rsp,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <fabsf@plt>
mov    %rax,%r12
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xde0(%rip),%xmm0
call   1030 <fabsf@plt>
cmp    %rax,%r12
jle    11e0 <test_mult_m4m4+0xb0>
mov    0x0(%r13),%edi
movss  0x90(%rsp,%rbx,4),%xmm0
mov    %r14,%rsi
mov    %ebx,%edx
movss  0xc(%rsp),%xmm1
mov    %ebx,%ecx
call   1050 <fprintf@plt>
xor    %r15d,%r15d
jmp    11e0 <test_mult_m4m4+0xb0>
mov    %r15d,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.test_mult_m4m4.m1 = [16 x float] [float 0x3FB99999A0000000, float -5.000000e-01, float -1.000000e+00, float 2.500000e+00, float -5.000000e-01, float 3.000000e+00, float -1.000000e+01, float 7.000000e+00, float 0x4010CCCCC0000000, float 0x4019333340000000, float 0xC01C666660000000, float 0xC0219999A0000000, float 0x3FFCCCCCC0000000, float 0xC0019999A0000000, float 0x4008CCCCC0000000, float 0xC000CCCCC0000000]
@__const.test_mult_m4m4.m2 = [16 x float] [float 0x4015333340000000, float 0x3FD3333340000000, float 0xBFF6666660000000, float 0x4016666660000000, float 0x400A666660000000, float 0xC003333340000000, float 0x401C666660000000, float 0xC007333340000000, float 0xC0199999A0000000, float 0x4002666660000000, float 0x4021333340000000, float 0xC0119999A0000000, float 0x401A666660000000, float 0x400D9999A0000000, float 0x3FF99999A0000000, float 0xC023333340000000]
@__const.test_mult_m4m4.e = [16 x float] [float 0x401251EB80000000, float 0xC036E3D700000000, float 0x4032FFFFE0000000, float 0x402FD1EBA0000000, float 0x403A214780000000, float 0x40452147A0000000, float 0xC043599980000000, float 0xC0503C2900000000, float 0x403A68F5A0000000, float 0x40527D70C0000000, float 0xC056D33340000000, float 0xC05095C2C0000000, float 0xC027800020000000, float 3.900000e+01, float 0xC0552E1480000000, float 0x40483D70A0000000]
@stderr = global i32 0
@.str = [75 x i8] c"compare failed: value: %f (d[%d])\0A expected: %f (e[%d])\0A\00"
define i32 @test_mult_m4m4() {
%1 = alloca i32
%2 = alloca [16 x float]
%3 = alloca [16 x float]
%4 = alloca [16 x float]
%5 = alloca [16 x float]
%6 = alloca i32
store i32 1, i32* %1
%7 = bitcast [16 x float]* %3 to i8*
%8 = bitcast [16 x float]* %4 to i8*
%9 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 0
%10 = getelementptr inbounds [16 x float], [16 x float]* %3, i64 0, i64 0
%11 = getelementptr inbounds [16 x float], [16 x float]* %4, i64 0, i64 0
%12 = call i32 @mult_m4m4(float* %9, float* %10, float* %11)
%13 = bitcast [16 x float]* %5 to i8*
store i32 0, i32* %6
br label %14
14: ; preds = %52, %0
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 16
br i1 %16, label %17, label %55
17: ; preds = %14
br label %18
18: ; preds = %17
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 %20
%22 = load float, float* %21
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 %24
%26 = load float, float* %25
%27 = fsub float %22, %26
%28 = fpext float %27 to double
%29 = call i64 @fabsf(double %28)
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 %31
%33 = load float, float* %32
%34 = fpext float %33 to double
%35 = fmul double 1.000000e-02, %34
%36 = call i64 @fabsf(double %35)
%37 = icmp sgt i64 %29, %36
br i1 %37, label %38, label %51
38: ; preds = %18
%39 = load i32, i32* @stderr
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 %41
%43 = load float, float* %42
%44 = load i32, i32* %6
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 %46
%48 = load float, float* %47
%49 = load i32, i32* %6
%50 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), float %43, i32 %44, float %48, i32 %49)
store i32 0, i32* %1
br label %51
51: ; preds = %38, %18
br label %52
52: ; preds = %51
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %14
55: ; preds = %14
%56 = load i32, i32* %1
ret i32 %56
}

LLVM IR (-O2):
@__const.test_mult_m4m4.m1 = [16 x float] [float 0x3FB99999A0000000, float -5.000000e-01, float -1.000000e+00, float 2.500000e+00, float -5.000000e-01, float 3.000000e+00, float -1.000000e+01, float 7.000000e+00, float 0x4010CCCCC0000000, float 0x4019333340000000, float 0xC01C666660000000, float 0xC0219999A0000000, float 0x3FFCCCCCC0000000, float 0xC0019999A0000000, float 0x4008CCCCC0000000, float 0xC000CCCCC0000000]
@__const.test_mult_m4m4.m2 = [16 x float] [float 0x4015333340000000, float 0x3FD3333340000000, float 0xBFF6666660000000, float 0x4016666660000000, float 0x400A666660000000, float 0xC003333340000000, float 0x401C666660000000, float 0xC007333340000000, float 0xC0199999A0000000, float 0x4002666660000000, float 0x4021333340000000, float 0xC0119999A0000000, float 0x401A666660000000, float 0x400D9999A0000000, float 0x3FF99999A0000000, float 0xC023333340000000]
@__const.test_mult_m4m4.e = [16 x float] [float 0x401251EB80000000, float 0xC036E3D700000000, float 0x4032FFFFE0000000, float 0x402FD1EBA0000000, float 0x403A214780000000, float 0x40452147A0000000, float 0xC043599980000000, float 0xC0503C2900000000, float 0x403A68F5A0000000, float 0x40527D70C0000000, float 0xC056D33340000000, float 0xC05095C2C0000000, float 0xC027800020000000, float 3.900000e+01, float 0xC0552E1480000000, float 0x40483D70A0000000]
@stderr = global i32 0
@.str = [75 x i8] c"compare failed: value: %f (d[%d])\0A expected: %f (e[%d])\0A\00"
define i32 @test_mult_m4m4() {
%1 = alloca [16 x float]
%2 = alloca [16 x float]
%3 = alloca [16 x float]
%4 = bitcast [16 x float]* %1 to i8*
%5 = bitcast [16 x float]* %2 to i8*
%6 = bitcast [16 x float]* %3 to i8*
%7 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%8 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 0
%9 = getelementptr inbounds [16 x float], [16 x float]* %3, i64 0, i64 0
%10 = call i32 @mult_m4m4(float* %7, float* %8, float* %9)
br label %12
11: ; preds = %31
ret i32 %32
12: ; preds = %0, %31
%13 = phi i64 [ 0, %0 ], [ %33, %31 ]
%14 = phi i32 [ 1, %0 ], [ %32, %31 ]
%15 = getelementptr inbounds [16 x float], [16 x float]* @__const.test_mult_m4m4.e, i64 0, i64 %13
%16 = load float, float* %15
%17 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 %13
%18 = load float, float* %17
%19 = fsub float %16, %18
%20 = fpext float %19 to double
%21 = call i64 @fabsf(double %20)
%22 = fpext float %16 to double
%23 = fmul double %22, 1.000000e-02
%24 = call i64 @fabsf(double %23)
%25 = icmp sgt i64 %21, %24
br i1 %25, label %26, label %31
26: ; preds = %12
%27 = load i32, i32* @stderr
%28 = load float, float* %17
%29 = trunc i64 %13 to i32
%30 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), float %28, i32 %29, float %16, i32 %29)
br label %31
31: ; preds = %12, %26
%32 = phi i32 [ 0, %26 ], [ %14, %12 ]
%33 = add nuw nsw i64 %13, 1
%34 = icmp eq i64 %33, 16
br i1 %34, label %11, label %12
}