#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 print_cmat(char **cmat, int N) {
  int i, j;
  for (i = 0; i < N; i++) {
    for (j = 0; j < N; j++)
      if (i == j)
        printf(".");
      else
        printf("%d", cmat[i][j]);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_cmat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b5 <print_cmat+0xa5>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1199 <print_cmat+0x89>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1164 <print_cmat+0x54>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1186 <print_cmat+0x76>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118b <print_cmat+0x7b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <print_cmat+0x29>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_cmat+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_cmat>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %esi,%esi
jle    118c <print_cmat+0x6c>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec6(%rip),%r14
xor    %r13d,%r13d
jmp    1153 <print_cmat+0x33>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
cmp    %r12,%r13
je     118c <print_cmat+0x6c>
xor    %ebx,%ebx
jmp    117b <print_cmat+0x5b>
nopw   0x0(%rax,%rax,1)
mov    (%r15,%r13,8),%rax
movsbl (%rax,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
je     1140 <print_cmat+0x20>
cmp    %rbx,%r13
jne    1160 <print_cmat+0x40>
mov    $0x2e,%edi
call   1030 <putchar@plt>
jmp    1172 <print_cmat+0x52>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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