#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;
};
typedef int /*<<< orphan*/ int64_t;

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


x86 assembly (clang, -O0):
<Mqtt_AppendDPDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
lea    -0x160(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
mov    $0x140,%esi
lea    0xead(%rip),%rdx
call   1040 <snprintf@plt>
cltq
mov    %rax,-0x168(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    -0x160(%rbp),%rcx
mov    -0x168(%rbp),%r8
xor    %r9d,%r9d
call   1030 <Mqtt_AppendDP@plt>
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mqtt_AppendDPDouble>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x148,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xec3(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x140,%esi
call   1040 <snprintf@plt>
movslq %eax,%r8
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
mov    %r15,%rcx
xor    %r9d,%r9d
call   1030 <Mqtt_AppendDP@plt>
add    $0x148,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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