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


x86 assembly (clang, -O0):
<_ucRcAT1608_ReadFuse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x64,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe5b(%rip),%rsi
mov    $0x2522,%edx
call   10a0 <sprintf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x1,%edx
call   1090 <iDoRemoteFunc@plt>
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x18(%rbp)
je     11f1 <_ucRcAT1608_ReadFuse+0x71>
mov    -0x18(%rbp),%esi
lea    0xe26(%rip),%rdi
call   1060 <vWriteLogTxt@plt>
movb   $0x1,-0x1(%rbp)
jmp    122d <_ucRcAT1608_ReadFuse+0xad>
xor    %edi,%edi
call   1040 <iGetParaInt@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1227 <_ucRcAT1608_ReadFuse+0xa7>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x2,%edi
call   1050 <psGetParaBuf@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   1070 <memcpy@plt>
mov    -0x18(%rbp),%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ucRcAT1608_ReadFuse>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0x64,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
lea    0xe65(%rip),%rsi
mov    %rax,%rdi
mov    $0x2522,%edx
call   10a0 <sprintf@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   1090 <iDoRemoteFunc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
test   %ebp,%ebp
je     11d8 <_ucRcAT1608_ReadFuse+0x58>
lea    0xe3d(%rip),%rdi
mov    %ebp,%esi
call   1060 <vWriteLogTxt@plt>
mov    $0x1,%bpl
jmp    11fe <_ucRcAT1608_ReadFuse+0x7e>
xor    %edi,%edi
call   1040 <iGetParaInt@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    11fe <_ucRcAT1608_ReadFuse+0x7e>
mov    $0x2,%edi
call   1050 <psGetParaBuf@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   1070 <memcpy@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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