#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_matrix(int n) {
  int row, col;
  for (row = 0; row < n; row++) {
    for (col = 0; col < n; col++) {
      if (col < row)
        printf("-1\t");
      else if (col > row)
        printf("1\t");
      else
        printf("0\t");
    }
    printf("\n");
  }
  return;
}


x86 assembly (clang, -O0):
<print_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b9 <print_matrix+0xa9>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119f <print_matrix+0x8f>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115e <print_matrix+0x4e>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    118c <print_matrix+0x7c>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    117b <print_matrix+0x6b>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
jmp    1187 <print_matrix+0x77>
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
jmp    118c <print_matrix+0x7c>
jmp    1191 <print_matrix+0x81>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <print_matrix+0x25>
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <print_matrix+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    118c <print_matrix+0x6c>
mov    %edi,%r13d
xor    %ebp,%ebp
lea    0xec6(%rip),%r14
lea    0xec2(%rip),%r15
lea    0xeb7(%rip),%r12
nopl   0x0(%rax)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    %ebp,%ebx
mov    %r15,%rdi
cmova  %r14,%rdi
cmovb  %r12,%rdi
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    %ebx,%r13d
jne    1160 <print_matrix+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %r13d,%ebp
jne    1150 <print_matrix+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"-1\09\00"
@.str.1 = [3 x i8] c"1\09\00"
@.str.2 = [3 x i8] c"0\09\00"
define void @print_matrix(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %18
3: ; preds = %1, %14
%4 = phi i32 [ %16, %14 ], [ 0, %1 ]
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ %12, %5 ], [ 0, %3 ]
%7 = icmp ult i32 %6, %4
%8 = icmp ugt i32 %6, %4
%9 = select i1 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%10 = select i1 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9
%11 = tail call i32 @printf(i8* dereferenceable(1) %10)
%12 = add nuw nsw i32 %6, 1
%13 = icmp eq i32 %12, %0
br i1 %13, label %14, label %5
14: ; preds = %5
%15 = tail call i32 @putchar(i32 10)
%16 = add nuw nsw i32 %4, 1
%17 = icmp eq i32 %16, %0
br i1 %17, label %18, label %3
18: ; preds = %14, %1
ret void
}