#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*/ Clear_Config_File(void *);
int Grab_RAMConfig_Line(char *, char *, int);
void *Load_Config_File();
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int getheader(char *);
scalar_t__ iscomment(char *);
scalar_t__ isheader(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ trim(char *);
int Clear_Audit_Objectives_From_File(int i_objective_count, int i_type,
                                     char *dest, int size) {
  void *rampointer = (void *)NULL;
  char *position;
  char inputbuffer[8192];
  char inputbuffer_swap[2 * 8192 + 2];
  int headertype = 0;
  FILE *configfile;
  int dw_objective_delete_error = 0;
  rampointer = Load_Config_File();
  if (!rampointer) {
    dw_objective_delete_error = 1;
  } else {
    int objectivecounter = 0;
    int currentsize = 0;
    position = (char *)rampointer;
    configfile = fopen("/etc/safed/safed.conf", "w");
    if (!configfile) {
      strncat(dest,
              "<br><b>NOTE: Could not open the configuration file for writing. "
              "Please verify the permissions set on the audit config file.",
              size - strlen(dest) - 1);
      Clear_Config_File(rampointer);
      return (dw_objective_delete_error);
    }
    while ((currentsize = Grab_RAMConfig_Line(position, inputbuffer, 8192))) {
      trim(inputbuffer);
      if (headertype == 5) {
        if (i_type == -2) {
          if (objectivecounter == (i_objective_count - 1)) {
            strcpy(inputbuffer_swap, inputbuffer);
            position += currentsize;
            objectivecounter++;
            continue;
          } else if (objectivecounter == i_objective_count) {
            strcat(inputbuffer, "\n\t");
            strcat(inputbuffer, inputbuffer_swap);
          }
        }
        if (i_type == -1) {
          if (objectivecounter == i_objective_count) {
            strcpy(inputbuffer_swap, inputbuffer);
            position += currentsize;
            objectivecounter++;
            continue;
          } else if (objectivecounter == (i_objective_count + 1)) {
            strcat(inputbuffer, "\n\t");
            strcat(inputbuffer, inputbuffer_swap);
          }
        }
        if (i_type == 0) {
          if (objectivecounter == i_objective_count) {
            position += currentsize;
            objectivecounter++;
            continue;
          }
        }
        objectivecounter++;
      }
      if (!iscomment(inputbuffer)) {
        if (isheader(inputbuffer)) {
          headertype = getheader(inputbuffer);
        }
      }
      if (isheader(inputbuffer) || iscomment(inputbuffer) ||
          !strlen(inputbuffer)) {
        fprintf(configfile, "%s\n", inputbuffer);
      } else {
        fprintf(configfile, "	%s\n", inputbuffer);
      }
      position += currentsize;
    }
    if (fclose(configfile)) {
      dw_objective_delete_error = 1;
      strncat(dest,
              "<br><b>NOTE: Could not write to the configuration file. Does "
              "the system have enough free disk space?.",
              size - strlen(dest) - 1);
      Clear_Config_File(rampointer);
      return (dw_objective_delete_error);
    }
    Clear_Config_File(rampointer);
  }
  return (dw_objective_delete_error);
}


x86 assembly (clang, -O0):
<Clear_Audit_Objectives_From_File>:
push   %rbp
mov    %rsp,%rbp
sub    $0x6080,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x6044(%rbp)
movl   $0x0,-0x6054(%rbp)
mov    $0x0,%al
call   1100 <Load_Config_File@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1239 <Clear_Audit_Objectives_From_File+0x59>
movl   $0x1,-0x6054(%rbp)
jmp    15e7 <Clear_Audit_Objectives_From_File+0x407>
movl   $0x0,-0x6058(%rbp)
movl   $0x0,-0x605c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    0xda4(%rip),%rdi
lea    0xdb3(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x6050(%rbp)
cmpq   $0x0,-0x6050(%rbp)
jne    12cf <Clear_Audit_Objectives_From_File+0xef>
mov    -0x18(%rbp),%rax
mov    %rax,-0x6068(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x606c(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x606c(%rbp),%edx
mov    -0x6068(%rbp),%rdi
sub    %eax,%edx
sub    $0x1,%edx
lea    0xd65(%rip),%rsi
call   1070 <strncat@plt>
mov    -0x28(%rbp),%rdi
call   10c0 <Clear_Config_File@plt>
mov    -0x6054(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15f0 <Clear_Audit_Objectives_From_File+0x410>
jmp    12d4 <Clear_Audit_Objectives_From_File+0xf4>
mov    -0x30(%rbp),%rdi
lea    -0x2030(%rbp),%rsi
mov    $0x2000,%edx
call   10a0 <Grab_RAMConfig_Line@plt>
mov    %eax,-0x605c(%rbp)
cmp    $0x0,%eax
je     156c <Clear_Audit_Objectives_From_File+0x38c>
lea    -0x2030(%rbp),%rdi
call   1060 <trim@plt>
cmpl   $0x5,-0x6044(%rbp)
jne    1496 <Clear_Audit_Objectives_From_File+0x2b6>
cmpl   $0xfffffffe,-0xc(%rbp)
jne    13a9 <Clear_Audit_Objectives_From_File+0x1c9>
mov    -0x6058(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    136a <Clear_Audit_Objectives_From_File+0x18a>
lea    -0x6040(%rbp),%rdi
lea    -0x2030(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x605c(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x6058(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6058(%rbp)
jmp    12d4 <Clear_Audit_Objectives_From_File+0xf4>
mov    -0x6058(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    139f <Clear_Audit_Objectives_From_File+0x1bf>
lea    -0x2030(%rbp),%rdi
lea    0xd0d(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x2030(%rbp),%rdi
lea    -0x6040(%rbp),%rsi
call   10d0 <strcat@plt>
jmp    13a4 <Clear_Audit_Objectives_From_File+0x1c4>
jmp    13a9 <Clear_Audit_Objectives_From_File+0x1c9>
cmpl   $0xffffffff,-0xc(%rbp)
jne    1441 <Clear_Audit_Objectives_From_File+0x261>
mov    -0x6058(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    13fd <Clear_Audit_Objectives_From_File+0x21d>
lea    -0x6040(%rbp),%rdi
lea    -0x2030(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x605c(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x6058(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6058(%rbp)
jmp    12d4 <Clear_Audit_Objectives_From_File+0xf4>
mov    -0x6058(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    1437 <Clear_Audit_Objectives_From_File+0x257>
lea    -0x2030(%rbp),%rdi
lea    0xc75(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x2030(%rbp),%rdi
lea    -0x6040(%rbp),%rsi
call   10d0 <strcat@plt>
jmp    143c <Clear_Audit_Objectives_From_File+0x25c>
jmp    1441 <Clear_Audit_Objectives_From_File+0x261>
cmpl   $0x0,-0xc(%rbp)
jne    1487 <Clear_Audit_Objectives_From_File+0x2a7>
mov    -0x6058(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1482 <Clear_Audit_Objectives_From_File+0x2a2>
mov    -0x605c(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x6058(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6058(%rbp)
jmp    12d4 <Clear_Audit_Objectives_From_File+0xf4>
jmp    1487 <Clear_Audit_Objectives_From_File+0x2a7>
mov    -0x6058(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6058(%rbp)
lea    -0x2030(%rbp),%rdi
call   10f0 <iscomment@plt>
cmp    $0x0,%rax
jne    14d9 <Clear_Audit_Objectives_From_File+0x2f9>
lea    -0x2030(%rbp),%rdi
call   1080 <isheader@plt>
cmp    $0x0,%rax
je     14d4 <Clear_Audit_Objectives_From_File+0x2f4>
lea    -0x2030(%rbp),%rdi
call   10e0 <getheader@plt>
mov    %eax,-0x6044(%rbp)
jmp    14d9 <Clear_Audit_Objectives_From_File+0x2f9>
lea    -0x2030(%rbp),%rdi
call   1080 <isheader@plt>
cmp    $0x0,%rax
jne    151a <Clear_Audit_Objectives_From_File+0x33a>
lea    -0x2030(%rbp),%rdi
call   10f0 <iscomment@plt>
cmp    $0x0,%rax
jne    151a <Clear_Audit_Objectives_From_File+0x33a>
lea    -0x2030(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jne    1539 <Clear_Audit_Objectives_From_File+0x359>
mov    -0x6050(%rbp),%rdi
lea    -0x2030(%rbp),%rdx
lea    0xb69(%rip),%rsi
call   1090 <fprintf@plt>
jmp    1553 <Clear_Audit_Objectives_From_File+0x373>
mov    -0x6050(%rbp),%rdi
lea    -0x2030(%rbp),%rdx
lea    0xb49(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x605c(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
jmp    12d4 <Clear_Audit_Objectives_From_File+0xf4>
mov    -0x6050(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     15de <Clear_Audit_Objectives_From_File+0x3fe>
movl   $0x1,-0x6054(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x6078(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x607c(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x607c(%rbp),%edx
mov    -0x6078(%rbp),%rdi
sub    %eax,%edx
sub    $0x1,%edx
lea    0xada(%rip),%rsi
call   1070 <strncat@plt>
mov    -0x28(%rbp),%rdi
call   10c0 <Clear_Config_File@plt>
mov    -0x6054(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15f0 <Clear_Audit_Objectives_From_File+0x410>
mov    -0x28(%rbp),%rdi
call   10c0 <Clear_Config_File@plt>
mov    -0x6054(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x6080,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Clear_Audit_Objectives_From_File>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x6048,%rsp
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,0x10(%rsp)
xor    %eax,%eax
call   1100 <Load_Config_File@plt>
mov    %rax,%rbx
mov    $0x1,%eax
test   %rbx,%rbx
je     14b8 <Clear_Audit_Objectives_From_File+0x2d8>
lea    0xde3(%rip),%rdi
lea    0xdf2(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,0x30(%rsp)
test   %rax,%rax
je     148a <Clear_Audit_Objectives_From_File+0x2aa>
mov    %r15d,0x2c(%rsp)
mov    %r14,0x38(%rsp)
mov    %ebp,0x24(%rsp)
lea    0x40(%rsp),%rsi
mov    %rbx,0x18(%rsp)
mov    %rbx,%rdi
mov    $0x2000,%edx
call   10a0 <Grab_RAMConfig_Line@plt>
test   %eax,%eax
je     1446 <Clear_Audit_Objectives_From_File+0x266>
mov    %eax,%r15d
mov    0x10(%rsp),%rax
lea    0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
add    $0xffffffff,%eax
mov    %eax,0x28(%rsp)
xor    %r14d,%r14d
lea    0x40(%rsp),%rbp
xor    %ebx,%ebx
mov    0x18(%rsp),%r13
jmp    12ca <Clear_Audit_Objectives_From_File+0xea>
nopl   0x0(%rax,%rax,1)
mov    0x30(%rsp),%rdi
mov    %r12,%rdx
call   1090 <fprintf@plt>
mov    %r12,%rbp
movslq %r15d,%rax
add    %rax,%r13
mov    %r13,%rdi
mov    %rbp,%rsi
mov    $0x2000,%edx
call   10a0 <Grab_RAMConfig_Line@plt>
mov    %eax,%r15d
mov    0x4(%rsp),%r14d
mov    0x8(%rsp),%ebx
test   %eax,%eax
je     1446 <Clear_Audit_Objectives_From_File+0x266>
mov    %rbp,%r12
mov    %rbp,%rdi
call   1060 <trim@plt>
cmp    $0x5,%ebx
jne    13b4 <Clear_Audit_Objectives_From_File+0x1d4>
mov    0x2c(%rsp),%eax
test   %eax,%eax
je     131d <Clear_Audit_Objectives_From_File+0x13d>
cmp    $0xffffffff,%eax
je     133d <Clear_Audit_Objectives_From_File+0x15d>
cmp    $0xfffffffe,%eax
jne    13b0 <Clear_Audit_Objectives_From_File+0x1d0>
cmp    0x28(%rsp),%r14d
jne    136c <Clear_Audit_Objectives_From_File+0x18c>
lea    0x2040(%rsp),%rdi
mov    %r12,%rbp
mov    %r12,%rsi
call   1030 <strcpy@plt>
movl   $0x5,0x8(%rsp)
mov    0x10(%rsp),%rax
jmp    1363 <Clear_Audit_Objectives_From_File+0x183>
movl   $0x5,0x8(%rsp)
mov    0xc(%rsp),%eax
mov    %eax,0x4(%rsp)
cmp    0x10(%rsp),%r14d
mov    %r12,%rbp
je     12a0 <Clear_Audit_Objectives_From_File+0xc0>
jmp    13b0 <Clear_Audit_Objectives_From_File+0x1d0>
cmp    0x10(%rsp),%r14d
jne    1378 <Clear_Audit_Objectives_From_File+0x198>
lea    0x2040(%rsp),%rdi
mov    %r12,%rbp
mov    %r12,%rsi
call   1030 <strcpy@plt>
movl   $0x5,0x8(%rsp)
mov    0xc(%rsp),%eax
mov    %eax,0x4(%rsp)
jmp    12a0 <Clear_Audit_Objectives_From_File+0xc0>
cmp    0x10(%rsp),%r14d
mov    %r12,%rbp
je     1382 <Clear_Audit_Objectives_From_File+0x1a2>
jmp    13b0 <Clear_Audit_Objectives_From_File+0x1d0>
cmp    0xc(%rsp),%r14d
mov    %r12,%rbp
jne    13b0 <Clear_Audit_Objectives_From_File+0x1d0>
mov    %rbp,%rdi
lea    0xd08(%rip),%rsi
call   10d0 <strcat@plt>
mov    %rbp,%rdi
lea    0x2040(%rsp),%rsi
call   10d0 <strcat@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14d
mov    %r14d,0x4(%rsp)
mov    %r12,%rdi
call   10f0 <iscomment@plt>
test   %rax,%rax
je     13e0 <Clear_Audit_Objectives_From_File+0x200>
mov    %ebx,%ecx
lea    0xcc9(%rip),%rbx
jmp    1400 <Clear_Audit_Objectives_From_File+0x220>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1080 <isheader@plt>
mov    %ebx,%ecx
test   %rax,%rax
lea    0xca4(%rip),%rbx
je     1400 <Clear_Audit_Objectives_From_File+0x220>
mov    %r12,%rdi
call   10e0 <getheader@plt>
mov    %eax,%ecx
mov    %ecx,0x8(%rsp)
mov    %r12,%rdi
call   1080 <isheader@plt>
mov    %rbx,%rsi
test   %rax,%rax
jne    1290 <Clear_Audit_Objectives_From_File+0xb0>
mov    %r12,%rdi
call   10f0 <iscomment@plt>
mov    %rbx,%rsi
test   %rax,%rax
jne    1290 <Clear_Audit_Objectives_From_File+0xb0>
mov    %r12,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
lea    0xc5a(%rip),%rsi
cmove  %rbx,%rsi
jmp    1290 <Clear_Audit_Objectives_From_File+0xb0>
mov    0x30(%rsp),%rdi
call   1040 <fclose@plt>
test   %rax,%rax
je     14ac <Clear_Audit_Objectives_From_File+0x2cc>
mov    0x38(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
not    %eax
mov    0x24(%rsp),%edx
add    %eax,%edx
lea    0xc2b(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strncat@plt>
mov    0x18(%rsp),%rdi
call   10c0 <Clear_Config_File@plt>
mov    $0x1,%eax
jmp    14b8 <Clear_Audit_Objectives_From_File+0x2d8>
mov    %r14,%rdi
call   1050 <strlen@plt>
not    %eax
add    %eax,%ebp
lea    0xb7b(%rip),%rsi
mov    %r14,%rdi
mov    %ebp,%edx
call   1070 <strncat@plt>
mov    %rbx,%rdi
jmp    14b1 <Clear_Audit_Objectives_From_File+0x2d1>
mov    0x18(%rsp),%rdi
call   10c0 <Clear_Config_File@plt>
xor    %eax,%eax
add    $0x6048,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"/etc/safed/safed.conf\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [124 x i8] c"<br><b>NOTE: Could not open the configuration file for writing. Please verify the permissions set on the audit config file.\00"
@.str.3 = [3 x i8] c"\0A\09\00"
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [5 x i8] c"\09%s\0A\00"
@.str.6 = [102 x i8] c"<br><b>NOTE: Could not write to the configuration file. Does the system have enough free disk space?.\00"
define i32 @Clear_Audit_Objectives_From_File(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [8192 x i8]
%13 = alloca [16386 x i8]
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* null, i8** %10
store i32 0, i32* %14
store i32 0, i32* %16
%19 = call i8* (...) @Load_Config_File()
store i8* %19, i8** %10
%20 = load i8*, i8** %10
%21 = icmp ne i8* %20, null
br i1 %21, label %23, label %22
22: ; preds = %4
store i32 1, i32* %16
br label %183
23: ; preds = %4
store i32 0, i32* %17
store i32 0, i32* %18
%24 = load i8*, i8** %10
store i8* %24, i8** %11
%25 = call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %25, i32** %15
%26 = load i32*, i32** %15
%27 = icmp ne i32* %26, null
br i1 %27, label %39, label %28
28: ; preds = %23
%29 = load i8*, i8** %8
%30 = load i32, i32* %9
%31 = load i8*, i8** %8
%32 = call i32 @strlen(i8* %31)
%33 = sub nsw i32 %30, %32
%34 = sub nsw i32 %33, 1
%35 = call i32 @strncat(i8* %29, i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str.2, i64 0, i64 0), i32 %34)
%36 = load i8*, i8** %10
%37 = call i32 @Clear_Config_File(i8* %36)
%38 = load i32, i32* %16
store i32 %38, i32* %5
br label %185
39: ; preds = %23
br label %40
40: ; preds = %160, %117, %87, %58, %39
%41 = load i8*, i8** %11
%42 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%43 = call i32 @Grab_RAMConfig_Line(i8* %41, i8* %42, i32 8192)
store i32 %43, i32* %18
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %165
45: ; preds = %40
%46 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%47 = call i32 @trim(i8* %46)
%48 = load i32, i32* %14
%49 = icmp eq i32 %48, 5
br i1 %49, label %50, label %128
50: ; preds = %45
%51 = load i32, i32* %7
%52 = icmp eq i32 %51, -2
br i1 %52, label %53, label %80
53: ; preds = %50
%54 = load i32, i32* %17
%55 = load i32, i32* %6
%56 = sub nsw i32 %55, 1
%57 = icmp eq i32 %54, %56
br i1 %57, label %58, label %68
58: ; preds = %53
%59 = getelementptr inbounds [16386 x i8], [16386 x i8]* %13, i64 0, i64 0
%60 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%61 = call i32 @strcpy(i8* %59, i8* %60)
%62 = load i32, i32* %18
%63 = load i8*, i8** %11
%64 = sext i32 %62 to i64
%65 = getelementptr inbounds i8, i8* %63, i64 %64
store i8* %65, i8** %11
%66 = load i32, i32* %17
%67 = add nsw i32 %66, 1
store i32 %67, i32* %17
br label %40
68: ; preds = %53
%69 = load i32, i32* %17
%70 = load i32, i32* %6
%71 = icmp eq i32 %69, %70
br i1 %71, label %72, label %78
72: ; preds = %68
%73 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%74 = call i32 @strcat(i8* %73, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%75 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%76 = getelementptr inbounds [16386 x i8], [16386 x i8]* %13, i64 0, i64 0
%77 = call i32 @strcat(i8* %75, i8* %76)
br label %78
78: ; preds = %72, %68
br label %79
79: ; preds = %78
br label %80
80: ; preds = %79, %50
%81 = load i32, i32* %7
%82 = icmp eq i32 %81, -1
br i1 %82, label %83, label %110
83: ; preds = %80
%84 = load i32, i32* %17
%85 = load i32, i32* %6
%86 = icmp eq i32 %84, %85
br i1 %86, label %87, label %97
87: ; preds = %83
%88 = getelementptr inbounds [16386 x i8], [16386 x i8]* %13, i64 0, i64 0
%89 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%90 = call i32 @strcpy(i8* %88, i8* %89)
%91 = load i32, i32* %18
%92 = load i8*, i8** %11
%93 = sext i32 %91 to i64
%94 = getelementptr inbounds i8, i8* %92, i64 %93
store i8* %94, i8** %11
%95 = load i32, i32* %17
%96 = add nsw i32 %95, 1
store i32 %96, i32* %17
br label %40
97: ; preds = %83
%98 = load i32, i32* %17
%99 = load i32, i32* %6
%100 = add nsw i32 %99, 1
%101 = icmp eq i32 %98, %100
br i1 %101, label %102, label %108
102: ; preds = %97
%103 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%104 = call i32 @strcat(i8* %103, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%105 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%106 = getelementptr inbounds [16386 x i8], [16386 x i8]* %13, i64 0, i64 0
%107 = call i32 @strcat(i8* %105, i8* %106)
br label %108
108: ; preds = %102, %97
br label %109
109: ; preds = %108
br label %110
110: ; preds = %109, %80
%111 = load i32, i32* %7
%112 = icmp eq i32 %111, 0
br i1 %112, label %113, label %125
113: ; preds = %110
%114 = load i32, i32* %17
%115 = load i32, i32* %6
%116 = icmp eq i32 %114, %115
br i1 %116, label %117, label %124
117: ; preds = %113
%118 = load i32, i32* %18
%119 = load i8*, i8** %11
%120 = sext i32 %118 to i64
%121 = getelementptr inbounds i8, i8* %119, i64 %120
store i8* %121, i8** %11
%122 = load i32, i32* %17
%123 = add nsw i32 %122, 1
store i32 %123, i32* %17
br label %40
124: ; preds = %113
br label %125
125: ; preds = %124, %110
%126 = load i32, i32* %17
%127 = add nsw i32 %126, 1
store i32 %127, i32* %17
br label %128
128: ; preds = %125, %45
%129 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%130 = call i64 @iscomment(i8* %129)
%131 = icmp ne i64 %130, 0
br i1 %131, label %140, label %132
132: ; preds = %128
%133 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%134 = call i64 @isheader(i8* %133)
%135 = icmp ne i64 %134, 0
br i1 %135, label %136, label %139
136: ; preds = %132
%137 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%138 = call i32 @getheader(i8* %137)
store i32 %138, i32* %14
br label %139
139: ; preds = %136, %132
br label %140
140: ; preds = %139, %128
%141 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%142 = call i64 @isheader(i8* %141)
%143 = icmp ne i64 %142, 0
br i1 %143, label %152, label %144
144: ; preds = %140
%145 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%146 = call i64 @iscomment(i8* %145)
%147 = icmp ne i64 %146, 0
br i1 %147, label %152, label %148
148: ; preds = %144
%149 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%150 = call i32 @strlen(i8* %149)
%151 = icmp ne i32 %150, 0
br i1 %151, label %156, label %152
152: ; preds = %148, %144, %140
%153 = load i32*, i32** %15
%154 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%155 = call i32 @fprintf(i32* %153, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %154)
br label %160
156: ; preds = %148
%157 = load i32*, i32** %15
%158 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%159 = call i32 @fprintf(i32* %157, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %158)
br label %160
160: ; preds = %156, %152
%161 = load i32, i32* %18
%162 = load i8*, i8** %11
%163 = sext i32 %161 to i64
%164 = getelementptr inbounds i8, i8* %162, i64 %163
store i8* %164, i8** %11
br label %40
165: ; preds = %40
%166 = load i32*, i32** %15
%167 = call i64 @fclose(i32* %166)
%168 = icmp ne i64 %167, 0
br i1 %168, label %169, label %180
169: ; preds = %165
store i32 1, i32* %16
%170 = load i8*, i8** %8
%171 = load i32, i32* %9
%172 = load i8*, i8** %8
%173 = call i32 @strlen(i8* %172)
%174 = sub nsw i32 %171, %173
%175 = sub nsw i32 %174, 1
%176 = call i32 @strncat(i8* %170, i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.6, i64 0, i64 0), i32 %175)
%177 = load i8*, i8** %10
%178 = call i32 @Clear_Config_File(i8* %177)
%179 = load i32, i32* %16
store i32 %179, i32* %5
br label %185
180: ; preds = %165
%181 = load i8*, i8** %10
%182 = call i32 @Clear_Config_File(i8* %181)
br label %183
183: ; preds = %180, %22
%184 = load i32, i32* %16
store i32 %184, i32* %5
br label %185
185: ; preds = %183, %169, %28
%186 = load i32, i32* %5
ret i32 %186
}

LLVM IR (-O2):
@.str = [22 x i8] c"/etc/safed/safed.conf\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [124 x i8] c"<br><b>NOTE: Could not open the configuration file for writing. Please verify the permissions set on the audit config file.\00"
@.str.3 = [3 x i8] c"\0A\09\00"
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [5 x i8] c"\09%s\0A\00"
@.str.6 = [102 x i8] c"<br><b>NOTE: Could not write to the configuration file. Does the system have enough free disk space?.\00"
define i32 @Clear_Audit_Objectives_From_File(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca [8192 x i8]
%6 = alloca [16386 x i8]
%7 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%8 = getelementptr inbounds [16386 x i8], [16386 x i8]* %6, i64 0, i64 0
%9 = tail call i8* (...) @Load_Config_File()
%10 = icmp eq i8* %9, null
br i1 %10, label %94, label %11
11: ; preds = %4
%12 = tail call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %20, label %14
14: ; preds = %11
%15 = call i32 @Grab_RAMConfig_Line(i8* %9, i8* %7, i32 8192)
%16 = icmp eq i32 %15, 0
br i1 %16, label %83, label %17
17: ; preds = %14
%18 = add nsw i32 %0, 1
%19 = add nsw i32 %0, -1
br label %26
20: ; preds = %11
%21 = tail call i32 @strlen(i8* %2)
%22 = xor i32 %21, -1
%23 = add i32 %22, %3
%24 = tail call i32 @strncat(i8* %2, i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = tail call i32 @Clear_Config_File(i8* %9)
br label %94
26: ; preds = %17, %38
%27 = phi i32 [ %15, %17 ], [ %43, %38 ]
%28 = phi i32 [ 0, %17 ], [ %40, %38 ]
%29 = phi i32 [ 0, %17 ], [ %39, %38 ]
%30 = phi i8* [ %9, %17 ], [ %42, %38 ]
%31 = call i32 @trim(i8* %7)
%32 = icmp eq i32 %29, 5
br i1 %32, label %33, label %60
33: ; preds = %26
switch i32 %1, label %58 [
i32 -2, label %34
i32 -1, label %47
i32 0, label %53
]
34: ; preds = %33
%35 = icmp eq i32 %28, %19
br i1 %35, label %36, label %45
36: ; preds = %34
%37 = call i32 @strcpy(i8* %8, i8* %7)
br label %38
38: ; preds = %53, %36, %49, %80
%39 = phi i32 [ 5, %36 ], [ 5, %49 ], [ %70, %80 ], [ 5, %53 ]
%40 = phi i32 [ %0, %36 ], [ %18, %49 ], [ %61, %80 ], [ %18, %53 ]
%41 = sext i32 %27 to i64
%42 = getelementptr inbounds i8, i8* %30, i64 %41
%43 = call i32 @Grab_RAMConfig_Line(i8* %42, i8* %7, i32 8192)
%44 = icmp eq i32 %43, 0
br i1 %44, label %83, label %26
45: ; preds = %34
%46 = icmp eq i32 %28, %0
br i1 %46, label %55, label %58
47: ; preds = %33
%48 = icmp eq i32 %28, %0
br i1 %48, label %49, label %51
49: ; preds = %47
%50 = call i32 @strcpy(i8* %8, i8* %7)
br label %38
51: ; preds = %47
%52 = icmp eq i32 %28, %18
br i1 %52, label %55, label %58
53: ; preds = %33
%54 = icmp eq i32 %28, %0
br i1 %54, label %38, label %58
55: ; preds = %51, %45
%56 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%57 = call i32 @strcat(i8* %7, i8* %8)
br label %58
58: ; preds = %55, %51, %45, %33, %53
%59 = add nsw i32 %28, 1
br label %60
60: ; preds = %58, %26
%61 = phi i32 [ %59, %58 ], [ %28, %26 ]
%62 = call i64 @iscomment(i8* %7)
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %69
64: ; preds = %60
%65 = call i64 @isheader(i8* %7)
%66 = icmp eq i64 %65, 0
br i1 %66, label %69, label %67
67: ; preds = %64
%68 = call i32 @getheader(i8* %7)
br label %69
69: ; preds = %64, %67, %60
%70 = phi i32 [ %29, %60 ], [ %68, %67 ], [ %29, %64 ]
%71 = call i64 @isheader(i8* %7)
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %80
73: ; preds = %69
%74 = call i64 @iscomment(i8* %7)
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %73
%77 = call i32 @strlen(i8* %7)
%78 = icmp eq i32 %77, 0
%79 = select i1 %78, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
br label %80
80: ; preds = %76, %69, %73
%81 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %73 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %69 ], [ %79, %76 ]
%82 = call i32 @fprintf(i32* %12, i8* %81, i8* %7)
br label %38
83: ; preds = %38, %14
%84 = call i64 @fclose(i32* %12)
%85 = icmp eq i64 %84, 0
br i1 %85, label %92, label %86
86: ; preds = %83
%87 = call i32 @strlen(i8* %2)
%88 = xor i32 %87, -1
%89 = add i32 %88, %3
%90 = call i32 @strncat(i8* %2, i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.6, i64 0, i64 0), i32 %89)
%91 = call i32 @Clear_Config_File(i8* %9)
br label %94
92: ; preds = %83
%93 = call i32 @Clear_Config_File(i8* %9)
br label %94
94: ; preds = %20, %86, %4, %92
%95 = phi i32 [ 0, %92 ], [ 1, %4 ], [ 0, %20 ], [ 1, %86 ]
ret i32 %95
}