#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*/ sCmd;

/* Variables and functions */
scalar_t__ osSystem_GetOutput(char *, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, ...);
int /*<<< orphan*/ utilStrTrim(char *);
long cfgDataGet(char *sFile, char *sSect, char *sKey, char *sDataBuf,
                int iDataLen) {
  char sCmd[128];
  if (sSect == (0) || sKey == (0) || sDataBuf == (0) || iDataLen <= 0)
    return (-1);
  if (sFile != (0))
    snprintf(sCmd, sizeof(sCmd), "umngcli -f '%s' get %s@%s", sFile, sKey,
             sSect);
  else
    snprintf(sCmd, sizeof(sCmd), "umngcli get %s@%s", sKey, sSect);
  if (osSystem_GetOutput(sCmd, sDataBuf, iDataLen) < 0)
    return (-1);
  utilStrTrim(sDataBuf);
  return (0);
}


x86 assembly (clang, -O0):
<cfgDataGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     117a <cfgDataGet+0x4a>
cmpq   $0x0,-0x20(%rbp)
je     117a <cfgDataGet+0x4a>
cmpq   $0x0,-0x28(%rbp)
je     117a <cfgDataGet+0x4a>
cmpl   $0x0,-0x2c(%rbp)
jg     1187 <cfgDataGet+0x57>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    121a <cfgDataGet+0xea>
cmpq   $0x0,-0x10(%rbp)
je     11bd <cfgDataGet+0x8d>
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x18(%rbp),%r9
mov    $0x80,%esi
lea    0xe4f(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    11df <cfgDataGet+0xaf>
lea    -0xb0(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    $0x80,%esi
lea    0xe42(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1040 <osSystem_GetOutput@plt>
cmp    $0x0,%rax
jge    1209 <cfgDataGet+0xd9>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    121a <cfgDataGet+0xea>
mov    -0x28(%rbp),%rdi
call   1050 <utilStrTrim@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cfgDataGet>:
push   %rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    $0xffffffffffffffff,%r14
test   %rsi,%rsi
je     11ba <cfgDataGet+0x8a>
mov    %r8d,%ebp
mov    %rdx,%r8
test   %rdx,%rdx
je     11ba <cfgDataGet+0x8a>
mov    %rcx,%rbx
test   %rcx,%rcx
je     11ba <cfgDataGet+0x8a>
test   %ebp,%ebp
jle    11ba <cfgDataGet+0x8a>
mov    %rsi,%r9
mov    %rdi,%rcx
test   %rdi,%rdi
je     1181 <cfgDataGet+0x51>
lea    0xe90(%rip),%rdx
mov    %rsp,%rdi
mov    $0x80,%esi
xor    %eax,%eax
call   1030 <snprintf@plt>
jmp    119d <cfgDataGet+0x6d>
lea    0xe92(%rip),%rdx
mov    %rsp,%rdi
mov    $0x80,%esi
mov    %r8,%rcx
mov    %r9,%r8
xor    %eax,%eax
call   1030 <snprintf@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <osSystem_GetOutput@plt>
test   %rax,%rax
js     11ba <cfgDataGet+0x8a>
mov    %rbx,%rdi
call   1050 <utilStrTrim@plt>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"umngcli -f '%s' get %s@%s\00"
@.str.1 = [18 x i8] c"umngcli get %s@%s\00"
define i64 @cfgDataGet(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca [128 x i8]
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i32 %4, i32* %11
%13 = load i8*, i8** %8
%14 = icmp eq i8* %13, null
br i1 %14, label %24, label %15
15: ; preds = %5
%16 = load i8*, i8** %9
%17 = icmp eq i8* %16, null
br i1 %17, label %24, label %18
18: ; preds = %15
%19 = load i8*, i8** %10
%20 = icmp eq i8* %19, null
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i32, i32* %11
%23 = icmp sle i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %21, %18, %15, %5
store i64 -1, i64* %6
br label %49
25: ; preds = %21
%26 = load i8*, i8** %7
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%30 = load i8*, i8** %7
%31 = load i8*, i8** %9
%32 = load i8*, i8** %8
%33 = call i32 (i8*, i32, i8*, i8*, i8*, ...) @snprintf(i8* %29, i32 128, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %30, i8* %31, i8* %32)
br label %39
34: ; preds = %25
%35 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%36 = load i8*, i8** %9
%37 = load i8*, i8** %8
%38 = call i32 (i8*, i32, i8*, i8*, i8*, ...) @snprintf(i8* %35, i32 128, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %36, i8* %37)
br label %39
39: ; preds = %34, %28
%40 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%41 = load i8*, i8** %10
%42 = load i32, i32* %11
%43 = call i64 @osSystem_GetOutput(i8* %40, i8* %41, i32 %42)
%44 = icmp slt i64 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %39
store i64 -1, i64* %6
br label %49
46: ; preds = %39
%47 = load i8*, i8** %10
%48 = call i32 @utilStrTrim(i8* %47)
store i64 0, i64* %6
br label %49
49: ; preds = %46, %45, %24
%50 = load i64, i64* %6
ret i64 %50
}

LLVM IR (-O2):
@.str = [26 x i8] c"umngcli -f '%s' get %s@%s\00"
@.str.1 = [18 x i8] c"umngcli get %s@%s\00"
define i64 @cfgDataGet(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca [128 x i8]
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%8 = icmp eq i8* %1, null
%9 = icmp eq i8* %2, null
%10 = or i1 %8, %9
%11 = icmp eq i8* %3, null
%12 = or i1 %10, %11
%13 = icmp slt i32 %4, 1
%14 = or i1 %12, %13
br i1 %14, label %26, label %15
15: ; preds = %5
%16 = icmp eq i8* %0, null
br i1 %16, label %19, label %17
17: ; preds = %15
%18 = call i32 (i8*, i32, i8*, i8*, i8*, ...) @snprintf(i8* %7, i32 128, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %2, i8* %1)
br label %21
19: ; preds = %15
%20 = call i32 (i8*, i32, i8*, i8*, i8*, ...) @snprintf(i8* %7, i32 128, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %1)
br label %21
21: ; preds = %19, %17
%22 = call i64 @osSystem_GetOutput(i8* %7, i8* %3, i32 %4)
%23 = icmp slt i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %21
%25 = call i32 @utilStrTrim(i8* %3)
br label %26
26: ; preds = %21, %5, %24
%27 = phi i64 [ 0, %24 ], [ -1, %5 ], [ -1, %21 ]
ret i64 %27
}