#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 fgetc(int /*<<< orphan*/ *);
scalar_t__ strchr(char *, int);
bool newline(int c, FILE *f) {
  if (c < 0 || strchr("\r\n", c)) {
    return true;
  } else if (c == ';') {
    while (!newline(fgetc(f), f))
      ;
    return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<newline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1162 <newline+0x32>
mov    -0x8(%rbp),%esi
lea    0xead(%rip),%rdi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     116e <newline+0x3e>
movl   $0x1,-0x4(%rbp)
jmp    11c3 <newline+0x93>
cmpl   $0x3b,-0x8(%rbp)
jne    11b7 <newline+0x87>
jmp    117d <newline+0x4d>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1030 <newline@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11a6 <newline+0x76>
jmp    11ab <newline+0x7b>
jmp    117d <newline+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    11c3 <newline+0x93>
jmp    11bc <newline+0x8c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newline>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
js     1176 <newline+0x46>
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xebd(%rip),%rdi
mov    %ebp,%esi
call   1040 <strchr@plt>
test   %rax,%rax
jne    1176 <newline+0x46>
xor    %eax,%eax
cmp    $0x3b,%ebp
jne    117b <newline+0x4b>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1030 <newline@plt>
test   %eax,%eax
je     1160 <newline+0x30>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\0D\0A\00"
define i32 @newline(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %4
store i32* %1, i32** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i32, i32* %4
%10 = call i64 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8, %2
store i32 1, i32* %3
br label %28
13: ; preds = %8
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 59
br i1 %15, label %16, label %26
16: ; preds = %13
br label %17
17: ; preds = %24, %16
%18 = load i32*, i32** %5
%19 = call i32 @fgetc(i32* %18)
%20 = load i32*, i32** %5
%21 = call i32 @newline(i32 %19, i32* %20)
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
br i1 %23, label %24, label %25
24: ; preds = %17
br label %17
25: ; preds = %17
store i32 1, i32* %3
br label %28
26: ; preds = %13
br label %27
27: ; preds = %26
store i32 0, i32* %3
br label %28
28: ; preds = %27, %25, %12
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0D\0A\00"
define i32 @newline(i32 %0, i32* nocapture %1) {
%3 = icmp slt i32 %0, 0
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = tail call i64 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = icmp eq i32 %0, 59
br i1 %8, label %9, label %13
9: ; preds = %7, %9
%10 = tail call i32 @fgetc(i32* %1)
%11 = tail call i32 @newline(i32 %10, i32* %1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %9, label %13
13: ; preds = %9, %7, %2, %4
%14 = phi i32 [ 1, %4 ], [ 1, %2 ], [ 0, %7 ], [ 1, %9 ]
ret i32 %14
}