#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 */
char EOF;
int /*<<< orphan*/ directive(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ function(char, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *load();
int main() {
  char *classes;
  FILE *fp = load();
  FILE *tp = fopen("output.c", "w");
  char a = getc(fp);
  while (a != EOF) {
    switch (a) {
    case '#':
      directive(fp, tp);
      break;
    default:
      function(a, fp, tp);
      break;
    }
    a = getc(fp);
  }
  fclose(fp);
  fclose(tp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <load@plt>
mov    %rax,-0x18(%rbp)
lea    0xe7f(%rip),%rdi
lea    0xe81(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <getc@plt>
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%eax
mov    0x2e40(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11f9 <main+0x99>
mov    -0x21(%rbp),%al
sub    $0x23,%al
jne    11d5 <main+0x75>
jmp    11c3 <main+0x63>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <directive@plt>
jmp    11e8 <main+0x88>
mov    -0x21(%rbp),%al
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
movsbl %al,%edi
call   1040 <function@plt>
mov    -0x18(%rbp),%rdi
call   1070 <getc@plt>
mov    %al,-0x21(%rbp)
jmp    119d <main+0x3d>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1060 <load@plt>
mov    %rax,%rbx
lea    0xe8a(%rip),%rdi
lea    0xe8c(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1070 <getc@plt>
mov    0x2e54(%rip),%r15
jmp    11b6 <main+0x56>
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <function@plt>
mov    %rbx,%rdi
call   1070 <getc@plt>
cmp    (%r15),%al
je     11cc <main+0x6c>
cmp    $0x23,%al
jne    11a0 <main+0x40>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <directive@plt>
jmp    11ae <main+0x4e>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"output.c\00"
@.str.1 = [2 x i8] c"w\00"
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i8
store i32 0, i32* %1
%6 = call i32* (...) @load()
store i32* %6, i32** %3
%7 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %4
%8 = load i32*, i32** %3
%9 = call signext i8 @getc(i32* %8)
store i8 %9, i8* %5
br label %10
10: ; preds = %28, %0
%11 = load i8, i8* %5
%12 = sext i8 %11 to i32
%13 = load i8, i8* @EOF
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %12, %14
br i1 %15, label %16, label %31
16: ; preds = %10
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
switch i32 %18, label %23 [
i32 35, label %19
]
19: ; preds = %16
%20 = load i32*, i32** %3
%21 = load i32*, i32** %4
%22 = call i32 @directive(i32* %20, i32* %21)
br label %28
23: ; preds = %16
%24 = load i8, i8* %5
%25 = load i32*, i32** %3
%26 = load i32*, i32** %4
%27 = call i32 @function(i8 signext %24, i32* %25, i32* %26)
br label %28
28: ; preds = %23, %19
%29 = load i32*, i32** %3
%30 = call signext i8 @getc(i32* %29)
store i8 %30, i8* %5
br label %10
31: ; preds = %10
%32 = load i32*, i32** %3
%33 = call i32 @fclose(i32* %32)
%34 = load i32*, i32** %4
%35 = call i32 @fclose(i32* %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"output.c\00"
@.str.1 = [2 x i8] c"w\00"
@EOF = global i8 0
define i32 @main() {
%1 = tail call i32* (...) @load()
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call signext i8 @getc(i32* %1)
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %3, %4
br i1 %5, label %17, label %6
6: ; preds = %0, %13
%7 = phi i8 [ %14, %13 ], [ %3, %0 ]
%8 = icmp eq i8 %7, 35
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @directive(i32* %1, i32* %2)
br label %13
11: ; preds = %6
%12 = tail call i32 @function(i8 signext %7, i32* %1, i32* %2)
br label %13
13: ; preds = %11, %9
%14 = tail call signext i8 @getc(i32* %1)
%15 = load i8, i8* @EOF
%16 = icmp eq i8 %14, %15
br i1 %16, label %17, label %6
17: ; preds = %13, %0
%18 = tail call i32 @fclose(i32* %1)
%19 = tail call i32 @fclose(i32* %2)
ret i32 0
}