#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*/ configadd(char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char const *);
int /*<<< orphan*/ strtolower(char *);
int /*<<< orphan*/ trim(char *);
void ConfigCLI(int argc, const char **argv) {
  char current_arg[16384] = "";
  char current_val[16384] = "";
  for (int i = 2; i < argc; i++) {
    if (argv[i][0] == '-') {
      strcpy(current_arg, argv[i] + 1);
    } else {
      if (current_arg[0] != '\0') {
        strcpy(current_val, argv[i]);
        trim(current_arg);
        trim(current_val);
        strtolower(current_arg);
        configadd(current_arg, current_val);
        current_val[0] = '\0';
        current_arg[0] = '\0';
      } else {
        fprintf(stderr, "Error in passed argument: %s\n", argv[i]);
        exit(1);
      }
    }
  }
}


x86 assembly (clang, -O0):
<ConfigCLI>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8020,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x4010(%rbp),%rdi
xor    %esi,%esi
mov    $0x4000,%edx
call   1060 <memset@plt>
lea    -0x8010(%rbp),%rdi
xor    %esi,%esi
mov    $0x4000,%edx
call   1060 <memset@plt>
movl   $0x2,-0x8014(%rbp)
mov    -0x8014(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12c1 <ConfigCLI+0x151>
mov    -0x10(%rbp),%rax
movslq -0x8014(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1200 <ConfigCLI+0x90>
lea    -0x4010(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x8014(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
jmp    12a8 <ConfigCLI+0x138>
movsbl -0x4010(%rbp),%eax
cmp    $0x0,%eax
je     1275 <ConfigCLI+0x105>
lea    -0x8010(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x8014(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcpy@plt>
lea    -0x4010(%rbp),%rdi
call   1050 <trim@plt>
lea    -0x8010(%rbp),%rdi
call   1050 <trim@plt>
lea    -0x4010(%rbp),%rdi
call   1040 <strtolower@plt>
lea    -0x4010(%rbp),%rdi
lea    -0x8010(%rbp),%rsi
call   1090 <configadd@plt>
movb   $0x0,-0x8010(%rbp)
movb   $0x0,-0x4010(%rbp)
jmp    12a3 <ConfigCLI+0x133>
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x8014(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd6c(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
jmp    12a8 <ConfigCLI+0x138>
jmp    12ad <ConfigCLI+0x13d>
mov    -0x8014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8014(%rbp)
jmp    11b2 <ConfigCLI+0x42>
add    $0x8020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConfigCLI>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x8000,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
mov    %rsp,%rdi
mov    $0x4000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x4000(%rsp),%rdi
mov    $0x4000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
cmp    $0x3,%ebx
jl     1233 <ConfigCLI+0xc3>
mov    %ebx,%r12d
mov    $0x2,%ebx
mov    %rsp,%r13
lea    0x4000(%rsp),%r15
jmp    11e8 <ConfigCLI+0x78>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rdx
mov    %r13,%rdi
mov    %rdx,%rsi
call   1030 <strcpy@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
je     1233 <ConfigCLI+0xc3>
mov    (%r14,%rbx,8),%rdx
cmpb   $0x2d,(%rdx)
je     11d0 <ConfigCLI+0x60>
cmpb   $0x0,(%rsp)
je     1244 <ConfigCLI+0xd4>
mov    %r15,%rdi
mov    %rdx,%rsi
call   1030 <strcpy@plt>
mov    %r13,%rdi
call   1050 <trim@plt>
mov    %r15,%rdi
call   1050 <trim@plt>
mov    %r13,%rdi
call   1040 <strtolower@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1090 <configadd@plt>
movb   $0x0,0x4000(%rsp)
movb   $0x0,(%rsp)
jmp    11df <ConfigCLI+0x6f>
add    $0x8000,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
lea    0xdac(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"Error in passed argument: %s\0A\00"
define void @ConfigCLI(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [16384 x i8]
%6 = alloca [16384 x i8]
%7 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%8 = bitcast [16384 x i8]* %5 to i8*
%9 = bitcast [16384 x i8]* %6 to i8*
store i32 2, i32* %7
br label %10
10: ; preds = %68, %2
%11 = load i32, i32* %7
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %71
14: ; preds = %10
%15 = load i8**, i8*** %4
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 45
br i1 %23, label %24, label %33
24: ; preds = %14
%25 = getelementptr inbounds [16384 x i8], [16384 x i8]* %5, i64 0, i64 0
%26 = load i8**, i8*** %4
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = call i32 @strcpy(i8* %25, i8* %31)
br label %67
33: ; preds = %14
%34 = getelementptr inbounds [16384 x i8], [16384 x i8]* %5, i64 0, i64 0
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %57
38: ; preds = %33
%39 = getelementptr inbounds [16384 x i8], [16384 x i8]* %6, i64 0, i64 0
%40 = load i8**, i8*** %4
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 @strcpy(i8* %39, i8* %44)
%46 = getelementptr inbounds [16384 x i8], [16384 x i8]* %5, i64 0, i64 0
%47 = call i32 @trim(i8* %46)
%48 = getelementptr inbounds [16384 x i8], [16384 x i8]* %6, i64 0, i64 0
%49 = call i32 @trim(i8* %48)
%50 = getelementptr inbounds [16384 x i8], [16384 x i8]* %5, i64 0, i64 0
%51 = call i32 @strtolower(i8* %50)
%52 = getelementptr inbounds [16384 x i8], [16384 x i8]* %5, i64 0, i64 0
%53 = getelementptr inbounds [16384 x i8], [16384 x i8]* %6, i64 0, i64 0
%54 = call i32 @configadd(i8* %52, i8* %53)
%55 = getelementptr inbounds [16384 x i8], [16384 x i8]* %6, i64 0, i64 0
store i8 0, i8* %55
%56 = getelementptr inbounds [16384 x i8], [16384 x i8]* %5, i64 0, i64 0
store i8 0, i8* %56
br label %66
57: ; preds = %33
%58 = load i32, i32* @stderr
%59 = load i8**, i8*** %4
%60 = load i32, i32* %7
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8*, i8** %59, i64 %61
%63 = load i8*, i8** %62
%64 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %63)
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %38
br label %67
67: ; preds = %66, %24
br label %68
68: ; preds = %67
%69 = load i32, i32* %7
%70 = add nsw i32 %69, 1
store i32 %70, i32* %7
br label %10
71: ; preds = %10
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"Error in passed argument: %s\0A\00"
define void @ConfigCLI(i32 %0, i8** nocapture %1) {
%3 = alloca [16384 x i8]
%4 = alloca [16384 x i8]
%5 = getelementptr inbounds [16384 x i8], [16384 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [16384 x i8], [16384 x i8]* %4, i64 0, i64 0
%7 = icmp sgt i32 %0, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = zext i32 %0 to i64
br label %11
10: ; preds = %33, %2
ret void
11: ; preds = %8, %33
%12 = phi i64 [ 2, %8 ], [ %34, %33 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 45
br i1 %16, label %17, label %20
17: ; preds = %11
%18 = getelementptr inbounds i8, i8* %14, i64 1
%19 = call i32 @strcpy(i8* %5, i8* %18)
br label %33
20: ; preds = %11
%21 = load i8, i8* %5
%22 = icmp eq i8 %21, 0
br i1 %22, label %29, label %23
23: ; preds = %20
%24 = call i32 @strcpy(i8* %6, i8* %14)
%25 = call i32 @trim(i8* %5)
%26 = call i32 @trim(i8* %6)
%27 = call i32 @strtolower(i8* %5)
%28 = call i32 @configadd(i8* %5, i8* %6)
store i8 0, i8* %6
store i8 0, i8* %5
br label %33
29: ; preds = %20
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %14)
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %17, %23
%34 = add nuw nsw i64 %12, 1
%35 = icmp eq i64 %34, %9
br i1 %35, label %10, label %11
}