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


x86 assembly (clang, -O0):
<_ucRcAT1608_WriteFuse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x64,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe7f(%rip),%rsi
mov    $0x2523,%edx
call   1080 <sprintf@plt>
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    $0x1,%edx
call   1070 <iDoRemoteFunc@plt>
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0xc(%rbp)
je     11cd <_ucRcAT1608_WriteFuse+0x6d>
mov    -0xc(%rbp),%esi
lea    0xe46(%rip),%rdi
call   1050 <vWriteLogTxt@plt>
movb   $0x1,-0x1(%rbp)
jmp    11dd <_ucRcAT1608_WriteFuse+0x7d>
xor    %edi,%edi
call   1040 <iGetParaInt@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ucRcAT1608_WriteFuse>:
push   %rbp
push   %rbx
push   %rax
mov    $0x64,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe89(%rip),%rsi
mov    %rax,%rdi
mov    $0x2523,%edx
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     11b3 <_ucRcAT1608_WriteFuse+0x53>
lea    0xe5d(%rip),%rdi
mov    %ebp,%esi
call   1050 <vWriteLogTxt@plt>
mov    $0x1,%al
jmp    11ba <_ucRcAT1608_WriteFuse+0x5a>
xor    %edi,%edi
call   1040 <iGetParaInt@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%u()\00"
@.str.1 = [45 x i8] c"_ucRcAT1608_WriteFuse iDoRemoteFunc ret = %d\00"
define zeroext i8 @_ucRcAT1608_WriteFuse() {
%1 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%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 9507)
%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 ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %3)
br label %11
8: ; preds = %0
%9 = tail call i32 @iGetParaInt(i32 0)
%10 = trunc i32 %9 to i8
br label %11
11: ; preds = %8, %6
%12 = phi i8 [ 1, %6 ], [ %10, %8 ]
ret i8 %12
}