#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*/ *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
scalar_t__ is_comment(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int, int);
scalar_t__ is_preprocessor_statements(int /*<<< orphan*/ *,
                                      int /*<<< orphan*/ *, int);
scalar_t__ is_quoted(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
scalar_t__ isspace(int);
int /*<<< orphan*/ skip_space(int /*<<< orphan*/ *);
scalar_t__ strchr(char *, int);
void rip(FILE *input, FILE *output, int comment) {
  int c;
  while ((c = fgetc(input)) != EOF) {
    if (is_quoted(input, output, c)) {
      continue;
    }
    if (is_comment(input, output, c, comment)) {
      continue;
    }
    if (is_preprocessor_statements(input, output, c)) {
      continue;
    }
    if (strchr("=+-*/%><!~&.?:|^;,{}()", c) || isspace(c)) {
      int token = c;
      if (isspace(token)) {
        token = ' ';
      }
      skip_space(input);
      fputc(token, output);
    } else {
      fputc(c, output);
    }
  }
}


x86 assembly (clang, -O0):
<rip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e42(%rip),%rcx
cmp    (%rcx),%eax
je     1283 <rip+0x103>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1080 <is_quoted@plt>
cmp    $0x0,%rax
je     11cd <rip+0x4d>
jmp    1193 <rip+0x13>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   10a0 <is_comment@plt>
cmp    $0x0,%rax
je     11ef <rip+0x6f>
jmp    1193 <rip+0x13>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1090 <is_preprocessor_statements@plt>
cmp    $0x0,%rax
je     120e <rip+0x8e>
jmp    1193 <rip+0x13>
mov    -0x18(%rbp),%esi
lea    0xde8(%rip),%rdi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    1239 <rip+0xb9>
mov    -0x18(%rbp),%edi
call   1060 <isspace@plt>
cmp    $0x0,%rax
je     1272 <rip+0xf2>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1060 <isspace@plt>
cmp    $0x0,%rax
je     1258 <rip+0xd8>
movl   $0x20,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <skip_space@plt>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <fputc@plt>
jmp    127e <rip+0xfe>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <fputc@plt>
jmp    1193 <rip+0x13>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rip>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%r12
mov    %rdi,%rbp
call   1050 <fgetc@plt>
mov    0x2e48(%rip),%r13
cmp    0x0(%r13),%eax
jne    11b5 <rip+0x35>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
lea    0xe42(%rip),%r15
jmp    1200 <rip+0x80>
mov    %ebx,%edi
call   1060 <isspace@plt>
test   %rax,%rax
mov    $0x20,%eax
cmovne %eax,%ebx
mov    %rbp,%rdi
call   1030 <skip_space@plt>
mov    %ebx,%edi
mov    %r12,%rsi
call   1070 <fputc@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
call   1050 <fgetc@plt>
mov    %eax,%ebx
cmp    0x0(%r13),%eax
je     11a6 <rip+0x26>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1080 <is_quoted@plt>
test   %rax,%rax
jne    11f0 <rip+0x70>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
mov    %r14d,%ecx
call   10a0 <is_comment@plt>
test   %rax,%rax
jne    11f0 <rip+0x70>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1090 <is_preprocessor_statements@plt>
test   %rax,%rax
jne    11f0 <rip+0x70>
mov    %r15,%rdi
mov    %ebx,%esi
call   1040 <strchr@plt>
test   %rax,%rax
jne    11c0 <rip+0x40>
mov    %ebx,%edi
call   1060 <isspace@plt>
test   %rax,%rax
jne    11c0 <rip+0x40>
jmp    11da <rip+0x5a>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [23 x i8] c"=+-*/%><!~&.?:|^;,{}()\00"
define void @rip(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
br label %9
9: ; preds = %60, %35, %28, %20, %3
%10 = load i32*, i32** %4
%11 = call i32 @fgetc(i32* %10)
store i32 %11, i32* %7
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %61
14: ; preds = %9
%15 = load i32*, i32** %4
%16 = load i32*, i32** %5
%17 = load i32, i32* %7
%18 = call i64 @is_quoted(i32* %15, i32* %16, i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
br label %9
21: ; preds = %14
%22 = load i32*, i32** %4
%23 = load i32*, i32** %5
%24 = load i32, i32* %7
%25 = load i32, i32* %6
%26 = call i64 @is_comment(i32* %22, i32* %23, i32 %24, i32 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %21
br label %9
29: ; preds = %21
%30 = load i32*, i32** %4
%31 = load i32*, i32** %5
%32 = load i32, i32* %7
%33 = call i64 @is_preprocessor_statements(i32* %30, i32* %31, i32 %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %29
br label %9
36: ; preds = %29
%37 = load i32, i32* %7
%38 = call i64 @strchr(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %44, label %40
40: ; preds = %36
%41 = load i32, i32* %7
%42 = call i64 @isspace(i32 %41)
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %56
44: ; preds = %40, %36
%45 = load i32, i32* %7
store i32 %45, i32* %8
%46 = load i32, i32* %8
%47 = call i64 @isspace(i32 %46)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %44
store i32 32, i32* %8
br label %50
50: ; preds = %49, %44
%51 = load i32*, i32** %4
%52 = call i32 @skip_space(i32* %51)
%53 = load i32, i32* %8
%54 = load i32*, i32** %5
%55 = call i32 @fputc(i32 %53, i32* %54)
br label %60
56: ; preds = %40
%57 = load i32, i32* %7
%58 = load i32*, i32** %5
%59 = call i32 @fputc(i32 %57, i32* %58)
br label %60
60: ; preds = %56, %50
br label %9
61: ; preds = %9
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [23 x i8] c"=+-*/%><!~&.?:|^;,{}()\00"
define void @rip(i32* %0, i32* %1, i32 %2) {
%4 = tail call i32 @fgetc(i32* %0)
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %35, label %7
7: ; preds = %3, %31
%8 = phi i32 [ %32, %31 ], [ %4, %3 ]
%9 = tail call i64 @is_quoted(i32* %0, i32* %1, i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %31
11: ; preds = %7
%12 = tail call i64 @is_comment(i32* %0, i32* %1, i32 %8, i32 %2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = tail call i64 @is_preprocessor_statements(i32* %0, i32* %1, i32 %8)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %31
17: ; preds = %14
%18 = tail call i64 @strchr(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %8)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = tail call i64 @isspace(i32 %8)
%22 = icmp eq i64 %21, 0
br i1 %22, label %28, label %23
23: ; preds = %20, %17
%24 = tail call i64 @isspace(i32 %8)
%25 = icmp eq i64 %24, 0
%26 = select i1 %25, i32 %8, i32 32
%27 = tail call i32 @skip_space(i32* %0)
br label %28
28: ; preds = %20, %23
%29 = phi i32 [ %26, %23 ], [ %8, %20 ]
%30 = tail call i32 @fputc(i32 %29, i32* %1)
br label %31
31: ; preds = %28, %7, %11, %14
%32 = tail call i32 @fgetc(i32* %0)
%33 = load i32, i32* @EOF
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %7
35: ; preds = %31, %3
ret void
}