#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 identity() {
  int a[10][10];
  int i, j, row, column, flag = 1;
  printf("Enter the order of the matrix A \n");
  scanf("%d %d", &row, &column);
  printf("Enter the elements of matrix A \n");
  for (i = 0; i < row; i++) {
    for (j = 0; j < column; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  printf("MATRIX A is \n");
  for (i = 0; i < row; i++) {
    for (j = 0; j < column; j++) {
      printf("%3d", a[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<identity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x1,-0x1a4(%rbp)
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x19c(%rbp),%rsi
lea    -0x1a0(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x194(%rbp)
mov    -0x194(%rbp),%eax
cmp    -0x19c(%rbp),%eax
jge    1203 <identity+0xe3>
movl   $0x0,-0x198(%rbp)
mov    -0x198(%rbp),%eax
cmp    -0x1a0(%rbp),%eax
jge    11ea <identity+0xca>
movslq -0x194(%rbp),%rax
lea    -0x190(%rbp),%rsi
imul   $0x28,%rax,%rax
add    %rax,%rsi
movslq -0x198(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x198(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x198(%rbp)
jmp    1193 <identity+0x73>
jmp    11ef <identity+0xcf>
mov    -0x194(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x194(%rbp)
jmp    1177 <identity+0x57>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x194(%rbp)
mov    -0x194(%rbp),%eax
cmp    -0x19c(%rbp),%eax
jge    12ac <identity+0x18c>
movl   $0x0,-0x198(%rbp)
mov    -0x198(%rbp),%eax
cmp    -0x1a0(%rbp),%eax
jge    128a <identity+0x16a>
movslq -0x194(%rbp),%rcx
lea    -0x190(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x198(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x198(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x198(%rbp)
jmp    1237 <identity+0x117>
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x194(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x194(%rbp)
jmp    121b <identity+0xfb>
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<identity>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a0,%rsp
lea    0xeb3(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9d(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xeb0(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
jle    11e5 <identity+0xa5>
lea    0x10(%rsp),%r15
mov    0x8(%rsp),%eax
lea    0xe6b(%rip),%r14
xor    %r12d,%r12d
jmp    11b0 <identity+0x70>
nopl   (%rax)
add    $0x1,%r12
movslq %ecx,%rdx
add    $0x28,%r15
cmp    %rdx,%r12
jge    11e5 <identity+0xa5>
test   %eax,%eax
jle    11a0 <identity+0x60>
mov    %r15,%r13
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
add    $0x4,%r13
cmp    %rax,%rbx
jl     11c0 <identity+0x80>
mov    0xc(%rsp),%ecx
jmp    11a0 <identity+0x60>
lea    0xe5f(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    125e <identity+0x11e>
lea    0x10(%rsp),%r12
lea    0xe02(%rip),%r14
xor    %r15d,%r15d
jmp    122c <identity+0xec>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
movslq 0xc(%rsp),%rax
add    $0x28,%r12
cmp    %rax,%r15
jge    125e <identity+0x11e>
cmpl   $0x0,0x8(%rsp)
jle    1210 <identity+0xd0>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
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     1240 <identity+0x100>
jmp    1210 <identity+0xd0>
add    $0x1a0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d %d\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.5 = [4 x i8] c"%3d\00"
@str = [33 x i8] c"Enter the order of the matrix A \00"
@str.7 = [32 x i8] c"Enter the elements of matrix A \00"
@str.8 = [13 x i8] c"MATRIX A is \00"
define void @identity() {
%1 = alloca [10 x [10 x i32]]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [10 x [10 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 ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.7, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %35
12: ; preds = %0
%13 = load i32, i32* %3
br label %14
14: ; preds = %12, %29
%15 = phi i32 [ %10, %12 ], [ %30, %29 ]
%16 = phi i32 [ %13, %12 ], [ %31, %29 ]
%17 = phi i64 [ 0, %12 ], [ %32, %29 ]
%18 = icmp sgt i32 %16, 0
br i1 %18, label %19, label %29
19: ; preds = %14, %19
%20 = phi i64 [ %23, %19 ], [ 0, %14 ]
%21 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %17, i64 %20
%22 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %21)
%23 = add nuw nsw i64 %20, 1
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = icmp slt i64 %23, %25
br i1 %26, label %19, label %27
27: ; preds = %19
%28 = load i32, i32* %2
br label %29
29: ; preds = %27, %14
%30 = phi i32 [ %28, %27 ], [ %15, %14 ]
%31 = phi i32 [ %24, %27 ], [ %16, %14 ]
%32 = add nuw nsw i64 %17, 1
%33 = sext i32 %30 to i64
%34 = icmp slt i64 %32, %33
br i1 %34, label %14, label %35
35: ; preds = %29, %0
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.8, i64 0, i64 0))
%37 = load i32, i32* %2
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %58
39: ; preds = %35, %52
%40 = phi i64 [ %54, %52 ], [ 0, %35 ]
%41 = load i32, i32* %3
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %52
43: ; preds = %39, %43
%44 = phi i64 [ %48, %43 ], [ 0, %39 ]
%45 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %40, i64 %44
%46 = load i32, i32* %45
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %46)
%48 = add nuw nsw i64 %44, 1
%49 = load i32, i32* %3
%50 = sext i32 %49 to i64
%51 = icmp slt i64 %48, %50
br i1 %51, label %43, label %52
52: ; preds = %43, %39
%53 = call i32 @putchar(i32 10)
%54 = add nuw nsw i64 %40, 1
%55 = load i32, i32* %2
%56 = sext i32 %55 to i64
%57 = icmp slt i64 %54, %56
br i1 %57, label %39, label %58
58: ; preds = %52, %35
ret void
}