#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*/ daxpy(double *, double *, long, double);
void bmod(double *a, double *b, double *c, long dimi, long dimj, long dimk,
          long stride) {
  long j, k;
  double alpha;
  for (k = 0; k < dimk; k++) {
    for (j = 0; j < dimj; j++) {
      alpha = -b[k + j * stride];
      daxpy(&c[j * stride], &a[k * stride], dimi, alpha);
    }
  }
}


x86 assembly (clang, -O0):
<bmod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x30(%rbp),%rax
jge    11f2 <bmod+0xe2>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    11dc <bmod+0xcc>
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    -0x38(%rbp),%rdx
imul   0x10(%rbp),%rdx
add    %rdx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rax
imul   0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x40(%rbp),%rax
imul   0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x20(%rbp),%rdx
movsd  -0x48(%rbp),%xmm0
call   1030 <daxpy@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1152 <bmod+0x42>
jmp    11e1 <bmod+0xd1>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    113c <bmod+0x2c>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bmod>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,0x8(%rsp)
mov    %rdi,0x10(%rsp)
mov    %r9,0x18(%rsp)
test   %r9,%r9
jle    11dd <bmod+0xcd>
mov    %rcx,%r13
mov    %rdx,%r14
mov    %rsi,%rbp
mov    0x60(%rsp),%rax
lea    0x0(,%rax,8),%rbx
xor    %eax,%eax
mov    %rax,(%rsp)
movaps 0xea7(%rip),%xmm1
jmp    117a <bmod+0x6a>
nopl   0x0(%rax,%rax,1)
mov    (%rsp),%rsi
add    $0x1,%rsi
add    $0x8,%rbp
mov    %rsi,%rax
mov    %rsi,(%rsp)
cmp    0x18(%rsp),%rsi
je     11dd <bmod+0xcd>
cmpq   $0x0,0x8(%rsp)
jle    1160 <bmod+0x50>
mov    (%rsp),%rax
imul   0x60(%rsp),%rax
mov    0x10(%rsp),%rsi
lea    (%rsi,%rax,8),%rax
mov    %rax,0x20(%rsp)
xor    %r15d,%r15d
mov    0x8(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x0(%rbp,%r15,1),%xmm0
xorps  %xmm1,%xmm0
lea    (%r14,%r15,1),%rdi
mov    0x20(%rsp),%rsi
mov    %r13,%rdx
call   1030 <daxpy@plt>
movaps 0xe2e(%rip),%xmm1
add    %rbx,%r15
add    $0xffffffffffffffff,%r12
jne    11b0 <bmod+0xa0>
jmp    1160 <bmod+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @bmod(double* %0, double* %1, double* %2, i64 %3, i64 %4, i64 %5, i64 %6) {
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca double
store double* %0, double** %8
store double* %1, double** %9
store double* %2, double** %10
store i64 %3, i64* %11
store i64 %4, i64* %12
store i64 %5, i64* %13
store i64 %6, i64* %14
store i64 0, i64* %16
br label %18
18: ; preds = %54, %7
%19 = load i64, i64* %16
%20 = load i64, i64* %13
%21 = icmp slt i64 %19, %20
br i1 %21, label %22, label %57
22: ; preds = %18
store i64 0, i64* %15
br label %23
23: ; preds = %50, %22
%24 = load i64, i64* %15
%25 = load i64, i64* %12
%26 = icmp slt i64 %24, %25
br i1 %26, label %27, label %53
27: ; preds = %23
%28 = load double*, double** %9
%29 = load i64, i64* %16
%30 = load i64, i64* %15
%31 = load i64, i64* %14
%32 = mul nsw i64 %30, %31
%33 = add nsw i64 %29, %32
%34 = getelementptr inbounds double, double* %28, i64 %33
%35 = load double, double* %34
%36 = fneg double %35
store double %36, double* %17
%37 = load double*, double** %10
%38 = load i64, i64* %15
%39 = load i64, i64* %14
%40 = mul nsw i64 %38, %39
%41 = getelementptr inbounds double, double* %37, i64 %40
%42 = load double*, double** %8
%43 = load i64, i64* %16
%44 = load i64, i64* %14
%45 = mul nsw i64 %43, %44
%46 = getelementptr inbounds double, double* %42, i64 %45
%47 = load i64, i64* %11
%48 = load double, double* %17
%49 = call i32 @daxpy(double* %41, double* %46, i64 %47, double %48)
br label %50
50: ; preds = %27
%51 = load i64, i64* %15
%52 = add nsw i64 %51, 1
store i64 %52, i64* %15
br label %23
53: ; preds = %23
br label %54
54: ; preds = %53
%55 = load i64, i64* %16
%56 = add nsw i64 %55, 1
store i64 %56, i64* %16
br label %18
57: ; preds = %18
ret void
}

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