#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 */
char *strstr(char *, char *);
char *readProperty(char *tag, char *propertyName) {
  char *property, *from, *to;
  if (!(property = strstr(tag, propertyName))) {
    return NULL;
  }
  if (!(from = strstr(property, "\""))) {
    return NULL;
  }
  from++;
  if (!(to = strstr(from, "\""))) {
    return NULL;
  }
  to[0] = '\0';
  return from;
}


x86 assembly (clang, -O0):
<readProperty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1148 <readProperty+0x38>
movq   $0x0,-0x8(%rbp)
jmp    11b9 <readProperty+0xa9>
mov    -0x20(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1173 <readProperty+0x63>
movq   $0x0,-0x8(%rbp)
jmp    11b9 <readProperty+0xa9>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    11aa <readProperty+0x9a>
movq   $0x0,-0x8(%rbp)
jmp    11b9 <readProperty+0xa9>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readProperty>:
push   %rbx
call   1040 <strstr@plt>
test   %rax,%rax
je     115b <readProperty+0x3b>
mov    %rax,%rdi
mov    $0x22,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     115b <readProperty+0x3b>
mov    %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x22,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     115b <readProperty+0x3b>
movb   $0x0,(%rax)
jmp    115d <readProperty+0x3d>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\22\00"
define i8* @readProperty(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call i8* @strstr(i8* %9, i8* %10)
store i8* %11, i8** %6
%12 = icmp ne i8* %11, null
br i1 %12, label %14, label %13
13: ; preds = %2
store i8* null, i8** %3
br label %30
14: ; preds = %2
%15 = load i8*, i8** %6
%16 = call i8* @strstr(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %16, i8** %7
%17 = icmp ne i8* %16, null
br i1 %17, label %19, label %18
18: ; preds = %14
store i8* null, i8** %3
br label %30
19: ; preds = %14
%20 = load i8*, i8** %7
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %7
%22 = load i8*, i8** %7
%23 = call i8* @strstr(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %23, i8** %8
%24 = icmp ne i8* %23, null
br i1 %24, label %26, label %25
25: ; preds = %19
store i8* null, i8** %3
br label %30
26: ; preds = %19
%27 = load i8*, i8** %8
%28 = getelementptr inbounds i8, i8* %27, i64 0
store i8 0, i8* %28
%29 = load i8*, i8** %7
store i8* %29, i8** %3
br label %30
30: ; preds = %26, %25, %18, %13
%31 = load i8*, i8** %3
ret i8* %31
}

LLVM IR (-O2):
define i8* @readProperty(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = tail call i8* @strchr(i8* %3, i32 34)
%7 = icmp eq i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = tail call i8* @strchr(i8* %9, i32 34)
%11 = icmp eq i8* %10, null
br i1 %11, label %13, label %12
12: ; preds = %8
store i8 0, i8* %10
br label %13
13: ; preds = %8, %5, %2, %12
%14 = phi i8* [ %9, %12 ], [ null, %2 ], [ null, %5 ], [ null, %8 ]
ret i8* %14
}