#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*/ ILibXmlEscape(char *, char const *);
scalar_t__ ILibXmlEscapeLength(char const *);
int /*<<< orphan*/ UpnpResponseGeneric(void const *, char *, char *, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, int const, int const, char *, char *,
                           int const, char *, char *);
scalar_t__ strlen(char *);
void UpnpResponse_MediaRenderer_ConnectionManager_GetCurrentConnectionInfo(
    const void *UPnPToken, const int RcsID, const int AVTransportID,
    const char *unescaped_ProtocolInfo,
    const char *unescaped_PeerConnectionManager, const int PeerConnectionID,
    const char *unescaped_Direction, const char *unescaped_Status) {
  char *body;
  char *ProtocolInfo =
      (char *)malloc(1 + ILibXmlEscapeLength(unescaped_ProtocolInfo));
  char *PeerConnectionManager =
      (char *)malloc(1 + ILibXmlEscapeLength(unescaped_PeerConnectionManager));
  char *Direction =
      (char *)malloc(1 + ILibXmlEscapeLength(unescaped_Direction));
  char *Status = (char *)malloc(1 + ILibXmlEscapeLength(unescaped_Status));
  ILibXmlEscape(ProtocolInfo, unescaped_ProtocolInfo);
  ILibXmlEscape(PeerConnectionManager, unescaped_PeerConnectionManager);
  ILibXmlEscape(Direction, unescaped_Direction);
  ILibXmlEscape(Status, unescaped_Status);
  body = (char *)malloc(233 + strlen(ProtocolInfo) +
                        strlen(PeerConnectionManager) + strlen(Direction) +
                        strlen(Status));
  sprintf(body,
          "<RcsID>%d</RcsID><AVTransportID>%d</AVTransportID><ProtocolInfo>%s</"
          "ProtocolInfo><PeerConnectionManager>%s</"
          "PeerConnectionManager><PeerConnectionID>%d</"
          "PeerConnectionID><Direction>%s</Direction><Status>%s</Status>",
          RcsID, AVTransportID, ProtocolInfo, PeerConnectionManager,
          PeerConnectionID, Direction, Status);
  UpnpResponseGeneric(UPnPToken,
                      "urn:schemas-upnp-org:service:ConnectionManager:1",
                      "GetCurrentConnectionInfo", body);
  free(body);
  free(ProtocolInfo);
  free(PeerConnectionManager);
  free(Direction);
  free(Status);
}


