#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*/ getch();
int /*<<< orphan*/ mult(int *, int *, int **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int A[3 * (3 + 1) / 2], B[3 * (3 + 1) / 2], C[3 * (3 + 1) / 2][3];
  int i, j;
  printf("Please input array A:\n");
  for (i = 0; i < 3 * (3 + 1) / 2; i++) {
    scanf("%d", &A[i]);
  }
  printf("Please input array B:\n");
  for (i = 0; i < 3 * (3 + 1) / 2; i++) {
    scanf("%d", &B[i]);
  }
  mult(A, B, C);
  printf("\nThe result of A*B is:\n");
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      printf("%d  ", C[i][j]);
    }
    printf("\n");
  }
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x94(%rbp)
cmpl   $0x6,-0x94(%rbp)
jge    11a2 <main+0x62>
movslq -0x94(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe8e(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1163 <main+0x23>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x94(%rbp)
cmpl   $0x6,-0x94(%rbp)
jge    11f9 <main+0xb9>
movslq -0x94(%rbp),%rax
lea    -0x40(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe37(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    11ba <main+0x7a>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   1040 <mult@plt>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x94(%rbp)
cmpl   $0x3,-0x94(%rbp)
jge    12ac <main+0x16c>
movl   $0x0,-0x98(%rbp)
cmpl   $0x3,-0x98(%rbp)
jge    128a <main+0x14a>
movslq -0x94(%rbp),%rcx
lea    -0x90(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x98(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    123c <main+0xfc>
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1225 <main+0xe5>
mov    $0x0,%al
call   1060 <getch@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
lea    0xe95(%rip),%rdi
call   1040 <puts@plt>
lea    0xe81(%rip),%rbx
lea    0x20(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <scanf@plt>
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x2c(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x34(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xe47(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x40(%rsp),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <mult@plt>
lea    0xdf2(%rip),%rdi
call   1040 <puts@plt>
mov    0x40(%rsp),%esi
lea    0xdb1(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x44(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x48(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x50(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x54(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x58(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x5c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x60(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1080 <getch@plt>
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Please input array A:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Please input array B:\0A\00"
@.str.3 = [24 x i8] c"\0AThe result of A*B is:\0A\00"
@.str.4 = [5 x i8] c"%d \00"
@.str.5 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca [6 x i32]
%2 = alloca [6 x i32]
%3 = alloca [6 x [3 x i32]]
%4 = alloca i32
%5 = alloca i32
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 6
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
br label %15
15: ; preds = %10
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
br label %7
18: ; preds = %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %20
20: ; preds = %28, %18
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 6
br i1 %22, label %23, label %31
23: ; preds = %20
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %25
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %26)
br label %28
28: ; preds = %23
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %20
31: ; preds = %20
%32 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%33 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%34 = getelementptr inbounds [6 x [3 x i32]], [6 x [3 x i32]]* %3, i64 0, i64 0
%35 = bitcast [3 x i32]* %34 to i32**
%36 = call i32 @mult(i32* %32, i32* %33, i32** %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %4
br label %38
38: ; preds = %59, %31
%39 = load i32, i32* %4
%40 = icmp slt i32 %39, 3
br i1 %40, label %41, label %62
41: ; preds = %38
store i32 0, i32* %5
br label %42
42: ; preds = %54, %41
%43 = load i32, i32* %5
%44 = icmp slt i32 %43, 3
br i1 %44, label %45, label %57
45: ; preds = %42
%46 = load i32, i32* %4
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [6 x [3 x i32]], [6 x [3 x i32]]* %3, i64 0, i64 %47
%49 = load i32, i32* %5
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [3 x i32], [3 x i32]* %48, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %52)
br label %54
54: ; preds = %45
%55 = load i32, i32* %5
%56 = add nsw i32 %55, 1
store i32 %56, i32* %5
br label %42
57: ; preds = %42
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %59
59: ; preds = %57
%60 = load i32, i32* %4
%61 = add nsw i32 %60, 1
store i32 %61, i32* %4
br label %38
62: ; preds = %38
%63 = call i32 (...) @getch()
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [5 x i8] c"%d \00"
@str = [22 x i8] c"Please input array A:\00"
@str.6 = [22 x i8] c"Please input array B:\00"
@str.7 = [23 x i8] c"\0AThe result of A*B is:\00"
define void @main() {
%1 = alloca [6 x i32]
%2 = alloca [6 x i32]
%3 = alloca [6 x [3 x i32]]
%4 = bitcast [6 x i32]* %1 to i8*
%5 = bitcast [6 x i32]* %2 to i8*
%6 = bitcast [6 x [3 x i32]]* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%8 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 1
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 2
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 3
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 4
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 5
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.6, i64 0, i64 0))
%21 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %21)
%23 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 1
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %23)
%25 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 2
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %25)
%27 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 3
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %27)
%29 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 4
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %29)
%31 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 5
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %31)
%33 = bitcast [6 x [3 x i32]]* %3 to i32**
%34 = call i32 @mult(i32* %8, i32* %21, i32** %33)
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.7, i64 0, i64 0))
%36 = getelementptr inbounds [6 x [3 x i32]], [6 x [3 x i32]]* %3, i64 0, i64 0, i64 0
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds [6 x [3 x i32]], [6 x [3 x i32]]* %3, i64 0, i64 0, i64 1
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds [6 x [3 x i32]], [6 x [3 x i32]]* %3, i64 0, i64 0, i64 2
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %43)
%45 = call i32 @putchar(i32 10)
%46 = getelementptr inbounds [6 x [3 x i32]], [6 x [3 x i32]]* %3, i64 0, i64 1, i64 0
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [6 x [3 x i32]], [6 x [3 x i32]]* %3, i64 0, i64 1, i64 1
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %50)
%52 = getelementptr inbounds [6 x [3 x i32]], [6 x [3 x i32]]* %3, i64 0, i64 1, i64 2
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %53)
%55 = call i32 @putchar(i32 10)
%56 = getelementptr inbounds [6 x [3 x i32]], [6 x [3 x i32]]* %3, i64 0, i64 2, i64 0
%57 = load i32, i32* %56
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %57)
%59 = getelementptr inbounds [6 x [3 x i32]], [6 x [3 x i32]]* %3, i64 0, i64 2, i64 1
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %60)
%62 = getelementptr inbounds [6 x [3 x i32]], [6 x [3 x i32]]* %3, i64 0, i64 2, i64 2
%63 = load i32, i32* %62
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %63)
%65 = call i32 @putchar(i32 10)
%66 = call i32 (...) @getch()
ret void
}