#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 */

/* Variables and functions */
int /*<<< orphan*/ UpnpResponseGeneric(void const *, char *, char *, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, unsigned int const);
void UpnpResponse_ContentDirectory_GetSystemUpdateID(const void *UPnPToken,
                                                     const unsigned int Id) {
  char *body;
  body = (char *)malloc(21);
  sprintf(body, "<Id>%u</Id>", Id);
  UpnpResponseGeneric(UPnPToken,
                      "urn:schemas-upnp-org:service:ContentDirectory:1",
                      "GetSystemUpdateID", body);
  free(body);
}


x86 assembly (clang, -O0):
<UpnpResponse_ContentDirectory_GetSystemUpdateID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x15,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe95(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rcx
lea    0xe8d(%rip),%rsi
lea    0xeb6(%rip),%rdx
call   1040 <UpnpResponseGeneric@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UpnpResponse_ContentDirectory_GetSystemUpdateID>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    $0x15,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xea3(%rip),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
call   1060 <sprintf@plt>
lea    0xe9e(%rip),%rsi
lea    0xec7(%rip),%rdx
mov    %r14,%rdi
mov    %rbx,%rcx
call   1040 <UpnpResponseGeneric@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"<Id>%u</Id>\00"
@.str.1 = [48 x i8] c"urn:schemas-upnp-org:service:ContentDirectory:1\00"
@.str.2 = [18 x i8] c"GetSystemUpdateID\00"
define void @UpnpResponse_ContentDirectory_GetSystemUpdateID(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call i64 @malloc(i32 21)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i32, i32* %4
%10 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i8*, i8** %3
%12 = load i8*, i8** %5
%13 = call i32 @UpnpResponseGeneric(i8* %11, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %5
%15 = call i32 @free(i8* %14)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"<Id>%u</Id>\00"
@.str.1 = [48 x i8] c"urn:schemas-upnp-org:service:ContentDirectory:1\00"
@.str.2 = [18 x i8] c"GetSystemUpdateID\00"
define void @UpnpResponse_ContentDirectory_GetSystemUpdateID(i8* %0, i32 %1) {
%3 = tail call i64 @malloc(i32 21)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
%6 = tail call i32 @UpnpResponseGeneric(i8* %0, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%7 = tail call i32 @free(i8* %4)
ret void
}