#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*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int main(void) {
  FILE *p1 = NULL;
  FILE *p2 = NULL;
  char c;
  p1 = fopen("url.txt", "r");
  p2 = fopen("answ.txt", "w+");
  while (1) {
    fread(&c, 1, 1, p1);
    if (feof(p1))
      break;
    if (c == '\n') {
      fwrite("\t", 1, 1, p2);
      continue;
    }
    fwrite(&c, 1, 1, p2);
  }
  fclose(p1);
  fclose(p2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xe8a(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe7d(%rip),%rdi
lea    0xe7f(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x19(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
mov    -0x10(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%rax
je     11c9 <main+0x79>
jmp    120b <main+0xbb>
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
jne    11f2 <main+0xa2>
mov    -0x18(%rbp),%rcx
lea    0xe35(%rip),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1070 <fwrite@plt>
jmp    119d <main+0x4d>
mov    -0x18(%rbp),%rcx
lea    -0x19(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1070 <fwrite@plt>
jmp    119d <main+0x4d>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xea2(%rip),%rdi
lea    0xea3(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0xe96(%rip),%rdi
lea    0xe98(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %rax,%rax
jne    11f7 <main+0xa7>
mov    $0x9,%ebp
lea    0x7(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl 0x7(%rsp),%eax
cmp    $0xa,%al
cmove  %ebp,%eax
movsbl %al,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %rax,%rax
je     11c0 <main+0x70>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"url.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"answ.txt\00"
@.str.3 = [3 x i8] c"w+\00"
@.str.4 = [2 x i8] c"\09\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i8
store i32 0, i32* %1
store i32* null, i32** %2
store i32* null, i32** %3
%5 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %2
%6 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %6, i32** %3
br label %7
7: ; preds = %0, %18, %21
%8 = load i32*, i32** %2
%9 = call i32 @fread(i8* %4, i32 1, i32 1, i32* %8)
%10 = load i32*, i32** %2
%11 = call i64 @feof(i32* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %7
br label %24
14: ; preds = %7
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 10
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i32*, i32** %3
%20 = call i32 @fwrite(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1, i32 1, i32* %19)
br label %7
21: ; preds = %14
%22 = load i32*, i32** %3
%23 = call i32 @fwrite(i8* %4, i32 1, i32 1, i32* %22)
br label %7
24: ; preds = %13
%25 = load i32*, i32** %2
%26 = call i32 @fclose(i32* %25)
%27 = load i32*, i32** %3
%28 = call i32 @fclose(i32* %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"url.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"answ.txt\00"
@.str.3 = [3 x i8] c"w+\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 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 i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%4 = call i32 @fread(i8* %1, i32 1, i32 1, i32* %2)
%5 = tail call i64 @feof(i32* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %0, %7
%8 = load i8, i8* %1
%9 = icmp eq i8 %8, 10
%10 = select i1 %9, i8 9, i8 %8
%11 = sext i8 %10 to i32
%12 = tail call i32 @fputc(i32 %11, i32* %3)
%13 = call i32 @fread(i8* %1, i32 1, i32 1, i32* %2)
%14 = tail call i64 @feof(i32* %2)
%15 = icmp eq i64 %14, 0
br i1 %15, label %7, label %16
16: ; preds = %7, %0
%17 = tail call i32 @fclose(i32* %2)
%18 = tail call i32 @fclose(i32* %3)
ret i32 0
}