#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*/ assert(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
void fprint_vector(FILE *fp, const char *sep, const double *x, const int n) {
  assert(NULL != fp);
  assert(NULL != x);
  assert(n > 0);
  fprintf(fp, "%6.5e", x[0]);
  for (int i = 1; i < n; i++) {
    fprintf(fp, "%s%6.5e", sep, x[i]);
  }
  fputc('\n', fp);
}


x86 assembly (clang, -O0):
<fprint_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x0,-0x1c(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xe71(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11dc <fprint_vector+0xac>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe39(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    119f <fprint_vector+0x6f>
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1030 <fputc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_vector>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r13
xor    %edi,%edi
test   %r13,%r13
setne  %dil
call   1040 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1040 <assert@plt>
xor    %edi,%edi
test   %ebp,%ebp
setg   %dil
call   1040 <assert@plt>
movsd  (%r14),%xmm0
lea    0xe87(%rip),%rsi
mov    %r13,%rdi
mov    $0x1,%al
call   1050 <fprintf@plt>
cmp    $0x2,%ebp
jl     11bf <fprint_vector+0x8f>
mov    %ebp,%ebp
mov    $0x1,%ebx
lea    0xe68(%rip),%r12
nopl   0x0(%rax,%rax,1)
movsd  (%r14,%rbx,8),%xmm0
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    $0x1,%al
call   1050 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11a0 <fprint_vector+0x70>
mov    $0xa,%edi
mov    %r13,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

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

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