#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 **grow(char **, int, char *);
size_t strlen(char const *);
scalar_t__ strncmp(char const *, char *, size_t const);
char **isoyg(char *src) {
  const char *PHRASE = "your grave";
  const size_t PHRASE_LEN = strlen(PHRASE);
  int count = 1;
  char **result = grow(NULL, count, src);
  for (char *ptr = src; *ptr; ptr++) {
    if (strncmp(PHRASE, ptr, PHRASE_LEN) == 0) {
      ++count;
      *ptr = '\0';
      ptr += PHRASE_LEN;
      result = grow(result, count, ptr);
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<isoyg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x8(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%edi
call   1040 <grow@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     11e5 <isoyg+0xb5>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11cf <isoyg+0x9f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1040 <grow@plt>
mov    %rax,-0x28(%rbp)
jmp    11d4 <isoyg+0xa4>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1177 <isoyg+0x47>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isoyg>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x1,%ebp
xor    %edi,%edi
mov    $0x1,%esi
mov    %rbx,%rdx
call   1040 <grow@plt>
mov    %rax,%r14
cmpb   $0x0,(%rbx)
je     118b <isoyg+0x6b>
lea    0xeb3(%rip),%r15
jmp    115a <isoyg+0x3a>
nop
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
je     118b <isoyg+0x6b>
mov    $0xa,%edx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1150 <isoyg+0x30>
add    $0x1,%ebp
movb   $0x0,(%rbx)
add    $0xa,%rbx
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1040 <grow@plt>
mov    %rax,%r14
jmp    1150 <isoyg+0x30>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"your grave\00"
define i8** @isoyg(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %3
%8 = load i8*, i8** %3
%9 = call i64 @strlen(i8* %8)
store i64 %9, i64* %4
store i32 1, i32* %5
%10 = load i32, i32* %5
%11 = load i8*, i8** %2
%12 = call i8** @grow(i8** null, i32 %10, i8* %11)
store i8** %12, i8*** %6
%13 = load i8*, i8** %2
store i8* %13, i8** %7
br label %14
14: ; preds = %36, %1
%15 = load i8*, i8** %7
%16 = load i8, i8* %15
%17 = icmp ne i8 %16, 0
br i1 %17, label %18, label %39
18: ; preds = %14
%19 = load i8*, i8** %3
%20 = load i8*, i8** %7
%21 = load i64, i64* %4
%22 = call i64 @strncmp(i8* %19, i8* %20, i64 %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %35
24: ; preds = %18
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
%27 = load i8*, i8** %7
store i8 0, i8* %27
%28 = load i64, i64* %4
%29 = load i8*, i8** %7
%30 = getelementptr inbounds i8, i8* %29, i64 %28
store i8* %30, i8** %7
%31 = load i8**, i8*** %6
%32 = load i32, i32* %5
%33 = load i8*, i8** %7
%34 = call i8** @grow(i8** %31, i32 %32, i8* %33)
store i8** %34, i8*** %6
br label %35
35: ; preds = %24, %18
br label %36
36: ; preds = %35
%37 = load i8*, i8** %7
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %7
br label %14
39: ; preds = %14
%40 = load i8**, i8*** %6
ret i8** %40
}

LLVM IR (-O2):
@.str = [11 x i8] c"your grave\00"
define i8** @isoyg(i8* %0) {
%2 = tail call i8** @grow(i8** null, i32 1, i8* %0)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %17, %1
%6 = phi i8** [ %2, %1 ], [ %19, %17 ]
ret i8** %6
7: ; preds = %1, %17
%8 = phi i8* [ %21, %17 ], [ %0, %1 ]
%9 = phi i8** [ %19, %17 ], [ %2, %1 ]
%10 = phi i32 [ %18, %17 ], [ 1, %1 ]
%11 = tail call i64 @strncmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %8, i64 10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %7
%14 = add nsw i32 %10, 1
store i8 0, i8* %8
%15 = getelementptr inbounds i8, i8* %8, i64 10
%16 = tail call i8** @grow(i8** %9, i32 %14, i8* %15)
br label %17
17: ; preds = %7, %13
%18 = phi i32 [ %14, %13 ], [ %10, %7 ]
%19 = phi i8** [ %16, %13 ], [ %9, %7 ]
%20 = phi i8* [ %15, %13 ], [ %8, %7 ]
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %5, label %7
}