#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 EOF;
int /*<<< orphan*/ eatline(int /*<<< orphan*/ *);
int getc(int /*<<< orphan*/ *);
scalar_t__ isspace(int);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
int eatspace(FILE *in, int sol) {
  int nl = 0;
  int c;
  do {
    c = getc(in);
    if (c == EOF)
      break;
    if (c == '\n')
      nl = 1;
    if (c == '#' && sol) {
      eatline(in);
      c = '\n';
      continue;
    }
    sol = 0;
  } while (isspace(c));
  if (c != EOF)
    ungetc(c, in);
  return nl;
}


x86 assembly (clang, -O0):
<eatspace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e7c(%rip),%rcx
cmp    (%rcx),%eax
jne    1179 <eatspace+0x39>
jmp    11cc <eatspace+0x8c>
cmpl   $0xa,-0x14(%rbp)
jne    118a <eatspace+0x4a>
movl   $0x1,-0x10(%rbp)
cmpl   $0x23,-0x14(%rbp)
jne    11b3 <eatspace+0x73>
cmpl   $0x0,-0xc(%rbp)
je     11b3 <eatspace+0x73>
mov    -0x8(%rbp),%rdi
call   1040 <eatline@plt>
movl   $0xa,-0x14(%rbp)
jmp    11ba <eatspace+0x7a>
movl   $0x0,-0xc(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
jne    1156 <eatspace+0x16>
mov    -0x14(%rbp),%eax
mov    0x2e12(%rip),%rcx
cmp    (%rcx),%eax
je     11ea <eatspace+0xaa>
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1050 <ungetc@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eatspace>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
xor    %r15d,%r15d
mov    0x2e8e(%rip),%r12
jmp    116f <eatspace+0x2f>
nopl   0x0(%rax)
mov    %ebp,%edi
call   1030 <isspace@plt>
mov    %r13d,%ebx
test   %rax,%rax
je     11a9 <eatspace+0x69>
mov    %r14,%rdi
call   1060 <getc@plt>
cmp    (%r12),%eax
je     11b9 <eatspace+0x79>
mov    %eax,%ebp
cmp    $0xa,%eax
mov    $0x1,%eax
cmove  %eax,%r15d
xor    %r13d,%r13d
cmp    $0x23,%ebp
jne    1160 <eatspace+0x20>
test   %ebx,%ebx
je     1160 <eatspace+0x20>
mov    %r14,%rdi
call   1040 <eatline@plt>
mov    $0xa,%ebp
mov    %ebx,%r13d
jmp    1160 <eatspace+0x20>
cmp    (%r12),%ebp
je     11b9 <eatspace+0x79>
mov    %ebp,%edi
mov    %r14,%rsi
call   1050 <ungetc@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @eatspace(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %28, %2
%8 = load i32*, i32** %3
%9 = call i32 @getc(i32* %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %7
br label %32
14: ; preds = %7
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 10
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 1, i32* %5
br label %18
18: ; preds = %17, %14
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 35
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32*, i32** %3
%26 = call i32 @eatline(i32* %25)
store i32 10, i32* %6
br label %28
27: ; preds = %21, %18
store i32 0, i32* %4
br label %28
28: ; preds = %27, %24
%29 = load i32, i32* %6
%30 = call i64 @isspace(i32 %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %7, label %32
32: ; preds = %28, %13
%33 = load i32, i32* %6
%34 = load i32, i32* @EOF
%35 = icmp ne i32 %33, %34
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load i32, i32* %6
%38 = load i32*, i32** %3
%39 = call i32 @ungetc(i32 %37, i32* %38)
br label %40
40: ; preds = %36, %32
%41 = load i32, i32* %5
ret i32 %41
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @eatspace(i32* %0, i32 %1) {
br label %3
3: ; preds = %17, %2
%4 = phi i32 [ %1, %2 ], [ %18, %17 ]
%5 = phi i32 [ 0, %2 ], [ %11, %17 ]
%6 = tail call i32 @getc(i32* %0)
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %6, %7
br i1 %8, label %27, label %9
9: ; preds = %3
%10 = icmp eq i32 %6, 10
%11 = select i1 %10, i32 1, i32 %5
%12 = icmp eq i32 %6, 35
%13 = icmp ne i32 %4, 0
%14 = select i1 %12, i1 %13, i1 false
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = tail call i32 @eatline(i32* %0)
br label %17
17: ; preds = %9, %15
%18 = phi i32 [ %4, %15 ], [ 0, %9 ]
%19 = phi i32 [ 10, %15 ], [ %6, %9 ]
%20 = tail call i64 @isspace(i32 %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %3
22: ; preds = %17
%23 = load i32, i32* @EOF
%24 = icmp eq i32 %19, %23
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call i32 @ungetc(i32 %19, i32* %0)
br label %27
27: ; preds = %3, %25, %22
%28 = phi i32 [ %11, %25 ], [ %11, %22 ], [ %5, %3 ]
ret i32 %28
}