#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*/ free(char *);
unsigned int iDoRemoteFunc(unsigned char *, unsigned int, int);
char *malloc(int);
unsigned int sprintf(char *, char *, int);
int /*<<< orphan*/ vWriteLogTxt(char *, unsigned int);
void _vRcSLE4442_Close(void) {
  unsigned int uiDataLen, uiRet;
  char *psFunCall = malloc(50);
  uiDataLen = sprintf(psFunCall, "%u()", 9202);
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
  if (uiRet) {
    vWriteLogTxt("_SLE4442_Close iDoRemoteFunc ret = %d", uiRet);
  }
}


x86 assembly (clang, -O0):
<_vRcSLE4442_Close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x32,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
mov    $0x23f2,%edx
call   1070 <sprintf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x1,%edx
call   1060 <iDoRemoteFunc@plt>
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x8(%rbp)
je     11b4 <_vRcSLE4442_Close+0x64>
mov    -0x8(%rbp),%esi
lea    0xe56(%rip),%rdi
call   1040 <vWriteLogTxt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_vRcSLE4442_Close>:
push   %rbp
push   %rbx
push   %rax
mov    $0x32,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xe99(%rip),%rsi
mov    %rax,%rdi
mov    $0x23f2,%edx
call   1070 <sprintf@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   1060 <iDoRemoteFunc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
test   %ebp,%ebp
je     11a5 <_vRcSLE4442_Close+0x55>
lea    0xe6d(%rip),%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <vWriteLogTxt@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%u()\00"
@.str.1 = [38 x i8] c"_SLE4442_Close iDoRemoteFunc ret = %d\00"
define void @_vRcSLE4442_Close() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = call i8* @malloc(i32 50)
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 9202)
store i32 %6, i32* %1
%7 = load i8*, i8** %3
%8 = load i32, i32* %1
%9 = call i32 @iDoRemoteFunc(i8* %7, i32 %8, i32 1)
store i32 %9, i32* %2
%10 = load i8*, i8** %3
%11 = call i32 @free(i8* %10)
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = load i32, i32* %2
%16 = call i32 @vWriteLogTxt(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %0
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%u()\00"
@.str.1 = [38 x i8] c"_SLE4442_Close iDoRemoteFunc ret = %d\00"
define void @_vRcSLE4442_Close() {
%1 = tail call dereferenceable_or_null(50) i8* @malloc(i32 50)
%2 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 9202)
%3 = tail call i32 @iDoRemoteFunc(i8* %1, i32 %2, i32 1)
%4 = tail call i32 @free(i8* %1)
%5 = icmp eq i32 %3, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = tail call i32 @vWriteLogTxt(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %3)
br label %8
8: ; preds = %6, %0
ret void
}