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


x86 assembly (clang, -O0):
<Mqtt_AppendDPSubvalueInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    $0xc,%esi
lea    0xeba(%rip),%rdx
call   1030 <snprintf@plt>
cltq
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
xor    %r8d,%r8d
call   1040 <Mqtt_AppendDPSubvalue@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mqtt_AppendDPSubvalueInt>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ecx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xec8(%rip),%rdx
lea    0x4(%rsp),%r15
mov    %r15,%rdi
mov    $0xc,%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    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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