#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*/ gzFile;

/* Variables and functions */
int /*<<< orphan*/ gzgets(int /*<<< orphan*/, char *, int);
void *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int strlen(char *);
int /*<<< orphan*/ *strstr(char *, char *);
char *strtok(char *, char *);
char **getprops(gzFile file, char buffer[]) {
  char **props = malloc(sizeof(char *) * 80);
  char *property;
  int i = 0;
  int length = 0;
  int err = 0;
  while (strstr(buffer, "#\tPROPERTIES") == NULL) {
    gzgets(file, buffer, 2048);
  }
  while (strstr(buffer, "#	PROPERTIES")) {
    strtok(buffer, "\t");
    strtok(NULL, "\t");
    while ((property = strtok(NULL, ", \n"))) {
      length = strlen(property) + 1;
      props[i] = malloc(sizeof(char) * length);
      memcpy(props[i], property, length);
      i++;
    }
    gzgets(file, buffer, 2048);
  }
  return props;
}


x86 assembly (clang, -O0):
<getprops>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x280,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
jne    11c2 <getprops+0x62>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x800,%edx
call   1030 <gzgets@plt>
jmp    1192 <getprops+0x32>
jmp    11c7 <getprops+0x67>
mov    -0x10(%rbp),%rdi
lea    0xe2e(%rip),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
je     1288 <getprops+0x128>
mov    -0x10(%rbp),%rdi
lea    0xe21(%rip),%rsi
call   1070 <strtok@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe11(%rip),%rsi
call   1070 <strtok@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe03(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1272 <getprops+0x112>
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
movslq -0x28(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1201 <getprops+0xa1>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x800,%edx
call   1030 <gzgets@plt>
jmp    11c7 <getprops+0x67>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getprops>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%r14d
mov    $0x280,%edi
call   1060 <malloc@plt>
mov    %rax,0x10(%rsp)
lea    0xe76(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strstr@plt>
test   %rax,%rax
jne    11c0 <getprops+0x60>
lea    0xe62(%rip),%rbp
xchg   %ax,%ax
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x800,%edx
call   1030 <gzgets@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <strstr@plt>
test   %rax,%rax
je     11a0 <getprops+0x40>
lea    0xe39(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strstr@plt>
test   %rax,%rax
je     12a5 <getprops+0x145>
xor    %r15d,%r15d
lea    0xe2d(%rip),%rbp
mov    %r14d,0xc(%rsp)
jmp    121c <getprops+0xbc>
nopl   0x0(%rax)
mov    %r13,%rbx
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
mov    $0x800,%edx
call   1030 <gzgets@plt>
mov    %rbx,%rdi
lea    0xdf2(%rip),%rsi
call   1080 <strstr@plt>
test   %rax,%rax
je     12a5 <getprops+0x145>
mov    %rbx,%r13
mov    %rbx,%rdi
lea    0xde4(%rip),%rbx
mov    %rbx,%rsi
call   1070 <strtok@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
xor    %edi,%edi
mov    %rbp,%rsi
call   1070 <strtok@plt>
test   %rax,%rax
je     11f0 <getprops+0x90>
mov    %rax,%r14
movslq %r15d,%rax
mov    0x10(%rsp),%rcx
lea    (%rcx,%rax,8),%r12
mov    %r13,%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%r13d
mov    %r13d,%edi
call   1060 <malloc@plt>
mov    %rax,(%r12)
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
call   1050 <memcpy@plt>
xor    %edi,%edi
mov    %rbp,%rsi
call   1070 <strtok@plt>
mov    %rax,%r14
add    $0x8,%r12
add    $0x1,%r15d
test   %rax,%rax
jne    1260 <getprops+0x100>
jmp    11f3 <getprops+0x93>
mov    0x10(%rsp),%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"#\09PROPERTIES\00"
@.str.1 = [2 x i8] c"\09\00"
@.str.2 = [4 x i8] c", \0A\00"
define i8** @getprops(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%10 = call i8* @malloc(i32 640)
%11 = bitcast i8* %10 to i8**
store i8** %11, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
br label %12
12: ; preds = %16, %2
%13 = load i8*, i8** %4
%14 = call i32* @strstr(i8* %13, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i32, i32* %3
%18 = load i8*, i8** %4
%19 = call i32 @gzgets(i32 %17, i8* %18, i32 2048)
br label %12
20: ; preds = %12
br label %21
21: ; preds = %55, %20
%22 = load i8*, i8** %4
%23 = call i32* @strstr(i8* %22, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%24 = icmp ne i32* %23, null
br i1 %24, label %25, label %59
25: ; preds = %21
%26 = load i8*, i8** %4
%27 = call i8* @strtok(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%28 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %32, %25
%30 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i8* %30, i8** %6
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %55
32: ; preds = %29
%33 = load i8*, i8** %6
%34 = call i32 @strlen(i8* %33)
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
%36 = load i32, i32* %8
%37 = sext i32 %36 to i64
%38 = mul i64 1, %37
%39 = trunc i64 %38 to i32
%40 = call i8* @malloc(i32 %39)
%41 = load i8**, i8*** %5
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
store i8* %40, i8** %44
%45 = load i8**, i8*** %5
%46 = load i32, i32* %7
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = load i8*, i8** %6
%51 = load i32, i32* %8
%52 = call i32 @memcpy(i8* %49, i8* %50, i32 %51)
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %29
55: ; preds = %29
%56 = load i32, i32* %3
%57 = load i8*, i8** %4
%58 = call i32 @gzgets(i32 %56, i8* %57, i32 2048)
br label %21
59: ; preds = %21
%60 = load i8**, i8*** %5
ret i8** %60
}

LLVM IR (-O2):
@.str = [13 x i8] c"#\09PROPERTIES\00"
@.str.1 = [2 x i8] c"\09\00"
@.str.2 = [4 x i8] c", \0A\00"
define noalias i8** @getprops(i32 %0, i8* %1) {
%3 = tail call dereferenceable_or_null(640) i8* @malloc(i32 640)
%4 = bitcast i8* %3 to i8**
%5 = tail call i32* @strstr(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %10, label %7
7: ; preds = %10, %2
%8 = tail call i32* @strstr(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %40, label %14
10: ; preds = %2, %10
%11 = tail call i32 @gzgets(i32 %0, i8* %1, i32 2048)
%12 = tail call i32* @strstr(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %10, label %7
14: ; preds = %7, %35
%15 = phi i32 [ %36, %35 ], [ 0, %7 ]
%16 = tail call i8* @strtok(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i8* %18, null
br i1 %19, label %35, label %20
20: ; preds = %14
%21 = sext i32 %15 to i64
br label %22
22: ; preds = %20, %22
%23 = phi i64 [ %21, %20 ], [ %30, %22 ]
%24 = phi i8* [ %18, %20 ], [ %31, %22 ]
%25 = tail call i32 @strlen(i8* %24)
%26 = add nsw i32 %25, 1
%27 = tail call i8* @malloc(i32 %26)
%28 = getelementptr inbounds i8*, i8** %4, i64 %23
store i8* %27, i8** %28
%29 = tail call i32 @memcpy(i8* %27, i8* %24, i32 %26)
%30 = add i64 %23, 1
%31 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i8* %31, null
br i1 %32, label %33, label %22
33: ; preds = %22
%34 = trunc i64 %30 to i32
br label %35
35: ; preds = %33, %14
%36 = phi i32 [ %15, %14 ], [ %34, %33 ]
%37 = tail call i32 @gzgets(i32 %0, i8* %1, i32 2048)
%38 = tail call i32* @strstr(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%39 = icmp eq i32* %38, null
br i1 %39, label %40, label %14
40: ; preds = %35, %7
ret i8** %4
}