#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void ighmm_cvector_print(FILE *file, double *vector, int len, char *tab,
                         char *separator, char *ending) {
  int j;
  fprintf(file, "%s", tab);
  if (len > 0)
    fprintf(file, "%6.2f", vector[0]);
  for (j = 1; j < len; j++)
    fprintf(file, "%s %6.2f", separator, vector[j]);
  fprintf(file, "%s\n", ending);
}


x86 assembly (clang, -O0):
<ighmm_cvector_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xec2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x0,-0x14(%rbp)
jle    1169 <ighmm_cvector_print+0x59>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xea4(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ad <ighmm_cvector_print+0x9d>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe6b(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1170 <ighmm_cvector_print+0x60>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xe50(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ighmm_cvector_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,(%rsp)
mov    %r8,%r15
mov    %edx,%ebp
mov    %rsi,%r12
mov    %rdi,%rbx
mov    %rcx,%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
test   %ebp,%ebp
jle    119f <ighmm_cvector_print+0x7f>
movsd  (%r12),%xmm0
lea    0xead(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <fprintf@plt>
cmp    $0x1,%ebp
je     119f <ighmm_cvector_print+0x7f>
mov    %ebp,%ebp
mov    $0x1,%r14d
lea    0xe8c(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%r12,%r14,8),%xmm0
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
mov    $0x1,%al
call   1040 <fprintf@plt>
add    $0x1,%r14
cmp    %r14,%rbp
jne    1180 <ighmm_cvector_print+0x60>
lea    0xe63(%rip),%rsi
mov    %rbx,%rdi
mov    (%rsp),%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>

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

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