#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 */
scalar_t__ is_include(char const *);
char *strstr(char const *, char *);
const char *find_include(const char *buf) {
  const char *p = buf;
  if (p[0] == '#') {
    if (is_include(p))
      return p;
  }
  while (1) {
    p = strstr(p, "\n#");
    if (!p)
      break;
    ++p;
    if (is_include(p))
      return p;
  }
  return 0;
}


x86 assembly (clang, -O0):
<find_include>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
jne    1169 <find_include+0x49>
mov    -0x18(%rbp),%rdi
call   1030 <is_include@plt>
cmp    $0x0,%rax
je     1164 <find_include+0x44>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11cb <find_include+0xab>
jmp    1169 <find_include+0x49>
jmp    116e <find_include+0x4e>
mov    -0x18(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1192 <find_include+0x72>
jmp    11c3 <find_include+0xa3>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <is_include@plt>
cmp    $0x0,%rax
je     11be <find_include+0x9e>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11cb <find_include+0xab>
jmp    116e <find_include+0x4e>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_include>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
cmpb   $0x23,(%rdi)
jne    1139 <find_include+0x19>
mov    %rbx,%rdi
call   1030 <is_include@plt>
test   %rax,%rax
jne    1168 <find_include+0x48>
lea    0xec0(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strstr@plt>
test   %rax,%rax
je     1166 <find_include+0x46>
mov    %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
call   1030 <is_include@plt>
test   %rax,%rax
je     1140 <find_include+0x20>
jmp    1168 <find_include+0x48>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"\0A#\00"
define i8* @find_include(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 35
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i64 @is_include(i8* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %4, %1
br label %8
8: ; preds = %7, %12
%9 = phi i8* [ %13, %12 ], [ %0, %7 ]
%10 = tail call i8* @strstr(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i8* %10, null
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %10, i64 1
%14 = tail call i64 @is_include(i8* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %8, label %16
16: ; preds = %8, %12, %4
%17 = phi i8* [ %0, %4 ], [ null, %8 ], [ %13, %12 ]
ret i8* %17
}