#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 UPNParg {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ DisplayNameValueList(char *, int);
int /*<<< orphan*/ simpleUPnPcommand(int, char const *, char const *,
                                     char const *, struct UPNParg const *,
                                     char *, int *);
int UPNP_GetGeneralVariable(const char *controlURL, const char *servicetype,
                            const char *variable,
                            const struct UPNParg *arguments) {
  char buffer[4096];
  int bufsize = 4096;
  if (!controlURL || !servicetype || !variable)
    return -1;
  simpleUPnPcommand(-1, controlURL, servicetype, variable, arguments, buffer,
                    &bufsize);
  DisplayNameValueList(buffer, bufsize);
  return 0;
}


x86 assembly (clang, -O0):
<UPNP_GetGeneralVariable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1040,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x1000,-0x1034(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1166 <UPNP_GetGeneralVariable+0x46>
cmpq   $0x0,-0x18(%rbp)
je     1166 <UPNP_GetGeneralVariable+0x46>
cmpq   $0x0,-0x20(%rbp)
jne    1172 <UPNP_GetGeneralVariable+0x52>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b7 <UPNP_GetGeneralVariable+0x97>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    -0x1030(%rbp),%r9
mov    $0xffffffff,%edi
lea    -0x1034(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <simpleUPnPcommand@plt>
lea    -0x1030(%rbp),%rdi
mov    -0x1034(%rbp),%esi
call   1040 <DisplayNameValueList@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UPNP_GetGeneralVariable>:
push   %rbx
sub    $0x1010,%rsp
movl   $0x1000,0xc(%rsp)
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     1179 <UPNP_GetGeneralVariable+0x59>
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
test   %rsi,%rsi
je     1179 <UPNP_GetGeneralVariable+0x59>
test   %rcx,%rcx
je     1179 <UPNP_GetGeneralVariable+0x59>
mov    %rdi,%rsi
lea    0xc(%rsp),%rax
mov    %rax,(%rsp)
lea    0x10(%rsp),%rbx
mov    $0xffffffff,%edi
mov    %rbx,%r9
call   1030 <simpleUPnPcommand@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <DisplayNameValueList@plt>
xor    %eax,%eax
add    $0x1010,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.UPNParg = type { i32 }
define i32 @UPNP_GetGeneralVariable(i8* %0, i8* %1, i8* %2, %struct.UPNParg* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca %struct.UPNParg*
%10 = alloca [4096 x i8]
%11 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store %struct.UPNParg* %3, %struct.UPNParg** %9
store i32 4096, i32* %11
%12 = load i8*, i8** %6
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %20
14: ; preds = %4
%15 = load i8*, i8** %7
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i8*, i8** %8
%19 = icmp ne i8* %18, null
br i1 %19, label %21, label %20
20: ; preds = %17, %14, %4
store i32 -1, i32* %5
br label %31
21: ; preds = %17
%22 = load i8*, i8** %6
%23 = load i8*, i8** %7
%24 = load i8*, i8** %8
%25 = load %struct.UPNParg*, %struct.UPNParg** %9
%26 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%27 = call i32 @simpleUPnPcommand(i32 -1, i8* %22, i8* %23, i8* %24, %struct.UPNParg* %25, i8* %26, i32* %11)
%28 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%29 = load i32, i32* %11
%30 = call i32 @DisplayNameValueList(i8* %28, i32 %29)
store i32 0, i32* %5
br label %31
31: ; preds = %21, %20
%32 = load i32, i32* %5
ret i32 %32
}

LLVM IR (-O2):
%struct.UPNParg = type { i32 }
define i32 @UPNP_GetGeneralVariable(i8* %0, i8* %1, i8* %2, %struct.UPNParg* %3) {
%5 = alloca [4096 x i8]
%6 = alloca i32
%7 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%8 = bitcast i32* %6 to i8*
store i32 4096, i32* %6
%9 = icmp ne i8* %0, null
%10 = icmp ne i8* %1, null
%11 = and i1 %9, %10
%12 = icmp ne i8* %2, null
%13 = and i1 %11, %12
br i1 %13, label %14, label %18
14: ; preds = %4
%15 = call i32 @simpleUPnPcommand(i32 -1, i8* %0, i8* %1, i8* %2, %struct.UPNParg* %3, i8* %7, i32* %6)
%16 = load i32, i32* %6
%17 = call i32 @DisplayNameValueList(i8* %7, i32 %16)
br label %18
18: ; preds = %4, %14
%19 = phi i32 [ 0, %14 ], [ -1, %4 ]
ret i32 %19
}