#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 */
struct confctl {
  int dummy;
};
struct buf {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ buf_append(struct buf *, int);
int /*<<< orphan*/ buf_finish(struct buf *);
struct buf *buf_new();
int buf_read_slashed(struct buf *, struct confctl const *,
                     int /*<<< orphan*/ *);
int /*<<< orphan*/ buf_read_until_newline(struct buf *, int /*<<< orphan*/ *);
int /*<<< orphan*/ buf_strip(struct buf *);
int getc(int /*<<< orphan*/ *);
scalar_t__ isspace(int);
int /*<<< orphan*/ ungetc_checked(int, int /*<<< orphan*/ *);
struct buf *buf_read_after(const struct confctl *cc, FILE *fp) {
  int ch;
  struct buf *b;
  bool comment_parsed;
  b = buf_new();
  for (;;) {
    ch = getc(fp);
    if (ch == EOF)
      break;
    if (ch == '/') {
      buf_append(b, ch);
      comment_parsed = buf_read_slashed(b, cc, fp);
      if (!comment_parsed) {
        buf_strip(b);
        goto unget;
      }
      continue;
    }
    if (ch == '#') {
      buf_append(b, ch);
      buf_read_until_newline(b, fp);
      continue;
    }
    if ((isspace(ch) && ch != '\n' && ch != '\r') || ch == ';') {
      buf_append(b, ch);
      continue;
    }
  unget:
    ungetc_checked(ch, fp);
    break;
  }
  buf_finish(b);
  return (b);
}


x86 assembly (clang, -O0):
<buf_read_after>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <buf_new@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <getc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e27(%rip),%rcx
cmp    (%rcx),%eax
jne    11ce <buf_read_after+0x3e>
jmp    128f <buf_read_after+0xff>
cmpl   $0x2f,-0x14(%rbp)
jne    1215 <buf_read_after+0x85>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1090 <buf_append@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   10b0 <buf_read_slashed@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1210 <buf_read_after+0x80>
mov    -0x20(%rbp),%rdi
call   1060 <buf_strip@plt>
jmp    1283 <buf_read_after+0xf3>
jmp    11ab <buf_read_after+0x1b>
cmpl   $0x23,-0x14(%rbp)
jne    123d <buf_read_after+0xad>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1090 <buf_append@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <buf_read_until_newline@plt>
jmp    11ab <buf_read_after+0x1b>
mov    -0x14(%rbp),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
je     1263 <buf_read_after+0xd3>
cmpl   $0xa,-0x14(%rbp)
je     1263 <buf_read_after+0xd3>
cmpl   $0xd,-0x14(%rbp)
jne    126d <buf_read_after+0xdd>
cmpl   $0x3b,-0x14(%rbp)
jne    127e <buf_read_after+0xee>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1090 <buf_append@plt>
jmp    11ab <buf_read_after+0x1b>
jmp    1283 <buf_read_after+0xf3>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <ungetc_checked@plt>
mov    -0x20(%rbp),%rdi
call   1030 <buf_finish@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buf_read_after>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %eax,%eax
call   1040 <buf_new@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   10a0 <getc@plt>
mov    0x2e31(%rip),%r12
cmp    (%r12),%eax
je     1272 <buf_read_after+0xe2>
mov    %eax,%ebp
jmp    11f8 <buf_read_after+0x68>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    $0x23,%esi
call   1090 <buf_append@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <buf_read_until_newline@plt>
mov    %r14,%rdi
call   10a0 <getc@plt>
mov    %eax,%ebp
cmp    (%r12),%eax
je     1272 <buf_read_after+0xe2>
cmp    $0x23,%ebp
je     11d0 <buf_read_after+0x40>
cmp    $0x2f,%ebp
jne    1230 <buf_read_after+0xa0>
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1090 <buf_append@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   10b0 <buf_read_slashed@plt>
test   %eax,%eax
jne    11e8 <buf_read_after+0x58>
jmp    1260 <buf_read_after+0xd0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%edi
call   1050 <isspace@plt>
test   %rax,%rax
setne  %al
cmp    $0xa,%ebp
setne  %cl
cmp    $0xd,%ebp
setne  %dl
cmp    $0x3b,%ebp
je     1254 <buf_read_after+0xc4>
and    %dl,%cl
and    %cl,%al
je     1268 <buf_read_after+0xd8>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1090 <buf_append@plt>
jmp    11e8 <buf_read_after+0x58>
mov    %rbx,%rdi
call   1060 <buf_strip@plt>
mov    %ebp,%edi
mov    %r14,%rsi
call   1070 <ungetc_checked@plt>
mov    %rbx,%rdi
call   1030 <buf_finish@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.buf = type { i32 }
%struct.confctl = type { i32 }
@EOF = global i32 0
define %struct.buf* @buf_read_after(%struct.confctl* %0, i32* %1) {
%3 = alloca %struct.confctl*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca %struct.buf*
%7 = alloca i32
store %struct.confctl* %0, %struct.confctl** %3
store i32* %1, i32** %4
%8 = call %struct.buf* (...) @buf_new()
store %struct.buf* %8, %struct.buf** %6
br label %9
9: ; preds = %56, %36, %32, %2
%10 = load i32*, i32** %4
%11 = call i32 @getc(i32* %10)
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %9
br label %65
16: ; preds = %9
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 47
br i1 %18, label %19, label %33
19: ; preds = %16
%20 = load %struct.buf*, %struct.buf** %6
%21 = load i32, i32* %5
%22 = call i32 @buf_append(%struct.buf* %20, i32 %21)
%23 = load %struct.buf*, %struct.buf** %6
%24 = load %struct.confctl*, %struct.confctl** %3
%25 = load i32*, i32** %4
%26 = call i32 @buf_read_slashed(%struct.buf* %23, %struct.confctl* %24, i32* %25)
store i32 %26, i32* %7
%27 = load i32, i32* %7
%28 = icmp ne i32 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %19
%30 = load %struct.buf*, %struct.buf** %6
%31 = call i32 @buf_strip(%struct.buf* %30)
br label %61
32: ; preds = %19
br label %9
33: ; preds = %16
%34 = load i32, i32* %5
%35 = icmp eq i32 %34, 35
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = load %struct.buf*, %struct.buf** %6
%38 = load i32, i32* %5
%39 = call i32 @buf_append(%struct.buf* %37, i32 %38)
%40 = load %struct.buf*, %struct.buf** %6
%41 = load i32*, i32** %4
%42 = call i32 @buf_read_until_newline(%struct.buf* %40, i32* %41)
br label %9
43: ; preds = %33
%44 = load i32, i32* %5
%45 = call i64 @isspace(i32 %44)
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %53
47: ; preds = %43
%48 = load i32, i32* %5
%49 = icmp ne i32 %48, 10
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = load i32, i32* %5
%52 = icmp ne i32 %51, 13
br i1 %52, label %56, label %53
53: ; preds = %50, %47, %43
%54 = load i32, i32* %5
%55 = icmp eq i32 %54, 59
br i1 %55, label %56, label %60
56: ; preds = %53, %50
%57 = load %struct.buf*, %struct.buf** %6
%58 = load i32, i32* %5
%59 = call i32 @buf_append(%struct.buf* %57, i32 %58)
br label %9
60: ; preds = %53
br label %61
61: ; preds = %60, %29
%62 = load i32, i32* %5
%63 = load i32*, i32** %4
%64 = call i32 @ungetc_checked(i32 %62, i32* %63)
br label %65
65: ; preds = %61, %15
%66 = load %struct.buf*, %struct.buf** %6
%67 = call i32 @buf_finish(%struct.buf* %66)
%68 = load %struct.buf*, %struct.buf** %6
ret %struct.buf* %68
}

LLVM IR (-O2):
%struct.buf = type { i32 }
%struct.confctl = type { i32 }
@EOF = global i32 0
define %struct.buf* @buf_read_after(%struct.confctl* %0, i32* %1) {
%3 = tail call %struct.buf* (...) @buf_new()
%4 = tail call i32 @getc(i32* %1)
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %35, label %7
7: ; preds = %2, %18
%8 = phi i32 [ %19, %18 ], [ %4, %2 ]
switch i32 %8, label %22 [
i32 47, label %9
i32 35, label %15
]
9: ; preds = %7
%10 = tail call i32 @buf_append(%struct.buf* %3, i32 47)
%11 = tail call i32 @buf_read_slashed(%struct.buf* %3, %struct.confctl* %0, i32* %1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = tail call i32 @buf_strip(%struct.buf* %3)
br label %33
15: ; preds = %7
%16 = tail call i32 @buf_append(%struct.buf* %3, i32 35)
%17 = tail call i32 @buf_read_until_newline(%struct.buf* %3, i32* %1)
br label %18
18: ; preds = %15, %31, %9
%19 = tail call i32 @getc(i32* %1)
%20 = load i32, i32* @EOF
%21 = icmp eq i32 %19, %20
br i1 %21, label %35, label %7
22: ; preds = %7
%23 = tail call i64 @isspace(i32 %8)
%24 = icmp ne i64 %23, 0
%25 = icmp ne i32 %8, 10
%26 = and i1 %25, %24
%27 = icmp ne i32 %8, 13
%28 = and i1 %27, %26
%29 = icmp eq i32 %8, 59
%30 = or i1 %29, %28
br i1 %30, label %31, label %33
31: ; preds = %22
%32 = tail call i32 @buf_append(%struct.buf* %3, i32 %8)
br label %18
33: ; preds = %22, %13
%34 = tail call i32 @ungetc_checked(i32 %8, i32* %1)
br label %35
35: ; preds = %18, %2, %33
%36 = tail call i32 @buf_finish(%struct.buf* %3)
ret %struct.buf* %3
}