#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 printPos(int n, int pos[n][n]) {
  int i, j;
  printf("pos matrix\n");
  for (i = 0; i < n; ++i) {
    for (j = 0; j < n; ++j) {
      if (i >= j)
        printf("-- ");
      else
        printf("%d ", pos[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printPos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x20(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d4 <printPos+0xc4>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b8 <printPos+0xa8>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     1179 <printPos+0x69>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a5 <printPos+0x95>
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    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11aa <printPos+0x9a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114e <printPos+0x3e>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113b <printPos+0x2b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPos>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
mov    %edi,%ebp
lea    0xec1(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
jle    11b9 <printPos+0x89>
mov    %ebp,%ebp
lea    0x0(,%rbp,4),%rax
mov    %rax,(%rsp)
lea    0xe9f(%rip),%r14
lea    0xe94(%rip),%r15
xor    %ebx,%ebx
jmp    1187 <printPos+0x57>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
add    (%rsp),%r13
cmp    %rbp,%rbx
je     11b9 <printPos+0x89>
xor    %r12d,%r12d
jmp    11a8 <printPos+0x78>
nopl   0x0(%rax)
mov    0x0(%r13,%r12,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r12
cmp    %r12,%rbp
je     1170 <printPos+0x40>
cmp    %r12,%rbx
jb     1190 <printPos+0x60>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    119f <printPos+0x6f>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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