#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 upnphttp {
  int dummy;
};
typedef int /*<<< orphan*/ body;

/* Variables and functions */
int /*<<< orphan*/ BuildSendAndCloseSoapResp(struct upnphttp *, char *, int);
int snprintf(char *, int, char const *, char const *, char *, char const *);
void GetSortCapabilities(struct upnphttp *h, const char *action) {
  static const char resp[] = "<u:%sResponse "
                             "xmlns:u=\"%s\">"
                             "<SortCaps>"
                             "dc:title,"
                             "dc:date,"
                             "upnp:class,"
                             "upnp:originalTrackNumber"
                             "</SortCaps>"
                             "</u:%sResponse>";
  char body[512];
  int bodylen;
  bodylen = snprintf(body, sizeof(body), resp, action,
                     "urn:schemas-upnp-org:service:ContentDirectory:1", action);
  BuildSendAndCloseSoapResp(h, body, bodylen);
}


x86 assembly (clang, -O0):
<GetSortCapabilities>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%r9
mov    $0x200,%esi
lea    0xeb2(%rip),%rdx
lea    0xf1f(%rip),%r8
call   1030 <snprintf@plt>
mov    %eax,-0x214(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    -0x214(%rbp),%edx
call   1040 <BuildSendAndCloseSoapResp@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetSortCapabilities>:
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rsi,%rcx
mov    %rdi,%rbx
lea    0xec9(%rip),%rdx
lea    0xf36(%rip),%r8
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x200,%esi
mov    %rcx,%r9
call   1030 <snprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <BuildSendAndCloseSoapResp@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.upnphttp = type { i32 }
@GetSortCapabilities.resp = internal constant [116 x i8] c"<u:%sResponse xmlns:u=\22%s\22><SortCaps>dc:title,dc:date,upnp:class,upnp:originalTrackNumber</SortCaps></u:%sResponse>\00"
@.str = [48 x i8] c"urn:schemas-upnp-org:service:ContentDirectory:1\00"
define void @GetSortCapabilities(%struct.upnphttp* %0, i8* %1) {
%3 = alloca %struct.upnphttp*
%4 = alloca i8*
%5 = alloca [512 x i8]
%6 = alloca i32
store %struct.upnphttp* %0, %struct.upnphttp** %3
store i8* %1, i8** %4
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %4
%9 = load i8*, i8** %4
%10 = call i32 @snprintf(i8* %7, i32 512, i8* getelementptr inbounds ([116 x i8], [116 x i8]* @GetSortCapabilities.resp, i64 0, i64 0), i8* %8, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %9)
store i32 %10, i32* %6
%11 = load %struct.upnphttp*, %struct.upnphttp** %3
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%13 = load i32, i32* %6
%14 = call i32 @BuildSendAndCloseSoapResp(%struct.upnphttp* %11, i8* %12, i32 %13)
ret void
}

LLVM IR (-O2):
%struct.upnphttp = type { i32 }
@GetSortCapabilities.resp = internal constant [116 x i8] c"<u:%sResponse xmlns:u=\22%s\22><SortCaps>dc:title,dc:date,upnp:class,upnp:originalTrackNumber</SortCaps></u:%sResponse>\00"
@.str = [48 x i8] c"urn:schemas-upnp-org:service:ContentDirectory:1\00"
define void @GetSortCapabilities(%struct.upnphttp* %0, i8* %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 512, i8* getelementptr inbounds ([116 x i8], [116 x i8]* @GetSortCapabilities.resp, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = call i32 @BuildSendAndCloseSoapResp(%struct.upnphttp* %0, i8* %4, i32 %5)
ret void
}