#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);
unsigned int iGetParaInt(int /*<<< orphan*/);
char *malloc(int);
unsigned int sprintf(char *, char *, int, unsigned int);
int /*<<< orphan*/ vWriteLogTxt(char *, ...);
unsigned int _uiRcTestCard(unsigned int uiReader) {
  unsigned int uiDataLen, uiRet;
  vWriteLogTxt("_uiRcTestCard");
  char *psFunCall = malloc(200);
  uiDataLen = sprintf(psFunCall, "%u(%u)", 1001, uiReader);
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
  if (uiRet) {
    vWriteLogTxt("_uiRcTestCard iDoRemoteFunc ret = %d", uiRet);
    return 0;
  }
  return iGetParaInt(0);
}


x86 assembly (clang, -O0):
<_uiRcTestCard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1050 <vWriteLogTxt@plt>
mov    $0xc8,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%ecx
lea    0xe79(%rip),%rsi
mov    $0x3e9,%edx
call   1080 <sprintf@plt>
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x1,%edx
call   1070 <iDoRemoteFunc@plt>
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x10(%rbp)
je     11e6 <_uiRcTestCard+0x86>
mov    -0x10(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1050 <vWriteLogTxt@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f0 <_uiRcTestCard+0x90>
xor    %edi,%edi
call   1040 <iGetParaInt@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_uiRcTestCard>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0xe94(%rip),%rdi
xor    %eax,%eax
call   1050 <vWriteLogTxt@plt>
mov    $0xc8,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe87(%rip),%rsi
mov    %rax,%rdi
mov    $0x3e9,%edx
mov    %ebp,%ecx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   1070 <iDoRemoteFunc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
test   %ebp,%ebp
je     11cc <_uiRcTestCard+0x6c>
lea    0xe5b(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <vWriteLogTxt@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <iGetParaInt@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"_uiRcTestCard\00"
@.str.1 = [7 x i8] c"%u(%u)\00"
@.str.2 = [37 x i8] c"_uiRcTestCard iDoRemoteFunc ret = %d\00"
define i32 @_uiRcTestCard(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %3
%7 = call i32 (i8*, ...) @vWriteLogTxt(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%8 = call i8* @malloc(i32 200)
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = load i32, i32* %3
%11 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 1001, i32 %10)
store i32 %11, i32* %4
%12 = load i8*, i8** %6
%13 = load i32, i32* %4
%14 = call i32 @iDoRemoteFunc(i8* %12, i32 %13, i32 1)
store i32 %14, i32* %5
%15 = load i8*, i8** %6
%16 = call i32 @free(i8* %15)
%17 = load i32, i32* %5
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %1
%20 = load i32, i32* %5
%21 = call i32 (i8*, ...) @vWriteLogTxt(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %20)
store i32 0, i32* %2
br label %24
22: ; preds = %1
%23 = call i32 @iGetParaInt(i32 0)
store i32 %23, i32* %2
br label %24
24: ; preds = %22, %19
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str = [14 x i8] c"_uiRcTestCard\00"
@.str.1 = [7 x i8] c"%u(%u)\00"
@.str.2 = [37 x i8] c"_uiRcTestCard iDoRemoteFunc ret = %d\00"
define i32 @_uiRcTestCard(i32 %0) {
%2 = tail call i32 (i8*, ...) @vWriteLogTxt(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = tail call dereferenceable_or_null(200) i8* @malloc(i32 200)
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 1001, i32 %0)
%5 = tail call i32 @iDoRemoteFunc(i8* %3, i32 %4, i32 1)
%6 = tail call i32 @free(i8* %3)
%7 = icmp eq i32 %5, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = tail call i32 (i8*, ...) @vWriteLogTxt(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %5)
br label %12
10: ; preds = %1
%11 = tail call i32 @iGetParaInt(i32 0)
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ 0, %8 ], [ %11, %10 ]
ret i32 %13
}