#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 */

/* Variables and functions */
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ *gets(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ repalce(char *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  char str[1024];
  freopen("input.txt", "r", stdin);
  while (gets(str) != NULL) {
    repalce(str);
    puts(str);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e88(%rip),%rax
mov    (%rax),%edx
lea    0xe97(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1040 <freopen@plt>
lea    -0x410(%rbp),%rdi
call   1050 <gets@plt>
cmp    $0x0,%rax
je     11a8 <main+0x68>
lea    -0x410(%rbp),%rdi
call   1060 <repalce@plt>
lea    -0x410(%rbp),%rdi
call   1030 <puts@plt>
jmp    1175 <main+0x35>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
lea    0xea8(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1040 <freopen@plt>
mov    %rsp,%rdi
call   1050 <gets@plt>
test   %rax,%rax
je     119d <main+0x5d>
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1060 <repalce@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
test   %rax,%rax
jne    1180 <main+0x40>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @stdin
%8 = call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %13, %2
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%11 = call i32* @gets(i8* %10)
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%15 = call i32 @repalce(i8* %14)
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%17 = call i32 @puts(i8* %16)
br label %9
18: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = tail call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = call i32* @gets(i8* %4)
%8 = icmp eq i32* %7, null
br i1 %8, label %14, label %9
9: ; preds = %2, %9
%10 = call i32 @repalce(i8* %4)
%11 = call i32 @puts(i8* %4)
%12 = call i32* @gets(i8* %4)
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %9
14: ; preds = %9, %2
ret i32 0
}