#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 */
char CaesarDe1(char);
char CaesarEn1(char);
int /*<<< orphan*/ fileEncrypt();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf_s(char *, char *, int);
int main9() {
  char ch[50];
  char cipher[50];
  char plain[50];
  for (int i = 0; i < 50; i++) {
    ch[i] = '\0';
    cipher[i] = '\0';
    plain[i] = '\0';
  }
  printf("Enter a Plain Text Message: To End message, Press  ");
  char c = '\0';
  int j = 0;
  while (c != '\n') {
    scanf_s("%c", &c, 1);
    ch[j] = c;
    j++;
  }
  for (int i = 0; i < 50; i++) {
    cipher[i] = CaesarEn1(ch[i]);
  }
  printf("\nCipher code is %s \n", cipher);
  for (int i = 0; i < 50; i++) {
    plain[i] = CaesarDe1(cipher[i]);
  }
  printf("\nPlain Text is %s \n\n\n", plain);
  fileEncrypt();
  return 0;
}


x86 assembly (clang, -O0):
<main9>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0xc4(%rbp)
cmpl   $0x32,-0xc4(%rbp)
jge    11ad <main9+0x5d>
movslq -0xc4(%rbp),%rax
movb   $0x0,-0x40(%rbp,%rax,1)
movslq -0xc4(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
movslq -0xc4(%rbp),%rax
movb   $0x0,-0xc0(%rbp,%rax,1)
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    1165 <main9+0x15>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x0,-0xc5(%rbp)
movl   $0x0,-0xcc(%rbp)
movsbl -0xc5(%rbp),%eax
cmp    $0xa,%eax
je     1219 <main9+0xc9>
lea    0xe51(%rip),%rdi
lea    -0xc5(%rbp),%rsi
mov    $0x1,%edx
call   1070 <scanf_s@plt>
mov    -0xc5(%rbp),%cl
movslq -0xcc(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    11cc <main9+0x7c>
movl   $0x0,-0xd0(%rbp)
cmpl   $0x32,-0xd0(%rbp)
jge    1262 <main9+0x112>
movslq -0xd0(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%edi
call   1050 <CaesarEn1@plt>
mov    %al,%cl
movslq -0xd0(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
mov    -0xd0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd0(%rbp)
jmp    1223 <main9+0xd3>
lea    -0x80(%rbp),%rsi
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xd4(%rbp)
cmpl   $0x32,-0xd4(%rbp)
jge    12c0 <main9+0x170>
movslq -0xd4(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%edi
call   1060 <CaesarDe1@plt>
mov    %al,%cl
movslq -0xd4(%rbp),%rax
mov    %cl,-0xc0(%rbp,%rax,1)
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    127e <main9+0x12e>
lea    -0xc0(%rbp),%rsi
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <fileEncrypt@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main9>:
push   %r15
push   %r14
push   %rbx
sub    $0xd0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0xb0(%rsp)
movw   $0x0,0xc0(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movw   $0x0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movw   $0x0,0x80(%rsp)
lea    0xe49(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movb   $0x0,0xf(%rsp)
lea    0x90(%rsp),%rbx
lea    0xe62(%rip),%r14
lea    0xf(%rsp),%r15
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
call   1070 <scanf_s@plt>
movzbl 0xf(%rsp),%eax
mov    %al,(%rbx)
add    $0x1,%rbx
cmp    $0xa,%al
jne    11e0 <main9+0x90>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl 0x90(%rsp,%rbx,1),%edi
call   1050 <CaesarEn1@plt>
mov    %al,0x10(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x32,%rbx
jne    1210 <main9+0xc0>
lea    0xe05(%rip),%rdi
xor    %ebx,%ebx
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x10(%rsp,%rbx,1),%edi
call   1060 <CaesarDe1@plt>
mov    %al,0x50(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x32,%rbx
jne    1240 <main9+0xf0>
lea    0xded(%rip),%rdi
lea    0x50(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <fileEncrypt@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [52 x i8] c"Enter a Plain Text Message: To End message, Press \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [21 x i8] c"\0ACipher code is %s \0A\00"
@.str.3 = [22 x i8] c"\0APlain Text is %s \0A\0A\0A\00"
define i32 @main9() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %4
br label %9
9: ; preds = %22, %0
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 50
br i1 %11, label %12, label %25
12: ; preds = %9
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %14
store i8 0, i8* %15
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %17
store i8 0, i8* %18
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %20
store i8 0, i8* %21
br label %22
22: ; preds = %12
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %9
25: ; preds = %9
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
store i8 0, i8* %5
store i32 0, i32* %6
br label %27
27: ; preds = %31, %25
%28 = load i8, i8* %5
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 10
br i1 %30, label %31, label %39
31: ; preds = %27
%32 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 1)
%33 = load i8, i8* %5
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %35
store i8 %33, i8* %36
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %27
39: ; preds = %27
store i32 0, i32* %7
br label %40
40: ; preds = %52, %39
%41 = load i32, i32* %7
%42 = icmp slt i32 %41, 50
br i1 %42, label %43, label %55
43: ; preds = %40
%44 = load i32, i32* %7
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = call signext i8 @CaesarEn1(i8 signext %47)
%49 = load i32, i32* %7
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %50
store i8 %48, i8* %51
br label %52
52: ; preds = %43
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %40
55: ; preds = %40
%56 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %56)
store i32 0, i32* %8
br label %58
58: ; preds = %70, %55
%59 = load i32, i32* %8
%60 = icmp slt i32 %59, 50
br i1 %60, label %61, label %73
61: ; preds = %58
%62 = load i32, i32* %8
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %63
%65 = load i8, i8* %64
%66 = call signext i8 @CaesarDe1(i8 signext %65)
%67 = load i32, i32* %8
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %68
store i8 %66, i8* %69
br label %70
70: ; preds = %61
%71 = load i32, i32* %8
%72 = add nsw i32 %71, 1
store i32 %72, i32* %8
br label %58
73: ; preds = %58
%74 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %74)
%76 = call i32 (...) @fileEncrypt()
ret i32 0
}

LLVM IR (-O2):
@.str = [52 x i8] c"Enter a Plain Text Message: To End message, Press \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [21 x i8] c"\0ACipher code is %s \0A\00"
@.str.3 = [22 x i8] c"\0APlain Text is %s \0A\0A\0A\00"
define i32 @main9() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = alloca [50 x i8]
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%5 = alloca [50 x i8]
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%7 = alloca i8
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
store i8 0, i8* %7
br label %12
12: ; preds = %0, %12
%13 = phi i64 [ 0, %0 ], [ %17, %12 ]
%14 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7, i32 1)
%15 = load i8, i8* %7
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %13
store i8 %15, i8* %16
%17 = add nuw i64 %13, 1
%18 = icmp eq i8 %15, 10
br i1 %18, label %21, label %12
19: ; preds = %21
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %9)
br label %32
21: ; preds = %12, %21
%22 = phi i64 [ %27, %21 ], [ 0, %12 ]
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = call signext i8 @CaesarEn1(i8 signext %24)
%26 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %22
store i8 %25, i8* %26
%27 = add nuw nsw i64 %22, 1
%28 = icmp eq i64 %27, 50
br i1 %28, label %19, label %21
29: ; preds = %32
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%31 = call i32 (...) @fileEncrypt()
ret i32 0
32: ; preds = %19, %32
%33 = phi i64 [ 0, %19 ], [ %38, %32 ]
%34 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = call signext i8 @CaesarDe1(i8 signext %35)
%37 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 %33
store i8 %36, i8* %37
%38 = add nuw nsw i64 %33, 1
%39 = icmp eq i64 %38, 50
br i1 %39, label %29, label %32
}