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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int setConfigTextValue(char *, char *);
int doSetConfig(FILE *file, int argc, char **argv) {
  int status;
  if (argc == 2) {
    status = setConfigTextValue(argv[0], argv[1]);
    if (status == 1) {
      printf("Config value '%s' set to '%s'\n", argv[0], argv[1]);
    } else {
      printf("Error - failed to set config value.\n");
    }
  } else {
    printf("Error - expected 2 arguments, the name and value of the config "
           "parameter.\n");
    status = 0;
  }
  return status;
}


x86 assembly (clang, -O0):
<doSetConfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x2,-0xc(%rbp)
jne    1193 <doSetConfig+0x73>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <setConfigTextValue@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    1180 <doSetConfig+0x60>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118e <doSetConfig+0x6e>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a8 <doSetConfig+0x88>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doSetConfig>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%esi
jne    1169 <doSetConfig+0x39>
mov    %rdx,%r14
mov    (%rdx),%rdi
mov    0x8(%rdx),%rsi
call   1050 <setConfigTextValue@plt>
cmp    $0x1,%eax
jne    1179 <doSetConfig+0x49>
mov    (%r14),%rsi
mov    0x8(%r14),%rdx
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
jmp    1187 <doSetConfig+0x57>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
jmp    1187 <doSetConfig+0x57>
mov    %eax,%ebx
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Config value '%s' set to '%s'\0A\00"
@.str.1 = [37 x i8] c"Error - failed to set config value.\0A\00"
@.str.2 = [75 x i8] c"Error - expected 2 arguments, the name and value of the config parameter.\0A\00"
define i32 @doSetConfig(i32* %0, i32 %1, i8** %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %31
10: ; preds = %3
%11 = load i8**, i8*** %6
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = load i8**, i8*** %6
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @setConfigTextValue(i8* %13, i8* %16)
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %28
20: ; preds = %10
%21 = load i8**, i8*** %6
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %6
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %23, i8* %26)
br label %30
28: ; preds = %10
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %28, %20
br label %33
31: ; preds = %3
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %7
br label %33
33: ; preds = %31, %30
%34 = load i32, i32* %7
ret i32 %34
}

LLVM IR (-O2):
@.str = [31 x i8] c"Config value '%s' set to '%s'\0A\00"
@str = [74 x i8] c"Error - expected 2 arguments, the name and value of the config parameter.\00"
@str.3 = [36 x i8] c"Error - failed to set config value.\00"
define i32 @doSetConfig(i32* nocapture readnone %0, i32 %1, i8** nocapture %2) {
%4 = icmp eq i32 %1, 2
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8*, i8** %2, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @setConfigTextValue(i8* %6, i8* %8)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %5
%12 = load i8*, i8** %2
%13 = load i8*, i8** %7
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13)
br label %19
15: ; preds = %5
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.3, i64 0, i64 0))
br label %19
17: ; preds = %3
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str, i64 0, i64 0))
br label %19
19: ; preds = %11, %15, %17
%20 = phi i32 [ 1, %11 ], [ %9, %15 ], [ 0, %17 ]
ret i32 %20
}