#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*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
char *to_string(int, double, double, double, double, double);
void main() {
  char *str = NULL;
  double values[] = {1.245, -3.5, 6.758, 33.399, -1.02};
  str = to_string(sizeof values / sizeof(double), values[0], values[1],
                  values[2], values[3], values[4]);
  printf("The string of values is:\n%s\n", str);
  free(str);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movsd  0xeb8(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xea3(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe79(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe64(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  -0x10(%rbp),%xmm4
mov    $0x5,%edi
call   1060 <to_string@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe55(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
movsd  0xec7(%rip),%xmm0
movsd  0xec7(%rip),%xmm1
movsd  0xec7(%rip),%xmm2
movsd  0xec7(%rip),%xmm3
movsd  0xec7(%rip),%xmm4
mov    $0x5,%edi
call   1050 <to_string@plt>
mov    %rax,%rbx
lea    0xebb(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"The string of values is:\0A%s\0A\00"
define void @main() {
%1 = alloca i8*
%2 = alloca [5 x double]
store i8* null, i8** %1
%3 = bitcast [5 x double]* %2 to i8*
%4 = bitcast i8* %3 to [5 x double]*
%5 = getelementptr inbounds [5 x double], [5 x double]* %4, i32 0, i32 0
store double 1.245000e+00, double* %5
%6 = getelementptr inbounds [5 x double], [5 x double]* %4, i32 0, i32 1
store double -3.500000e+00, double* %6
%7 = getelementptr inbounds [5 x double], [5 x double]* %4, i32 0, i32 2
store double 6.758000e+00, double* %7
%8 = getelementptr inbounds [5 x double], [5 x double]* %4, i32 0, i32 3
store double 3.339900e+01, double* %8
%9 = getelementptr inbounds [5 x double], [5 x double]* %4, i32 0, i32 4
store double -1.020000e+00, double* %9
%10 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 0
%11 = load double, double* %10
%12 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 1
%13 = load double, double* %12
%14 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 2
%15 = load double, double* %14
%16 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 3
%17 = load double, double* %16
%18 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 4
%19 = load double, double* %18
%20 = call i8* @to_string(i32 5, double %11, double %13, double %15, double %17, double %19)
store i8* %20, i8** %1
%21 = load i8*, i8** %1
%22 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = load i8*, i8** %1
%24 = call i32 @free(i8* %23)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"The string of values is:\0A%s\0A\00"
define void @main() {
%1 = tail call i8* @to_string(i32 5, double 1.245000e+00, double -3.500000e+00, double 6.758000e+00, double 3.339900e+01, double -1.020000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = tail call i32 @free(i8* %1)
ret void
}