#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*/ printf(char *, ...);
int main() {
  int matrix[5][5];
  int vec[5];
  int i, j;
  int prod[5];
  for (i = 0; i < 5; i++) {
    for (j = 0; j < 5; j++) {
      matrix[i][j] = 1;
    }
  }
  for (j = 0; j < 5; j++) {
    vec[j] = 1;
  }
#pragma omp parallel for private(i)
  for (i = 0; i < 5; i++) {
    int temp_sum = 0;
#pragma omp parallel for reduction(+ : temp_sum)
    for (j = 0; j < 5; j++) {
      temp_sum += matrix[i][j] * vec[j];
    }
    prod[i] = temp_sum;
  }
  printf("The product array is: \n");
  for (i = 0; i < 5; i++) {
    printf("%d\t", prod[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x94(%rbp)
cmpl   $0x5,-0x94(%rbp)
jge    119d <main+0x8d>
movl   $0x0,-0x98(%rbp)
cmpl   $0x5,-0x98(%rbp)
jge    1184 <main+0x74>
movslq -0x94(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x98(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    1143 <main+0x33>
jmp    1189 <main+0x79>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    112c <main+0x1c>
movl   $0x0,-0x98(%rbp)
cmpl   $0x5,-0x98(%rbp)
jge    11da <main+0xca>
movslq -0x98(%rbp),%rax
movl   $0x1,-0x90(%rbp,%rax,4)
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    11a7 <main+0x97>
movl   $0x0,-0x94(%rbp)
cmpl   $0x5,-0x94(%rbp)
jge    1285 <main+0x175>
movl   $0x0,-0xb4(%rbp)
movl   $0x0,-0x98(%rbp)
cmpl   $0x5,-0x98(%rbp)
jge    125d <main+0x14d>
movslq -0x94(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x98(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
movslq -0x98(%rbp),%rcx
imul   -0x90(%rbp,%rcx,4),%eax
ff
add    -0xb4(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    1205 <main+0xf5>
mov    -0xb4(%rbp),%ecx
movslq -0x94(%rbp),%rax
mov    %ecx,-0xb0(%rbp,%rax,4)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    11e4 <main+0xd4>
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x94(%rbp)
cmpl   $0x5,-0x94(%rbp)
jge    12da <main+0x1ca>
movslq -0x94(%rbp),%rax
mov    -0xb0(%rbp,%rax,4),%esi
lea    0xd59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    129d <main+0x18d>
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xecc(%rip),%rdi
call   1040 <puts@plt>
lea    0xebc(%rip),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"The product array is: \0A\00"
@.str.1 = [4 x i8] c"%d\09\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [5 x i32]]
%3 = alloca [5 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca [5 x i32]
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %8
8: ; preds = %26, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 5
br i1 %10, label %11, label %29
11: ; preds = %8
store i32 0, i32* %5
br label %12
12: ; preds = %22, %11
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 5
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 %17
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %18, i64 0, i64 %20
store i32 1, i32* %21
br label %22
22: ; preds = %15
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %12
25: ; preds = %12
br label %26
26: ; preds = %25
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %8
29: ; preds = %8
store i32 0, i32* %5
br label %30
30: ; preds = %37, %29
%31 = load i32, i32* %5
%32 = icmp slt i32 %31, 5
br i1 %32, label %33, label %40
33: ; preds = %30
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %35
store i32 1, i32* %36
br label %37
37: ; preds = %33
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %30
40: ; preds = %30
store i32 0, i32* %4
br label %41
41: ; preds = %71, %40
%42 = load i32, i32* %4
%43 = icmp slt i32 %42, 5
br i1 %43, label %44, label %74
44: ; preds = %41
store i32 0, i32* %7
store i32 0, i32* %5
br label %45
45: ; preds = %63, %44
%46 = load i32, i32* %5
%47 = icmp slt i32 %46, 5
br i1 %47, label %48, label %66
48: ; preds = %45
%49 = load i32, i32* %4
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 %50
%52 = load i32, i32* %5
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [5 x i32], [5 x i32]* %51, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = load i32, i32* %5
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %57
%59 = load i32, i32* %58
%60 = mul nsw i32 %55, %59
%61 = load i32, i32* %7
%62 = add nsw i32 %61, %60
store i32 %62, i32* %7
br label %63
63: ; preds = %48
%64 = load i32, i32* %5
%65 = add nsw i32 %64, 1
store i32 %65, i32* %5
br label %45
66: ; preds = %45
%67 = load i32, i32* %7
%68 = load i32, i32* %4
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %69
store i32 %67, i32* %70
br label %71
71: ; preds = %66
%72 = load i32, i32* %4
%73 = add nsw i32 %72, 1
store i32 %73, i32* %4
br label %41
74: ; preds = %41
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %76
76: ; preds = %85, %74
%77 = load i32, i32* %4
%78 = icmp slt i32 %77, 5
br i1 %78, label %79, label %88
79: ; preds = %76
%80 = load i32, i32* %4
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %81
%83 = load i32, i32* %82
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %83)
br label %85
85: ; preds = %79
%86 = load i32, i32* %4
%87 = add nsw i32 %86, 1
store i32 %87, i32* %4
br label %76
88: ; preds = %76
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\09\00"
@str = [23 x i8] c"The product array is: \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 5)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 5)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 5)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 5)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 5)
%7 = tail call i32 @putchar(i32 10)
ret i32 0
}