#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*/ scanf(char *, int *);
void main() {
  int n;
  printf("Informe a dimensao da matriz: ");
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) {
        printf("+");
      } else {
        printf("*");
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c0 <main+0xa0>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a6 <main+0x86>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1187 <main+0x67>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
jmp    1193 <main+0x73>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
jmp    1198 <main+0x78>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115e <main+0x3e>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114b <main+0x2b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    119b <main+0x6b>
xor    %ebx,%ebx
jmp    1175 <main+0x45>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%eax
cmp    %eax,%ebx
jge    119b <main+0x6b>
test   %eax,%eax
jle    1160 <main+0x30>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
cmp    %ebp,%ebx
sete   %dil
or     $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     1180 <main+0x50>
jmp    1160 <main+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Informe a dimensao da matriz: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"+\00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
store i32 0, i32* %2
br label %6
6: ; preds = %29, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %1
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %32
10: ; preds = %6
store i32 0, i32* %3
br label %11
11: ; preds = %24, %10
%12 = load i32, i32* %3
%13 = load i32, i32* %1
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %27
15: ; preds = %11
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %23
21: ; preds = %15
%22 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
br label %24
24: ; preds = %23
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %11
27: ; preds = %11
%28 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %29
29: ; preds = %27
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %6
32: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Informe a dimensao da matriz: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %0, %12
%8 = phi i32 [ %15, %12 ], [ %5, %0 ]
%9 = phi i32 [ %14, %12 ], [ 0, %0 ]
%10 = icmp sgt i32 %8, 0
br i1 %10, label %17, label %12
11: ; preds = %12, %0
ret void
12: ; preds = %17, %7
%13 = call i32 @putchar(i32 10)
%14 = add nuw nsw i32 %9, 1
%15 = load i32, i32* %1
%16 = icmp slt i32 %14, %15
br i1 %16, label %7, label %11
17: ; preds = %7, %17
%18 = phi i32 [ %22, %17 ], [ 0, %7 ]
%19 = icmp eq i32 %9, %18
%20 = select i1 %19, i32 43, i32 42
%21 = call i32 @putchar(i32 %20)
%22 = add nuw nsw i32 %18, 1
%23 = load i32, i32* %1
%24 = icmp slt i32 %22, %23
br i1 %24, label %17, label %12
}