#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 */

/* Variables and functions */
int /*<<< orphan*/ Q_snprintfz(char *, int, char *, float, float, float);
char *vtos(float v[3]) {
  static int index;
  static char str[8][32];
  char *s;
  s = str[index];
  index = (index + 1) & 7;
  Q_snprintfz(s, 32, "(%+6.3f %+6.3f %+6.3f)", v[0], v[1], v[2]);
  return s;
}


x86 assembly (clang, -O0):
<vtos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movslq 0x2f1d(%rip),%rcx
lea    0x2f26(%rip),%rax
shl    $0x5,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    0x2f05(%rip),%eax
add    $0x1,%eax
and    $0x7,%eax
mov    %eax,0x2ef9(%rip)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm2
mov    $0x20,%esi
lea    0xe8f(%rip),%rdx
call   1030 <Q_snprintfz@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vtos>:
push   %rbx
mov    0x2f29(%rip),%eax
lea    0x1(%rax),%ecx
shl    $0x5,%rax
lea    0x2f2b(%rip),%rbx
add    %rax,%rbx
and    $0x7,%ecx
mov    %ecx,0x2f0f(%rip)
movss  (%rdi),%xmm0
movss  0x4(%rdi),%xmm1
movss  0x8(%rdi),%xmm2
lea    0xeba(%rip),%rdx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <Q_snprintfz@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@vtos.index = internal global i32 0
@vtos.str = internal global [8 x [32 x i8]] zeroinitializer
@.str = [23 x i8] c"(%+6.3f %+6.3f %+6.3f)\00"
define i8* @vtos(float* %0) {
%2 = alloca float*
%3 = alloca i8*
store float* %0, float** %2
%4 = load i32, i32* @vtos.index
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [8 x [32 x i8]], [8 x [32 x i8]]* @vtos.str, i64 0, i64 %5
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
store i8* %7, i8** %3
%8 = load i32, i32* @vtos.index
%9 = add nsw i32 %8, 1
%10 = and i32 %9, 7
store i32 %10, i32* @vtos.index
%11 = load i8*, i8** %3
%12 = load float*, float** %2
%13 = getelementptr inbounds float, float* %12, i64 0
%14 = load float, float* %13
%15 = load float*, float** %2
%16 = getelementptr inbounds float, float* %15, i64 1
%17 = load float, float* %16
%18 = load float*, float** %2
%19 = getelementptr inbounds float, float* %18, i64 2
%20 = load float, float* %19
%21 = call i32 @Q_snprintfz(i8* %11, i32 32, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), float %14, float %17, float %20)
%22 = load i8*, i8** %3
ret i8* %22
}

LLVM IR (-O2):
@vtos.index = internal unnamed_addr global i32 0
@vtos.str = internal global [8 x [32 x i8]] zeroinitializer
@.str = [23 x i8] c"(%+6.3f %+6.3f %+6.3f)\00"
define i8* @vtos(float* nocapture %0) {
%2 = load i32, i32* @vtos.index
%3 = zext i32 %2 to i64
%4 = getelementptr inbounds [8 x [32 x i8]], [8 x [32 x i8]]* @vtos.str, i64 0, i64 %3, i64 0
%5 = add nsw i32 %2, 1
%6 = and i32 %5, 7
store i32 %6, i32* @vtos.index
%7 = load float, float* %0
%8 = getelementptr inbounds float, float* %0, i64 1
%9 = load float, float* %8
%10 = getelementptr inbounds float, float* %0, i64 2
%11 = load float, float* %10
%12 = tail call i32 @Q_snprintfz(i8* %4, i32 32, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), float %7, float %9, float %11)
ret i8* %4
}