#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 char, unsigned char,
                     unsigned char, unsigned char);
int /*<<< orphan*/ vWriteLogTxt(char *, unsigned int);
unsigned int _uiRcMifCopy(unsigned char ucSrcSecNo, unsigned char ucSrcBlock,
                          unsigned char ucDesSecNo, unsigned char ucDesBlock) {
  unsigned int uiDataLen, uiRet;
  char *psFunCall = malloc(50);
  uiDataLen = sprintf(psFunCall, "%u(%u,%u,%u,%u)", 2010, ucSrcSecNo,
                      ucSrcBlock, ucDesSecNo, ucDesBlock);
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
  if (uiRet) {
    vWriteLogTxt("_uiRcMifCopy iDoRemoteFunc ret = %d", uiRet);
    return 1;
  }
  return iGetParaInt(0);
}


x86 assembly (clang, -O0):
<_uiRcMifCopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %dl,-0x6(%rbp)
mov    %cl,-0x7(%rbp)
mov    %al,-0x8(%rbp)
mov    $0x32,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x5(%rbp),%cl
mov    -0x6(%rbp),%r8b
mov    -0x7(%rbp),%al
lea    0xe5e(%rip),%rsi
mov    $0x7da,%edx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %al,%r9d
movzbl -0x8(%rbp),%eax
mov    %eax,(%rsp)
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     1203 <_uiRcMifCopy+0xa3>
mov    -0x10(%rbp),%esi
lea    0xe1e(%rip),%rdi
call   1050 <vWriteLogTxt@plt>
movl   $0x1,-0x4(%rbp)
jmp    120d <_uiRcMifCopy+0xad>
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):
<_uiRcMifCopy>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%r12d
mov    $0x32,%edi
call   1060 <malloc@plt>
mov    %rax,%rbp
mov    %ebx,(%rsp)
lea    0xe72(%rip),%rsi
mov    %rax,%rdi
mov    $0x7da,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %r14d,%r9d
call   1080 <sprintf@plt>
mov    %rbp,%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   1070 <iDoRemoteFunc@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1030 <free@plt>
test   %ebx,%ebx
je     11e1 <_uiRcMifCopy+0x81>
lea    0xe48(%rip),%rdi
mov    %ebx,%esi
call   1050 <vWriteLogTxt@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <iGetParaInt@plt>

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

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