#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*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int main(void) {
  const char source[] = "input.txt";
  FILE *in_stream = fopen(source, "r");
  if (in_stream != NULL) {
    const char dest[] = "output.txt";
    FILE *out_stream = fopen(dest, "w");
    if (out_stream != NULL) {
      char symbol;
      while ((symbol = fgetc(in_stream)) != EOF) {
        fputc(symbol, out_stream);
      }
      fclose(out_stream);
    }
    fclose(in_stream);
  } else {
    perror("Ошибка создания потока ввода");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xe97(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0xe(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1223 <main+0xd3>
mov    0xe71(%rip),%rax
mov    %rax,-0x23(%rbp)
mov    0xe6e(%rip),%ax
mov    %ax,-0x1b(%rbp)
mov    0xe66(%rip),%al
mov    %al,-0x19(%rbp)
lea    -0x23(%rbp),%rdi
lea    0xe59(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1215 <main+0xc5>
jmp    11d7 <main+0x87>
mov    -0x18(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x31(%rbp)
movsbl %al,%eax
mov    0x2dfb(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     120c <main+0xbc>
mov    -0x31(%rbp),%al
mov    -0x30(%rbp),%rsi
movsbl %al,%edi
call   1050 <fputc@plt>
jmp    11d7 <main+0x87>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
jmp    122f <main+0xdf>
lea    0xdef(%rip),%rdi
call   1070 <perror@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movabs $0x78742e7475706e69,%rax
2e 74 78
mov    %rax,(%rsp)
movw   $0x74,0x8(%rsp)
lea    0xe95(%rip),%rsi
mov    %rsp,%rdi
call   1060 <fopen@plt>
test   %rax,%rax
je     1204 <main+0xb4>
mov    %rax,%r14
movabs $0x742e74757074756f,%rax
74 2e 74
mov    %rax,0x10(%rsp)
movl   $0x747874,0x17(%rsp)
lea    0xe70(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1060 <fopen@plt>
test   %rax,%rax
je     11f0 <main+0xa0>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <fgetc@plt>
mov    0x2e20(%rip),%r15
cmp    (%r15),%al
je     11e8 <main+0x98>
nopl   (%rax)
movsbl %al,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
mov    %r14,%rdi
call   1040 <fgetc@plt>
cmp    (%r15),%al
jne    11d0 <main+0x80>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe0e(%rip),%rdi
call   1070 <perror@plt>
jmp    11f8 <main+0xa8>

LLVM IR (-O0):
@__const.main.source = [10 x i8] c"input.txt\00"
@.str = [2 x i8] c"r\00"
@__const.main.dest = [11 x i8] c"output.txt\00"
@.str.1 = [2 x i8] c"w\00"
@EOF = global i8 0
@.str.2 = [54 x i8] c"\D0\9E\D1\88\D0\B8\D0\B1\D0\BA\D0\B0 \D1\81\D0\BE\D0\B7\D0\B4\D0\B0\D0\BD\D0\B8\D1\8F \D0\BF\D0\BE\D1\82\D0\BE\D0\BA\D0\B0 \D0\B2\D0\B2\D0\BE\D0\B4\D0\B0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i32*
%4 = alloca [11 x i8]
%5 = alloca i32*
%6 = alloca i8
store i32 0, i32* %1
%7 = bitcast [10 x i8]* %2 to i8*
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %9, i32** %3
%10 = load i32*, i32** %3
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %36
12: ; preds = %0
%13 = bitcast [11 x i8]* %4 to i8*
%14 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %15, i32** %5
%16 = load i32*, i32** %5
%17 = icmp ne i32* %16, null
br i1 %17, label %18, label %33
18: ; preds = %12
br label %19
19: ; preds = %26, %18
%20 = load i32*, i32** %3
%21 = call signext i8 @fgetc(i32* %20)
store i8 %21, i8* %6
%22 = sext i8 %21 to i32
%23 = load i8, i8* @EOF
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %22, %24
br i1 %25, label %26, label %30
26: ; preds = %19
%27 = load i8, i8* %6
%28 = load i32*, i32** %5
%29 = call i32 @fputc(i8 signext %27, i32* %28)
br label %19
30: ; preds = %19
%31 = load i32*, i32** %5
%32 = call i32 @fclose(i32* %31)
br label %33
33: ; preds = %30, %12
%34 = load i32*, i32** %3
%35 = call i32 @fclose(i32* %34)
br label %38
36: ; preds = %0
%37 = call i32 @perror(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
br label %38
38: ; preds = %36, %33
ret i32 0
}

LLVM IR (-O2):
@__const.main.source = [10 x i8] c"input.txt\00"
@.str = [2 x i8] c"r\00"
@__const.main.dest = [11 x i8] c"output.txt\00"
@.str.1 = [2 x i8] c"w\00"
@EOF = global i8 0
@.str.2 = [54 x i8] c"\D0\9E\D1\88\D0\B8\D0\B1\D0\BA\D0\B0 \D1\81\D0\BE\D0\B7\D0\B4\D0\B0\D0\BD\D0\B8\D1\8F \D0\BF\D0\BE\D1\82\D0\BE\D0\BA\D0\B0 \D0\B2\D0\B2\D0\BE\D0\B4\D0\B0\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [11 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = call i32* @fopen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %24, label %6
6: ; preds = %0
%7 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %22, label %10
10: ; preds = %6
%11 = tail call signext i8 @fgetc(i32* %4)
%12 = load i8, i8* @EOF
%13 = icmp eq i8 %11, %12
br i1 %13, label %20, label %14
14: ; preds = %10, %14
%15 = phi i8 [ %17, %14 ], [ %11, %10 ]
%16 = tail call i32 @fputc(i8 signext %15, i32* %8)
%17 = tail call signext i8 @fgetc(i32* %4)
%18 = load i8, i8* @EOF
%19 = icmp eq i8 %17, %18
br i1 %19, label %20, label %14
20: ; preds = %14, %10
%21 = tail call i32 @fclose(i32* %8)
br label %22
22: ; preds = %20, %6
%23 = tail call i32 @fclose(i32* %4)
br label %26
24: ; preds = %0
%25 = tail call i32 @perror(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
ret i32 0
}