#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*/ cesar_cifrado(char *, int);
int /*<<< orphan*/ cesar_descifrado(char *, int);
size_t getline(char **, size_t *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int main() {
  char *buffer;
  size_t bufsize = 256;
  size_t n;
  char cipher[50];
  int shift;
  buffer = cipher;
  printf("Texto a cifrar (solo mayusculas): ");
  n = getline(&buffer, &bufsize, stdin);
  buffer[n - 1] = '\0';
  printf("Usted digito: %s\nEn total %zu caracteres \n", buffer, n);
  printf("Ingresar el corrimiento: ");
  scanf("%d", &shift);
  cesar_cifrado(cipher, shift);
  cesar_descifrado(cipher, shift);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x100,-0x18(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <getline@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe96(%rip),%rdi
lea    -0x64(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1070 <cesar_cifrado@plt>
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1030 <cesar_descifrado@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
movq   $0x100,0x18(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,0x10(%rsp)
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rsi
call   1060 <getline@plt>
mov    0x10(%rsp),%rcx
movb   $0x0,-0x1(%rax,%rcx,1)
mov    0x10(%rsp),%rsi
lea    0xe7f(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1070 <cesar_cifrado@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <cesar_descifrado@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Texto a cifrar (solo mayusculas): \00"
@stdin = global i32 0
@.str.1 = [43 x i8] c"Usted digito: %s\0AEn total %zu caracteres \0A\00"
@.str.2 = [26 x i8] c"Ingresar el corrimiento: \00"
@.str.3 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
%5 = alloca [50 x i8]
%6 = alloca i32
store i32 0, i32* %1
store i64 256, i64* %3
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
store i8* %7, i8** %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @stdin
%10 = call i64 @getline(i8** %2, i64* %3, i32 %9)
store i64 %10, i64* %4
%11 = load i8*, i8** %2
%12 = load i64, i64* %4
%13 = sub i64 %12, 1
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 0, i8* %14
%15 = load i8*, i8** %2
%16 = load i64, i64* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %15, i64 %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %6)
%20 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%21 = load i32, i32* %6
%22 = call i32 @cesar_cifrado(i8* %20, i32 %21)
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%24 = load i32, i32* %6
%25 = call i32 @cesar_descifrado(i8* %23, i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"Texto a cifrar (solo mayusculas): \00"
@stdin = global i32 0
@.str.1 = [43 x i8] c"Usted digito: %s\0AEn total %zu caracteres \0A\00"
@.str.2 = [26 x i8] c"Ingresar el corrimiento: \00"
@.str.3 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i64
%3 = alloca [50 x i8]
%4 = alloca i32
%5 = bitcast i8** %1 to i8*
%6 = bitcast i64* %2 to i8*
store i64 256, i64* %2
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%8 = bitcast i32* %4 to i8*
store i8* %7, i8** %1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @stdin
%11 = call i64 @getline(i8** %1, i64* %2, i32 %10)
%12 = load i8*, i8** %1
%13 = add i64 %11, -1
%14 = getelementptr inbounds i8, i8* %12, i64 %13
store i8 0, i8* %14
%15 = load i8*, i8** %1
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %15, i64 %11)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%19 = load i32, i32* %4
%20 = call i32 @cesar_cifrado(i8* %7, i32 %19)
%21 = load i32, i32* %4
%22 = call i32 @cesar_descifrado(i8* %7, i32 %21)
ret i32 0
}