#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 *, int);
int Mqtt_AppendDPInt(struct MqttBuffer *buf, const char *dsid, int64_t ts,
                     int value) {
  char intbuf[12];
  size_t bytes = (size_t)snprintf(intbuf, 12, "%d", value);
  return Mqtt_AppendDP(buf, dsid, ts, intbuf, bytes, 0);
}


x86 assembly (clang, -O0):
<Mqtt_AppendDPInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
lea    -0x24(%rbp),%rdi
mov    -0x18(%rbp),%ecx
mov    $0xc,%esi
lea    0xeb7(%rip),%rdx
call   1040 <snprintf@plt>
cltq
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    -0x24(%rbp),%rcx
mov    -0x30(%rbp),%r8
xor    %r9d,%r9d
call   1030 <Mqtt_AppendDP@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mqtt_AppendDPInt>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xec6(%rip),%rdx
lea    0xc(%rsp),%r15
mov    %r15,%rdi
mov    $0xc,%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    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.MqttBuffer = type { i32 }
@.str = [3 x i8] c"%d\00"
define i32 @Mqtt_AppendDPInt(%struct.MqttBuffer* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca %struct.MqttBuffer*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [12 x i8]
%10 = alloca i64
store %struct.MqttBuffer* %0, %struct.MqttBuffer** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%12 = load i32, i32* %8
%13 = call i32 @snprintf(i8* %11, i32 12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %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 [12 x i8], [12 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 = [3 x i8] c"%d\00"
define i32 @Mqtt_AppendDPInt(%struct.MqttBuffer* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca [12 x i8]
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%7 = call i32 @snprintf(i8* %6, i32 12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %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
}