#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 */
unsigned int iDoRemoteFunc(unsigned char *, unsigned int, int);
char *malloc(int);
unsigned int sprintf(char *, char *, int);
int /*<<< orphan*/ vWriteLogTxt(char *, unsigned int);
void _vRcBuzzer(void) {
  unsigned int uiDataLen, uiRet;
  char *psFunCall = malloc(20);
  uiDataLen = sprintf(psFunCall, "%u()", 1012);
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  if (uiRet) {
    vWriteLogTxt("_vRcBuzzer iDoRemoteFunc ret = %d", uiRet);
  }
}


x86 assembly (clang, -O0):
<_vRcBuzzer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x3f4,%edx
call   1060 <sprintf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x1,%edx
call   1050 <iDoRemoteFunc@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     119b <_vRcBuzzer+0x5b>
mov    -0x8(%rbp),%esi
lea    0xe6f(%rip),%rdi
call   1030 <vWriteLogTxt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_vRcBuzzer>:
push   %rbx
mov    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xeab(%rip),%rsi
mov    %rax,%rdi
mov    $0x3f4,%edx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   1050 <iDoRemoteFunc@plt>
test   %eax,%eax
je     1184 <_vRcBuzzer+0x44>
lea    0xe89(%rip),%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <vWriteLogTxt@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%u()\00"
@.str.1 = [34 x i8] c"_vRcBuzzer iDoRemoteFunc ret = %d\00"
define void @_vRcBuzzer() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = call i8* @malloc(i32 20)
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1012)
store i32 %6, i32* %1
%7 = load i8*, i8** %3
%8 = load i32, i32* %1
%9 = call i32 @iDoRemoteFunc(i8* %7, i32 %8, i32 1)
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* %2
%14 = call i32 @vWriteLogTxt(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %0
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%u()\00"
@.str.1 = [34 x i8] c"_vRcBuzzer iDoRemoteFunc ret = %d\00"
define void @_vRcBuzzer() {
%1 = tail call dereferenceable_or_null(20) i8* @malloc(i32 20)
%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 1012)
%3 = tail call i32 @iDoRemoteFunc(i8* %1, i32 %2, i32 1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @vWriteLogTxt(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %3)
br label %7
7: ; preds = %5, %0
ret void
}