#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 printDoubleVector(double *arr, int start, int end) {
  int i;
  for (i = start; i < end; i++) {
    printf("%g", arr[i]);
    if (i != end - 1)
      printf(" ");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printDoubleVector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1181 <printDoubleVector+0x71>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xeb8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     116e <printDoubleVector+0x5e>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1173 <printDoubleVector+0x63>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1128 <printDoubleVector+0x18>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printDoubleVector>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmp    %edx,%esi
jge    117a <printDoubleVector+0x5a>
mov    %edx,%r15d
lea    -0x1(%r15),%eax
movslq %esi,%rcx
movslq %eax,%r13
sub    %rcx,%r13
lea    (%rdi,%rcx,8),%r12
sub    %esi,%r15d
xor    %ebx,%ebx
lea    0xeb3(%rip),%r14
jmp    1159 <printDoubleVector+0x39>
nop
add    $0x1,%rbx
cmp    %ebx,%r15d
je     117a <printDoubleVector+0x5a>
movsd  (%r12,%rbx,8),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cmp    %rbx,%r13
je     1150 <printDoubleVector+0x30>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1150 <printDoubleVector+0x30>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

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