#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 matrixSize = 2;
  int matrixA[2][2];
  matrixA[0][0] = 1;
  matrixA[0][1] = 3;
  matrixA[1][0] = 2;
  matrixA[1][1] = 6;
  int matrixB[2][2] = {{4, 2}, {3, 5}};
  int matrixResult[2][2] = {{0, 0}, {0, 0}};
  for (int x = 0; x < matrixSize; x++) {
    for (int y = 0; y < matrixSize; y++) {
      int tmpSum = 0;
      for (int z = 0; z < matrixSize; z++) {
        tmpSum += matrixA[x][z] * matrixB[z][y];
      }
      printf("%i ", tmpSum);
      matrixResult[x][y] = tmpSum;
    }
    printf("\n");
  }
  for (int x; x < matrixSize; x++) {
    for (int y; y < matrixSize; y++) {
      printf("%i ", matrixResult[x][y]);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x3,-0x1c(%rbp)
movl   $0x2,-0x18(%rbp)
movl   $0x6,-0x14(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    124d <main+0x12d>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1231 <main+0x111>
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f9 <main+0xd9>
movslq -0x44(%rbp),%rcx
lea    -0x20(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x50(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
movslq -0x50(%rbp),%rdx
lea    -0x30(%rbp),%rcx
shl    $0x3,%rdx
add    %rdx,%rcx
movslq -0x48(%rbp),%rdx
imul   (%rcx,%rdx,4),%eax
add    -0x4c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    11ac <main+0x8c>
mov    -0x4c(%rbp),%esi
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4c(%rbp),%edx
movslq -0x44(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x48(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1192 <main+0x72>
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    117f <main+0x5f>
jmp    1252 <main+0x132>
mov    -0x54(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12bd <main+0x19d>
jmp    1263 <main+0x143>
mov    -0x58(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12a1 <main+0x181>
movslq -0x54(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1263 <main+0x143>
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1252 <main+0x132>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xd,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x1a,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x22,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i \00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 13)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 17)
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 26)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 34)
%6 = tail call i32 @putchar(i32 10)
ret i32 0
}