#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 *);
int /*<<< orphan*/ iDoRemoteFunc(unsigned char *, unsigned int, int);
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, unsigned char *, unsigned int);
unsigned int sprintf(char *, char *, unsigned int, ...);
void _vRcFingerprintSend(unsigned char *psIn, unsigned int uiInLen) {
  unsigned int uiDataLen;
  char *psFunCall = malloc(100);
  uiDataLen = sprintf(psFunCall, "%u(b%03u", 4004, uiInLen);
  memcpy(psFunCall + uiDataLen, psIn, uiInLen);
  uiDataLen += uiInLen;
  uiDataLen += sprintf(psFunCall + uiDataLen, ",%u)", uiInLen);
  iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
}


x86 assembly (clang, -O0):
<_vRcFingerprintSend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x64,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%ecx
lea    0xe85(%rip),%rsi
mov    $0xfa4,%edx
mov    $0x0,%al
call   1070 <sprintf@plt>
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%eax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%eax
add    %rax,%rdi
mov    -0xc(%rbp),%edx
lea    0xe4c(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    $0x1,%edx
call   1060 <iDoRemoteFunc@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_vRcFingerprintSend>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
mov    $0x64,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xe8f(%rip),%rsi
mov    %rax,%rdi
mov    $0xfa4,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1070 <sprintf@plt>
mov    %eax,%ebp
mov    %eax,%edi
add    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1040 <memcpy@plt>
add    %r15d,%ebp
lea    (%rbx,%rbp,1),%rdi
lea    0xe66(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1070 <sprintf@plt>
add    %eax,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
call   1060 <iDoRemoteFunc@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"%u(b%03u\00"
@.str.1 = [5 x i8] c",%u)\00"
define void @_vRcFingerprintSend(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = call i8* @malloc(i32 100)
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = load i32, i32* %4
%10 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 4004, i32 %9)
store i32 %10, i32* %5
%11 = load i8*, i8** %6
%12 = load i32, i32* %5
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = call i32 @memcpy(i8* %14, i8* %15, i32 %16)
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = add i32 %19, %18
store i32 %20, i32* %5
%21 = load i8*, i8** %6
%22 = load i32, i32* %5
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i32, i32* %4
%26 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %5
%28 = add i32 %27, %26
store i32 %28, i32* %5
%29 = load i8*, i8** %6
%30 = load i32, i32* %5
%31 = call i32 @iDoRemoteFunc(i8* %29, i32 %30, i32 1)
%32 = load i8*, i8** %6
%33 = call i32 @free(i8* %32)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%u(b%03u\00"
@.str.1 = [5 x i8] c",%u)\00"
define void @_vRcFingerprintSend(i8* %0, i32 %1) {
%3 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%4 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 4004, i32 %1)
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %3, i64 %5
%7 = tail call i32 @memcpy(i8* %6, i8* %0, i32 %1)
%8 = add i32 %4, %1
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %3, i64 %9
%11 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %10, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%12 = add i32 %11, %8
%13 = tail call i32 @iDoRemoteFunc(i8* %3, i32 %12, i32 1)
%14 = tail call i32 @free(i8* %3)
ret void
}