#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 ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ perror(char *);
char *strchr(char *, char);
int strlen(char *);
int /*<<< orphan*/ *strstr(char *, char *);
char *strstrip(char *);
char *get_str_value(char *property) {
  char *value = NULL;
  FILE *file = fopen("launcher.conf", "r");
  if (file != NULL) {
    char *line = NULL;
    size_t len = 0;
    ssize_t read;
    while ((read = getline(&line, &len, file)) != -1) {
      char aux[read + 1];
      memcpy(aux, line, read + 1);
      if (strstr(aux, property) != NULL) {
        char *aux_2 = strstrip(aux);
        char *rest = strchr(aux_2, ' ');
        if (rest != NULL) {
          int index = rest - aux_2;
          char *opt = aux_2 + index + 1;
          opt = strstrip(opt);
          int size = strlen(opt) + 1;
          if (size > 1) {
            value = (char *)malloc(sizeof(char) * size);
            memcpy(value, opt, size);
            break;
          }
        }
      }
    }
    free(line);
    fclose(file);
  } else {
    perror("Cannot open properties file");
  }
  return value;
}


x86 assembly (clang, -O0):
<get_str_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xe35(%rip),%rdi
lea    0xe3c(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     134b <get_str_value+0x19b>
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   10c0 <getline@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
je     1334 <get_str_value+0x184>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x70(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
call   1080 <memcpy@plt>
mov    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   10d0 <strstr@plt>
cmp    $0x0,%rax
je     130c <get_str_value+0x15c>
mov    -0x70(%rbp),%rdi
call   1070 <strstrip@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    $0x20,%esi
call   1060 <strchr@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
je     1307 <get_str_value+0x157>
mov    -0x50(%rbp),%rax
mov    -0x48(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x54(%rbp)
mov    -0x48(%rbp),%rax
movslq -0x54(%rbp),%rcx
add    %rcx,%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
call   1070 <strstrip@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
cmpl   $0x1,-0x64(%rbp)
jle    1302 <get_str_value+0x152>
movslq -0x64(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x64(%rbp),%edx
call   1080 <memcpy@plt>
movl   $0x3,-0x68(%rbp)
jmp    1313 <get_str_value+0x163>
jmp    1307 <get_str_value+0x157>
jmp    130c <get_str_value+0x15c>
movl   $0x0,-0x68(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x68(%rbp),%eax
test   %eax,%eax
je     132f <get_str_value+0x17f>
jmp    132a <get_str_value+0x17a>
jmp    1334 <get_str_value+0x184>
jmp    11f6 <get_str_value+0x46>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
jmp    1357 <get_str_value+0x1a7>
lea    0xcbe(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x10(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_str_value>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r12
lea    0xe35(%rip),%rdi
lea    0xe3c(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     12db <get_str_value+0x12b>
mov    %rax,%r15
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
jmp    1203 <get_str_value+0x53>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rsp
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
mov    %r15,%rdx
call   10c0 <getline@plt>
cmp    $0xffffffff,%eax
je     12b5 <get_str_value+0x105>
mov    %rsp,%r13
mov    %eax,%ecx
add    $0x1,%eax
mov    %rsp,%r14
add    $0x10,%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r14
mov    %r14,%rsp
mov    -0x30(%rbp),%rsi
mov    %r14,%rdi
mov    %eax,%edx
call   1080 <memcpy@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   10d0 <strstr@plt>
test   %rax,%rax
je     1200 <get_str_value+0x50>
mov    %r14,%rdi
call   1070 <strstrip@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x20,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1200 <get_str_value+0x50>
sub    %ebx,%eax
cltq
lea    (%rbx,%rax,1),%rdi
add    $0x1,%rdi
call   1070 <strstrip@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    1200 <get_str_value+0x50>
mov    %eax,%ebx
add    $0x1,%ebx
mov    %ebx,%edi
call   1090 <malloc@plt>
mov    %rax,%r12
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1080 <memcpy@plt>
mov    %r13,%rsp
jmp    12b8 <get_str_value+0x108>
xor    %r12d,%r12d
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %r12,%rax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd2e(%rip),%rdi
call   10b0 <perror@plt>
xor    %r12d,%r12d
jmp    12c9 <get_str_value+0x119>

LLVM IR (-O0):
@.str = [14 x i8] c"launcher.conf\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [28 x i8] c"Cannot open properties file\00"
define i8* @get_str_value(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
store i8* %0, i8** %2
store i8* null, i8** %3
%16 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %4
%17 = load i32*, i32** %4
%18 = icmp ne i32* %17, null
br i1 %18, label %19, label %85
19: ; preds = %1
store i8* null, i8** %5
store i64 0, i64* %6
br label %20
20: ; preds = %79, %19
%21 = load i32*, i32** %4
%22 = call i32 @getline(i8** %5, i64* %6, i32* %21)
store i32 %22, i32* %7
%23 = icmp ne i32 %22, -1
br i1 %23, label %24, label %80
24: ; preds = %20
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
%27 = zext i32 %26 to i64
%28 = call i8* @llvm.stacksave()
store i8* %28, i8** %8
%29 = alloca i8, i64 %27
store i64 %27, i64* %9
%30 = load i8*, i8** %5
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
%33 = call i32 @memcpy(i8* %29, i8* %30, i32 %32)
%34 = load i8*, i8** %2
%35 = call i32* @strstr(i8* %29, i8* %34)
%36 = icmp ne i32* %35, null
br i1 %36, label %37, label %75
37: ; preds = %24
%38 = call i8* @strstrip(i8* %29)
store i8* %38, i8** %10
%39 = load i8*, i8** %10
%40 = call i8* @strchr(i8* %39, i8 signext 32)
store i8* %40, i8** %11
%41 = load i8*, i8** %11
%42 = icmp ne i8* %41, null
br i1 %42, label %43, label %74
43: ; preds = %37
%44 = load i8*, i8** %11
%45 = load i8*, i8** %10
%46 = ptrtoint i8* %44 to i64
%47 = ptrtoint i8* %45 to i64
%48 = sub i64 %46, %47
%49 = trunc i64 %48 to i32
store i32 %49, i32* %12
%50 = load i8*, i8** %10
%51 = load i32, i32* %12
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8, i8* %50, i64 %52
%54 = getelementptr inbounds i8, i8* %53, i64 1
store i8* %54, i8** %13
%55 = load i8*, i8** %13
%56 = call i8* @strstrip(i8* %55)
store i8* %56, i8** %13
%57 = load i8*, i8** %13
%58 = call i32 @strlen(i8* %57)
%59 = add nsw i32 %58, 1
store i32 %59, i32* %14
%60 = load i32, i32* %14
%61 = icmp sgt i32 %60, 1
br i1 %61, label %62, label %73
62: ; preds = %43
%63 = load i32, i32* %14
%64 = sext i32 %63 to i64
%65 = mul i64 1, %64
%66 = trunc i64 %65 to i32
%67 = call i64 @malloc(i32 %66)
%68 = inttoptr i64 %67 to i8*
store i8* %68, i8** %3
%69 = load i8*, i8** %3
%70 = load i8*, i8** %13
%71 = load i32, i32* %14
%72 = call i32 @memcpy(i8* %69, i8* %70, i32 %71)
store i32 3, i32* %15
br label %76
73: ; preds = %43
br label %74
74: ; preds = %73, %37
br label %75
75: ; preds = %74, %24
store i32 0, i32* %15
br label %76
76: ; preds = %75, %62
%77 = load i8*, i8** %8
%78 = load i32, i32* %15
switch i32 %78, label %89 [
i32 0, label %79
i32 3, label %80
]
79: ; preds = %76
br label %20
80: ; preds = %76, %20
%81 = load i8*, i8** %5
%82 = call i32 @free(i8* %81)
%83 = load i32*, i32** %4
%84 = call i32 @fclose(i32* %83)
br label %87
85: ; preds = %1
%86 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %87
87: ; preds = %85, %80
%88 = load i8*, i8** %3
ret i8* %88
89: ; preds = %76
unreachable
}

LLVM IR (-O2):
@.str = [14 x i8] c"launcher.conf\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [28 x i8] c"Cannot open properties file\00"
define i8* @get_str_value(i8* nocapture %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %49, label %6
6: ; preds = %1
%7 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%8 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%9 = call i32 @getline(i8** %2, i64* %3, i32* %4)
%10 = icmp eq i32 %9, -1
br i1 %10, label %44, label %11
11: ; preds = %6, %41
%12 = phi i32 [ %42, %41 ], [ %9, %6 ]
%13 = add nuw nsw i32 %12, 1
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
%16 = alloca i8, i64 %14
%17 = load i8*, i8** %2
%18 = call i32 @memcpy(i8* %16, i8* %17, i32 %13)
%19 = call i32* @strstr(i8* %16, i8* dereferenceable(1) %0)
%20 = icmp eq i32* %19, null
br i1 %20, label %41, label %21
21: ; preds = %11
%22 = call i8* @strstrip(i8* %16)
%23 = call i8* @strchr(i8* dereferenceable(1) %22, i8 signext 32)
%24 = icmp eq i8* %23, null
br i1 %24, label %41, label %25
25: ; preds = %21
%26 = ptrtoint i8* %23 to i64
%27 = ptrtoint i8* %22 to i64
%28 = sub i64 %26, %27
%29 = shl i64 %28, 32
%30 = ashr exact i64 %29, 32
%31 = getelementptr inbounds i8, i8* %22, i64 1
%32 = getelementptr inbounds i8, i8* %31, i64 %30
%33 = call i8* @strstrip(i8* %32)
%34 = call i32 @strlen(i8* %33)
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %41
36: ; preds = %25
%37 = add nuw nsw i32 %34, 1
%38 = call i64 @malloc(i32 %37)
%39 = inttoptr i64 %38 to i8*
%40 = call i32 @memcpy(i8* %39, i8* %33, i32 %37)
br label %44
41: ; preds = %21, %25, %11
%42 = call i32 @getline(i8** %2, i64* %3, i32* %4)
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %11
44: ; preds = %41, %6, %36
%45 = phi i8* [ %39, %36 ], [ null, %6 ], [ null, %41 ]
%46 = load i8*, i8** %2
%47 = call i32 @free(i8* %46)
%48 = call i32 @fclose(i32* %4)
br label %51
49: ; preds = %1
%50 = tail call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %51
51: ; preds = %49, %44
%52 = phi i8* [ %45, %44 ], [ null, %49 ]
ret i8* %52
}