#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  char texto[100];
  int i = 0, con = 0, tam;
  printf("texto\n");
  fgets(texto, 100, stdin);
  printf("constante\n");
  scanf("%d", &con);
  tam = strlen(texto);
  char cesar[tam];
  for (i = 0; i < tam; i++) {
    if (texto[i] >= 'a' && texto[i] <= 'z')
      cesar[i] = ((texto[i] - 97 + con) % 26 + 97);
    else
      cesar[i] = texto[i];
    printf("%c", cesar[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
lea    0xe99(%rip),%rdi
xor    %eax,%eax
mov    %al,-0xa1(%rbp)
call   1040 <printf@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edx
lea    -0x70(%rbp),%rdi
mov    %rdi,-0xa0(%rbp)
mov    $0x64,%esi
call   1050 <fgets@plt>
mov    -0xa1(%rbp),%al
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
lea    0xe67(%rip),%rdi
lea    -0x78(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0xa0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x88(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x98(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x90(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jge    1297 <main+0x157>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     1256 <main+0x116>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     1256 <main+0x116>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
sub    $0x61,%eax
add    -0x78(%rbp),%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    -0x98(%rbp),%rax
add    $0x61,%edx
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    126c <main+0x12c>
mov    -0x98(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    -0x70(%rbp,%rcx,1),%dl
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x98(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xd93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11f9 <main+0xb9>
mov    -0x88(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
movl   $0x0,0xc(%rsp)
lea    0xe98(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1060 <fgets@plt>
lea    0xe77(%rip),%rdi
call   1040 <puts@plt>
lea    0xe62(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rsp,%r14
test   %eax,%eax
jle    120e <main+0xbe>
mov    %eax,%r15d
xor    %ebx,%ebx
jmp    11d1 <main+0x81>
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
je     120e <main+0xbe>
movzbl 0x10(%rsp,%rbx,1),%eax
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     11c0 <main+0x70>
movzbl %al,%eax
mov    0xc(%rsp),%ecx
add    %ecx,%eax
add    $0xffffff9f,%eax
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
jmp    11c0 <main+0x70>
mov    %r14,%rsp
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"texto\0A\00"
@stdin = global i32 0
@.str.1 = [11 x i8] c"constante\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %9, i32 100, i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %6
%19 = alloca i8, i64 %17
store i64 %17, i64* %7
store i32 0, i32* %3
br label %20
20: ; preds = %68, %0
%21 = load i32, i32* %3
%22 = load i32, i32* %5
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %71
24: ; preds = %20
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp sge i32 %29, 97
br i1 %30, label %31, label %53
31: ; preds = %24
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp sle i32 %36, 122
br i1 %37, label %38, label %53
38: ; preds = %31
%39 = load i32, i32* %3
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = sub nsw i32 %43, 97
%45 = load i32, i32* %4
%46 = add nsw i32 %44, %45
%47 = srem i32 %46, 26
%48 = add nsw i32 %47, 97
%49 = trunc i32 %48 to i8
%50 = load i32, i32* %3
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %19, i64 %51
store i8 %49, i8* %52
br label %61
53: ; preds = %31, %24
%54 = load i32, i32* %3
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %55
%57 = load i8, i8* %56
%58 = load i32, i32* %3
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %19, i64 %59
store i8 %57, i8* %60
br label %61
61: ; preds = %53, %38
%62 = load i32, i32* %3
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %19, i64 %63
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %66)
br label %68
68: ; preds = %61
%69 = load i32, i32* %3
%70 = add nsw i32 %69, 1
store i32 %70, i32* %3
br label %20
71: ; preds = %20
%72 = load i8*, i8** %6
%73 = load i32, i32* %1
ret i32 %73
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.2 = [3 x i8] c"%d\00"
@str = [6 x i8] c"texto\00"
@str.4 = [10 x i8] c"constante\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %3, i32 100, i32 %6)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.4, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = call i32 @strlen(i8* %3)
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
%13 = icmp sgt i32 %10, 0
br i1 %13, label %14, label %34
14: ; preds = %0, %28
%15 = phi i64 [ %32, %28 ], [ 0, %0 ]
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = add i8 %17, -97
%19 = icmp ult i8 %18, 26
br i1 %19, label %20, label %28
20: ; preds = %14
%21 = zext i8 %17 to i32
%22 = add nsw i32 %21, -97
%23 = load i32, i32* %2
%24 = add nsw i32 %22, %23
%25 = srem i32 %24, 26
%26 = trunc i32 %25 to i8
%27 = add nsw i8 %26, 97
br label %28
28: ; preds = %14, %20
%29 = phi i8 [ %27, %20 ], [ %17, %14 ]
%30 = sext i8 %29 to i32
%31 = call i32 @putchar(i32 %30)
%32 = add nuw nsw i64 %15, 1
%33 = icmp eq i64 %32, %11
br i1 %33, label %34, label %14
34: ; preds = %28, %0
ret i32 0
}