#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*/ atoi(char *);
int err_getdest();
int /*<<< orphan*/ err_setdest(int);
int /*<<< orphan*/ err_setlevel(int /*<<< orphan*/);
int /*<<< orphan*/ err_setlogfile(char *);
int /*<<< orphan*/ err_settruncate(int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
scalar_t__ strlen(char *);
void _conf_apply_element(char *section, char *key, char *cold, char *cnew) {
  if ((strcmp(section, "general") == 0) && (strcmp(key, "logfile") == 0)) {
    if ((cnew) && strlen(cnew)) {
      err_setlogfile(cnew);
      err_setdest(err_getdest() | 4);
    } else {
      err_setdest(err_getdest() & ~4);
    }
  }
  if ((strcmp(section, "general") == 0) && (strcmp(key, "debuglevel") == 0)) {
    err_setlevel(atoi(cnew));
  }
  if ((strcmp(section, "general") == 0) && (strcmp(key, "truncate") == 0)) {
    err_settruncate(atoi(cnew));
  }
}


x86 assembly (clang, -O0):
<_conf_apply_element>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe5d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    121f <_conf_apply_element+0x9f>
mov    -0x10(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    121f <_conf_apply_element+0x9f>
cmpq   $0x0,-0x20(%rbp)
je     1209 <_conf_apply_element+0x89>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
je     1209 <_conf_apply_element+0x89>
mov    -0x20(%rbp),%rdi
call   1070 <err_setlogfile@plt>
mov    $0x0,%al
call   1040 <err_getdest@plt>
mov    %eax,%edi
or     $0x4,%edi
call   1060 <err_setdest@plt>
jmp    121a <_conf_apply_element+0x9a>
mov    $0x0,%al
call   1040 <err_getdest@plt>
mov    %eax,%edi
and    $0xfffffffb,%edi
call   1060 <err_setdest@plt>
jmp    121f <_conf_apply_element+0x9f>
mov    -0x8(%rbp),%rdi
lea    0xdd6(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1263 <_conf_apply_element+0xe3>
mov    -0x10(%rbp),%rdi
lea    0xdcc(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1263 <_conf_apply_element+0xe3>
mov    -0x20(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
call   1090 <err_setlevel@plt>
mov    -0x8(%rbp),%rdi
lea    0xd92(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12a7 <_conf_apply_element+0x127>
mov    -0x10(%rbp),%rdi
lea    0xd93(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12a7 <_conf_apply_element+0x127>
mov    -0x20(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
call   10a0 <err_settruncate@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_conf_apply_element>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xe7b(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11d3 <_conf_apply_element+0x63>
lea    0xe72(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11d3 <_conf_apply_element+0x63>
test   %r14,%r14
je     11c2 <_conf_apply_element+0x52>
cmpb   $0x0,(%r14)
je     11c2 <_conf_apply_element+0x52>
mov    %r14,%rdi
call   1060 <err_setlogfile@plt>
xor    %eax,%eax
call   1030 <err_getdest@plt>
or     $0x4,%eax
jmp    11cc <_conf_apply_element+0x5c>
xor    %eax,%eax
call   1030 <err_getdest@plt>
and    $0xfffffffb,%eax
mov    %eax,%edi
call   1050 <err_setdest@plt>
lea    0xe26(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    120a <_conf_apply_element+0x9a>
lea    0xe22(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    120a <_conf_apply_element+0x9a>
mov    %r14,%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1080 <err_setlevel@plt>
lea    0xdef(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1232 <_conf_apply_element+0xc2>
lea    0xdf6(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1238 <_conf_apply_element+0xc8>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %r14,%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1090 <err_settruncate@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"general\00"
@.str.1 = [8 x i8] c"logfile\00"
@.str.2 = [11 x i8] c"debuglevel\00"
@.str.3 = [9 x i8] c"truncate\00"
define void @_conf_apply_element(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %34
12: ; preds = %4
%13 = load i8*, i8** %6
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %34
16: ; preds = %12
%17 = load i8*, i8** %8
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %29
19: ; preds = %16
%20 = load i8*, i8** %8
%21 = call i64 @strlen(i8* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %19
%24 = load i8*, i8** %8
%25 = call i32 @err_setlogfile(i8* %24)
%26 = call i32 (...) @err_getdest()
%27 = or i32 %26, 4
%28 = call i32 @err_setdest(i32 %27)
br label %33
29: ; preds = %19, %16
%30 = call i32 (...) @err_getdest()
%31 = and i32 %30, -5
%32 = call i32 @err_setdest(i32 %31)
br label %33
33: ; preds = %29, %23
br label %34
34: ; preds = %33, %12, %4
%35 = load i8*, i8** %5
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %46
38: ; preds = %34
%39 = load i8*, i8** %6
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %38
%43 = load i8*, i8** %8
%44 = call i32 @atoi(i8* %43)
%45 = call i32 @err_setlevel(i32 %44)
br label %46
46: ; preds = %42, %38, %34
%47 = load i8*, i8** %5
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %58
50: ; preds = %46
%51 = load i8*, i8** %6
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %58
54: ; preds = %50
%55 = load i8*, i8** %8
%56 = call i32 @atoi(i8* %55)
%57 = call i32 @err_settruncate(i32 %56)
br label %58
58: ; preds = %54, %50, %46
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"general\00"
@.str.1 = [8 x i8] c"logfile\00"
@.str.2 = [11 x i8] c"debuglevel\00"
@.str.3 = [9 x i8] c"truncate\00"
define void @_conf_apply_element(i8* %0, i8* %1, i8* nocapture readnone %2, i8* %3) {
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %25
7: ; preds = %4
%8 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %25
10: ; preds = %7
%11 = icmp eq i8* %3, null
br i1 %11, label %19, label %12
12: ; preds = %10
%13 = load i8, i8* %3
%14 = icmp eq i8 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %12
%16 = tail call i32 @err_setlogfile(i8* %3)
%17 = tail call i32 (...) @err_getdest()
%18 = or i32 %17, 4
br label %22
19: ; preds = %12, %10
%20 = tail call i32 (...) @err_getdest()
%21 = and i32 %20, -5
br label %22
22: ; preds = %19, %15
%23 = phi i32 [ %18, %15 ], [ %21, %19 ]
%24 = tail call i32 @err_setdest(i32 %23)
br label %25
25: ; preds = %22, %7, %4
%26 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = tail call i32 @atoi(i8* %3)
%33 = tail call i32 @err_setlevel(i32 %32)
br label %34
34: ; preds = %31, %28, %25
%35 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %43
37: ; preds = %34
%38 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = tail call i32 @atoi(i8* %3)
%42 = tail call i32 @err_settruncate(i32 %41)
br label %43
43: ; preds = %40, %37, %34
ret void
}