#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 */
int /*<<< orphan*/ osSystem(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char *, ...);
long cfgDataSet(char *sFile, char *sSect, char *sKey, char *sData) {
  char sCmd[128];
  if (sSect == (0) || sKey == (0) || sData == (0))
    return (-1);
  if (sFile != (0))
    snprintf(sCmd, sizeof(sCmd), "umngcli -f '%s' set %s@%s='%s'", sFile, sKey,
             sSect, sData);
  else
    snprintf(sCmd, sizeof(sCmd), "umngcli set %s@%s='%s'", sKey, sSect, sData);
  if (osSystem(sCmd) != (0))
    return (-1);
  return (0);
}


x86 assembly (clang, -O0):
<cfgDataSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115c <cfgDataSet+0x3c>
cmpq   $0x0,-0x20(%rbp)
je     115c <cfgDataSet+0x3c>
cmpq   $0x0,-0x28(%rbp)
jne    1169 <cfgDataSet+0x49>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    11f7 <cfgDataSet+0xd7>
cmpq   $0x0,-0x10(%rbp)
je     11a7 <cfgDataSet+0x87>
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x18(%rbp),%r9
mov    -0x28(%rbp),%rax
mov    $0x80,%esi
lea    0xe69(%rip),%rdx
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    11cd <cfgDataSet+0xad>
lea    -0xb0(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    $0x80,%esi
lea    0xe59(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    -0xb0(%rbp),%rdi
call   1040 <osSystem@plt>
cmp    $0x0,%eax
je     11ef <cfgDataSet+0xcf>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    11f7 <cfgDataSet+0xd7>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cfgDataSet>:
mov    $0xffffffffffffffff,%rax
test   %rsi,%rsi
je     119c <cfgDataSet+0x7c>
mov    %rdx,%r8
test   %rdx,%rdx
je     119c <cfgDataSet+0x7c>
mov    %rcx,%r10
test   %rcx,%rcx
je     119c <cfgDataSet+0x7c>
sub    $0x98,%rsp
mov    %rsi,%r9
mov    %rdi,%rcx
test   %rdi,%rdi
je     1165 <cfgDataSet+0x45>
mov    %r10,(%rsp)
lea    0xea7(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x80,%esi
jmp    117f <cfgDataSet+0x5f>
lea    0xeb3(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x80,%esi
mov    %r8,%rcx
mov    %r9,%r8
mov    %r10,%r9
xor    %eax,%eax
call   1030 <snprintf@plt>
lea    0x10(%rsp),%rdi
call   1040 <osSystem@plt>
neg    %eax
sbb    %rax,%rax
add    $0x98,%rsp
ret

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

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