#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 long);
int /*<<< orphan*/ vWriteLogTxt(char *, unsigned int);
unsigned int _uiRcMifDecrement(unsigned char ucSecNo, unsigned char ucBlock,
                               unsigned long ulValue) {
  unsigned int uiDataLen, uiRet;
  char *psFunCall = malloc(50);
  uiDataLen =
      sprintf(psFunCall, "%u(%u,%u,%lu)", 2009, ucSecNo, ucBlock, ulValue);
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
  if (uiRet) {
    vWriteLogTxt("_uiRcMifDecrement iDoRemoteFunc ret = %d", uiRet);
    return 1;
  }
  return iGetParaInt(0);
}


x86 assembly (clang, -O0):
<_uiRcMifDecrement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %rdx,-0x10(%rbp)
mov    $0x32,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x5(%rbp),%cl
mov    -0x6(%rbp),%al
mov    -0x10(%rbp),%r9
lea    0xe65(%rip),%rsi
mov    $0x7d9,%edx
movzbl %cl,%ecx
movzbl %al,%r8d
call   1080 <sprintf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x1,%edx
call   1070 <iDoRemoteFunc@plt>
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x18(%rbp)
je     11f1 <_uiRcMifDecrement+0x91>
mov    -0x18(%rbp),%esi
lea    0xe2e(%rip),%rdi
call   1050 <vWriteLogTxt@plt>
movl   $0x1,-0x4(%rbp)
jmp    11fb <_uiRcMifDecrement+0x9b>
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):
<_uiRcMifDecrement>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%r15d
mov    %edi,%ebx
mov    $0x32,%edi
call   1060 <malloc@plt>
mov    %rax,%rbp
lea    0xe7d(%rip),%rsi
mov    %rax,%rdi
mov    $0x7d9,%edx
mov    %ebx,%ecx
mov    %r15d,%r8d
mov    %r14,%r9
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     11d3 <_uiRcMifDecrement+0x73>
lea    0xe52(%rip),%rdi
mov    %ebx,%esi
call   1050 <vWriteLogTxt@plt>
mov    $0x1,%eax
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 = [14 x i8] c"%u(%u,%u,%lu)\00"
@.str.1 = [41 x i8] c"_uiRcMifDecrement iDoRemoteFunc ret = %d\00"
define i32 @_uiRcMifDecrement(i8 zeroext %0, i8 zeroext %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i8 %0, i8* %5
store i8 %1, i8* %6
store i64 %2, i64* %7
%11 = call i8* @malloc(i32 50)
store i8* %11, i8** %10
%12 = load i8*, i8** %10
%13 = load i8, i8* %5
%14 = load i8, i8* %6
%15 = load i64, i64* %7
%16 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 2009, i8 zeroext %13, i8 zeroext %14, i64 %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 1)
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 ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %25)
store i32 1, i32* %4
br label %29
27: ; preds = %3
%28 = call i32 @iGetParaInt(i32 0)
store i32 %28, i32* %4
br label %29
29: ; preds = %27, %24
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
@.str = [14 x i8] c"%u(%u,%u,%lu)\00"
@.str.1 = [41 x i8] c"_uiRcMifDecrement iDoRemoteFunc ret = %d\00"
define i32 @_uiRcMifDecrement(i8 zeroext %0, i8 zeroext %1, i64 %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 ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 2009, i8 zeroext %0, i8 zeroext %1, i64 %2)
%6 = tail call i32 @iDoRemoteFunc(i8* %4, i32 %5, i32 1)
%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 ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %13
11: ; preds = %3
%12 = tail call i32 @iGetParaInt(i32 0)
br label %13
13: ; preds = %11, %9
%14 = phi i32 [ 1, %9 ], [ %12, %11 ]
ret i32 %14
}