#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 getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
int skipline(FILE *f) {
  int state, flag, c;
  state = 0;
  flag = 0;
  for (;;) {
    c = getc(f);
    if (c == '\n')
      return flag;
    if (state) {
      ungetc(c, f);
      return flag;
    }
    if (c == EOF)
      return -1;
    if (c == '\r')
      state = 1;
    else if (c != ' ')
      flag = 1;
  }
}


x86 assembly (clang, -O0):
<skipline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jne    115b <skipline+0x3b>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11cb <skipline+0xab>
cmpl   $0x0,-0x14(%rbp)
je     117c <skipline+0x5c>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <ungetc@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11cb <skipline+0xab>
mov    -0x1c(%rbp),%eax
mov    0x2e62(%rip),%rcx
cmp    (%rcx),%eax
jne    119a <skipline+0x7a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11cb <skipline+0xab>
cmpl   $0xd,-0x1c(%rbp)
jne    11b0 <skipline+0x90>
movl   $0x1,-0x14(%rbp)
jmp    11c6 <skipline+0xa6>
cmpl   $0x20,-0x1c(%rbp)
je     11c1 <skipline+0xa1>
movl   $0x1,-0x18(%rbp)
jmp    11c6 <skipline+0xa6>
jmp    113a <skipline+0x1a>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipline>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <getc@plt>
xor    %r15d,%r15d
cmp    $0xa,%eax
je     1199 <skipline+0x79>
xor    %r15d,%r15d
mov    0x2ea7(%rip),%r14
xor    %ebp,%ebp
jmp    115f <skipline+0x3f>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1040 <getc@plt>
cmp    $0xa,%eax
je     1199 <skipline+0x79>
test   %ebp,%ebp
jne    1187 <skipline+0x67>
cmp    (%r14),%eax
je     1193 <skipline+0x73>
cmp    $0xd,%eax
je     1180 <skipline+0x60>
cmp    $0x20,%eax
je     1150 <skipline+0x30>
mov    $0x1,%r15d
jmp    1150 <skipline+0x30>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%ebp
jmp    1152 <skipline+0x32>
mov    %eax,%edi
mov    %rbx,%rsi
call   1030 <ungetc@plt>
jmp    1199 <skipline+0x79>
mov    $0xffffffff,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @skipline(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = icmp eq i32 %2, 10
br i1 %3, label %22, label %4
4: ; preds = %1, %17
%5 = phi i32 [ %20, %17 ], [ %2, %1 ]
%6 = phi i32 [ %19, %17 ], [ 0, %1 ]
%7 = phi i32 [ %18, %17 ], [ 0, %1 ]
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = tail call i32 @ungetc(i32 %5, i32* %0)
br label %22
11: ; preds = %4
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %5, %12
br i1 %13, label %22, label %14
14: ; preds = %11
switch i32 %5, label %15 [
i32 13, label %17
i32 32, label %16
]
15: ; preds = %14
br label %17
16: ; preds = %14
br label %17
17: ; preds = %14, %16, %15
%18 = phi i32 [ 0, %15 ], [ 1, %14 ], [ 0, %16 ]
%19 = phi i32 [ 1, %15 ], [ %6, %14 ], [ %6, %16 ]
%20 = tail call i32 @getc(i32* %0)
%21 = icmp eq i32 %20, 10
br i1 %21, label %22, label %4
22: ; preds = %17, %11, %1, %9
%23 = phi i32 [ %6, %9 ], [ 0, %1 ], [ %19, %17 ], [ -1, %11 ]
ret i32 %23
}