#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 const *, float const);
void fvec_fprintf(FILE *f, const float *v, int n, const char *fmt) {
  int i;
  if (fmt == NULL)
    fmt = "%f ";
  for (i = 0; i < n; i++)
    fprintf(f, fmt, v[i]);
}


x86 assembly (clang, -O0):
<fvec_fprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    113d <fvec_fprintf+0x2d>
lea    0xec7(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1178 <fvec_fprintf+0x68>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1144 <fvec_fprintf+0x34>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fvec_fprintf>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %rcx,%rcx
lea    0xedd(%rip),%r12
cmovne %rcx,%r12
test   %edx,%edx
jle    115a <fvec_fprintf+0x4a>
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%r13d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movss  (%r14,%rbx,4),%xmm0
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1140 <fvec_fprintf+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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