#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;
      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     1291 <main+0x131>
movsbl -0x420(%rbp),%eax
cmp    $0x9,%eax
jne    1275 <main+0x115>
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    -0x20(%rbp),%rdi
mov    -0x428(%rbp),%rdx
lea    0xda3(%rip),%rsi
call   1050 <fprintf@plt>
jmp    128c <main+0x12c>
mov    -0x20(%rbp),%rdi
lea    -0x420(%rbp),%rdx
lea    0xd8c(%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    1260 <main+0xf0>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe68(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     126a <main+0xfa>
mov    %rax,%r12
mov    0x10(%rbx),%rdi
lea    0xe4e(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1274 <main+0x104>
mov    %rax,%r14
mov    %rsp,%rdi
mov    $0x3ff,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     124c <main+0xdc>
lea    0xe23(%rip),%r15
mov    %rsp,%rbx
lea    0xe1b(%rip),%r13
jmp    1210 <main+0xa0>
nopl   (%rax)
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     124c <main+0xdc>
cmpb   $0x9,(%rsp)
jne    11f0 <main+0x80>
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     11fb <main+0x8b>
mov    %r14,%rdi
lea    0xdcc(%rip),%rsi
mov    %rbp,%rdx
call   1060 <fprintf@plt>
jmp    11fb <main+0x8b>
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 = [5 x i8] c"%s\0D\0A\00"
@.str.5 = [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 = %56, %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 %57
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 %52
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 i32*, i32** %7
%50 = load i8*, i8** %9
%51 = call i32 @fprintf(i32* %49, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %50)
br label %56
52: ; preds = %36
%53 = load i32*, i32** %7
%54 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%55 = call i32 @fprintf(i32* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %52, %48
br label %31
57: ; 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 = [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 %39, label %25
23: ; preds = %15
%24 = tail call i32 @exit(i32 3)
unreachable
25: ; preds = %20, %36
%26 = load i8, i8* %4
%27 = icmp eq i8 %26, 9
br i1 %27, label %28, label %34
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 %36, label %32
32: ; preds = %28
%33 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %29)
br label %36
34: ; preds = %25
%35 = call i32 @fputs(i8* %4, i32* %18)
br label %36
36: ; preds = %34, %32, %28
%37 = call i64 @fgets(i8* %4, i32 1023, i32* %11)
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %25
39: ; preds = %36, %20
ret i32 0
}