#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_diffmat(const int n, const double *a, const double shift) {
  printf("Diff matrix:\n");
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < i; j++)
      printf("         ");
    for (int j = i + 1; j < n; j++)
      printf("%-8.1f ", a[j] - a[i] - shift);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_diffmat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11e5 <print_diffmat+0xd5>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1179 <print_diffmat+0x69>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1151 <print_diffmat+0x41>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c9 <print_diffmat+0xb9>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
subsd  -0x18(%rbp),%xmm0
lea    0xe64(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1182 <print_diffmat+0x72>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1139 <print_diffmat+0x29>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_diffmat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rsi,%r13
mov    %edi,%ebx
lea    0xec2(%rip),%rdi
call   1040 <puts@plt>
cmp    $0x2,%ebx
jl     121f <print_diffmat+0xef>
mov    %rbx,%rax
mov    %eax,%r12d
add    $0xffffffff,%eax
mov    %rax,0x18(%rsp)
lea    0xe97(%rip),%rbp
mov    %r12,0x10(%rsp)
mov    %r13,%rbx
xor    %r14d,%r14d
jmp    11a1 <print_diffmat+0x71>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x8,%rbx
add    $0xffffffffffffffff,%r12
mov    0x20(%rsp),%rax
mov    %rax,%r14
cmp    0x18(%rsp),%rax
je     121f <print_diffmat+0xef>
mov    %rbp,%r15
mov    %r14,%rbp
test   %r14,%r14
je     11c4 <print_diffmat+0x94>
nopl   0x0(%rax)
lea    0xe49(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffffffffffff,%rbp
jne    11b0 <print_diffmat+0x80>
lea    0x1(%r14),%rax
mov    %rax,0x20(%rsp)
cmp    0x10(%rsp),%rax
movsd  0x8(%rsp),%xmm1
mov    %r15,%rbp
jae    1180 <print_diffmat+0x50>
mov    $0x1,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rbx,%r15,8),%xmm0
subsd  0x0(%r13,%r14,8),%xmm0
subsd  %xmm1,%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm1
add    $0x1,%r15
cmp    %r15,%r12
jne    11f0 <print_diffmat+0xc0>
jmp    1180 <print_diffmat+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Diff matrix:\0A\00"
@.str.1 = [10 x i8] c" \00"
@.str.2 = [8 x i8] c"%-8.1f \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @print_diffmat(i32 %0, double* %1, double %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store double* %1, double** %5
store double %2, double* %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %11
11: ; preds = %53, %3
%12 = load i32, i32* %7
%13 = load i32, i32* %4
%14 = sub nsw i32 %13, 1
%15 = icmp slt i32 %12, %14
br i1 %15, label %16, label %56
16: ; preds = %11
store i32 0, i32* %8
br label %17
17: ; preds = %23, %16
%18 = load i32, i32* %8
%19 = load i32, i32* %7
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21
%24 = load i32, i32* %8
%25 = add nsw i32 %24, 1
store i32 %25, i32* %8
br label %17
26: ; preds = %17
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %9
br label %29
29: ; preds = %48, %26
%30 = load i32, i32* %9
%31 = load i32, i32* %4
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %51
33: ; preds = %29
%34 = load double*, double** %5
%35 = load i32, i32* %9
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %34, i64 %36
%38 = load double, double* %37
%39 = load double*, double** %5
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
%43 = load double, double* %42
%44 = fsub double %38, %43
%45 = load double, double* %6
%46 = fsub double %44, %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %46)
br label %48
48: ; preds = %33
%49 = load i32, i32* %9
%50 = add nsw i32 %49, 1
store i32 %50, i32* %9
br label %29
51: ; preds = %29
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %53
53: ; preds = %51
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %11
56: ; preds = %11
ret void
}

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