#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 *, char *, ...);
void ighmm_cvector_print_prec(FILE *file, double *vector, int len, int width,
                              int prec, char *tab, char *separator,
                              char *ending) {
  int j;
  if (len > 0)
    fprintf(file, "%s%*.*f", tab, width, prec, vector[0]);
  for (j = 1; j < len; j++)
    fprintf(file, "%s %*.*f", separator, width, prec, vector[j]);
  fprintf(file, "%s\n", ending);
}


x86 assembly (clang, -O0):
<ighmm_cvector_print_prec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1165 <ighmm_cvector_print_prec+0x55>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xea2(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b0 <ighmm_cvector_print_prec+0xa0>
mov    -0x8(%rbp),%rdi
mov    0x10(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rsi
movsd  (%rax,%rsi,8),%xmm0
lea    0xe6d(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    116c <ighmm_cvector_print_prec+0x5c>
mov    -0x8(%rbp),%rdi
mov    0x18(%rbp),%rdx
lea    0xe52(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ighmm_cvector_print_prec>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mov    0x58(%rsp),%rax
mov    %rax,0x8(%rsp)
test   %edx,%edx
jle    119e <ighmm_cvector_print_prec+0x8e>
mov    %edx,%r14d
mov    0x50(%rsp),%rax
mov    %rax,0x10(%rsp)
movsd  (%rsi),%xmm0
mov    %rsi,%rbp
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
mov    %r9,%rdx
mov    %ecx,%r13d
mov    %r8d,%r12d
mov    $0x1,%al
call   1030 <fprintf@plt>
cmp    $0x1,%r14d
je     119e <ighmm_cvector_print_prec+0x8e>
mov    %rbp,%rax
mov    %r14d,%r14d
mov    $0x1,%r15d
nop
movsd  (%rax,%r15,8),%xmm0
mov    %rbx,%rdi
lea    0xe88(%rip),%rsi
mov    0x10(%rsp),%rdx
mov    %r13d,%ecx
mov    %r12d,%r8d
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    %rbp,%rax
add    $0x1,%r15
cmp    %r15,%r14
jne    1170 <ighmm_cvector_print_prec+0x60>
lea    0xe6c(%rip),%rsi
mov    %rbx,%rdi
mov    0x8(%rsp),%rdx
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

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

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