#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 */
int safestrlen(char const *);
char *strstr(char *, char const *);
char *Find_start(char *str, const char *key) {
  int n = safestrlen(key);
  while ((str = strstr(str, key)) && str[n] != '=')
    ;
  if (str)
    str += (n + 1);
  return (str);
}


x86 assembly (clang, -O0):
<Find_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <safestrlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strstr@plt>
mov    %rax,%rcx
mov    %rcx,-0x8(%rbp)
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x15(%rbp)
je     1174 <Find_start+0x54>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3d,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1184 <Find_start+0x64>
jmp    1189 <Find_start+0x69>
jmp    113c <Find_start+0x1c>
cmpq   $0x0,-0x8(%rbp)
je     11a8 <Find_start+0x88>
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Find_start>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <safestrlen@plt>
movslq %eax,%r12
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strstr@plt>
test   %rax,%rax
je     1162 <Find_start+0x42>
mov    %rax,%rbx
cmpb   $0x3d,(%rax,%r12,1)
jne    1140 <Find_start+0x20>
lea    (%r12,%rbx,1),%r14
add    $0x1,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @Find_start(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @safestrlen(i8* %6)
store i32 %7, i32* %5
br label %8
8: ; preds = %23, %2
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = call i8* @strstr(i8* %9, i8* %10)
store i8* %11, i8** %3
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %21
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 61
br label %21
21: ; preds = %13, %8
%22 = phi i1 [ false, %8 ], [ %20, %13 ]
br i1 %22, label %23, label %24
23: ; preds = %21
br label %8
24: ; preds = %21
%25 = load i8*, i8** %3
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
%30 = load i8*, i8** %3
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds i8, i8* %30, i64 %31
store i8* %32, i8** %3
br label %33
33: ; preds = %27, %24
%34 = load i8*, i8** %3
ret i8* %34
}

LLVM IR (-O2):
define i8* @Find_start(i8* %0, i8* %1) {
%3 = tail call i32 @safestrlen(i8* %1)
%4 = sext i32 %3 to i64
br label %5
5: ; preds = %9, %2
%6 = phi i8* [ %0, %2 ], [ %7, %9 ]
%7 = tail call i8* @strstr(i8* dereferenceable(1) %6, i8* dereferenceable(1) %1)
%8 = icmp eq i8* %7, null
br i1 %8, label %17, label %9
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %7, i64 %4
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 61
br i1 %12, label %13, label %5
13: ; preds = %9
%14 = add nsw i32 %3, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %7, i64 %15
br label %17
17: ; preds = %5, %13
%18 = phi i8* [ %16, %13 ], [ null, %5 ]
ret i8* %18
}