#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 printv(char name, double vector[], int size) {
  int i;
  int length = size / sizeof(double);
  printf("%c    : (", name);
  for (i = 0; i < length; i++) {
    printf("%12f", vector[i]);
    if (i < length - 1)
      printf(", ");
    if ((i + 1) % 10 == 0)
      printf("\n        ");
  }
  printf(")\n");
}


x86 assembly (clang, -O0):
<printv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shr    $0x3,%rax
mov    %eax,-0x1c(%rbp)
movsbl -0x1(%rbp),%esi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11c7 <printv+0xb7>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xea1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    118f <printv+0x7f>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b4 <printv+0xa4>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b9 <printv+0xa9>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1149 <printv+0x39>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printv>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,(%rsp)
mov    %edi,%esi
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x8,%ebx
jl     11df <printv+0xbf>
sar    $0x3,%ebx
lea    -0x1(%rbx),%eax
movslq %eax,%rbp
cmp    $0x2,%ebx
mov    $0x1,%r12d
cmovl  %r12d,%ebx
xor    %r13d,%r13d
jmp    117c <printv+0x5c>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r12d
mov    %r14,%r13
cmp    %r14,%rbx
je     11df <printv+0xbf>
mov    %r12d,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x23,%rax
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,1),%r15d
add    $0xfffffffe,%r15d
or     $0x1,%r15
mov    (%rsp),%rax
movsd  (%rax,%r13,8),%xmm0
lea    0xe5e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cmp    %rbp,%r13
jge    11c6 <printv+0xa6>
lea    0xe50(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1(%r13),%r14
cmp    %r13d,%r15d
jne    1170 <printv+0x50>
lea    0xe3c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1170 <printv+0x50>
lea    0xe36(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

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

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