#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 printf_distance_matrix(float **x) {
  int i, j, n;
  n = (int)x[0][0];
  printf("> X  %d\n", n);
  if (n > 1) {
    for (i = 2; i <= n; i++) {
      for (j = 1; j < i; j++)
        printf("%g ", x[i][j]);
      printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<printf_distance_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
cvttss2si (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x14(%rbp)
jle    11c1 <printf_distance_matrix+0xb1>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11bc <printf_distance_matrix+0xac>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a0 <printf_distance_matrix+0x90>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x10(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115f <printf_distance_matrix+0x4f>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114c <printf_distance_matrix+0x3c>
jmp    11c1 <printf_distance_matrix+0xb1>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printf_distance_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
mov    (%rdi),%rax
cvttss2si (%rax),%r14d
lea    0xec3(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%r14d
jl     11b8 <printf_distance_matrix+0x98>
add    $0x1,%r14d
mov    $0x2,%ebx
mov    $0x4,%r13d
lea    0xea6(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r12,%rbx,8),%rax
movss  0x4(%rax,%rbp,1),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x4,%rbp
cmp    %rbp,%r13
jne    1180 <printf_distance_matrix+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
add    $0x4,%r13
cmp    %r14,%rbx
jne    1170 <printf_distance_matrix+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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