#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 /*<<< orphan*/ exit(int);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
char *strtok(char *, char *);
int main(int argc, char *argv[]) {
  FILE *fd, *fdout;
  char buf[1024];
  if (argc < 3)
    exit(1);
  if (!(fd = fopen(argv[1], "r")))
    exit(2);
  if (!(fdout = fopen(argv[2], "w")))
    exit(3);
  while (fgets(buf, 1023, fd)) {
    if (*buf == '\t') {
      char *symbol = strtok(buf, " ");
      if (!strncmp(symbol, "\t_real@", 7))
        continue;
      if (!strncmp(symbol, "\t_xmm@", 6))
        continue;
      fprintf(fdout, "%s\r\n", symbol);
    } else
      fprintf(fdout, "%s", buf);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    118d <main+0x2d>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe64(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11b9 <main+0x59>
mov    $0x2,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe3a(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11e5 <main+0x85>
mov    $0x3,%edi
call   1080 <exit@plt>
jmp    11ea <main+0x8a>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x3ff,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     12b7 <main+0x157>
movsbl -0x420(%rbp),%eax
cmp    $0x9,%eax
jne    129b <main+0x13b>
lea    -0x420(%rbp),%rdi
lea    0xddd(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x428(%rbp)
mov    -0x428(%rbp),%rdi
lea    0xdc5(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1259 <main+0xf9>
jmp    11ea <main+0x8a>
mov    -0x428(%rbp),%rdi
lea    0xda7(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    127f <main+0x11f>
jmp    11ea <main+0x8a>
mov    -0x20(%rbp),%rdi
mov    -0x428(%rbp),%rdx
lea    0xd84(%rip),%rsi
call   1050 <fprintf@plt>
jmp    12b2 <main+0x152>
mov    -0x20(%rbp),%rdi
lea    -0x420(%rbp),%rdx
lea    0xd6d(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11ea <main+0x8a>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
cmp    $0x2,%edi
jle    1288 <main+0x118>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe68(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1292 <main+0x122>
mov    %rax,%r12
mov    0x10(%rbx),%rdi
lea    0xe4e(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     129c <main+0x12c>
mov    %rax,%r14
mov    %rsp,%rdi
mov    $0x3ff,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1274 <main+0x104>
lea    0xe1f(%rip),%r15
mov    %rsp,%rbx
lea    0xe17(%rip),%r13
jmp    1220 <main+0xb0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
mov    $0x3ff,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1274 <main+0x104>
cmpb   $0x9,(%rsp)
jne    1200 <main+0x90>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <strtok@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r13,%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     120b <main+0x9b>
mov    %rbp,%rdi
lea    0xdbc(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     120b <main+0x9b>
mov    %r14,%rdi
lea    0xdab(%rip),%rsi
mov    %rbp,%rdx
call   1060 <fprintf@plt>
jmp    120b <main+0x9b>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   1090 <exit@plt>
mov    $0x2,%edi
call   1090 <exit@plt>
mov    $0x3,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [8 x i8] c"\09_real@\00"
@.str.4 = [7 x i8] c"\09_xmm@\00"
@.str.5 = [5 x i8] c"%s\0D\0A\00"
@.str.6 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [1024 x i8]
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %18, i32** %6
%19 = icmp ne i32* %18, null
br i1 %19, label %22, label %20
20: ; preds = %14
%21 = call i32 @exit(i32 2)
unreachable
22: ; preds = %14
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %7
%27 = icmp ne i32* %26, null
br i1 %27, label %30, label %28
28: ; preds = %22
%29 = call i32 @exit(i32 3)
unreachable
30: ; preds = %22
br label %31
31: ; preds = %61, %52, %47, %30
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%33 = load i32*, i32** %6
%34 = call i64 @fgets(i8* %32, i32 1023, i32* %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %62
36: ; preds = %31
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 9
br i1 %40, label %41, label %57
41: ; preds = %36
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%43 = call i8* @strtok(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %43, i8** %9
%44 = load i8*, i8** %9
%45 = call i32 @strncmp(i8* %44, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 7)
%46 = icmp ne i32 %45, 0
br i1 %46, label %48, label %47
47: ; preds = %41
br label %31
48: ; preds = %41
%49 = load i8*, i8** %9
%50 = call i32 @strncmp(i8* %49, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 6)
%51 = icmp ne i32 %50, 0
br i1 %51, label %53, label %52
52: ; preds = %48
br label %31
53: ; preds = %48
%54 = load i32*, i32** %7
%55 = load i8*, i8** %9
%56 = call i32 @fprintf(i32* %54, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %55)
br label %61
57: ; preds = %36
%58 = load i32*, i32** %7
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%60 = call i32 @fprintf(i32* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %59)
br label %61
61: ; preds = %57, %53
br label %31
62: ; preds = %31
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [8 x i8] c"\09_real@\00"
@.str.4 = [7 x i8] c"\09_xmm@\00"
@.str.5 = [5 x i8] c"%s\0D\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = tail call i32 @exit(i32 2)
unreachable
15: ; preds = %8
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %23, label %20
20: ; preds = %15
%21 = call i64 @fgets(i8* %4, i32 1023, i32* %11)
%22 = icmp eq i64 %21, 0
br i1 %22, label %42, label %25
23: ; preds = %15
%24 = tail call i32 @exit(i32 3)
unreachable
25: ; preds = %20, %39
%26 = load i8, i8* %4
%27 = icmp eq i8 %26, 9
br i1 %27, label %28, label %37
28: ; preds = %25
%29 = call i8* @strtok(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 @strncmp(i8* %29, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 7)
%31 = icmp eq i32 %30, 0
br i1 %31, label %39, label %32
32: ; preds = %28
%33 = call i32 @strncmp(i8* %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 6)
%34 = icmp eq i32 %33, 0
br i1 %34, label %39, label %35
35: ; preds = %32
%36 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %29)
br label %39
37: ; preds = %25
%38 = call i32 @fputs(i8* %4, i32* %18)
br label %39
39: ; preds = %37, %35, %28, %32
%40 = call i64 @fgets(i8* %4, i32 1023, i32* %11)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %25
42: ; preds = %39, %20
ret i32 0
}