#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 *, ...);
void PrintSquareMatrix(int matrixSize, int matrix[matrixSize][matrixSize]) {
  int i, j;
  for (i = 0; i < matrixSize; i++) {
    for (j = 0; j < matrixSize; j++) {
      if (matrix[i][j] == 100) {
        printf("inf\t");
      } else {
        printf("%d\t", matrix[i][j]);
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<PrintSquareMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11df <PrintSquareMatrix+0xcf>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c3 <PrintSquareMatrix+0xb3>
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x64,(%rax,%rcx,4)
jne    1184 <PrintSquareMatrix+0x74>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b0 <PrintSquareMatrix+0xa0>
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b5 <PrintSquareMatrix+0xa5>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1140 <PrintSquareMatrix+0x30>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <PrintSquareMatrix+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintSquareMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11a8 <PrintSquareMatrix+0x88>
mov    %rsi,%rbx
mov    %edi,%r12d
lea    0x0(,%r12,4),%rax
mov    %rax,(%rsp)
lea    0xeb8(%rip),%r14
lea    0xeb6(%rip),%r15
xor    %ebp,%ebp
jmp    1177 <PrintSquareMatrix+0x57>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
add    (%rsp),%rbx
cmp    %r12,%rbp
je     11a8 <PrintSquareMatrix+0x88>
xor    %r13d,%r13d
jmp    1193 <PrintSquareMatrix+0x73>
nopl   0x0(%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r13
cmp    %r13,%r12
je     1160 <PrintSquareMatrix+0x40>
mov    (%rbx,%r13,4),%esi
cmp    $0x64,%esi
jne    1180 <PrintSquareMatrix+0x60>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    118a <PrintSquareMatrix+0x6a>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"inf\09\00"
@.str.1 = [4 x i8] c"%d\09\00"
define void @PrintSquareMatrix(i32 %0, i32* nocapture %1) {
%3 = zext i32 %0 to i64
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %25
5: ; preds = %2, %21
%6 = phi i64 [ %23, %21 ], [ 0, %2 ]
%7 = mul nuw nsw i64 %6, %3
%8 = getelementptr inbounds i32, i32* %1, i64 %7
br label %9
9: ; preds = %5, %18
%10 = phi i64 [ 0, %5 ], [ %19, %18 ]
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 100
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %18
16: ; preds = %9
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %18
18: ; preds = %14, %16
%19 = add nuw nsw i64 %10, 1
%20 = icmp eq i64 %19, %3
br i1 %20, label %21, label %9
21: ; preds = %18
%22 = tail call i32 @putchar(i32 10)
%23 = add nuw nsw i64 %6, 1
%24 = icmp eq i64 %23, %3
br i1 %24, label %25, label %5
25: ; preds = %21, %2
ret void
}