#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 /*<<< orphan*/ puts(char *);
int sqrt(int);
void bayesianNetPrintSquereMatrix(int *matrix, int numMatrix) {
  int width = sqrt(numMatrix);
  int i, j;
  puts("--------------");
  printf("  ");
  for (i = 0; i < width; i++) {
    printf("%c ", 'A' + i);
  }
  puts("");
  for (i = 0; i < width; i++) {
    printf("%c ", 'A' + i);
    for (j = 0; j < width; j++) {
      printf("%d ", matrix[i * width + j]);
    }
    puts("");
  }
  puts("--------------");
}


x86 assembly (clang, -O0):
<bayesianNetPrintSquereMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,-0x10(%rbp)
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1199 <bayesianNetPrintSquereMatrix+0x69>
mov    -0x14(%rbp),%esi
add    $0x41,%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116b <bayesianNetPrintSquereMatrix+0x3b>
lea    0xe71(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1229 <bayesianNetPrintSquereMatrix+0xf9>
mov    -0x14(%rbp),%esi
add    $0x41,%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    120f <bayesianNetPrintSquereMatrix+0xdf>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11d3 <bayesianNetPrintSquereMatrix+0xa3>
lea    0xdfb(%rip),%rdi
call   1030 <puts@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ac <bayesianNetPrintSquereMatrix+0x7c>
lea    0xdd0(%rip),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bayesianNetPrintSquereMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %esi,%edi
call   1060 <sqrt@plt>
mov    %eax,%r14d
lea    0xea1(%rip),%rdi
call   1040 <puts@plt>
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14d,%r14d
jle    122f <bayesianNetPrintSquereMatrix+0xef>
mov    %r14d,%r12d
neg    %r12d
mov    $0x41,%ebp
lea    0xe85(%rip),%r15
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    (%r12,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x41,%eax
jne    1190 <bayesianNetPrintSquereMatrix+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    1239 <bayesianNetPrintSquereMatrix+0xf9>
mov    %r14d,%ebp
lea    0x0(,%rbp,4),%r12
lea    0xe46(%rip),%r15
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x41(%r13),%esi
lea    0xe27(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rbx,%r14,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbp
jne    1200 <bayesianNetPrintSquereMatrix+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    %r12,%rbx
cmp    %rbp,%r13
jne    11e0 <bayesianNetPrintSquereMatrix+0xa0>
jmp    1239 <bayesianNetPrintSquereMatrix+0xf9>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdc0(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"--------------\00"
@.str.1 = [3 x i8] c" \00"
@.str.2 = [4 x i8] c"%c \00"
@.str.4 = [4 x i8] c"%d \00"
define void @bayesianNetPrintSquereMatrix(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @sqrt(i32 %1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp sgt i32 %3, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @putchar(i32 10)
br label %38
9: ; preds = %2, %9
%10 = phi i32 [ %13, %9 ], [ 0, %2 ]
%11 = add nuw nsw i32 %10, 65
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = add nuw nsw i32 %10, 1
%14 = icmp eq i32 %13, %3
br i1 %14, label %15, label %9
15: ; preds = %9
%16 = tail call i32 @putchar(i32 10)
br i1 %6, label %17, label %38
17: ; preds = %15
%18 = zext i32 %3 to i64
%19 = zext i32 %3 to i64
br label %20
20: ; preds = %34, %17
%21 = phi i64 [ 0, %17 ], [ %36, %34 ]
%22 = trunc i64 %21 to i32
%23 = add i32 %22, 65
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = mul nsw i64 %21, %18
br label %26
26: ; preds = %20, %26
%27 = phi i64 [ 0, %20 ], [ %32, %26 ]
%28 = add nuw nsw i64 %27, %25
%29 = getelementptr inbounds i32, i32* %0, i64 %28
%30 = load i32, i32* %29
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %30)
%32 = add nuw nsw i64 %27, 1
%33 = icmp eq i64 %32, %19
br i1 %33, label %34, label %26
34: ; preds = %26
%35 = tail call i32 @putchar(i32 10)
%36 = add nuw nsw i64 %21, 1
%37 = icmp eq i64 %36, %19
br i1 %37, label %38, label %20
38: ; preds = %34, %7, %15
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}