#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 */
int /*<<< orphan*/ matmul_s(double *, double *, double *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int i, j;
  double a[] = {1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4};
  double b[] = {1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4};
  double c[16];
  matmul_s(&a[0], &b[0], &c[0]);
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4; j++)
      printf("%.2f ", c[i * 4 + j]);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x80,%edx
call   1050 <memcpy@plt>
lea    -0x110(%rbp),%rdi
lea    0xf18(%rip),%rsi
mov    $0x80,%edx
call   1050 <memcpy@plt>
lea    -0x90(%rbp),%rdi
lea    -0x110(%rbp),%rsi
lea    -0x190(%rbp),%rdx
call   1040 <matmul_s@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11fa <main+0xca>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11de <main+0xae>
mov    -0x8(%rbp),%eax
shl    $0x2,%eax
add    -0xc(%rbp),%eax
cltq
movsd  -0x190(%rbp,%rax,8),%xmm0
ff ff
lea    0xf37(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a4 <main+0x74>
lea    0xf21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1193 <main+0x63>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x180,%rsp
movaps 0xf31(%rip),%xmm0
movaps %xmm0,0x170(%rsp)
movaps 0xf12(%rip),%xmm1
movaps %xmm1,0x160(%rsp)
movaps 0xef3(%rip),%xmm2
movaps %xmm2,0x150(%rsp)
movaps 0xed4(%rip),%xmm3
movaps %xmm3,0x140(%rsp)
movaps 0xeb5(%rip),%xmm4
movaps %xmm4,0x130(%rsp)
movaps 0xe96(%rip),%xmm5
movaps %xmm5,0x120(%rsp)
movaps 0xe77(%rip),%xmm6
movaps %xmm6,0x110(%rsp)
movaps 0xe58(%rip),%xmm7
movaps %xmm7,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm1,0xe0(%rsp)
movaps %xmm2,0xd0(%rsp)
movaps %xmm3,0xc0(%rsp)
movaps %xmm4,0xb0(%rsp)
movaps %xmm5,0xa0(%rsp)
movaps %xmm6,0x90(%rsp)
movaps %xmm7,0x80(%rsp)
lea    0x100(%rsp),%rdi
lea    0x80(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <matmul_s@plt>
movsd  (%rsp),%xmm0
lea    0xe6c(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x20(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x28(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x30(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x38(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x40(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x48(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x50(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x58(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x60(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x68(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x70(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x78(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x180,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [16 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00]
@__const.main.b = [16 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00]
@.str = [6 x i8] c"%.2f \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [16 x double]
%5 = alloca [16 x double]
%6 = alloca [16 x double]
store i32 0, i32* %1
%7 = bitcast [16 x double]* %4 to i8*
%8 = bitcast [16 x double]* %5 to i8*
%9 = getelementptr inbounds [16 x double], [16 x double]* %4, i64 0, i64 0
%10 = getelementptr inbounds [16 x double], [16 x double]* %5, i64 0, i64 0
%11 = getelementptr inbounds [16 x double], [16 x double]* %6, i64 0, i64 0
%12 = call i32 @matmul_s(double* %9, double* %10, double* %11)
store i32 0, i32* %2
br label %13
13: ; preds = %34, %0
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 4
br i1 %15, label %16, label %37
16: ; preds = %13
store i32 0, i32* %3
br label %17
17: ; preds = %29, %16
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 4
br i1 %19, label %20, label %32
20: ; preds = %17
%21 = load i32, i32* %2
%22 = mul nsw i32 %21, 4
%23 = load i32, i32* %3
%24 = add nsw i32 %22, %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [16 x double], [16 x double]* %6, i64 0, i64 %25
%27 = load double, double* %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %27)
br label %29
29: ; preds = %20
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %17
32: ; preds = %17
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %32
%35 = load i32, i32* %2
%36 = add nsw i32 %35, 1
store i32 %36, i32* %2
br label %13
37: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@__const.main.b = [16 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00]
@.str = [6 x i8] c"%.2f \00"
define i32 @main() {
%1 = alloca [16 x double]
%2 = alloca [16 x double]
%3 = alloca [16 x double]
%4 = bitcast [16 x double]* %1 to i8*
%5 = bitcast [16 x double]* %2 to i8*
%6 = bitcast [16 x double]* %3 to i8*
%7 = getelementptr inbounds [16 x double], [16 x double]* %1, i64 0, i64 0
%8 = getelementptr inbounds [16 x double], [16 x double]* %2, i64 0, i64 0
%9 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 0
%10 = call i32 @matmul_s(double* %7, double* %8, double* %9)
%11 = load double, double* %9
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %11)
%13 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 1
%14 = load double, double* %13
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %14)
%16 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 2
%17 = load double, double* %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %17)
%19 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 3
%20 = load double, double* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %20)
%22 = call i32 @putchar(i32 10)
%23 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 4
%24 = load double, double* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %24)
%26 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 5
%27 = load double, double* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %27)
%29 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 6
%30 = load double, double* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %30)
%32 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 7
%33 = load double, double* %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %33)
%35 = call i32 @putchar(i32 10)
%36 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 8
%37 = load double, double* %36
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %37)
%39 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 9
%40 = load double, double* %39
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %40)
%42 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 10
%43 = load double, double* %42
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %43)
%45 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 11
%46 = load double, double* %45
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %46)
%48 = call i32 @putchar(i32 10)
%49 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 12
%50 = load double, double* %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %50)
%52 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 13
%53 = load double, double* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %53)
%55 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 14
%56 = load double, double* %55
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %56)
%58 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 15
%59 = load double, double* %58
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %59)
%61 = call i32 @putchar(i32 10)
ret i32 0
}