#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int iaMat[100][100], iRow, iCol, i, j;
  printf("\nEnter the order of the matrix\n");
  scanf("%d%d", &iRow, &iCol);
  if (iRow != iCol) {
    printf("\nMatrix should be a Square Matrix\n");
    exit(0);
  }
  for (i = 0; i < iRow; i++) {
    for (j = 0; j < iCol; j++) {
      if (i + j < iRow - 1)
        iaMat[i][j] = 1;
      else if (i + j == iRow - 1)
        iaMat[i][j] = 0;
      else
        iaMat[i][j] = -1;
    }
  }
  printf("\nMatrix \n");
  for (i = 0; i < iRow; i++) {
    for (j = 0; j < iCol; j++) {
      printf("%2d\t", iaMat[i][j]);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9c60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x9c54(%rbp),%rsi
lea    -0x9c58(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x9c54(%rbp),%eax
cmp    -0x9c58(%rbp),%eax
je     1191 <main+0x61>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
movl   $0x0,-0x9c5c(%rbp)
mov    -0x9c5c(%rbp),%eax
cmp    -0x9c54(%rbp),%eax
jge    12b6 <main+0x186>
movl   $0x0,-0x9c60(%rbp)
mov    -0x9c60(%rbp),%eax
cmp    -0x9c58(%rbp),%eax
jge    129d <main+0x16d>
mov    -0x9c5c(%rbp),%eax
add    -0x9c60(%rbp),%eax
mov    -0x9c54(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1211 <main+0xe1>
movslq -0x9c5c(%rbp),%rcx
lea    -0x9c50(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x9c60(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    1284 <main+0x154>
mov    -0x9c5c(%rbp),%eax
add    -0x9c60(%rbp),%eax
mov    -0x9c54(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1259 <main+0x129>
movslq -0x9c5c(%rbp),%rcx
lea    -0x9c50(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x9c60(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    127f <main+0x14f>
movslq -0x9c5c(%rbp),%rcx
lea    -0x9c50(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x9c60(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
jmp    1284 <main+0x154>
jmp    1289 <main+0x159>
mov    -0x9c60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c60(%rbp)
jmp    11b7 <main+0x87>
jmp    12a2 <main+0x172>
mov    -0x9c5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c5c(%rbp)
jmp    119b <main+0x6b>
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x9c5c(%rbp)
mov    -0x9c5c(%rbp),%eax
cmp    -0x9c54(%rbp),%eax
jge    1362 <main+0x232>
movl   $0x0,-0x9c60(%rbp)
mov    -0x9c60(%rbp),%eax
cmp    -0x9c58(%rbp),%eax
jge    1340 <main+0x210>
movslq -0x9c5c(%rbp),%rcx
lea    -0x9c50(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x9c60(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x9c60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c60(%rbp)
jmp    12ea <main+0x1ba>
lea    0xd09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x9c5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c5c(%rbp)
jmp    12ce <main+0x19e>
xor    %eax,%eax
add    $0x9c60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x9c58,%rsp
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8f(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    0x8(%rsp),%eax
jne    128f <main+0x13f>
test   %eax,%eax
jle    1209 <main+0xb9>
lea    -0x1(%rax),%ecx
lea    0x10(%rsp),%rdx
xor    %esi,%esi
mov    %rcx,%r8
jmp    11c4 <main+0x74>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rsi
add    $0xffffffffffffffff,%r8
add    $0x190,%rdx
cmp    %rax,%rsi
je     1209 <main+0xb9>
xor    %ebx,%ebx
jmp    11e0 <main+0x90>
nopl   0x0(%rax,%rax,1)
movl   $0x1,(%rdx,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rax
je     11b0 <main+0x60>
lea    (%rsi,%rbx,1),%edi
cmp    %edi,%ecx
jg     11d0 <main+0x80>
cmp    %rbx,%r8
jne    1200 <main+0xb0>
movl   $0x0,(%rdx,%rbx,4)
jmp    11d7 <main+0x87>
cs nopw 0x0(%rax,%rax,1)
nop
movl   $0xffffffff,(%rdx,%rbx,4)
jmp    11d7 <main+0x87>
lea    0xe19(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    127e <main+0x12e>
lea    0x10(%rsp),%r12
lea    0xddd(%rip),%r14
xor    %r15d,%r15d
jmp    124f <main+0xff>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
movslq 0xc(%rsp),%rax
add    $0x190,%r12
cmp    %rax,%r15
jge    127e <main+0x12e>
cmpl   $0x0,0x8(%rsp)
jle    1230 <main+0xe0>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jl     1260 <main+0x110>
jmp    1230 <main+0xe0>
xor    %eax,%eax
add    $0x9c58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xd9c(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>

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

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%d%d\00"
@.str.4 = [5 x i8] c"%2d\09\00"
@str = [31 x i8] c"\0AEnter the order of the matrix\00"
@str.6 = [9 x i8] c"\0AMatrix \00"
@str.7 = [34 x i8] c"\0AMatrix should be a Square Matrix\00"
define i32 @main() {
%1 = alloca [100 x [100 x i32]]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [100 x [100 x i32]]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %18
12: ; preds = %0
%13 = icmp sgt i32 %9, 0
br i1 %13, label %14, label %41
14: ; preds = %12
%15 = add nsw i32 %9, -1
%16 = zext i32 %15 to i64
%17 = zext i32 %9 to i64
br label %21
18: ; preds = %0
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.7, i64 0, i64 0))
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %38, %14
%22 = phi i64 [ 0, %14 ], [ %39, %38 ]
br label %23
23: ; preds = %21, %35
%24 = phi i64 [ 0, %21 ], [ %36, %35 ]
%25 = add nuw nsw i64 %24, %22
%26 = trunc i64 %25 to i32
%27 = icmp sgt i32 %15, %26
br i1 %27, label %28, label %30
28: ; preds = %23
%29 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %1, i64 0, i64 %22, i64 %24
store i32 1, i32* %29
br label %35
30: ; preds = %23
%31 = icmp eq i64 %25, %16
%32 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %1, i64 0, i64 %22, i64 %24
br i1 %31, label %33, label %34
33: ; preds = %30
store i32 0, i32* %32
br label %35
34: ; preds = %30
store i32 -1, i32* %32
br label %35
35: ; preds = %28, %34, %33
%36 = add nuw nsw i64 %24, 1
%37 = icmp eq i64 %36, %17
br i1 %37, label %38, label %23
38: ; preds = %35
%39 = add nuw nsw i64 %22, 1
%40 = icmp eq i64 %39, %17
br i1 %40, label %41, label %21
41: ; preds = %38, %12
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.6, i64 0, i64 0))
%43 = load i32, i32* %2
%44 = icmp sgt i32 %43, 0
br i1 %44, label %45, label %64
45: ; preds = %41, %58
%46 = phi i64 [ %60, %58 ], [ 0, %41 ]
%47 = load i32, i32* %3
%48 = icmp sgt i32 %47, 0
br i1 %48, label %49, label %58
49: ; preds = %45, %49
%50 = phi i64 [ %54, %49 ], [ 0, %45 ]
%51 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %1, i64 0, i64 %46, i64 %50
%52 = load i32, i32* %51
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %52)
%54 = add nuw nsw i64 %50, 1
%55 = load i32, i32* %3
%56 = sext i32 %55 to i64
%57 = icmp slt i64 %54, %56
br i1 %57, label %49, label %58
58: ; preds = %49, %45
%59 = call i32 @putchar(i32 10)
%60 = add nuw nsw i64 %46, 1
%61 = load i32, i32* %2
%62 = sext i32 %61 to i64
%63 = icmp slt i64 %60, %62
br i1 %63, label %45, label %64
64: ; preds = %58, %41
ret i32 0
}