#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*/ dceasar(char *, char *, int);
int /*<<< orphan*/ eceasar(char *, char *, int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
size_t strcspn(char *, char *);
int main(int argc, char *argv[]) {
  char msg[256];
  fgets(msg, 256, stdin);
  msg[strcspn(msg, "\n")] = 0;
  char ciphertext[256];
  eceasar(msg, ciphertext, 7);
  printf("Ciphertext: %s\n", ciphertext);
  char plaintext[256];
  dceasar(ciphertext, plaintext, 7);
  printf("Plaintext: %s\n", plaintext);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x310,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
mov    0x2e71(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1060 <fgets@plt>
lea    -0x110(%rbp),%rdi
lea    0xe8c(%rip),%rsi
call   1050 <strcspn@plt>
movb   $0x0,-0x110(%rbp,%rax,1)
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    $0x7,%edx
call   1030 <eceasar@plt>
lea    -0x210(%rbp),%rsi
lea    0xe3c(%rip),%rdi
call   1040 <printf@plt>
lea    -0x210(%rbp),%rdi
lea    -0x310(%rbp),%rsi
mov    $0x7,%edx
call   1070 <dceasar@plt>
lea    -0x310(%rbp),%rsi
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x310,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x308,%rsp
mov    0x2e87(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x100,%esi
call   1060 <fgets@plt>
lea    0xea3(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcspn@plt>
movb   $0x0,(%rsp,%rax,1)
lea    0x200(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x7,%edx
call   1030 <eceasar@plt>
lea    0xe5b(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0x100(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x7,%edx
call   1070 <dceasar@plt>
lea    0xe44(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x308,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [16 x i8] c"Ciphertext: %s\0A\00"
@.str.2 = [15 x i8] c"Plaintext: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %9, i32 256, i32 %10)
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%13 = call i64 @strcspn(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %13
store i8 0, i8* %14
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%17 = call i32 @eceasar(i8* %15, i8* %16, i32 7)
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%22 = call i32 @dceasar(i8* %20, i8* %21, i32 7)
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%24 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %23)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [16 x i8] c"Ciphertext: %s\0A\00"
@.str.2 = [15 x i8] c"Plaintext: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 256, i32 %7)
%9 = call i64 @strcspn(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %9
store i8 0, i8* %10
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%12 = call i32 @eceasar(i8* %6, i8* %11, i32 7)
%13 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%15 = call i32 @dceasar(i8* %11, i8* %14, i32 7)
%16 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %14)
ret i32 0
}