#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 fgetc(int /*<<< orphan*/ *);
scalar_t__ isspace(int);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
int igspaces(FILE *f) {
  int c;
  do {
    c = fgetc(f);
    if (c == '#')
      while ((c = fgetc(f)) != '\n' && c != EOF)
        ;
  } while (isspace(c));
  ungetc(c, f);
  return c;
}


x86 assembly (clang, -O0):
<igspaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x23,-0xc(%rbp)
jne    119f <igspaces+0x6f>
jmp    1157 <igspaces+0x27>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xd(%rbp)
je     1185 <igspaces+0x55>
mov    -0xc(%rbp),%eax
mov    0x2e6b(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1195 <igspaces+0x65>
jmp    119a <igspaces+0x6a>
jmp    1157 <igspaces+0x27>
jmp    119f <igspaces+0x6f>
jmp    11a4 <igspaces+0x74>
mov    -0xc(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
jne    113c <igspaces+0xc>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1050 <ungetc@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<igspaces>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x2eaa(%rip),%r14
jmp    114c <igspaces+0x1c>
mov    %ebp,%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     1176 <igspaces+0x46>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
cmp    $0x23,%eax
jne    1140 <igspaces+0x10>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
cmp    $0xa,%eax
je     1140 <igspaces+0x10>
cmp    (%r14),%ebp
jne    1160 <igspaces+0x30>
jmp    1140 <igspaces+0x10>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <ungetc@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @igspaces(i32* nocapture %0) {
br label %2
2: ; preds = %11, %1
%3 = tail call i32 @fgetc(i32* %0)
%4 = icmp eq i32 %3, 35
br i1 %4, label %5, label %11
5: ; preds = %2, %5
%6 = tail call i32 @fgetc(i32* %0)
%7 = icmp ne i32 %6, 10
%8 = load i32, i32* @EOF
%9 = icmp ne i32 %6, %8
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %5, label %11
11: ; preds = %5, %2
%12 = phi i32 [ %3, %2 ], [ %6, %5 ]
%13 = tail call i64 @isspace(i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %2
15: ; preds = %11
%16 = tail call i32 @ungetc(i32 %12, i32* %0)
ret i32 %12
}