#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 */
scalar_t__ is_finite(double);
int /*<<< orphan*/ printf(char *, ...);
void print_edist_matrix_UT(int first_N_X, int N_X, double **EDM) {
  int i, j, I = first_N_X - 1;
  printf("  ");
  for (i = 1; i < first_N_X; i++) {
    printf(" %8d", i);
  }
  printf("\n");
  for (i = 0; i < I; i++) {
    printf("%2d", i);
    for (j = 0; j < i; j++) {
      printf("         ");
    }
    for (j = 0; j < (I - i); j++) {
      if (is_finite(EDM[i][j])) {
        printf(" %8.4f", EDM[i][j]);
      } else {
        printf(" %8.1e", EDM[i][j]);
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_edist_matrix_UT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    117b <print_edist_matrix_UT+0x5b>
mov    -0x14(%rbp),%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1150 <print_edist_matrix_UT+0x30>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1292 <print_edist_matrix_UT+0x172>
mov    -0x14(%rbp),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11dc <print_edist_matrix_UT+0xbc>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b4 <print_edist_matrix_UT+0x94>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    1276 <print_edist_matrix_UT+0x156>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1040 <is_finite@plt>
cmp    $0x0,%rax
je     1240 <print_edist_matrix_UT+0x120>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xde1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1263 <print_edist_matrix_UT+0x143>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xdc0(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1268 <print_edist_matrix_UT+0x148>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11e3 <print_edist_matrix_UT+0xc3>
lea    0xd88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1190 <print_edist_matrix_UT+0x70>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_edist_matrix_UT>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbp
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%ebx
jl     1278 <print_edist_matrix_UT+0x148>
mov    %rbp,0x10(%rsp)
lea    -0x1(%rbx),%eax
mov    %eax,0x4(%rsp)
mov    $0x1,%ebp
lea    0xe8e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1180 <print_edist_matrix_UT+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x2,%ebx
jl     1290 <print_edist_matrix_UT+0x160>
mov    0x4(%rsp),%eax
mov    %eax,%ecx
mov    %rcx,0x8(%rsp)
lea    0xe62(%rip),%rbx
lea    0xe4a(%rip),%rbp
xor    %r13d,%r13d
mov    %eax,%r12d
mov    0x10(%rsp),%r15
jmp    11f4 <print_edist_matrix_UT+0xc4>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    $0xffffffff,%r12d
cmp    0x8(%rsp),%r13
lea    0xe1b(%rip),%rbp
je     1290 <print_edist_matrix_UT+0x160>
mov    %rbx,%r14
lea    0xe07(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rbx
test   %r13,%r13
je     1220 <print_edist_matrix_UT+0xf0>
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
jne    1210 <print_edist_matrix_UT+0xe0>
mov    %r12d,%r12d
cmp    %r13d,0x4(%rsp)
mov    %r14,%rbx
lea    0xde1(%rip),%rbp
jle    11d0 <print_edist_matrix_UT+0xa0>
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
mov    (%r15,%r13,8),%rax
movsd  (%rax,%r14,8),%xmm0
call   1050 <is_finite@plt>
test   %rax,%rax
mov    (%r15,%r13,8),%rax
movsd  (%rax,%r14,8),%xmm0
mov    %rbp,%rdi
cmove  %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r12
jne    1240 <print_edist_matrix_UT+0x110>
jmp    11d0 <print_edist_matrix_UT+0xa0>
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c" \00"
@.str.1 = [5 x i8] c" %8d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [4 x i8] c"%2d\00"
@.str.4 = [10 x i8] c" \00"
@.str.5 = [7 x i8] c" %8.4f\00"
@.str.6 = [7 x i8] c" %8.1e\00"
define void @print_edist_matrix_UT(i32 %0, i32 %1, double** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store double** %2, double*** %6
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %9
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %7
br label %13
13: ; preds = %20, %3
%14 = load i32, i32* %7
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %23
17: ; preds = %13
%18 = load i32, i32* %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %17
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %13
23: ; preds = %13
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %7
br label %25
25: ; preds = %88, %23
%26 = load i32, i32* %7
%27 = load i32, i32* %9
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %91
29: ; preds = %25
%30 = load i32, i32* %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %30)
store i32 0, i32* %8
br label %32
32: ; preds = %38, %29
%33 = load i32, i32* %8
%34 = load i32, i32* %7
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %36
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
br label %32
41: ; preds = %32
store i32 0, i32* %8
br label %42
42: ; preds = %83, %41
%43 = load i32, i32* %8
%44 = load i32, i32* %9
%45 = load i32, i32* %7
%46 = sub nsw i32 %44, %45
%47 = icmp slt i32 %43, %46
br i1 %47, label %48, label %86
48: ; preds = %42
%49 = load double**, double*** %6
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double*, double** %49, i64 %51
%53 = load double*, double** %52
%54 = load i32, i32* %8
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %53, i64 %55
%57 = load double, double* %56
%58 = call i64 @is_finite(double %57)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %71
60: ; preds = %48
%61 = load double**, double*** %6
%62 = load i32, i32* %7
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double*, double** %61, i64 %63
%65 = load double*, double** %64
%66 = load i32, i32* %8
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %65, i64 %67
%69 = load double, double* %68
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %69)
br label %82
71: ; preds = %48
%72 = load double**, double*** %6
%73 = load i32, i32* %7
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds double*, double** %72, i64 %74
%76 = load double*, double** %75
%77 = load i32, i32* %8
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %76, i64 %78
%80 = load double, double* %79
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), double %80)
br label %82
82: ; preds = %71, %60
br label %83
83: ; preds = %82
%84 = load i32, i32* %8
%85 = add nsw i32 %84, 1
store i32 %85, i32* %8
br label %42
86: ; preds = %42
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %88
88: ; preds = %86
%89 = load i32, i32* %7
%90 = add nsw i32 %89, 1
store i32 %90, i32* %7
br label %25
91: ; preds = %25
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c" \00"
@.str.1 = [5 x i8] c" %8d\00"
@.str.3 = [4 x i8] c"%2d\00"
@.str.4 = [10 x i8] c" \00"
@.str.5 = [7 x i8] c" %8.4f\00"
@.str.6 = [7 x i8] c" %8.1e\00"
define void @print_edist_matrix_UT(i32 %0, i32 %1, double** nocapture %2) {
%4 = add i32 %0, -1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp sgt i32 %0, 1
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @putchar(i32 10)
br label %54
9: ; preds = %3, %9
%10 = phi i32 [ %12, %9 ], [ 1, %3 ]
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, %0
br i1 %13, label %14, label %9
14: ; preds = %9
%15 = tail call i32 @putchar(i32 10)
br i1 %6, label %16, label %54
16: ; preds = %14
%17 = zext i32 %4 to i64
br label %18
18: ; preds = %16, %49
%19 = phi i64 [ 0, %16 ], [ %51, %49 ]
%20 = phi i32 [ %4, %16 ], [ %52, %49 ]
%21 = trunc i64 %19 to i32
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = icmp eq i64 %19, 0
br i1 %23, label %24, label %29
24: ; preds = %29, %18
%25 = icmp sgt i32 %4, %21
br i1 %25, label %26, label %49
26: ; preds = %24
%27 = getelementptr inbounds double*, double** %2, i64 %19
%28 = zext i32 %20 to i64
br label %35
29: ; preds = %18, %29
%30 = phi i32 [ %32, %29 ], [ 0, %18 ]
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%32 = add nuw nsw i32 %30, 1
%33 = zext i32 %32 to i64
%34 = icmp eq i64 %19, %33
br i1 %34, label %24, label %29
35: ; preds = %26, %35
%36 = phi i64 [ 0, %26 ], [ %47, %35 ]
%37 = load double*, double** %27
%38 = getelementptr inbounds double, double* %37, i64 %36
%39 = load double, double* %38
%40 = tail call i64 @is_finite(double %39)
%41 = icmp eq i64 %40, 0
%42 = load double*, double** %27
%43 = getelementptr inbounds double, double* %42, i64 %36
%44 = load double, double* %43
%45 = select i1 %41, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0)
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %45, double %44)
%47 = add nuw nsw i64 %36, 1
%48 = icmp eq i64 %47, %28
br i1 %48, label %49, label %35
49: ; preds = %35, %24
%50 = tail call i32 @putchar(i32 10)
%51 = add nuw nsw i64 %19, 1
%52 = add i32 %20, -1
%53 = icmp eq i64 %51, %17
br i1 %53, label %54, label %18
54: ; preds = %49, %7, %14
ret void
}