#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 *eat_blank(char *);
char *read_line(char *s) {
  s = eat_blank(s);
  while (*s && (*s != '\n'))
    s++;
  if (*s == 0)
    return s;
  return s + 1;
}


x86 assembly (clang, -O0):
<read_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <eat_blank@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     114e <read_line+0x3e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115e <read_line+0x4e>
jmp    116f <read_line+0x5f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1129 <read_line+0x19>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    118c <read_line+0x7c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1198 <read_line+0x88>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_line>:
push   %rax
call   1030 <eat_blank@plt>
cs nopw 0x0(%rax,%rax,1)
movzbl (%rax),%ecx
test   %cl,%cl
je     1132 <read_line+0x22>
cmp    $0xa,%cl
je     1132 <read_line+0x22>
add    $0x1,%rax
jmp    1120 <read_line+0x10>
cmp    $0x1,%cl
sbb    $0xffffffffffffffff,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @read_line(i8* %0) {
%2 = tail call i8* @eat_blank(i8* %0)
br label %3
3: ; preds = %6, %1
%4 = phi i8* [ %2, %1 ], [ %7, %6 ]
%5 = load i8, i8* %4
switch i8 %5, label %6 [
i8 0, label %8
i8 10, label %8
]
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
8: ; preds = %3, %3
%9 = icmp ne i8 %5, 0
%10 = zext i1 %9 to i64
%11 = getelementptr i8, i8* %4, i64 %10
ret i8* %11
}