#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__ u_calloc(int, int, char *, int, char *);
void multi_rectv(double *au_1, int *irow_1, int *jq_1, int n_1, int m_1,
                 double *b, double **v_rp) {
  int i, j;
  double *v_r = NULL;
  v_r = (double *)u_calloc(
      (m_1), sizeof(double),
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/prool/ccx_prool/refs/heads/master/CalculiX/"
      "ccx_2.17/src/multi_rectv.c",
      45, "v_r");
  for (j = 0; j < m_1; j++) {
    for (i = jq_1[j] - 1; i < jq_1[j + 1] - 1; i++) {
      v_r[j] += au_1[i] * b[irow_1[i] - 1];
    }
  }
  *v_rp = v_r;
  return;
}


x86 assembly (clang, -O0):
<multi_rectv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x20(%rbp),%edi
mov    $0x8,%esi
lea    0xeb6(%rip),%rdx
mov    $0x2d,%ecx
lea    0xf4a(%rip),%r8
call   1030 <u_calloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1203 <multi_rectv+0xf3>
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    -0x30(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11f0 <multi_rectv+0xe0>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x38(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1183 <multi_rectv+0x73>
jmp    11f5 <multi_rectv+0xe5>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1166 <multi_rectv+0x56>
mov    -0x38(%rbp),%rcx
mov    0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multi_rectv>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r15
mov    %r8d,%ebp
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%rbx
mov    0x40(%rsp),%r13
lea    0xeca(%rip),%rdx
lea    0xf63(%rip),%r8
mov    %ebp,%edi
mov    $0x8,%esi
mov    $0x2d,%ecx
call   1030 <u_calloc@plt>
test   %ebp,%ebp
jle    1221 <multi_rectv+0x111>
mov    %ebp,%r8d
mov    (%r14),%r10d
xor    %r9d,%r9d
jmp    1179 <multi_rectv+0x69>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %r8,%r9
je     1221 <multi_rectv+0x111>
mov    %r9,%rdi
mov    %r10d,%edx
add    $0x1,%r9
mov    0x4(%r14,%rdi,4),%r10d
cmp    %r10d,%edx
jge    1170 <multi_rectv+0x60>
lea    -0x1(%r10),%r11d
lea    -0x1(%rdx),%ecx
movslq %ecx,%rbp
cmp    %r11d,%edx
mov    %r11d,%esi
cmovg  %edx,%esi
movsd  (%rax,%rdi,8),%xmm0
mov    %esi,%ecx
sub    %edx,%ecx
add    $0x1,%ecx
test   $0x1,%cl
je     11ce <multi_rectv+0xbe>
movsd  (%rbx,%rbp,8),%xmm1
movslq (%r12,%rbp,4),%rcx
mulsd  -0x8(%r15,%rcx,8),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rdi,8)
add    $0x1,%rbp
cmp    %r11d,%edx
jge    1170 <multi_rectv+0x60>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rbx,%rbp,8),%xmm1
movslq (%r12,%rbp,4),%rcx
mulsd  -0x8(%r15,%rcx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rax,%rdi,8)
movsd  0x8(%rbx,%rbp,8),%xmm0
movslq 0x4(%r12,%rbp,4),%rcx
mulsd  -0x8(%r15,%rcx,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rdi,8)
add    $0x2,%rbp
cmp    %ebp,%esi
jne    11e0 <multi_rectv+0xd0>
jmp    1170 <multi_rectv+0x60>
mov    %rax,0x0(%r13)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/prool/ccx_prool/refs/heads/master/CalculiX/ccx_2.17/src/multi_rectv.c\00"
@.str.1 = [4 x i8] c"v_r\00"
define void @multi_rectv(double* %0, i32* %1, i32* %2, i32 %3, i32 %4, double* %5, double** %6) {
%8 = alloca double*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca double*
%14 = alloca double**
%15 = alloca i32
%16 = alloca i32
%17 = alloca double*
store double* %0, double** %8
store i32* %1, i32** %9
store i32* %2, i32** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store double* %5, double** %13
store double** %6, double*** %14
store double* null, double** %17
%18 = load i32, i32* %12
%19 = call i64 @u_calloc(i32 %18, i32 8, i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%20 = inttoptr i64 %19 to double*
store double* %20, double** %17
store i32 0, i32* %16
br label %21
21: ; preds = %68, %7
%22 = load i32, i32* %16
%23 = load i32, i32* %12
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %71
25: ; preds = %21
%26 = load i32*, i32** %10
%27 = load i32, i32* %16
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
%30 = load i32, i32* %29
%31 = sub nsw i32 %30, 1
store i32 %31, i32* %15
br label %32
32: ; preds = %64, %25
%33 = load i32, i32* %15
%34 = load i32*, i32** %10
%35 = load i32, i32* %16
%36 = add nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %34, i64 %37
%39 = load i32, i32* %38
%40 = sub nsw i32 %39, 1
%41 = icmp slt i32 %33, %40
br i1 %41, label %42, label %67
42: ; preds = %32
%43 = load double*, double** %8
%44 = load i32, i32* %15
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
%47 = load double, double* %46
%48 = load double*, double** %13
%49 = load i32*, i32** %9
%50 = load i32, i32* %15
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %49, i64 %51
%53 = load i32, i32* %52
%54 = sub nsw i32 %53, 1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %48, i64 %55
%57 = load double, double* %56
%58 = load double*, double** %17
%59 = load i32, i32* %16
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %58, i64 %60
%62 = load double, double* %61
%63 = call double @llvm.fmuladd.f64(double %47, double %57, double %62)
store double %63, double* %61
br label %64
64: ; preds = %42
%65 = load i32, i32* %15
%66 = add nsw i32 %65, 1
store i32 %66, i32* %15
br label %32
67: ; preds = %32
br label %68
68: ; preds = %67
%69 = load i32, i32* %16
%70 = add nsw i32 %69, 1
store i32 %70, i32* %16
br label %21
71: ; preds = %21
%72 = load double*, double** %17
%73 = load double**, double*** %14
store double* %72, double** %73
ret void
}

LLVM IR (-O2):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/prool/ccx_prool/refs/heads/master/CalculiX/ccx_2.17/src/multi_rectv.c\00"
@.str.1 = [4 x i8] c"v_r\00"
define void @multi_rectv(double* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32 %3, i32 %4, double* nocapture %5, double** nocapture writeonly %6) {
%8 = tail call i64 @u_calloc(i32 %4, i32 8, i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = inttoptr i64 %8 to double*
%10 = icmp sgt i32 %4, 0
br i1 %10, label %11, label %74
11: ; preds = %7
%12 = zext i32 %4 to i64
%13 = load i32, i32* %2
br label %16
14: ; preds = %45, %49, %16
%15 = icmp eq i64 %19, %12
br i1 %15, label %74, label %16
16: ; preds = %11, %14
%17 = phi i32 [ %13, %11 ], [ %21, %14 ]
%18 = phi i64 [ 0, %11 ], [ %19, %14 ]
%19 = add nuw nsw i64 %18, 1
%20 = getelementptr inbounds i32, i32* %2, i64 %19
%21 = load i32, i32* %20
%22 = icmp slt i32 %17, %21
br i1 %22, label %23, label %14
23: ; preds = %16
%24 = add nsw i32 %21, -1
%25 = add i32 %17, -1
%26 = getelementptr inbounds double, double* %9, i64 %18
%27 = sext i32 %25 to i64
%28 = call i32 @llvm.smax.i32(i32 %17, i32 %24)
%29 = load double, double* %26
%30 = add i32 %28, 1
%31 = sub i32 %30, %17
%32 = and i32 %31, 1
%33 = icmp eq i32 %32, 0
br i1 %33, label %45, label %34
34: ; preds = %23
%35 = getelementptr inbounds double, double* %0, i64 %27
%36 = load double, double* %35
%37 = getelementptr inbounds i32, i32* %1, i64 %27
%38 = load i32, i32* %37
%39 = add nsw i32 %38, -1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %5, i64 %40
%42 = load double, double* %41
%43 = tail call double @llvm.fmuladd.f64(double %36, double %42, double %29)
store double %43, double* %26
%44 = add nsw i64 %27, 1
br label %45
45: ; preds = %34, %23
%46 = phi double [ %29, %23 ], [ %43, %34 ]
%47 = phi i64 [ %27, %23 ], [ %44, %34 ]
%48 = icmp slt i32 %17, %24
br i1 %48, label %49, label %14
49: ; preds = %45, %49
%50 = phi double [ %70, %49 ], [ %46, %45 ]
%51 = phi i64 [ %71, %49 ], [ %47, %45 ]
%52 = getelementptr inbounds double, double* %0, i64 %51
%53 = load double, double* %52
%54 = getelementptr inbounds i32, i32* %1, i64 %51
%55 = load i32, i32* %54
%56 = add nsw i32 %55, -1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %5, i64 %57
%59 = load double, double* %58
%60 = tail call double @llvm.fmuladd.f64(double %53, double %59, double %50)
store double %60, double* %26
%61 = add nsw i64 %51, 1
%62 = getelementptr inbounds double, double* %0, i64 %61
%63 = load double, double* %62
%64 = getelementptr inbounds i32, i32* %1, i64 %61
%65 = load i32, i32* %64
%66 = add nsw i32 %65, -1
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %5, i64 %67
%69 = load double, double* %68
%70 = tail call double @llvm.fmuladd.f64(double %63, double %69, double %60)
store double %70, double* %26
%71 = add nsw i64 %51, 2
%72 = trunc i64 %71 to i32
%73 = icmp eq i32 %28, %72
br i1 %73, label %14, label %49
74: ; preds = %14, %7
store double* %9, double** %6
ret void
}