#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*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char);
char fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *);
void main() {
  FILE *arquivo1, *arquivo2;
  char acesso, letra, cifra;
  arquivo1 = fopen("arq7-a.txt", "r");
  arquivo2 = fopen("cifra.txt", "w");
  if (arquivo1 == NULL && arquivo2 == NULL) {
    printf("\nO arquivo não pode ser aberto");
  } else {
    acesso = fscanf(arquivo1, "%c", &letra);
    while (acesso != EOF) {
      if (letra == ' ')
        cifra = letra;
      else
        cifra = letra + 3;
      fprintf(arquivo2, "%c", cifra);
      acesso = fscanf(arquivo1, "%c", &letra);
    }
  }
  fclose(arquivo1);
  fclose(arquivo2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    0xe97(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11ad <main+0x5d>
cmpq   $0x0,-0x10(%rbp)
jne    11ad <main+0x5d>
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
jmp    1231 <main+0xe1>
mov    -0x8(%rbp),%rdi
lea    0xe81(%rip),%rsi
lea    -0x12(%rbp),%rdx
call   1050 <fscanf@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
mov    0x2e19(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     122c <main+0xdc>
movsbl -0x12(%rbp),%eax
cmp    $0x20,%eax
jne    11f2 <main+0xa2>
mov    -0x12(%rbp),%al
mov    %al,-0x13(%rbp)
jmp    11fc <main+0xac>
movsbl -0x12(%rbp),%eax
add    $0x3,%eax
mov    %al,-0x13(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe32(%rip),%rsi
movsbl -0x13(%rbp),%edx
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe1e(%rip),%rsi
lea    -0x12(%rbp),%rdx
call   1050 <fscanf@plt>
mov    %al,-0x11(%rbp)
jmp    11c4 <main+0x74>
jmp    1231 <main+0xe1>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe9e(%rip),%rdi
lea    0xea2(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
lea    0xe95(%rip),%rdi
lea    0xe98(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rax
or     %rbx,%rax
jne    119d <main+0x4d>
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
jmp    11ff <main+0xaf>
lea    0xe95(%rip),%rsi
lea    0x7(%rsp),%rdx
mov    %r14,%rdi
call   1050 <fscanf@plt>
mov    0x2e30(%rip),%r13
cmp    0x0(%r13),%al
je     11ff <main+0xaf>
mov    $0x20,%ebp
lea    0xe6f(%rip),%r15
lea    0x7(%rsp),%r12
nop
movzbl 0x7(%rsp),%eax
lea    0x3(%rax),%ecx
cmp    $0x20,%al
movzbl %cl,%eax
cmove  %ebp,%eax
movsbl %al,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <fscanf@plt>
cmp    0x0(%r13),%al
jne    11d0 <main+0x80>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"arq7-a.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"cifra.txt\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [32 x i8] c"\0AO arquivo n\C3\A3o pode ser aberto\00"
@.str.5 = [3 x i8] c"%c\00"
@EOF = global i8 0
define void @main() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %1
%7 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %7, i32** %2
%8 = load i32*, i32** %1
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %15
10: ; preds = %0
%11 = load i32*, i32** %2
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %42
15: ; preds = %10, %0
%16 = load i32*, i32** %1
%17 = call signext i8 @fscanf(i32* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %4)
store i8 %17, i8* %3
br label %18
18: ; preds = %35, %15
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = load i8, i8* @EOF
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %20, %22
br i1 %23, label %24, label %41
24: ; preds = %18
%25 = load i8, i8* %4
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 32
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = load i8, i8* %4
store i8 %29, i8* %5
br label %35
30: ; preds = %24
%31 = load i8, i8* %4
%32 = sext i8 %31 to i32
%33 = add nsw i32 %32, 3
%34 = trunc i32 %33 to i8
store i8 %34, i8* %5
br label %35
35: ; preds = %30, %28
%36 = load i32*, i32** %2
%37 = load i8, i8* %5
%38 = call i32 @fprintf(i32* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8 signext %37)
%39 = load i32*, i32** %1
%40 = call signext i8 @fscanf(i32* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %4)
store i8 %40, i8* %3
br label %18
41: ; preds = %18
br label %42
42: ; preds = %41, %13
%43 = load i32*, i32** %1
%44 = call i32 @fclose(i32* %43)
%45 = load i32*, i32** %2
%46 = call i32 @fclose(i32* %45)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"arq7-a.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"cifra.txt\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [32 x i8] c"\0AO arquivo n\C3\A3o pode ser aberto\00"
@.str.5 = [3 x i8] c"%c\00"
@EOF = global i8 0
define void @main() {
%1 = alloca i8
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 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 ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%4 = icmp eq i32* %2, null
%5 = icmp eq i32* %3, null
%6 = and i1 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %23
9: ; preds = %0
%10 = call signext i8 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %1)
%11 = load i8, i8* @EOF
%12 = icmp eq i8 %10, %11
br i1 %12, label %23, label %13
13: ; preds = %9, %13
%14 = load i8, i8* %1
%15 = icmp eq i8 %14, 32
%16 = add i8 %14, 3
%17 = select i1 %15, i8 32, i8 %16
%18 = sext i8 %17 to i32
%19 = call i32 @fputc(i32 %18, i32* %3)
%20 = call signext i8 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %1)
%21 = load i8, i8* @EOF
%22 = icmp eq i8 %20, %21
br i1 %22, label %23, label %13
23: ; preds = %13, %9, %7
%24 = call i32 @fclose(i32* %2)
%25 = call i32 @fclose(i32* %3)
ret void
}