#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 /*<<< orphan*/ assert(int);
const char *find_next_newline(const char *source_text_end,
                              const char *error_location) {
  assert(error_location <= source_text_end);
  const char *c = error_location;
  while (c != source_text_end && *c != '\n') {
    ++c;
  }
  return c;
}


x86 assembly (clang, -O0):
<find_next_newline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x8(%rbp),%rcx
mov    %al,-0x19(%rbp)
je     1160 <find_next_newline+0x50>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1170 <find_next_newline+0x60>
jmp    1181 <find_next_newline+0x71>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    113d <find_next_newline+0x2d>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_next_newline>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
cmp    %r14,%rsi
setbe  %dil
call   1030 <assert@plt>
cmp    %r14,%rbx
je     1141 <find_next_newline+0x31>
nopl   (%rax)
cmpb   $0xa,(%rbx)
je     1141 <find_next_newline+0x31>
add    $0x1,%rbx
cmp    %r14,%rbx
jne    1130 <find_next_newline+0x20>
mov    %r14,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @find_next_newline(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = load i8*, i8** %3
%8 = icmp ule i8* %6, %7
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i8*, i8** %4
store i8* %11, i8** %5
br label %12
12: ; preds = %23, %2
%13 = load i8*, i8** %5
%14 = load i8*, i8** %3
%15 = icmp ne i8* %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i8*, i8** %5
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 10
br label %21
21: ; preds = %16, %12
%22 = phi i1 [ false, %12 ], [ %20, %16 ]
br i1 %22, label %23, label %26
23: ; preds = %21
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %5
br label %12
26: ; preds = %21
%27 = load i8*, i8** %5
ret i8* %27
}

LLVM IR (-O2):
define i8* @find_next_newline(i8* readnone %0, i8* %1) {
%3 = icmp ule i8* %1, %0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp eq i8* %1, %0
br i1 %6, label %19, label %7
7: ; preds = %2
%8 = ptrtoint i8* %0 to i64
%9 = ptrtoint i8* %1 to i64
%10 = sub i64 %8, %9
%11 = getelementptr i8, i8* %1, i64 %10
br label %12
12: ; preds = %7, %16
%13 = phi i8* [ %17, %16 ], [ %1, %7 ]
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 10
br i1 %15, label %19, label %16
16: ; preds = %12
%17 = getelementptr inbounds i8, i8* %13, i64 1
%18 = icmp eq i8* %17, %0
br i1 %18, label %19, label %12
19: ; preds = %12, %16, %2
%20 = phi i8* [ %1, %2 ], [ %11, %16 ], [ %13, %12 ]
ret i8* %20
}