#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 char iGetParaInt(int /*<<< orphan*/);
char *malloc(int);
unsigned int sprintf(char *, char *, int, unsigned int, unsigned int);
int /*<<< orphan*/ vWriteLogTxt(char *, unsigned int);
unsigned char _ucRcAT1604_Erase(unsigned int Addr, unsigned int Len) {
  unsigned int uiDataLen, uiRet;
  char *psFunCall = malloc(50);
  uiDataLen = sprintf(psFunCall, "%u(%u,%u)", 9408, Addr, Len);
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 2);
  free(psFunCall);
  if (uiRet) {
    vWriteLogTxt("_AT1604_Erase iDoRemoteFunc ret = %d", uiRet);
    return 1;
  }
  return iGetParaInt(0);
}


x86 assembly (clang, -O0):
<_ucRcAT1604_Erase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x32,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xe72(%rip),%rsi
mov    $0x24c0,%edx
call   1080 <sprintf@plt>
mov    %eax,-0x10(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    $0x2,%edx
call   1070 <iDoRemoteFunc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x14(%rbp)
je     11da <_ucRcAT1604_Erase+0x7a>
mov    -0x14(%rbp),%esi
lea    0xe3e(%rip),%rdi
call   1050 <vWriteLogTxt@plt>
movb   $0x1,-0x1(%rbp)
jmp    11e4 <_ucRcAT1604_Erase+0x84>
xor    %edi,%edi
call   1040 <iGetParaInt@plt>
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ucRcAT1604_Erase>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebx
mov    $0x32,%edi
call   1060 <malloc@plt>
mov    %rax,%rbp
lea    0xe83(%rip),%rsi
mov    %rax,%rdi
mov    $0x24c0,%edx
mov    %ebx,%ecx
mov    %r14d,%r8d
call   1080 <sprintf@plt>
mov    %rbp,%rdi
mov    %eax,%esi
mov    $0x2,%edx
call   1070 <iDoRemoteFunc@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1030 <free@plt>
test   %ebx,%ebx
je     11c1 <_ucRcAT1604_Erase+0x61>
lea    0xe57(%rip),%rdi
mov    %ebx,%esi
call   1050 <vWriteLogTxt@plt>
mov    $0x1,%al
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %edi,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <iGetParaInt@plt>

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

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