#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 */
struct tagStorm {
  int dummy;
};
struct tagStanza {
  int dummy;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ safef(char *, int, char *, double);
int /*<<< orphan*/ tagStanzaAdd(struct tagStorm *, struct tagStanza *, char *,
                                char *);
void tagStanzaAddDouble(struct tagStorm *tagStorm, struct tagStanza *stanza,
                        char *var, double val) {
  char buf[32];
  safef(buf, sizeof(buf), "%g", val);
  tagStanzaAdd(tagStorm, stanza, var, buf);
}


x86 assembly (clang, -O0):
<tagStanzaAddDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
lea    -0x40(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
mov    $0x20,%esi
lea    0xeb2(%rip),%rdx
call   1040 <safef@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   1030 <tagStanzaAdd@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tagStanzaAddDouble>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xec5(%rip),%rdx
mov    %rsp,%r12
mov    %r12,%rdi
mov    $0x20,%esi
call   1040 <safef@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %r12,%rcx
call   1030 <tagStanzaAdd@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tagStorm = type { i32 }
%struct.tagStanza = type { i32 }
@.str = [3 x i8] c"%g\00"
define void @tagStanzaAddDouble(%struct.tagStorm* %0, %struct.tagStanza* %1, i8* %2, double %3) {
%5 = alloca %struct.tagStorm*
%6 = alloca %struct.tagStanza*
%7 = alloca i8*
%8 = alloca double
%9 = alloca [32 x i8]
store %struct.tagStorm* %0, %struct.tagStorm** %5
store %struct.tagStanza* %1, %struct.tagStanza** %6
store i8* %2, i8** %7
store double %3, double* %8
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%11 = load double, double* %8
%12 = call i32 @safef(i8* %10, i32 32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %11)
%13 = load %struct.tagStorm*, %struct.tagStorm** %5
%14 = load %struct.tagStanza*, %struct.tagStanza** %6
%15 = load i8*, i8** %7
%16 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%17 = call i32 @tagStanzaAdd(%struct.tagStorm* %13, %struct.tagStanza* %14, i8* %15, i8* %16)
ret void
}

LLVM IR (-O2):
%struct.tagStorm = type { i32 }
%struct.tagStanza = type { i32 }
@.str = [3 x i8] c"%g\00"
define void @tagStanzaAddDouble(%struct.tagStorm* %0, %struct.tagStanza* %1, i8* %2, double %3) {
%5 = alloca [32 x i8]
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%7 = call i32 @safef(i8* %6, i32 32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %3)
%8 = call i32 @tagStanzaAdd(%struct.tagStorm* %0, %struct.tagStanza* %1, i8* %2, i8* %6)
ret void
}