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


x86 assembly (clang, -O0):
<_ucRcAT1604_EraseAZ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x32,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x2(%rbp),%al
mov    -0x8(%rbp),%r8d
mov    -0xc(%rbp),%r9d
lea    0xe68(%rip),%rsi
mov    $0x24c1,%edx
movzbl %al,%ecx
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     11e7 <_ucRcAT1604_EraseAZ+0x87>
mov    -0x14(%rbp),%esi
lea    0xe34(%rip),%rdi
call   1050 <vWriteLogTxt@plt>
movb   $0x1,-0x1(%rbp)
jmp    11f1 <_ucRcAT1604_EraseAZ+0x91>
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_EraseAZ>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebx
mov    $0x32,%edi
call   1060 <malloc@plt>
mov    %rax,%rbp
lea    0xe7d(%rip),%rsi
mov    %rax,%rdi
mov    $0x24c1,%edx
mov    %ebx,%ecx
mov    %r15d,%r8d
mov    %r14d,%r9d
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     11d0 <_ucRcAT1604_EraseAZ+0x70>
lea    0xe51(%rip),%rdi
mov    %ebx,%esi
call   1050 <vWriteLogTxt@plt>
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <iGetParaInt@plt>

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

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