// File: /workspace/github_cpp_makefile_star2_O3/allardlamberink[P]fritz-curl/fritz-curl.cpp
// Function: executeCurlAction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string executeCurlAction(string fburl, string fbport, string upnpaction, string urn, string functionname, string postfields)
{
	stringstream kout;

	CURL *curl;
	//get a curl handle
	curl = curl_easy_init();
	if(curl)
       	{
		CURLcode res;
		res = curl_global_init(CURL_GLOBAL_DEFAULT);
		
		/* Check for errors */
		if(res != CURLE_OK) {
			fprintf(stderr, "curl_global_init() failed: %s\n",
		        curl_easy_strerror(res));
			return "-1";
		}

		curl_easy_setopt(curl, CURLOPT_URL, (fburl + ":" + fbport + upnpaction).c_str());

		struct curl_slist *c_chunk = NULL;

		string s_soapaction = "SoapAction: " + urn + "#" + functionname;

		c_chunk = curl_slist_append(c_chunk, "Content-Type: text/xml; charset=\"utf-8\"");
		c_chunk = curl_slist_append(c_chunk, s_soapaction.c_str());

		curl_easy_setopt(curl, CURLOPT_HTTPHEADER, c_chunk);

		/* Now specify we want to POST data */
        	curl_easy_setopt(curl, CURLOPT_POST, 1L);
		curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, postfields.size());
		curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postfields.c_str());
		/* get verbose debug output please */
		if(bDebug) curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
		curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
		curl_easy_setopt(curl, CURLOPT_WRITEDATA, &kout);

		/* Perform the request, res will get the return code */
		res = curl_easy_perform(curl);
	
		/* Check for errors */
		if(res != CURLE_OK)
      			fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));

		if(c_chunk != NULL)
			curl_slist_free_all(c_chunk);

		curl_easy_cleanup(curl);
	}
	else
	{
		cout << "could not init curl" <<endl;
	}
	if(bDebug) cout << "result=" << kout.str() << endl;
	return kout.str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %r9, %r15
