#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 fabs(double);
int /*<<< orphan*/ printf(char *, ...);
void Print_Real_1d(int n, double *array, char *title) {
  int i;
  printf("\n%s:\n", title);
  for (i = 0; i < n; i++) {
    printf("   %4d", i);
    if (fabs(array[i]) < 1e-12)
      printf(": 0\n");
    else
      printf(": %.5g\n", array[i]);
  }
}


x86 assembly (clang, -O0):
<Print_Real_1d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d2 <Print_Real_1d+0xb2>
mov    -0x1c(%rbp),%esi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe79(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a4 <Print_Real_1d+0x84>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bf <Print_Real_1d+0x9f>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe62(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11c4 <Print_Real_1d+0xa4>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114c <Print_Real_1d+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Print_Real_1d>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
mov    %edi,%ebx
lea    0xeb9(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jle    11b0 <Print_Real_1d+0x80>
mov    %ebx,%ebp
lea    0xea8(%rip),%r14
lea    0xeb0(%rip),%r15
lea    0xea1(%rip),%r12
xor    %ebx,%ebx
jmp    118a <Print_Real_1d+0x5a>
movsd  0x0(%r13,%rbx,8),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     11b0 <Print_Real_1d+0x80>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x0(%r13,%rbx,8),%xmm0
call   1050 <fabs@plt>
test   %eax,%eax
jg     1170 <Print_Real_1d+0x40>
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    1181 <Print_Real_1d+0x51>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"\0A%s:\0A\00"
@.str.1 = [7 x i8] c" %4d\00"
@.str.2 = [5 x i8] c": 0\0A\00"
@.str.3 = [8 x i8] c": %.5g\0A\00"
define void @Print_Real_1d(i32 %0, double* %1, i8* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store double* %1, double** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %8)
store i32 0, i32* %7
br label %10
10: ; preds = %35, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %38
14: ; preds = %10
%15 = load i32, i32* %7
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load double*, double** %5
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = call i32 @fabs(double %21)
%23 = sitofp i32 %22 to double
%24 = fcmp olt double %23, 0x3D719799812DEA11
br i1 %24, label %25, label %27
25: ; preds = %14
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %34
27: ; preds = %14
%28 = load double*, double** %5
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
%32 = load double, double* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double %32)
br label %34
34: ; preds = %27, %25
br label %35
35: ; preds = %34
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %10
38: ; preds = %10
ret void
}

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