#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*/ sgemm_kernel_1(float const, float *, float *, double,
                                  float *);
void multiply_stream(const float alpha, const float beta,
                     const unsigned int stream_length, unsigned int *stream_A,
                     unsigned int *stream_B, unsigned int *stream_C,
                     float (*A)[4][4], float (*B)[4][4], float (*C)[4][4]) {
  unsigned int i, i_block, j_block, k_block;
  unsigned int i_A, i_B, i_C;
  float x, y, z;
  for (i = 0; i < stream_length; i++) {
    i_A = stream_A[i];
    i_B = stream_B[i];
    i_C = stream_C[i];
    sgemm_kernel_1(alpha, (float *)&A[i_A], (float *)&B[i_B], 1.0,
                   (float *)&C[i_C]);
  }
}


x86 assembly (clang, -O0):
<multiply_stream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x10(%rbp),%rax
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11c1 <multiply_stream+0xb1>
mov    -0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x50(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x3c(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x54(%rbp)
movss  -0x4(%rbp),%xmm0
mov    -0x30(%rbp),%rdi
mov    -0x4c(%rbp),%eax
shl    $0x6,%rax
add    %rax,%rdi
mov    -0x38(%rbp),%rsi
mov    -0x50(%rbp),%eax
shl    $0x6,%rax
add    %rax,%rsi
mov    0x10(%rbp),%rdx
mov    -0x54(%rbp),%eax
shl    $0x6,%rax
add    %rax,%rdx
movsd  0xe52(%rip),%xmm1
call   1030 <sgemm_kernel_1@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1144 <multiply_stream+0x34>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiply_stream>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %edi,%edi
je     1193 <multiply_stream+0x83>
mov    %r9,%r15
mov    %r8,%r12
mov    %rcx,%r13
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %edi,%eax
mov    %rax,0x10(%rsp)
xor    %r14d,%r14d
movss  %xmm0,0xc(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp,%r14,4),%edi
mov    (%rbx,%r14,4),%esi
mov    0x0(%r13,%r14,4),%edx
shl    $0x6,%rdi
add    %r12,%rdi
shl    $0x6,%rsi
add    %r15,%rsi
shl    $0x6,%rdx
add    0x50(%rsp),%rdx
movss  0xc(%rsp),%xmm0
movsd  0xe7d(%rip),%xmm1
call   1030 <sgemm_kernel_1@plt>
add    $0x1,%r14
cmp    %r14,0x10(%rsp)
jne    1150 <multiply_stream+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @multiply_stream(float %0, float %1, i32 %2, i32* %3, i32* %4, i32* %5, [4 x [4 x float]]* %6, [4 x [4 x float]]* %7, [4 x [4 x float]]* %8) {
%10 = alloca float
%11 = alloca float
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca [4 x [4 x float]]*
%17 = alloca [4 x [4 x float]]*
%18 = alloca [4 x [4 x float]]*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca float
%27 = alloca float
%28 = alloca float
store float %0, float* %10
store float %1, float* %11
store i32 %2, i32* %12
store i32* %3, i32** %13
store i32* %4, i32** %14
store i32* %5, i32** %15
store [4 x [4 x float]]* %6, [4 x [4 x float]]** %16
store [4 x [4 x float]]* %7, [4 x [4 x float]]** %17
store [4 x [4 x float]]* %8, [4 x [4 x float]]** %18
store i32 0, i32* %19
br label %29
29: ; preds = %66, %9
%30 = load i32, i32* %19
%31 = load i32, i32* %12
%32 = icmp ult i32 %30, %31
br i1 %32, label %33, label %69
33: ; preds = %29
%34 = load i32*, i32** %13
%35 = load i32, i32* %19
%36 = zext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
%38 = load i32, i32* %37
store i32 %38, i32* %23
%39 = load i32*, i32** %14
%40 = load i32, i32* %19
%41 = zext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %39, i64 %41
%43 = load i32, i32* %42
store i32 %43, i32* %24
%44 = load i32*, i32** %15
%45 = load i32, i32* %19
%46 = zext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %44, i64 %46
%48 = load i32, i32* %47
store i32 %48, i32* %25
%49 = load float, float* %10
%50 = load [4 x [4 x float]]*, [4 x [4 x float]]** %16
%51 = load i32, i32* %23
%52 = zext i32 %51 to i64
%53 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %50, i64 %52
%54 = bitcast [4 x [4 x float]]* %53 to float*
%55 = load [4 x [4 x float]]*, [4 x [4 x float]]** %17
%56 = load i32, i32* %24
%57 = zext i32 %56 to i64
%58 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %55, i64 %57
%59 = bitcast [4 x [4 x float]]* %58 to float*
%60 = load [4 x [4 x float]]*, [4 x [4 x float]]** %18
%61 = load i32, i32* %25
%62 = zext i32 %61 to i64
%63 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %60, i64 %62
%64 = bitcast [4 x [4 x float]]* %63 to float*
%65 = call i32 @sgemm_kernel_1(float %49, float* %54, float* %59, double 1.000000e+00, float* %64)
br label %66
66: ; preds = %33
%67 = load i32, i32* %19
%68 = add i32 %67, 1
store i32 %68, i32* %19
br label %29
69: ; preds = %29
ret void
}

LLVM IR (-O2):
define void @multiply_stream(float %0, float %1, i32 %2, i32* nocapture %3, i32* nocapture %4, i32* nocapture %5, [4 x [4 x float]]* %6, [4 x [4 x float]]* %7, [4 x [4 x float]]* %8) {
%10 = icmp eq i32 %2, 0
br i1 %10, label %30, label %11
11: ; preds = %9
%12 = zext i32 %2 to i64
br label %13
13: ; preds = %11, %13
%14 = phi i64 [ 0, %11 ], [ %28, %13 ]
%15 = getelementptr inbounds i32, i32* %3, i64 %14
%16 = load i32, i32* %15
%17 = getelementptr inbounds i32, i32* %4, i64 %14
%18 = load i32, i32* %17
%19 = getelementptr inbounds i32, i32* %5, i64 %14
%20 = load i32, i32* %19
%21 = zext i32 %16 to i64
%22 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %6, i64 %21, i64 0, i64 0
%23 = zext i32 %18 to i64
%24 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %7, i64 %23, i64 0, i64 0
%25 = zext i32 %20 to i64
%26 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 %25, i64 0, i64 0
%27 = tail call i32 @sgemm_kernel_1(float %0, float* %22, float* %24, double 1.000000e+00, float* %26)
%28 = add nuw nsw i64 %14, 1
%29 = icmp eq i64 %28, %12
br i1 %29, label %30, label %13
30: ; preds = %13, %9
ret void
}