#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*/ *);
void smash_spaces(FILE *f) {
  int c;
  while (1) {
    c = fgetc(f);
    if (isspace(c))
      continue;
    if (c == ' ')
      continue;
    if (c == '\t')
      continue;
    if (c == '\n')
      continue;
    if (c == 10 || c == 13)
      continue;
    if (c == '#') {
      while (1) {
        c = fgetc(f);
        if (c == '\n' || c == EOF)
          break;
      }
      continue;
    }
    break;
  }
  if (c != EOF)
    ungetc(c, f);
}


x86 assembly (clang, -O0):
<smash_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     115f <smash_spaces+0x2f>
jmp    113c <smash_spaces+0xc>
cmpl   $0x20,-0xc(%rbp)
jne    116e <smash_spaces+0x3e>
jmp    113c <smash_spaces+0xc>
cmpl   $0x9,-0xc(%rbp)
jne    117d <smash_spaces+0x4d>
jmp    113c <smash_spaces+0xc>
cmpl   $0xa,-0xc(%rbp)
jne    118c <smash_spaces+0x5c>
jmp    113c <smash_spaces+0xc>
cmpl   $0xa,-0xc(%rbp)
je     11a0 <smash_spaces+0x70>
cmpl   $0xd,-0xc(%rbp)
jne    11a5 <smash_spaces+0x75>
jmp    113c <smash_spaces+0xc>
cmpl   $0x23,-0xc(%rbp)
jne    11eb <smash_spaces+0xbb>
jmp    11b4 <smash_spaces+0x84>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
je     11dc <smash_spaces+0xac>
mov    -0xc(%rbp),%eax
mov    0x2e14(%rip),%rcx
cmp    (%rcx),%eax
jne    11e1 <smash_spaces+0xb1>
jmp    11e6 <smash_spaces+0xb6>
jmp    11b4 <smash_spaces+0x84>
jmp    113c <smash_spaces+0xc>
jmp    11f0 <smash_spaces+0xc0>
mov    -0xc(%rbp),%eax
mov    0x2dee(%rip),%rcx
cmp    (%rcx),%eax
je     120e <smash_spaces+0xde>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1050 <ungetc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smash_spaces>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movabs $0x100002600,%r15
mov    0x2e9d(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    1150 <smash_spaces+0x20>
cmp    $0x23,%ebp
ja     1196 <smash_spaces+0x66>
mov    %ebp,%eax
bt     %rax,%r15
jb     1150 <smash_spaces+0x20>
cmp    $0x23,%rax
jne    1196 <smash_spaces+0x66>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    (%r14),%ecx
cmp    $0xa,%eax
je     1150 <smash_spaces+0x20>
cmp    %ecx,%eax
jne    1180 <smash_spaces+0x50>
jmp    1150 <smash_spaces+0x20>
cmp    (%r14),%ebp
jne    11a6 <smash_spaces+0x76>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <ungetc@plt>

LLVM IR (-O0):
@EOF = global i32 0
define void @smash_spaces(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
br label %4
4: ; preds = %1, %10, %14, %18, %22, %29, %45
%5 = load i32*, i32** %2
%6 = call i32 @fgetc(i32* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i64 @isspace(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %4
br label %4
11: ; preds = %4
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 32
br i1 %13, label %14, label %15
14: ; preds = %11
br label %4
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 9
br i1 %17, label %18, label %19
18: ; preds = %15
br label %4
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 10
br i1 %21, label %22, label %23
22: ; preds = %19
br label %4
23: ; preds = %19
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, 10
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, 13
br i1 %28, label %29, label %30
29: ; preds = %26, %23
br label %4
30: ; preds = %26
%31 = load i32, i32* %3
%32 = icmp eq i32 %31, 35
br i1 %32, label %33, label %46
33: ; preds = %30
br label %34
34: ; preds = %33, %44
%35 = load i32*, i32** %2
%36 = call i32 @fgetc(i32* %35)
store i32 %36, i32* %3
%37 = load i32, i32* %3
%38 = icmp eq i32 %37, 10
br i1 %38, label %43, label %39
39: ; preds = %34
%40 = load i32, i32* %3
%41 = load i32, i32* @EOF
%42 = icmp eq i32 %40, %41
br i1 %42, label %43, label %44
43: ; preds = %39, %34
br label %45
44: ; preds = %39
br label %34
45: ; preds = %43
br label %4
46: ; preds = %30
br label %47
47: ; preds = %46
%48 = load i32, i32* %3
%49 = load i32, i32* @EOF
%50 = icmp ne i32 %48, %49
br i1 %50, label %51, label %55
51: ; preds = %47
%52 = load i32, i32* %3
%53 = load i32*, i32** %2
%54 = call i32 @ungetc(i32 %52, i32* %53)
br label %55
55: ; preds = %51, %47
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @smash_spaces(i32* nocapture %0) {
br label %2
2: ; preds = %7, %1
%3 = tail call i32 @fgetc(i32* %0)
%4 = tail call i64 @isspace(i32 %3)
%5 = freeze i64 %4
%6 = icmp eq i64 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %9, %2, %8, %8, %8, %8
br label %2
8: ; preds = %2
switch i32 %3, label %15 [
i32 32, label %7
i32 10, label %7
i32 9, label %7
i32 13, label %7
i32 35, label %9
]
9: ; preds = %8, %9
%10 = tail call i32 @fgetc(i32* %0)
%11 = icmp eq i32 %10, 10
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %10, %12
%14 = select i1 %11, i1 true, i1 %13
br i1 %14, label %7, label %9
15: ; preds = %8
%16 = load i32, i32* @EOF
%17 = icmp eq i32 %3, %16
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 @ungetc(i32 %3, i32* %0)
br label %20
20: ; preds = %18, %15
ret void
}