x86 assembly (clang, -O0):
<UpnpResponse_MediaRenderer_ConnectionManager_GetCurrentConnectionInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1090 <ILibXmlEscapeLength@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
call   1090 <ILibXmlEscapeLength@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    0x10(%rbp),%rdi
call   1090 <ILibXmlEscapeLength@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    0x18(%rbp),%rdi
call   1090 <ILibXmlEscapeLength@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <ILibXmlEscape@plt>
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <ILibXmlEscape@plt>
mov    -0x48(%rbp),%rdi
mov    0x10(%rbp),%rsi
call   1040 <ILibXmlEscape@plt>
mov    -0x50(%rbp),%rdi
mov    0x18(%rbp),%rsi
call   1040 <ILibXmlEscape@plt>
mov    -0x38(%rbp),%rdi
call   1060 <strlen@plt>
add    $0xe9,%rax
mov    %rax,-0x68(%rbp)
mov    -0x40(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rcx
mov    -0x68(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x48(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x50(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x58(%rbp),%rdi
add    %rax,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x38(%rbp),%r8
mov    -0x40(%rbp),%r9
mov    -0x24(%rbp),%r11d
mov    -0x48(%rbp),%r10
mov    -0x50(%rbp),%rax
lea    0xd50(%rip),%rsi
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1080 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rcx
lea    0xe04(%rip),%rsi
lea    0xe2e(%rip),%rdx
call   1050 <UpnpResponseGeneric@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UpnpResponse_MediaRenderer_ConnectionManager_GetCurrentConnectionInfo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,0x18(%rsp)
mov    %r8,%rbx
mov    %r8,0x10(%rsp)
mov    %rcx,%r13
mov    %edx,0x4(%rsp)
mov    %esi,(%rsp)
mov    %rdi,0x20(%rsp)
mov    0x68(%rsp),%r15
mov    0x60(%rsp),%rbp
mov    %rcx,%rdi
call   1090 <ILibXmlEscapeLength@plt>
lea    0x1(%rax),%rdi
call   1070 <malloc@plt>
mov    %rax,%r12
mov    %rbx,%rdi
call   1090 <ILibXmlEscapeLength@plt>
lea    0x1(%rax),%rdi
call   1070 <malloc@plt>
mov    %rax,0x8(%rsp)
mov    %rbp,%rdi
call   1090 <ILibXmlEscapeLength@plt>
lea    0x1(%rax),%rdi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    %r15,%rdi
mov    %r15,%rbx
call   1090 <ILibXmlEscapeLength@plt>
lea    0x1(%rax),%rdi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <ILibXmlEscape@plt>
mov    0x8(%rsp),%r13
mov    %r13,%rdi
mov    0x10(%rsp),%rsi
call   1040 <ILibXmlEscape@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1040 <ILibXmlEscape@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <ILibXmlEscape@plt>
mov    %r12,%rdi
call   1060 <strlen@plt>
mov    %rax,%rbp
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %rax,%rbx
add    %rbp,%rbx
mov    %r14,%rdi
call   1060 <strlen@plt>
mov    %rax,%rbp
add    %rbx,%rbp
mov    %r15,%rdi
call   1060 <strlen@plt>
lea    (%rax,%rbp,1),%rdi
add    $0xe9,%rdi
call   1070 <malloc@plt>
mov    %rax,%rbx
sub    $0x8,%rsp
lea    0xd87(%rip),%rsi
mov    %rax,%rdi
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    %r12,%r8
mov    %r13,%r9
push   %r15
push   %r14
push   0x30(%rsp)
call   1080 <sprintf@plt>
add    $0x20,%rsp
lea    0xe34(%rip),%rsi
lea    0xe5e(%rip),%rdx
mov    0x20(%rsp),%rdi
mov    %rbx,%rcx
call   1050 <UpnpResponseGeneric@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [214 x i8] c"<RcsID>%d</RcsID><AVTransportID>%d</AVTransportID><ProtocolInfo>%s</ProtocolInfo><PeerConnectionManager>%s</PeerConnectionManager><PeerConnectionID>%d</PeerConnectionID><Direction>%s</Direction><Status>%s</Status>\00"
@.str.1 = [49 x i8] c"urn:schemas-upnp-org:service:ConnectionManager:1\00"
@.str.2 = [25 x i8] c"GetCurrentConnectionInfo\00"
define void @UpnpResponse_MediaRenderer_ConnectionManager_GetCurrentConnectionInfo(i8* %0, i32 %1, i32 %2, i8* %3, i8* %4, i32 %5, i8* %6, i8* %7) {
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i8*
store i8* %0, i8** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i8* %3, i8** %12
store i8* %4, i8** %13
store i32 %5, i32* %14
store i8* %6, i8** %15
store i8* %7, i8** %16
%22 = load i8*, i8** %12
%23 = call i64 @ILibXmlEscapeLength(i8* %22)
%24 = add nsw i64 1, %23
%25 = call i64 @malloc(i64 %24)
%26 = inttoptr i64 %25 to i8*
store i8* %26, i8** %18
%27 = load i8*, i8** %13
%28 = call i64 @ILibXmlEscapeLength(i8* %27)
%29 = add nsw i64 1, %28
%30 = call i64 @malloc(i64 %29)
%31 = inttoptr i64 %30 to i8*
store i8* %31, i8** %19
%32 = load i8*, i8** %15
%33 = call i64 @ILibXmlEscapeLength(i8* %32)
%34 = add nsw i64 1, %33
%35 = call i64 @malloc(i64 %34)
%36 = inttoptr i64 %35 to i8*
store i8* %36, i8** %20
%37 = load i8*, i8** %16
%38 = call i64 @ILibXmlEscapeLength(i8* %37)
%39 = add nsw i64 1, %38
%40 = call i64 @malloc(i64 %39)
%41 = inttoptr i64 %40 to i8*
store i8* %41, i8** %21
%42 = load i8*, i8** %18
%43 = load i8*, i8** %12
%44 = call i32 @ILibXmlEscape(i8* %42, i8* %43)
%45 = load i8*, i8** %19
%46 = load i8*, i8** %13
%47 = call i32 @ILibXmlEscape(i8* %45, i8* %46)
%48 = load i8*, i8** %20
%49 = load i8*, i8** %15
%50 = call i32 @ILibXmlEscape(i8* %48, i8* %49)
%51 = load i8*, i8** %21
%52 = load i8*, i8** %16
%53 = call i32 @ILibXmlEscape(i8* %51, i8* %52)
%54 = load i8*, i8** %18
%55 = call i64 @strlen(i8* %54)
%56 = add nsw i64 233, %55
%57 = load i8*, i8** %19
%58 = call i64 @strlen(i8* %57)
%59 = add nsw i64 %56, %58
%60 = load i8*, i8** %20
%61 = call i64 @strlen(i8* %60)
%62 = add nsw i64 %59, %61
%63 = load i8*, i8** %21
%64 = call i64 @strlen(i8* %63)
%65 = add nsw i64 %62, %64
%66 = call i64 @malloc(i64 %65)
%67 = inttoptr i64 %66 to i8*
store i8* %67, i8** %17
%68 = load i8*, i8** %17
%69 = load i32, i32* %10
%70 = load i32, i32* %11
%71 = load i8*, i8** %18
%72 = load i8*, i8** %19
%73 = load i32, i32* %14
%74 = load i8*, i8** %20
%75 = load i8*, i8** %21
%76 = call i32 @sprintf(i8* %68, i8* getelementptr inbounds ([214 x i8], [214 x i8]* @.str, i64 0, i64 0), i32 %69, i32 %70, i8* %71, i8* %72, i32 %73, i8* %74, i8* %75)
%77 = load i8*, i8** %9
%78 = load i8*, i8** %17
%79 = call i32 @UpnpResponseGeneric(i8* %77, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %78)
%80 = load i8*, i8** %17
%81 = call i32 @free(i8* %80)
%82 = load i8*, i8** %18
%83 = call i32 @free(i8* %82)
%84 = load i8*, i8** %19
%85 = call i32 @free(i8* %84)
%86 = load i8*, i8** %20
%87 = call i32 @free(i8* %86)
%88 = load i8*, i8** %21
%89 = call i32 @free(i8* %88)
ret void
}

LLVM IR (-O2):
@.str = [214 x i8] c"<RcsID>%d</RcsID><AVTransportID>%d</AVTransportID><ProtocolInfo>%s</ProtocolInfo><PeerConnectionManager>%s</PeerConnectionManager><PeerConnectionID>%d</PeerConnectionID><Direction>%s</Direction><Status>%s</Status>\00"
@.str.1 = [49 x i8] c"urn:schemas-upnp-org:service:ConnectionManager:1\00"
@.str.2 = [25 x i8] c"GetCurrentConnectionInfo\00"
define void @UpnpResponse_MediaRenderer_ConnectionManager_GetCurrentConnectionInfo(i8* %0, i32 %1, i32 %2, i8* %3, i8* %4, i32 %5, i8* %6, i8* %7) {
%9 = tail call i64 @ILibXmlEscapeLength(i8* %3)
%10 = add nsw i64 %9, 1
%11 = tail call i64 @malloc(i64 %10)
%12 = inttoptr i64 %11 to i8*
%13 = tail call i64 @ILibXmlEscapeLength(i8* %4)
%14 = add nsw i64 %13, 1
%15 = tail call i64 @malloc(i64 %14)
%16 = inttoptr i64 %15 to i8*
%17 = tail call i64 @ILibXmlEscapeLength(i8* %6)
%18 = add nsw i64 %17, 1
%19 = tail call i64 @malloc(i64 %18)
%20 = inttoptr i64 %19 to i8*
%21 = tail call i64 @ILibXmlEscapeLength(i8* %7)
%22 = add nsw i64 %21, 1
%23 = tail call i64 @malloc(i64 %22)
%24 = inttoptr i64 %23 to i8*
%25 = tail call i32 @ILibXmlEscape(i8* %12, i8* %3)
%26 = tail call i32 @ILibXmlEscape(i8* %16, i8* %4)
%27 = tail call i32 @ILibXmlEscape(i8* %20, i8* %6)
%28 = tail call i32 @ILibXmlEscape(i8* %24, i8* %7)
%29 = tail call i64 @strlen(i8* dereferenceable(1) %12)
%30 = add nsw i64 %29, 233
%31 = tail call i64 @strlen(i8* dereferenceable(1) %16)
%32 = add nsw i64 %30, %31
%33 = tail call i64 @strlen(i8* dereferenceable(1) %20)
%34 = add nsw i64 %32, %33
%35 = tail call i64 @strlen(i8* dereferenceable(1) %24)
%36 = add nsw i64 %34, %35
%37 = tail call i64 @malloc(i64 %36)
%38 = inttoptr i64 %37 to i8*
%39 = tail call i32 @sprintf(i8* dereferenceable(1) %38, i8* dereferenceable(1) getelementptr inbounds ([214 x i8], [214 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i8* %12, i8* %16, i32 %5, i8* %20, i8* %24)
%40 = tail call i32 @UpnpResponseGeneric(i8* %0, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %38)
%41 = tail call i32 @free(i8* %38)
%42 = tail call i32 @free(i8* %12)
%43 = tail call i32 @free(i8* %16)
%44 = tail call i32 @free(i8* %20)
%45 = tail call i32 @free(i8* %24)
ret void
}