#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 MqttBuffer {
  int dummy;
};

/* Variables and functions */
int Mqtt_AppendDPSubvalue(struct MqttBuffer *, char const *, char *, size_t,
                          int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, double);
int Mqtt_AppendDPSubvalueDouble(struct MqttBuffer *buf, const char *name,
                                double value) {
  char dblbuf[320];
  size_t bytes = (size_t)snprintf(dblbuf, 320, "%lf", value);
  return Mqtt_AppendDPSubvalue(buf, name, dblbuf, bytes, 0);
}


x86 assembly (clang, -O0):
<Mqtt_AppendDPSubvalueDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
lea    -0x160(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
mov    $0x140,%esi
lea    0xeb0(%rip),%rdx
call   1030 <snprintf@plt>
cltq
mov    %rax,-0x168(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x160(%rbp),%rdx
mov    -0x168(%rbp),%rcx
xor    %r8d,%r8d
call   1040 <Mqtt_AppendDPSubvalue@plt>
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mqtt_AppendDPSubvalueDouble>:
push   %r15
push   %r14
push   %rbx
sub    $0x140,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xec7(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x140,%esi
call   1030 <snprintf@plt>
movslq %eax,%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %r8d,%r8d
call   1040 <Mqtt_AppendDPSubvalue@plt>
add    $0x140,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.MqttBuffer = type { i32 }
@.str = [4 x i8] c"%lf\00"
define i32 @Mqtt_AppendDPSubvalueDouble(%struct.MqttBuffer* %0, i8* %1, double %2) {
%4 = alloca %struct.MqttBuffer*
%5 = alloca i8*
%6 = alloca double
%7 = alloca [320 x i8]
%8 = alloca i64
store %struct.MqttBuffer* %0, %struct.MqttBuffer** %4
store i8* %1, i8** %5
store double %2, double* %6
%9 = getelementptr inbounds [320 x i8], [320 x i8]* %7, i64 0, i64 0
%10 = load double, double* %6
%11 = call i32 @snprintf(i8* %9, i32 320, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %10)
%12 = sext i32 %11 to i64
store i64 %12, i64* %8
%13 = load %struct.MqttBuffer*, %struct.MqttBuffer** %4
%14 = load i8*, i8** %5
%15 = getelementptr inbounds [320 x i8], [320 x i8]* %7, i64 0, i64 0
%16 = load i64, i64* %8
%17 = call i32 @Mqtt_AppendDPSubvalue(%struct.MqttBuffer* %13, i8* %14, i8* %15, i64 %16, i32 0)
ret i32 %17
}

LLVM IR (-O2):
%struct.MqttBuffer = type { i32 }
@.str = [4 x i8] c"%lf\00"
define i32 @Mqtt_AppendDPSubvalueDouble(%struct.MqttBuffer* %0, i8* %1, double %2) {
%4 = alloca [320 x i8]
%5 = getelementptr inbounds [320 x i8], [320 x i8]* %4, i64 0, i64 0
%6 = call i32 @snprintf(i8* %5, i32 320, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %2)
%7 = sext i32 %6 to i64
%8 = call i32 @Mqtt_AppendDPSubvalue(%struct.MqttBuffer* %0, i8* %1, i8* %5, i64 %7, i32 0)
ret i32 %8
}