#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 fprint_vec(FILE *fp, double t, double *x, int n) {
  if (fp) {
    fprintf(fp, "%lf ", t);
    int i;
    for (i = 0; i < n; i++) {
      fprintf(fp, "%lf ", x[i]);
    }
    fprintf(fp, "\n");
  }
}


x86 assembly (clang, -O0):
<fprint_vec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     119c <fprint_vec+0x8c>
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
lea    0xebd(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    118a <fprint_vec+0x7a>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe8b(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1151 <fprint_vec+0x41>
mov    -0x8(%rbp),%rdi
lea    0xe70(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_vec>:
test   %rdi,%rdi
je     1191 <fprint_vec+0x71>
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r12
lea    0xec4(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
test   %ebp,%ebp
jle    117c <fprint_vec+0x5c>
mov    %ebp,%ebp
xor    %ebx,%ebx
lea    0xeae(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r14,%rbx,8),%xmm0
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <fprint_vec+0x40>
mov    $0xa,%edi
mov    %r12,%rsi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>
ret

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

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