#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 /*<<< orphan*/);
int /*<<< orphan*/ isspace(unsigned char);
char *looking_at_ws_then_newline(char *start) {
  char *result;
  result = start;
  do {
    if (*result == '\n')
      return result;
    else if (!isspace(*(unsigned char *)result))
      return NULL;
    else
      result++;
  } while (1);
  assert(0);
}


x86 assembly (clang, -O0):
<looking_at_ws_then_newline>:
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    $0xa,%eax
jne    1151 <looking_at_ws_then_newline+0x31>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <looking_at_ws_then_newline+0x7f>
mov    -0x18(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    1173 <looking_at_ws_then_newline+0x53>
movq   $0x0,-0x8(%rbp)
jmp    119f <looking_at_ws_then_newline+0x7f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1184 <looking_at_ws_then_newline+0x64>
jmp    1189 <looking_at_ws_then_newline+0x69>
mov    $0x1,%al
test   $0x1,%al
jne    1134 <looking_at_ws_then_newline+0x14>
jmp    1198 <looking_at_ws_then_newline+0x78>
xor    %edi,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<looking_at_ws_then_newline>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
cmp    $0xa,%al
je     113c <looking_at_ws_then_newline+0x2c>
nopw   0x0(%rax,%rax,1)
movzbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
je     113a <looking_at_ws_then_newline+0x2a>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
cmp    $0xa,%al
jne    1120 <looking_at_ws_then_newline+0x10>
jmp    113c <looking_at_ws_then_newline+0x2c>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @looking_at_ws_then_newline(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
br label %6
6: ; preds = %24, %1
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 10
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = load i8*, i8** %4
store i8* %12, i8** %2
br label %27
13: ; preds = %6
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = call i32 @isspace(i8 zeroext %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %13
store i8* null, i8** %2
br label %27
19: ; preds = %13
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
br label %22
22: ; preds = %19
br label %23
23: ; preds = %22
br label %24
24: ; preds = %23
br i1 true, label %6, label %25
25: ; preds = %24
%26 = call i32 @assert(i32 0)
br label %27
27: ; preds = %25, %18, %11
%28 = load i8*, i8** %2
ret i8* %28
}

LLVM IR (-O2):
define i8* @looking_at_ws_then_newline(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 10
br i1 %3, label %13, label %4
4: ; preds = %1, %9
%5 = phi i8 [ %11, %9 ], [ %2, %1 ]
%6 = phi i8* [ %10, %9 ], [ %0, %1 ]
%7 = tail call i32 @isspace(i8 zeroext %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 10
br i1 %12, label %13, label %4
13: ; preds = %9, %4, %1
%14 = phi i8* [ %0, %1 ], [ null, %4 ], [ %10, %9 ]
ret i8* %14
}