#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 ShowUpperTriangMatrix(double *values, int squareSize) {
  int i, j, index;
  index = 0;
  printf("Upper triang matrix:\n");
  for (i = 0; i < squareSize; i++) {
    for (j = 0; j < i; j++)
      printf("         ");
    for (j = i + 1; j < squareSize; j++) {
      printf("%.6f ", values[index]);
      index++;
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<ShowUpperTriangMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d9 <ShowUpperTriangMatrix+0xc9>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1176 <ShowUpperTriangMatrix+0x66>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114e <ShowUpperTriangMatrix+0x3e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bd <ShowUpperTriangMatrix+0xad>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe81(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117f <ShowUpperTriangMatrix+0x6f>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113b <ShowUpperTriangMatrix+0x2b>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShowUpperTriangMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r15d
mov    %rdi,0x10(%rsp)
lea    0xec3(%rip),%rdi
call   1040 <puts@plt>
test   %r15d,%r15d
jle    11f3 <ShowUpperTriangMatrix+0xc3>
lea    -0x1(%r15),%ebx
lea    0xea4(%rip),%r12
lea    0xe93(%rip),%r13
movl   $0x0,0x4(%rsp)
xor    %r14d,%r14d
mov    %r15,0x8(%rsp)
jmp    1193 <ShowUpperTriangMatrix+0x63>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%rbx
cmp    %r15d,%r14d
je     11f3 <ShowUpperTriangMatrix+0xc3>
test   %r14d,%r14d
je     11af <ShowUpperTriangMatrix+0x7f>
mov    %r14d,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%ebp
jne    11a0 <ShowUpperTriangMatrix+0x70>
add    $0x1,%r14d
cmp    %r15d,%r14d
jge    1180 <ShowUpperTriangMatrix+0x50>
movslq 0x4(%rsp),%rax
mov    0x10(%rsp),%rcx
lea    (%rcx,%rax,8),%r15
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movsd  (%r15,%rbp,8),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %ebp,%ebx
jne    11d0 <ShowUpperTriangMatrix+0xa0>
add    %ebp,0x4(%rsp)
mov    0x8(%rsp),%r15
jmp    1180 <ShowUpperTriangMatrix+0x50>
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str.1 = [10 x i8] c" \00"
@.str.2 = [6 x i8] c"%.6f \00"
@str = [21 x i8] c"Upper triang matrix:\00"
define void @ShowUpperTriangMatrix(double* nocapture %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %34
5: ; preds = %2, %30
%6 = phi i32 [ %31, %30 ], [ 0, %2 ]
%7 = phi i32 [ %15, %30 ], [ 0, %2 ]
%8 = icmp eq i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %5, %9
%10 = phi i32 [ %12, %9 ], [ 0, %5 ]
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, %7
br i1 %13, label %14, label %9
14: ; preds = %9, %5
%15 = add nuw nsw i32 %7, 1
%16 = icmp slt i32 %15, %1
br i1 %16, label %17, label %30
17: ; preds = %14
%18 = sext i32 %6 to i64
br label %19
19: ; preds = %17, %19
%20 = phi i64 [ %18, %17 ], [ %25, %19 ]
%21 = phi i32 [ %15, %17 ], [ %26, %19 ]
%22 = getelementptr inbounds double, double* %0, i64 %20
%23 = load double, double* %22
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %23)
%25 = add nsw i64 %20, 1
%26 = add nuw i32 %21, 1
%27 = icmp eq i32 %26, %1
br i1 %27, label %28, label %19
28: ; preds = %19
%29 = trunc i64 %25 to i32
br label %30
30: ; preds = %28, %14
%31 = phi i32 [ %6, %14 ], [ %29, %28 ]
%32 = tail call i32 @putchar(i32 10)
%33 = icmp eq i32 %15, %1
br i1 %33, label %34, label %5
34: ; preds = %30, %2
%35 = tail call i32 @putchar(i32 10)
ret void
}