movq %r8, -0x98(%rbp)
movq %rcx, %r13
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, -0x70(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x3150
callq 0x3400
movq %rax, %r14
testq %rax, %rax
je 0x38c7
movl $0x3, %edi
callq 0x3120
testl %eax, %eax
jne 0x3c85
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq -0x68(%rbp), %rdi
callq 0x6e3a
leaq 0xc8a3(%rip), %rsi      # 0x1012a
leaq -0x68(%rbp), %rdi
callq 0x32e0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
leaq -0x68(%rbp), %rdi
callq 0x3320
leaq -0x80(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3912
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x3918
movq 0x126f2(%rip), %rbx     # 0x15fc0
leaq 0xc7c9(%rip), %rsi      # 0x1009e
movl $0x13, %edx
movq %rbx, %rdi
callq 0x33f0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3440
movsbl %al, %esi
movq 0x126c0(%rip), %rdi     # 0x15fc0
callq 0x3260
movq %rax, %rdi
callq 0x3220
jmp 0x3bb8
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
leaq -0x90(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
callq 0x3320
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0x58(%rbp), %r13
je 0x396c
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x3974
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x48(%rbp), %rdx
movq %r14, %rdi
movl $0x2712, %esi           # imm = 0x2712
xorl %eax, %eax
callq 0x3390
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x39b3
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x30b0
movq -0x90(%rbp), %rdi
cmpq %rbx, %rdi
je 0x39cb
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x30b0
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0x39e0
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x30b0
leaq 0xc660(%rip), %rsi      # 0x10047
leaq -0x68(%rbp), %rdi
movq -0x98(%rbp), %rdx
callq 0x6c51
leaq 0xc656(%rip), %rsi      # 0x10054
leaq -0x68(%rbp), %rdi
callq 0x32e0
movq %rbx, -0x90(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3a2d
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x3a33
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
leaq -0x90(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
callq 0x3320
movq %r12, -0x48(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3a7d
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x3a85
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x90(%rbp), %rdi
cmpq %rbx, %rdi
je 0x3ab4
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x30b0
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0x3ac9
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x30b0
leaq 0xc586(%rip), %rsi      # 0x10056
xorl %edi, %edi
callq 0x32d0
movq -0x48(%rbp), %rsi
movq %rax, %rdi
callq 0x32d0
movq %rax, %r15
movq %r14, %rdi
movl $0x2727, %esi           # imm = 0x2727
movq %rax, %rdx
xorl %eax, %eax
callq 0x3390
movl $0x1, %edx
movq %r14, %rdi
movl $0x2f, %esi
xorl %eax, %eax
callq 0x3390
movq 0x10(%rbp), %rbx
movq 0x8(%rbx), %rdx
movq %r14, %rdi
movl $0x3c, %esi
xorl %eax, %eax
callq 0x3390
movq (%rbx), %rdx
movq %r14, %rdi
movl $0x271f, %esi           # imm = 0x271F
xorl %eax, %eax
callq 0x3390
cmpb $0x1, 0x12738(%rip)     # 0x16274
jne 0x3b52
movl $0x1, %edx
movq %r14, %rdi
movl $0x29, %esi
xorl %eax, %eax
callq 0x3390
leaq -0x4ba(%rip), %rdx      # 0x369f
movq %r14, %rdi
movl $0x4e2b, %esi           # imm = 0x4E2B
xorl %eax, %eax
callq 0x3390
leaq -0x220(%rbp), %rdx
movq %r14, %rdi
movl $0x2711, %esi           # imm = 0x2711
xorl %eax, %eax
callq 0x3390
movq %r14, %rdi
callq 0x32f0
testl %eax, %eax
jne 0x3cca
testq %r15, %r15
je 0x3b9b
movq %r15, %rdi
callq 0x33c0
movq %r14, %rdi
callq 0x30c0
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x3bb8
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x30b0
cmpb $0x1, 0x126b5(%rip)     # 0x16274
jne 0x3c40
movq 0x123f8(%rip), %rdi     # 0x15fc0
leaq 0xc4e3(%rip), %rsi      # 0x100b2
movl $0x7, %edx
callq 0x33f0
leaq -0x208(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x31a0
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq 0x123c8(%rip), %rdi     # 0x15fc0
callq 0x33f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3440
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3260
movq %rax, %rdi
callq 0x3220
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3c40
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x30b0
leaq -0x208(%rbp), %rsi
movq -0x70(%rbp), %rdi
callq 0x31a0
movq 0x12391(%rip), %rsi     # 0x15fe8
leaq -0x220(%rbp), %rdi
callq 0x3330
leaq -0x1a0(%rbp), %rdi
callq 0x3310
movq -0x70(%rbp), %rax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x12344(%rip), %rcx     # 0x15fd0
movq (%rcx), %rbx
movl %eax, %edi
callq 0x31f0
leaq 0xc388(%rip), %rsi      # 0x10025
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3110
movq -0x70(%rbp), %rdi
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
leaq 0xc388(%rip), %rsi      # 0x10044
leaq 0xc383(%rip), %rdx      # 0x10046
callq 0x6d9c
jmp 0x3c50
movq 0x122ff(%rip), %rcx     # 0x15fd0
movq (%rcx), %rbx
movl %eax, %edi
callq 0x31f0
leaq 0xc39c(%rip), %rsi      # 0x1007e
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3110
jmp 0x3b8e
jmp 0x3d63
jmp 0x3d63
jmp 0x3d18
jmp 0x3d37
jmp 0x3d63
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x3d1b
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x30b0
jmp 0x3d1b
movq %rax, %r14
movq -0x90(%rbp), %rdi
cmpq %rbx, %rdi
je 0x3d3a
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x30b0
jmp 0x3d3a
jmp 0x3d37
movq %rax, %r14
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x3d80
movq -0x58(%rbp), %rsi
jmp 0x3d78
jmp 0x3d63
jmp 0x3d63
movq %rax, %r14
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x3d74
jmp 0x3d80
movq %rax, %r14
jmp 0x3d80
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x3d80
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x30b0
movq 0x12261(%rip), %rsi     # 0x15fe8
leaq -0x220(%rbp), %rdi
callq 0x3330
leaq -0x1a0(%rbp), %rdi
callq 0x3310
movq %r14, %rdi
callq 0x32c0