// File: /workspace/github_cpp_makefile_star2_O1/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 $0x208, %rsp            # imm = 0x208
movq %r9, %r12
movq %r8, -0xa0(%rbp)
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, -0x78(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x3150
callq 0x3400
movq %rax, %r15
testq %rax, %rax
je 0x38af
movl $0x3, %edi
callq 0x3120
testl %eax, %eax
movl %eax, -0x4c(%rbp)
jne 0x3c86
leaq -0x60(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x6e46
leaq 0xd8c1(%rip), %rsi      # 0x1112a
leaq -0x70(%rbp), %rdi
callq 0x32e0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
leaq -0x70(%rbp), %rdi
callq 0x3320
leaq -0x88(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x38fa
movq %rdx, -0x98(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x88(%rbp)
jmp 0x3902
movq 0x1370a(%rip), %rbx     # 0x16fc0
leaq 0xd7e1(%rip), %rsi      # 0x1109e
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 0x136d8(%rip), %rdi     # 0x16fc0
callq 0x3260
movq %rax, %rdi
callq 0x3220
jmp 0x3bb9
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq -0x98(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
callq 0x3320
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3950
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x3957
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x48(%rbp), %rdx
movq %r15, %rdi
movl $0x2712, %esi           # imm = 0x2712
xorl %eax, %eax
callq 0x3390
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x3996
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x30b0
movq -0x98(%rbp), %rdi
cmpq %r13, %rdi
je 0x39b1
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x30b0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x39ca
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x30b0
leaq 0xd676(%rip), %rsi      # 0x11047
leaq -0x70(%rbp), %rdi
movq -0xa0(%rbp), %rdx
callq 0x6c61
leaq 0xd66c(%rip), %rsi      # 0x11054
leaq -0x70(%rbp), %rdi
callq 0x32e0
movq %r13, -0x98(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3a1a
movq %rdx, -0x98(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x88(%rbp)
jmp 0x3a22
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq -0x98(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
callq 0x3320
movq %r14, -0x48(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3a6e
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x3a75
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x98(%rbp), %rdi
cmpq %r13, %rdi
je 0x3aa7
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x30b0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3ac0
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x30b0
leaq 0xd58f(%rip), %rsi      # 0x11056
xorl %edi, %edi
callq 0x32d0
movq -0x48(%rbp), %rsi
movq %rax, %rdi
callq 0x32d0
movq %rax, %r12
movq %r15, %rdi
movl $0x2727, %esi           # imm = 0x2727
movq %rax, %rdx
xorl %eax, %eax
callq 0x3390
movl $0x1, %edx
movq %r15, %rdi
movl $0x2f, %esi
xorl %eax, %eax
callq 0x3390
movq 0x10(%rbp), %rbx
movq 0x8(%rbx), %rdx
movq %r15, %rdi
movl $0x3c, %esi
xorl %eax, %eax
callq 0x3390
movq (%rbx), %rdx
movq %r15, %rdi
movl $0x271f, %esi           # imm = 0x271F
xorl %eax, %eax
callq 0x3390
cmpb $0x1, 0x13741(%rip)     # 0x17274
jne 0x3b49
movl $0x1, %edx
movq %r15, %rdi
movl $0x29, %esi
xorl %eax, %eax
callq 0x3390
leaq -0x4d1(%rip), %rdx      # 0x367f
movq %r15, %rdi
movl $0x4e2b, %esi           # imm = 0x4E2B
xorl %eax, %eax
callq 0x3390
leaq -0x228(%rbp), %rdx
movq %r15, %rdi
movl $0x2711, %esi           # imm = 0x2711
xorl %eax, %eax
callq 0x3390
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
jne 0x3ccf
testq %r12, %r12
je 0x3b92
movq %r12, %rdi
callq 0x33c0
movq %r15, %rdi
callq 0x30c0
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x3baf
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x30b0
cmpl $0x0, -0x4c(%rbp)
jne 0x3c51
cmpb $0x1, 0x136b4(%rip)     # 0x17274
jne 0x3c41
movq 0x133f7(%rip), %rdi     # 0x16fc0
leaq 0xd4e2(%rip), %rsi      # 0x110b2
movl $0x7, %edx
callq 0x33f0
leaq -0x210(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x31a0
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq 0x133c7(%rip), %rdi     # 0x16fc0
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 0x3c41
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x30b0
leaq -0x210(%rbp), %rsi
movq -0x78(%rbp), %rdi
callq 0x31a0
movq 0x13390(%rip), %rsi     # 0x16fe8
leaq -0x228(%rbp), %rdi
callq 0x3330
leaq -0x1a8(%rbp), %rdi
callq 0x3310
movq -0x78(%rbp), %rax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x13343(%rip), %rcx     # 0x16fd0
movq (%rcx), %rbx
movl -0x4c(%rbp), %edi
callq 0x31f0
leaq 0xd386(%rip), %rsi      # 0x11025
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3110
movq -0x78(%rbp), %rdi
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
leaq 0xd386(%rip), %rsi      # 0x11044
leaq 0xd381(%rip), %rdx      # 0x11046
callq 0x6dac
jmp 0x3baf
movq 0x132fa(%rip), %rcx     # 0x16fd0
movq (%rcx), %rbx
movl %eax, %edi
callq 0x31f0
leaq 0xd397(%rip), %rsi      # 0x1107e
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3110
jmp 0x3b85
jmp 0x3d6b
jmp 0x3d6b
jmp 0x3d1d
jmp 0x3d3f
jmp 0x3d6b
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x3d20
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x30b0
jmp 0x3d20
movq %rax, %rbx
movq -0x98(%rbp), %rdi
cmpq %r13, %rdi
je 0x3d42
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x30b0
jmp 0x3d42
jmp 0x3d3f
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3d88
movq -0x60(%rbp), %rsi
jmp 0x3d80
jmp 0x3d6b
jmp 0x3d6b
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x3d7c
jmp 0x3d88
movq %rax, %rbx
jmp 0x3d88
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x3d88
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x30b0
movq 0x13259(%rip), %rsi     # 0x16fe8
leaq -0x228(%rbp), %rdi
callq 0x3330
leaq -0x1a8(%rbp), %rdi
callq 0x3310
movq %rbx, %rdi
callq 0x32c0