#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__ fabs(double);
double *generate_zero_vector(int);
double *multiply_abs_double_vector_matrix(double *b, double **a, int m, int n) {
  double *c = generate_zero_vector(n + 1);
  int i, j;
  for (j = 1; j <= n; j++) {
    c[j] = 0.0;
    for (i = 1; i <= m; i++) {
      c[j] += fabs(b[i] * a[i][j]);
    }
  }
  return c;
}


x86 assembly (clang, -O0):
<multiply_abs_double_vector_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%edi
add    $0x1,%edi
call   1040 <generate_zero_vector@plt>
mov    %rax,-0x20(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11da <multiply_abs_double_vector_matrix+0xba>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11c7 <multiply_abs_double_vector_matrix+0xa7>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %rax,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116f <multiply_abs_double_vector_matrix+0x4f>
jmp    11cc <multiply_abs_double_vector_matrix+0xac>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    114c <multiply_abs_double_vector_matrix+0x2c>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiply_abs_double_vector_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,%ebp
mov    %rdx,0x8(%rsp)
mov    %rsi,%r15
mov    %rdi,%r12
lea    0x1(%rbp),%r14d
mov    %r14d,%edi
call   1040 <generate_zero_vector@plt>
mov    %rax,%rbx
test   %ebp,%ebp
jle    1262 <multiply_abs_double_vector_matrix+0x142>
mov    0x8(%rsp),%rax
add    $0x1,%eax
mov    %r14d,%ecx
mov    %rcx,0x20(%rsp)
mov    %rax,0x18(%rsp)
lea    -0x1(%rax),%r13
mov    %r13,%rax
mov    %r13,0x10(%rsp)
and    $0xfffffffffffffffe,%r13
neg    %r13
mov    $0x1,%r14d
jmp    119f <multiply_abs_double_vector_matrix+0x7f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r14
cmp    0x20(%rsp),%r14
je     1262 <multiply_abs_double_vector_matrix+0x142>
movq   $0x0,(%rbx,%r14,8)
cmpl   $0x0,0x8(%rsp)
jle    1190 <multiply_abs_double_vector_matrix+0x70>
mov    $0x1,%ebp
cmpl   $0x2,0x18(%rsp)
je     1229 <multiply_abs_double_vector_matrix+0x109>
mov    $0x1,%ebp
nop
movsd  (%r12,%rbp,8),%xmm0
mov    (%r15,%rbp,8),%rax
mulsd  (%rax,%r14,8),%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rbx,%r14,8),%xmm0
movsd  %xmm0,(%rbx,%r14,8)
movsd  0x8(%r12,%rbp,8),%xmm0
mov    0x8(%r15,%rbp,8),%rax
mulsd  (%rax,%r14,8),%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rbx,%r14,8),%xmm0
movsd  %xmm0,(%rbx,%r14,8)
lea    0x2(,%rbp,1),%rax
add    %r13,%rax
add    $0x2,%rbp
cmp    $0x1,%rax
jne    11c0 <multiply_abs_double_vector_matrix+0xa0>
testb  $0x1,0x10(%rsp)
je     1190 <multiply_abs_double_vector_matrix+0x70>
movsd  (%r12,%rbp,8),%xmm0
mov    (%r15,%rbp,8),%rax
mulsd  (%rax,%r14,8),%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rbx,%r14,8),%xmm0
movsd  %xmm0,(%rbx,%r14,8)
jmp    1190 <multiply_abs_double_vector_matrix+0x70>
mov    %rbx,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define double* @multiply_abs_double_vector_matrix(double* nocapture %0, double** nocapture %1, i32 %2, i32 %3) {
%5 = add i32 %3, 1
%6 = tail call double* @generate_zero_vector(i32 %5)
%7 = icmp slt i32 %3, 1
br i1 %7, label %68, label %8
8: ; preds = %4
%9 = icmp slt i32 %2, 1
%10 = add i32 %2, 1
%11 = zext i32 %5 to i64
%12 = zext i32 %10 to i64
%13 = add nsw i64 %12, -1
%14 = and i64 %13, 1
%15 = icmp eq i32 %10, 2
%16 = and i64 %13, -2
%17 = icmp eq i64 %14, 0
br label %18
18: ; preds = %8, %65
%19 = phi i64 [ 1, %8 ], [ %66, %65 ]
%20 = getelementptr inbounds double, double* %6, i64 %19
store double 0.000000e+00, double* %20
br i1 %9, label %65, label %21
21: ; preds = %18
br i1 %15, label %51, label %22
22: ; preds = %21, %22
%23 = phi i64 [ %48, %22 ], [ 1, %21 ]
%24 = phi i64 [ %49, %22 ], [ 0, %21 ]
%25 = getelementptr inbounds double, double* %0, i64 %23
%26 = load double, double* %25
%27 = getelementptr inbounds double*, double** %1, i64 %23
%28 = load double*, double** %27
%29 = getelementptr inbounds double, double* %28, i64 %19
%30 = load double, double* %29
%31 = fmul double %26, %30
%32 = tail call i64 @fabs(double %31)
%33 = sitofp i64 %32 to double
%34 = load double, double* %20
%35 = fadd double %34, %33
store double %35, double* %20
%36 = add nuw nsw i64 %23, 1
%37 = getelementptr inbounds double, double* %0, i64 %36
%38 = load double, double* %37
%39 = getelementptr inbounds double*, double** %1, i64 %36
%40 = load double*, double** %39
%41 = getelementptr inbounds double, double* %40, i64 %19
%42 = load double, double* %41
%43 = fmul double %38, %42
%44 = tail call i64 @fabs(double %43)
%45 = sitofp i64 %44 to double
%46 = load double, double* %20
%47 = fadd double %46, %45
store double %47, double* %20
%48 = add nuw nsw i64 %23, 2
%49 = add i64 %24, 2
%50 = icmp eq i64 %49, %16
br i1 %50, label %51, label %22
51: ; preds = %22, %21
%52 = phi i64 [ 1, %21 ], [ %48, %22 ]
br i1 %17, label %65, label %53
53: ; preds = %51
%54 = getelementptr inbounds double, double* %0, i64 %52
%55 = load double, double* %54
%56 = getelementptr inbounds double*, double** %1, i64 %52
%57 = load double*, double** %56
%58 = getelementptr inbounds double, double* %57, i64 %19
%59 = load double, double* %58
%60 = fmul double %55, %59
%61 = tail call i64 @fabs(double %60)
%62 = sitofp i64 %61 to double
%63 = load double, double* %20
%64 = fadd double %63, %62
store double %64, double* %20
br label %65
65: ; preds = %53, %51, %18
%66 = add nuw nsw i64 %19, 1
%67 = icmp eq i64 %66, %11
br i1 %67, label %68, label %18
68: ; preds = %65, %4
ret double* %6
}