#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 sqrt(float);
int RBR_print_vector(float *V) {
  int i;
  printf("(");
  for (i = 0; i < 3; ++i) {
    printf("%8.5f", V[i]);
    if (i < 2)
      printf(", ");
  }
  printf(")");
  printf(" length: %8.5f\n", sqrt(V[0] * V[0] + V[1] * V[1] + V[2] * V[2]));
  return 0;
}


x86 assembly (clang, -O0):
<RBR_print_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1195 <RBR_print_vector+0x75>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cmpl   $0x2,-0xc(%rbp)
jge    1182 <RBR_print_vector+0x62>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1187 <RBR_print_vector+0x67>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1141 <RBR_print_vector+0x21>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulss  0x4(%rax),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1040 <sqrt@plt>
lea    0xe1a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RBR_print_vector>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    $0x28,%edi
call   1030 <putchar@plt>
movss  (%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeaf(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xea4(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movss  0x4(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movss  0x8(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x29,%edi
call   1030 <putchar@plt>
movss  (%rbx),%xmm1
movss  0x4(%rbx),%xmm0
mulss  %xmm0,%xmm0
mulss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  0x8(%rbx),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
call   1050 <sqrt@plt>
lea    0xe35(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%8.5f\00"
@.str.2 = [3 x i8] c", \00"
@.str.4 = [16 x i8] c" length: %8.5f\0A\00"
define i32 @RBR_print_vector(float* nocapture %0) {
%2 = tail call i32 @putchar(i32 40)
%3 = load float, float* %0
%4 = fpext float %3 to double
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%7 = getelementptr inbounds float, float* %0, i64 1
%8 = load float, float* %7
%9 = fpext float %8 to double
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %9)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%12 = getelementptr inbounds float, float* %0, i64 2
%13 = load float, float* %12
%14 = fpext float %13 to double
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %14)
%16 = tail call i32 @putchar(i32 41)
%17 = load float, float* %0
%18 = load float, float* %7
%19 = fmul float %18, %18
%20 = tail call float @llvm.fmuladd.f32(float %17, float %17, float %19)
%21 = load float, float* %12
%22 = tail call float @llvm.fmuladd.f32(float %21, float %21, float %20)
%23 = tail call double @sqrt(float %22)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), double %23)
ret i32 0
}