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

/* Variables and functions */
int /*<<< orphan*/ check_line_for_deps(char const *, int /*<<< orphan*/ *);
scalar_t__ isspace(char const);
char *memchr(char const *, char, int);
void scan_buffer(const char *line, const char *end, FILE *cachef) {
  for (;;) {
    while (line < end && *line != '\n' && isspace(*line))
      ++line;
    if (line == end)
      return;
    if (*line == '#')
      check_line_for_deps(line, cachef);
    line = memchr(line, '\n', end - line);
    if (line == NULL)
      return;
    ++line;
  }
}


x86 assembly (clang, -O0):
<scan_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
jmp    1149 <scan_buffer+0x19>
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x19(%rbp)
jae    1187 <scan_buffer+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x19(%rbp)
je     1187 <scan_buffer+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1197 <scan_buffer+0x67>
jmp    11a8 <scan_buffer+0x78>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1149 <scan_buffer+0x19>
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    11bb <scan_buffer+0x8b>
jmp    1218 <scan_buffer+0xe8>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
jne    11d8 <scan_buffer+0xa8>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <check_line_for_deps@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    $0xa,%esi
call   1050 <memchr@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1207 <scan_buffer+0xd7>
jmp    1218 <scan_buffer+0xe8>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1144 <scan_buffer+0x14>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_buffer>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
jmp    116c <scan_buffer+0x3c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15d,%edx
sub    %r12d,%edx
mov    %r12,%rdi
mov    $0xa,%esi
call   1050 <memchr@plt>
lea    0x1(%rax),%r12
test   %rax,%rax
je     11c9 <scan_buffer+0x99>
cmp    %r15,%r12
jae    11b0 <scan_buffer+0x80>
mov    %r15,%rbx
sub    %r12,%rbx
nopw   0x0(%rax,%rax,1)
movzbl (%r12),%eax
cmp    $0xa,%al
je     11b0 <scan_buffer+0x80>
movsbl %al,%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     11b0 <scan_buffer+0x80>
add    $0x1,%r12
add    $0xffffffffffffffff,%rbx
jne    1180 <scan_buffer+0x50>
mov    %r15,%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %r15,%r12
je     11c9 <scan_buffer+0x99>
cmpb   $0x23,(%r12)
jne    1150 <scan_buffer+0x20>
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <check_line_for_deps@plt>
jmp    1150 <scan_buffer+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @scan_buffer(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
br label %7
7: ; preds = %53, %3
br label %8
8: ; preds = %24, %7
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = icmp ult i8* %9, %10
br i1 %11, label %12, label %22
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 10
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i8*, i8** %4
%19 = load i8, i8* %18
%20 = call i64 @isspace(i8 signext %19)
%21 = icmp ne i64 %20, 0
br label %22
22: ; preds = %17, %12, %8
%23 = phi i1 [ false, %12 ], [ false, %8 ], [ %21, %17 ]
br i1 %23, label %24, label %27
24: ; preds = %22
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %4
br label %8
27: ; preds = %22
%28 = load i8*, i8** %4
%29 = load i8*, i8** %5
%30 = icmp eq i8* %28, %29
br i1 %30, label %31, label %32
31: ; preds = %27
br label %56
32: ; preds = %27
%33 = load i8*, i8** %4
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 35
br i1 %36, label %37, label %41
37: ; preds = %32
%38 = load i8*, i8** %4
%39 = load i32*, i32** %6
%40 = call i32 @check_line_for_deps(i8* %38, i32* %39)
br label %41
41: ; preds = %37, %32
%42 = load i8*, i8** %4
%43 = load i8*, i8** %5
%44 = load i8*, i8** %4
%45 = ptrtoint i8* %43 to i64
%46 = ptrtoint i8* %44 to i64
%47 = sub i64 %45, %46
%48 = trunc i64 %47 to i32
%49 = call i8* @memchr(i8* %42, i8 signext 10, i32 %48)
store i8* %49, i8** %4
%50 = load i8*, i8** %4
%51 = icmp eq i8* %50, null
br i1 %51, label %52, label %53
52: ; preds = %41
br label %56
53: ; preds = %41
%54 = load i8*, i8** %4
%55 = getelementptr inbounds i8, i8* %54, i32 1
store i8* %55, i8** %4
br label %7
56: ; preds = %52, %31
ret void
}

LLVM IR (-O2):
define void @scan_buffer(i8* %0, i8* %1, i32* %2) {
%4 = ptrtoint i8* %1 to i64
br label %5
5: ; preds = %31, %3
%6 = phi i8* [ %0, %3 ], [ %37, %31 ]
%7 = icmp ult i8* %6, %1
br i1 %7, label %8, label %23
8: ; preds = %5
%9 = ptrtoint i8* %6 to i64
%10 = getelementptr i8, i8* %6, i64 %4
%11 = sub i64 0, %9
%12 = getelementptr i8, i8* %10, i64 %11
br label %13
13: ; preds = %8, %20
%14 = phi i8* [ %21, %20 ], [ %6, %8 ]
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 10
br i1 %16, label %23, label %17
17: ; preds = %13
%18 = tail call i64 @isspace(i8 signext %15)
%19 = icmp eq i64 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = getelementptr inbounds i8, i8* %14, i64 1
%22 = icmp eq i8* %21, %12
br i1 %22, label %23, label %13
23: ; preds = %17, %13, %20, %5
%24 = phi i8* [ %6, %5 ], [ %12, %20 ], [ %14, %13 ], [ %14, %17 ]
%25 = icmp eq i8* %24, %1
br i1 %25, label %38, label %26
26: ; preds = %23
%27 = load i8, i8* %24
%28 = icmp eq i8 %27, 35
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = tail call i32 @check_line_for_deps(i8* %24, i32* %2)
br label %31
31: ; preds = %29, %26
%32 = ptrtoint i8* %24 to i64
%33 = sub i64 %4, %32
%34 = trunc i64 %33 to i32
%35 = tail call i8* @memchr(i8* %24, i8 signext 10, i32 %34)
%36 = icmp eq i8* %35, null
%37 = getelementptr inbounds i8, i8* %35, i64 1
br i1 %36, label %38, label %5
38: ; preds = %31, %23
ret void
}