#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 */
struct stat {
  int st_size;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char const *, char const *);
scalar_t__ stat(char const *, struct stat *);
int /*<<< orphan*/ strcasecmp(char *, char const *);
int /*<<< orphan*/ strcat(char *, char *);
char *strchr(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strpbrk(char *, char *);
int strspn(char *, char *);
int set_property(const char *filename, const char *propname, const char *value,
                 const char *comment) {
  int found = 0, result = 0, file_size = 0, i;
  char line[32768], line2[32768], *str = NULL, *p = NULL;
  FILE *fh;
  struct stat fstate;
  if (stat(filename, &fstate) != 0)
    file_size = fstate.st_size;
  if (!(str = (char *)malloc(file_size + 32768)))
    return -1;
  *str = 0;
  if ((fh = fopen(filename, "r")) != 0) {
    while (fgets(line, sizeof line, fh) != NULL) {
      strcpy(line2, line);
      if ((p = strpbrk(line2, "="
                              "#\r\n")))
        *p = 0;
      for (i = strlen(line2) - 1;
           i >= 0 && (line2[i] == '\t' || line2[i] == ' '); i--)
        ;
      line2[i + 1] = 0;
      if (!strcasecmp(line2 + strspn(line2, "\t "), propname)) {
        found = 1;
        if (value == NULL)
          continue;
        sprintf(line,
                "%s"
                "="
                "%s\n",
                propname, value);
      }
      strcat(str, line);
    }
    fclose(fh);
  }
  if (!found && value) {
    if (comment) {
      strcat(str, "#"
                  "\n"
                  "#"
                  " ");
      for (p = strchr(str, 0); *comment; comment++)
        switch (*comment) {
        case '\r':
          break;
        case '\n':
          strcat(str, "\n"
                      "#"
                      " ");
          break;
        default:
          p = strchr(str, 0);
          *p = *comment;
          *(++p) = 0;
          break;
        }
      strcat(str, "\n"
                  "#"
                  "\n");
    }
    sprintf(line,
            "%s"
            "="
            "%s\n",
            propname, value);
    strcat(str, line);
  }
  if ((fh = fopen(filename, "w")) == NULL)
    return -1;
  result = fwrite(str, 1, strlen(str), fh);
  fclose(fh);
  return result;
}


x86 assembly (clang, -O0):
<set_property>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10080,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movq   $0x0,-0x10048(%rbp)
movq   $0x0,-0x10050(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x10060(%rbp),%rsi
call   10a0 <stat@plt>
cmp    $0x0,%rax
je     1249 <set_property+0x69>
mov    -0x10060(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edi
add    $0x8000,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x10048(%rbp)
cmp    $0x0,%rax
jne    1274 <set_property+0x94>
movl   $0xffffffff,-0x4(%rbp)
jmp    15e2 <set_property+0x402>
mov    -0x10048(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    0xd77(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x10058(%rbp)
cmp    $0x0,%rax
je     1437 <set_property+0x257>
jmp    12a4 <set_property+0xc4>
lea    -0x8040(%rbp),%rdi
mov    -0x10058(%rbp),%rdx
mov    $0x8000,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     142b <set_property+0x24b>
lea    -0x10040(%rbp),%rdi
lea    -0x8040(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x10040(%rbp),%rdi
lea    0xd1b(%rip),%rsi
call   10c0 <strpbrk@plt>
mov    %rax,-0x10050(%rbp)
cmp    $0x0,%rax
je     1307 <set_property+0x127>
mov    -0x10050(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x10040(%rbp),%rdi
call   1060 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x38(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x38(%rbp)
mov    %al,-0x10061(%rbp)
jl     136c <set_property+0x18c>
movslq -0x38(%rbp),%rax
movsbl -0x10040(%rbp,%rax,1),%ecx
ff
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x10062(%rbp)
je     1360 <set_property+0x180>
movslq -0x38(%rbp),%rax
movsbl -0x10040(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
sete   %al
mov    %al,-0x10062(%rbp)
mov    -0x10062(%rbp),%al
mov    %al,-0x10061(%rbp)
mov    -0x10061(%rbp),%al
test   $0x1,%al
jne    137f <set_property+0x19f>
jmp    1392 <set_property+0x1b2>
jmp    1384 <set_property+0x1a4>
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
jmp    1319 <set_property+0x139>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x0,-0x10040(%rbp,%rax,1)
lea    -0x10040(%rbp),%rax
mov    %rax,-0x10070(%rbp)
lea    -0x10040(%rbp),%rdi
lea    0xc49(%rip),%rsi
call   1080 <strspn@plt>
mov    -0x10070(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1413 <set_property+0x233>
movl   $0x1,-0x2c(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    13f8 <set_property+0x218>
jmp    12a4 <set_property+0xc4>
lea    -0x8040(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xbfc(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x10048(%rbp),%rdi
lea    -0x8040(%rbp),%rsi
call   10e0 <strcat@plt>
jmp    12a4 <set_property+0xc4>
mov    -0x10058(%rbp),%rdi
call   1050 <fclose@plt>
cmpl   $0x0,-0x2c(%rbp)
jne    156c <set_property+0x38c>
cmpq   $0x0,-0x20(%rbp)
je     156c <set_property+0x38c>
cmpq   $0x0,-0x28(%rbp)
je     153e <set_property+0x35e>
mov    -0x10048(%rbp),%rdi
lea    0xbac(%rip),%rsi
call   10e0 <strcat@plt>
mov    -0x10048(%rbp),%rdi
xor    %esi,%esi
call   1070 <strchr@plt>
mov    %rax,-0x10050(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
je     152b <set_property+0x34b>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x10074(%rbp)
sub    $0xa,%eax
je     14c0 <set_property+0x2e0>
jmp    14a7 <set_property+0x2c7>
mov    -0x10074(%rbp),%eax
sub    $0xd,%eax
jne    14d8 <set_property+0x2f8>
jmp    14bb <set_property+0x2db>
jmp    1515 <set_property+0x335>
mov    -0x10048(%rbp),%rdi
lea    0xb44(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1515 <set_property+0x335>
mov    -0x10048(%rbp),%rdi
xor    %esi,%esi
call   1070 <strchr@plt>
mov    %rax,-0x10050(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%cl
mov    -0x10050(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10050(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10050(%rbp)
movb   $0x0,0x1(%rax)
jmp    151a <set_property+0x33a>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    147f <set_property+0x29f>
mov    -0x10048(%rbp),%rdi
lea    0xadd(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8040(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xab6(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x10048(%rbp),%rdi
lea    -0x8040(%rbp),%rsi
call   10e0 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xaa3(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x10058(%rbp)
cmp    $0x0,%rax
jne    1599 <set_property+0x3b9>
movl   $0xffffffff,-0x4(%rbp)
jmp    15e2 <set_property+0x402>
mov    -0x10048(%rbp),%rax
mov    %rax,-0x10080(%rbp)
mov    -0x10048(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x10080(%rbp),%rdi
mov    %eax,%edx
mov    -0x10058(%rbp),%rcx
mov    $0x1,%esi
call   1100 <fwrite@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10058(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10080,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_property>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10028,%rsp
mov    %rcx,%r13
mov    %rdx,(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rdi,%r12
lea    0x10(%rsp),%rsi
call   1090 <stat@plt>
mov    $0x8000,%ecx
mov    0x10(%rsp),%edi
add    %ecx,%edi
test   %rax,%rax
cmove  %ecx,%edi
call   10a0 <malloc@plt>
mov    $0xffffffff,%r15d
test   %rax,%rax
je     146b <set_property+0x29b>
mov    %rax,%rbp
movb   $0x0,(%rax)
lea    0xdd4(%rip),%rsi
mov    %r12,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1380 <set_property+0x1b0>
mov    %rax,%r14
mov    %r12,0x18(%rsp)
lea    0x8020(%rsp),%rdi
mov    $0x8000,%esi
mov    %rax,%rdx
call   1080 <fgets@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     136b <set_property+0x19b>
lea    0x20(%rsp),%r15
lea    0x8020(%rsp),%r12
jmp    12bd <set_property+0xed>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
lea    0xd80(%rip),%rsi
mov    0x8(%rsp),%rdx
call   10e0 <sprintf@plt>
mov    $0x1,%ebx
mov    %rbp,%rdi
mov    %r12,%rsi
call   10d0 <strcat@plt>
mov    %r12,%rdi
mov    $0x8000,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     136b <set_property+0x19b>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
mov    %r15,%rdi
lea    0xd30(%rip),%rsi
call   10b0 <strpbrk@plt>
test   %rax,%rax
je     12df <set_property+0x10f>
movb   $0x0,(%rax)
mov    %r15,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    1322 <set_property+0x152>
mov    %eax,%eax
jmp    12fd <set_property+0x12d>
nop
lea    0x1(%rcx),%rdx
mov    %rcx,%rax
cmp    $0x1,%rdx
jbe    1320 <set_property+0x150>
lea    -0x1(%rax),%rcx
mov    %ecx,%edx
movzbl 0x20(%rsp,%rdx,1),%edx
cmp    $0x20,%dl
je     12f0 <set_property+0x120>
cmp    $0x9,%dl
je     12f0 <set_property+0x120>
jmp    1322 <set_property+0x152>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
cltq
movb   $0x0,0x20(%rsp,%rax,1)
mov    %r15,%rdi
lea    0xcd4(%rip),%rsi
call   1070 <strspn@plt>
cltq
lea    (%rsp,%rax,1),%rdi
add    $0x20,%rdi
mov    0x8(%rsp),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
jne    1299 <set_property+0xc9>
mov    (%rsp),%rcx
test   %rcx,%rcx
jne    1280 <set_property+0xb0>
mov    $0x1,%ebx
jmp    12a4 <set_property+0xd4>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    $0xffffffff,%r15d
mov    0x18(%rsp),%r12
jmp    1382 <set_property+0x1b2>
xor    %ebx,%ebx
mov    (%rsp),%rcx
test   %rcx,%rcx
je     142f <set_property+0x25f>
test   %ebx,%ebx
jne    142f <set_property+0x25f>
test   %r13,%r13
je     1408 <set_property+0x238>
lea    0xc6e(%rip),%rsi
mov    %rbp,%rdi
call   10d0 <strcat@plt>
mov    0x0(%r13),%bl
test   %bl,%bl
je     13f5 <set_property+0x225>
add    $0x1,%r13
lea    0xc54(%rip),%r14
jmp    13db <set_property+0x20b>
call   1060 <strlen@plt>
mov    %bl,0x0(%rbp,%rax,1)
movb   $0x0,0x1(%rbp,%rax,1)
movzbl 0x0(%r13),%ebx
add    $0x1,%r13
test   %bl,%bl
je     13f5 <set_property+0x225>
movsbl %bl,%eax
cmp    $0xd,%eax
je     13ce <set_property+0x1fe>
mov    %rbp,%rdi
cmp    $0xa,%eax
jne    13c0 <set_property+0x1f0>
mov    %r14,%rsi
call   10d0 <strcat@plt>
jmp    13ce <set_property+0x1fe>
lea    0xc1a(%rip),%rsi
mov    %rbp,%rdi
call   10d0 <strcat@plt>
mov    (%rsp),%rcx
lea    0xbfb(%rip),%rsi
lea    0x8020(%rsp),%rbx
mov    %rbx,%rdi
mov    0x8(%rsp),%rdx
call   10e0 <sprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10d0 <strcat@plt>
lea    0xbe4(%rip),%rsi
mov    %r12,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     146b <set_property+0x29b>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %eax,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %r15d,%eax
add    $0x10028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [2 x i8] c"r\00"
@.str.1 = [5 x i8] c"=#\0D\0A\00"
@.str.2 = [3 x i8] c"\09 \00"
@.str.3 = [7 x i8] c"%s=%s\0A\00"
@.str.4 = [5 x i8] c"#\0A# \00"
@.str.5 = [4 x i8] c"\0A# \00"
@.str.6 = [4 x i8] c"\0A#\0A\00"
@.str.7 = [2 x i8] c"w\00"
define i32 @set_property(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [32768 x i8]
%15 = alloca [32768 x i8]
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i32*
%19 = alloca %struct.stat
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i8* null, i8** %16
store i8* null, i8** %17
%20 = load i8*, i8** %6
%21 = call i64 @stat(i8* %20, %struct.stat* %19)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %4
%24 = getelementptr inbounds %struct.stat, %struct.stat* %19, i32 0, i32 0
%25 = load i32, i32* %24
store i32 %25, i32* %12
br label %26
26: ; preds = %23, %4
%27 = load i32, i32* %12
%28 = add nsw i32 %27, 32768
%29 = call i64 @malloc(i32 %28)
%30 = inttoptr i64 %29 to i8*
store i8* %30, i8** %16
%31 = icmp ne i8* %30, null
br i1 %31, label %33, label %32
32: ; preds = %26
store i32 -1, i32* %5
br label %174
33: ; preds = %26
%34 = load i8*, i8** %16
store i8 0, i8* %34
%35 = load i8*, i8** %6
%36 = call i32* @fopen(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %36, i32** %18
%37 = icmp ne i32* %36, null
br i1 %37, label %38, label %111
38: ; preds = %33
br label %39
39: ; preds = %104, %98, %38
%40 = getelementptr inbounds [32768 x i8], [32768 x i8]* %14, i64 0, i64 0
%41 = load i32*, i32** %18
%42 = call i32* @fgets(i8* %40, i32 32768, i32* %41)
%43 = icmp ne i32* %42, null
br i1 %43, label %44, label %108
44: ; preds = %39
%45 = getelementptr inbounds [32768 x i8], [32768 x i8]* %15, i64 0, i64 0
%46 = getelementptr inbounds [32768 x i8], [32768 x i8]* %14, i64 0, i64 0
%47 = call i32 @strcpy(i8* %45, i8* %46)
%48 = getelementptr inbounds [32768 x i8], [32768 x i8]* %15, i64 0, i64 0
%49 = call i8* @strpbrk(i8* %48, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i8* %49, i8** %17
%50 = icmp ne i8* %49, null
br i1 %50, label %51, label %53
51: ; preds = %44
%52 = load i8*, i8** %17
store i8 0, i8* %52
br label %53
53: ; preds = %51, %44
%54 = getelementptr inbounds [32768 x i8], [32768 x i8]* %15, i64 0, i64 0
%55 = call i32 @strlen(i8* %54)
%56 = sub nsw i32 %55, 1
store i32 %56, i32* %13
br label %57
57: ; preds = %79, %53
%58 = load i32, i32* %13
%59 = icmp sge i32 %58, 0
br i1 %59, label %60, label %76
60: ; preds = %57
%61 = load i32, i32* %13
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [32768 x i8], [32768 x i8]* %15, i64 0, i64 %62
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %65, 9
br i1 %66, label %74, label %67
67: ; preds = %60
%68 = load i32, i32* %13
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [32768 x i8], [32768 x i8]* %15, i64 0, i64 %69
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 32
br label %74
74: ; preds = %67, %60
%75 = phi i1 [ true, %60 ], [ %73, %67 ]
br label %76
76: ; preds = %74, %57
%77 = phi i1 [ false, %57 ], [ %75, %74 ]
br i1 %77, label %78, label %82
78: ; preds = %76
br label %79
79: ; preds = %78
%80 = load i32, i32* %13
%81 = add nsw i32 %80, -1
store i32 %81, i32* %13
br label %57
82: ; preds = %76
%83 = load i32, i32* %13
%84 = add nsw i32 %83, 1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [32768 x i8], [32768 x i8]* %15, i64 0, i64 %85
store i8 0, i8* %86
%87 = getelementptr inbounds [32768 x i8], [32768 x i8]* %15, i64 0, i64 0
%88 = getelementptr inbounds [32768 x i8], [32768 x i8]* %15, i64 0, i64 0
%89 = call i32 @strspn(i8* %88, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i8, i8* %87, i64 %90
%92 = load i8*, i8** %7
%93 = call i32 @strcasecmp(i8* %91, i8* %92)
%94 = icmp ne i32 %93, 0
br i1 %94, label %104, label %95
95: ; preds = %82
store i32 1, i32* %10
%96 = load i8*, i8** %8
%97 = icmp eq i8* %96, null
br i1 %97, label %98, label %99
98: ; preds = %95
br label %39
99: ; preds = %95
%100 = getelementptr inbounds [32768 x i8], [32768 x i8]* %14, i64 0, i64 0
%101 = load i8*, i8** %7
%102 = load i8*, i8** %8
%103 = call i32 @sprintf(i8* %100, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %101, i8* %102)
br label %104
104: ; preds = %99, %82
%105 = load i8*, i8** %16
%106 = getelementptr inbounds [32768 x i8], [32768 x i8]* %14, i64 0, i64 0
%107 = call i32 @strcat(i8* %105, i8* %106)
br label %39
108: ; preds = %39
%109 = load i32*, i32** %18
%110 = call i32 @fclose(i32* %109)
br label %111
111: ; preds = %108, %33
%112 = load i32, i32* %10
%113 = icmp ne i32 %112, 0
br i1 %113, label %160, label %114
114: ; preds = %111
%115 = load i8*, i8** %8
%116 = icmp ne i8* %115, null
br i1 %116, label %117, label %160
117: ; preds = %114
%118 = load i8*, i8** %9
%119 = icmp ne i8* %118, null
br i1 %119, label %120, label %152
120: ; preds = %117
%121 = load i8*, i8** %16
%122 = call i32 @strcat(i8* %121, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%123 = load i8*, i8** %16
%124 = call i8* @strchr(i8* %123, i32 0)
store i8* %124, i8** %17
br label %125
125: ; preds = %146, %120
%126 = load i8*, i8** %9
%127 = load i8, i8* %126
%128 = icmp ne i8 %127, 0
br i1 %128, label %129, label %149
129: ; preds = %125
%130 = load i8*, i8** %9
%131 = load i8, i8* %130
%132 = sext i8 %131 to i32
switch i32 %132, label %137 [
i32 13, label %133
i32 10, label %134
]
133: ; preds = %129
br label %145
134: ; preds = %129
%135 = load i8*, i8** %16
%136 = call i32 @strcat(i8* %135, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %145
137: ; preds = %129
%138 = load i8*, i8** %16
%139 = call i8* @strchr(i8* %138, i32 0)
store i8* %139, i8** %17
%140 = load i8*, i8** %9
%141 = load i8, i8* %140
%142 = load i8*, i8** %17
store i8 %141, i8* %142
%143 = load i8*, i8** %17
%144 = getelementptr inbounds i8, i8* %143, i32 1
store i8* %144, i8** %17
store i8 0, i8* %144
br label %145
145: ; preds = %137, %134, %133
br label %146
146: ; preds = %145
%147 = load i8*, i8** %9
%148 = getelementptr inbounds i8, i8* %147, i32 1
store i8* %148, i8** %9
br label %125
149: ; preds = %125
%150 = load i8*, i8** %16
%151 = call i32 @strcat(i8* %150, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %152
152: ; preds = %149, %117
%153 = getelementptr inbounds [32768 x i8], [32768 x i8]* %14, i64 0, i64 0
%154 = load i8*, i8** %7
%155 = load i8*, i8** %8
%156 = call i32 @sprintf(i8* %153, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %154, i8* %155)
%157 = load i8*, i8** %16
%158 = getelementptr inbounds [32768 x i8], [32768 x i8]* %14, i64 0, i64 0
%159 = call i32 @strcat(i8* %157, i8* %158)
br label %160
160: ; preds = %152, %114, %111
%161 = load i8*, i8** %6
%162 = call i32* @fopen(i8* %161, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %162, i32** %18
%163 = icmp eq i32* %162, null
br i1 %163, label %164, label %165
164: ; preds = %160
store i32 -1, i32* %5
br label %174
165: ; preds = %160
%166 = load i8*, i8** %16
%167 = load i8*, i8** %16
%168 = call i32 @strlen(i8* %167)
%169 = load i32*, i32** %18
%170 = call i32 @fwrite(i8* %166, i32 1, i32 %168, i32* %169)
store i32 %170, i32* %11
%171 = load i32*, i32** %18
%172 = call i32 @fclose(i32* %171)
%173 = load i32, i32* %11
store i32 %173, i32* %5
br label %174
174: ; preds = %165, %164, %32
%175 = load i32, i32* %5
ret i32 %175
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [2 x i8] c"r\00"
@.str.1 = [5 x i8] c"=#\0D\0A\00"
@.str.2 = [3 x i8] c"\09 \00"
@.str.3 = [7 x i8] c"%s=%s\0A\00"
@.str.4 = [5 x i8] c"#\0A# \00"
@.str.5 = [4 x i8] c"\0A# \00"
@.str.6 = [4 x i8] c"\0A#\0A\00"
@.str.7 = [2 x i8] c"w\00"
define i32 @set_property(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [32768 x i8]
%6 = alloca [32768 x i8]
%7 = alloca %struct.stat
%8 = getelementptr inbounds [32768 x i8], [32768 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [32768 x i8], [32768 x i8]* %6, i64 0, i64 0
%10 = bitcast %struct.stat* %7 to i8*
%11 = call i64 @stat(i8* %0, %struct.stat* %7)
%12 = icmp eq i64 %11, 0
%13 = getelementptr inbounds %struct.stat, %struct.stat* %7, i64 0, i32 0
%14 = load i32, i32* %13
%15 = add i32 %14, 32768
%16 = select i1 %12, i32 32768, i32 %15
%17 = call i64 @malloc(i32 %16)
%18 = inttoptr i64 %17 to i8*
%19 = icmp eq i64 %17, 0
br i1 %19, label %108, label %20
20: ; preds = %4
store i8 0, i8* %18
%21 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %71, label %23
23: ; preds = %20
%24 = call i32* @fgets(i8* %8, i32 32768, i32* %21)
%25 = icmp eq i32* %24, null
br i1 %25, label %68, label %26
26: ; preds = %23
%27 = icmp eq i8* %2, null
br label %28
28: ; preds = %26, %64
%29 = phi i32 [ 0, %26 ], [ %65, %64 ]
%30 = call i32 @strcpy(i8* %9, i8* %8)
%31 = call i8* @strpbrk(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%32 = icmp eq i8* %31, null
br i1 %32, label %34, label %33
33: ; preds = %28
store i8 0, i8* %31
br label %34
34: ; preds = %33, %28
%35 = call i32 @strlen(i8* %9)
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %49
37: ; preds = %34
%38 = zext i32 %35 to i64
br label %39
39: ; preds = %37, %45
%40 = phi i64 [ %38, %37 ], [ %41, %45 ]
%41 = add nsw i64 %40, -1
%42 = and i64 %41, 4294967295
%43 = getelementptr inbounds [32768 x i8], [32768 x i8]* %6, i64 0, i64 %42
%44 = load i8, i8* %43
switch i8 %44, label %47 [
i8 9, label %45
i8 32, label %45
]
45: ; preds = %39, %39
%46 = icmp ugt i64 %40, 1
br i1 %46, label %39, label %49
47: ; preds = %39
%48 = trunc i64 %40 to i32
br label %49
49: ; preds = %45, %47, %34
%50 = phi i32 [ %35, %34 ], [ %48, %47 ], [ 0, %45 ]
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [32768 x i8], [32768 x i8]* %6, i64 0, i64 %51
store i8 0, i8* %52
%53 = call i32 @strspn(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [32768 x i8], [32768 x i8]* %6, i64 0, i64 %54
%56 = call i32 @strcasecmp(i8* %55, i8* %1)
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %49
br i1 %27, label %64, label %59
59: ; preds = %58
%60 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %1, i8* %2)
br label %61
61: ; preds = %59, %49
%62 = phi i32 [ %29, %49 ], [ 1, %59 ]
%63 = call i32 @strcat(i8* %18, i8* %8)
br label %64
64: ; preds = %61, %58
%65 = phi i32 [ %62, %61 ], [ 1, %58 ]
%66 = call i32* @fgets(i8* %8, i32 32768, i32* %21)
%67 = icmp eq i32* %66, null
br i1 %67, label %68, label %28
68: ; preds = %64, %23
%69 = phi i32 [ 0, %23 ], [ %65, %64 ]
%70 = call i32 @fclose(i32* %21)
br label %71
71: ; preds = %68, %20
%72 = phi i32 [ %69, %68 ], [ 0, %20 ]
%73 = icmp eq i32 %72, 0
%74 = icmp ne i8* %2, null
%75 = and i1 %74, %73
br i1 %75, label %76, label %101
76: ; preds = %71
%77 = icmp eq i8* %3, null
br i1 %77, label %98, label %78
78: ; preds = %76
%79 = call i32 @strcat(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%80 = load i8, i8* %3
%81 = icmp eq i8 %80, 0
br i1 %81, label %96, label %82
82: ; preds = %78, %92
%83 = phi i8 [ %94, %92 ], [ %80, %78 ]
%84 = phi i8* [ %93, %92 ], [ %3, %78 ]
%85 = sext i8 %83 to i32
switch i32 %85, label %88 [
i32 13, label %92
i32 10, label %86
]
86: ; preds = %82
%87 = call i32 @strcat(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %92
88: ; preds = %82
%89 = call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %18)
%90 = getelementptr i8, i8* %18, i64 %89
store i8 %83, i8* %90
%91 = getelementptr inbounds i8, i8* %90, i64 1
store i8 0, i8* %91
br label %92
92: ; preds = %82, %86, %88
%93 = getelementptr inbounds i8, i8* %84, i64 1
%94 = load i8, i8* %93
%95 = icmp eq i8 %94, 0
br i1 %95, label %96, label %82
96: ; preds = %92, %78
%97 = call i32 @strcat(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %98
98: ; preds = %96, %76
%99 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %1, i8* %2)
%100 = call i32 @strcat(i8* %18, i8* %8)
br label %101
101: ; preds = %98, %71
%102 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%103 = icmp eq i32* %102, null
br i1 %103, label %108, label %104
104: ; preds = %101
%105 = call i32 @strlen(i8* %18)
%106 = call i32 @fwrite(i8* %18, i32 1, i32 %105, i32* %102)
%107 = call i32 @fclose(i32* %102)
br label %108
108: ; preds = %101, %4, %104
%109 = phi i32 [ %106, %104 ], [ -1, %4 ], [ -1, %101 ]
ret i32 %109
}