#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 *, double, double, double);
void displayPoints(int nbPoints, double *points) {
  int i = 0;
  for (i = 0; i < nbPoints; ++i) {
    printf("%e %e %e \n", points[i * 3], points[i * 3 + 1], points[i * 3 + 2]);
  }
}


x86 assembly (clang, -O0):
<displayPoints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1189 <displayPoints+0x79>
mov    -0x10(%rbp),%rax
imul   $0x3,-0x14(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x3,-0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
imul   $0x3,-0x14(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <displayPoints+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayPoints>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1165 <displayPoints+0x55>
mov    %rsi,%r12
mov    %edi,%eax
shl    $0x3,%rax
lea    (%rax,%rax,2),%r15
xor    %ebx,%ebx
lea    0xece(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r12,%rbx,1),%xmm0
movsd  0x8(%r12,%rbx,1),%xmm1
movsd  0x10(%r12,%rbx,1),%xmm2
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x18,%rbx
cmp    %rbx,%r15
jne    1140 <displayPoints+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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