#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 */
typedef int /*<<< orphan*/ sTlvObject;

/* Variables and functions */
int iTlvAddObj(unsigned char *, unsigned char *, int);
int iTlvMakeObject(unsigned char *, unsigned int, unsigned char *,
                   unsigned char *, int);
int iTlvMakeAddObj(unsigned char *psTlvBuffer, unsigned char *psTag,
                   unsigned int uiLength, unsigned char *psValue,
                   int iConflictFlag) {
  int iRet;
  unsigned char sTlvObject[260];
  iRet =
      iTlvMakeObject(psTag, uiLength, psValue, sTlvObject, sizeof(sTlvObject));
  if (iRet < 0)
    return (iRet);
  iRet = iTlvAddObj(psTlvBuffer, sTlvObject, iConflictFlag);
  return (iRet);
}


x86 assembly (clang, -O0):
<iTlvMakeAddObj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x28(%rbp),%rdx
lea    -0x140(%rbp),%rcx
mov    $0x104,%r8d
call   1040 <iTlvMakeObject@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    1173 <iTlvMakeAddObj+0x53>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118f <iTlvMakeAddObj+0x6f>
mov    -0x10(%rbp),%rdi
lea    -0x140(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1030 <iTlvAddObj@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iTlvMakeAddObj>:
push   %rbp
push   %rbx
sub    $0x108,%rsp
mov    %r8d,%ebp
mov    %rdi,%rbx
mov    %rsp,%rax
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %rax,%rcx
mov    $0x104,%r8d
call   1040 <iTlvMakeObject@plt>
test   %eax,%eax
js     1159 <iTlvMakeAddObj+0x39>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1030 <iTlvAddObj@plt>
add    $0x108,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @iTlvMakeAddObj(i8* %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca [260 x i8]
store i8* %0, i8** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i8* %3, i8** %10
store i32 %4, i32* %11
%14 = load i8*, i8** %8
%15 = load i32, i32* %9
%16 = load i8*, i8** %10
%17 = getelementptr inbounds [260 x i8], [260 x i8]* %13, i64 0, i64 0
%18 = call i32 @iTlvMakeObject(i8* %14, i32 %15, i8* %16, i8* %17, i32 260)
store i32 %18, i32* %12
%19 = load i32, i32* %12
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %5
%22 = load i32, i32* %12
store i32 %22, i32* %6
br label %29
23: ; preds = %5
%24 = load i8*, i8** %7
%25 = getelementptr inbounds [260 x i8], [260 x i8]* %13, i64 0, i64 0
%26 = load i32, i32* %11
%27 = call i32 @iTlvAddObj(i8* %24, i8* %25, i32 %26)
store i32 %27, i32* %12
%28 = load i32, i32* %12
store i32 %28, i32* %6
br label %29
29: ; preds = %23, %21
%30 = load i32, i32* %6
ret i32 %30
}

LLVM IR (-O2):
define i32 @iTlvMakeAddObj(i8* %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca [260 x i8]
%7 = getelementptr inbounds [260 x i8], [260 x i8]* %6, i64 0, i64 0
%8 = call i32 @iTlvMakeObject(i8* %1, i32 %2, i8* %3, i8* %7, i32 260)
%9 = icmp slt i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %5
%11 = call i32 @iTlvAddObj(i8* %0, i8* %7, i32 %4)
br label %12
12: ; preds = %5, %10
%13 = phi i32 [ %11, %10 ], [ %8, %5 ]
ret i32 %13
}