#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*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
char rotate_char(char, int);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char message[256];
  puts("You have to decrypt this text: ");
  puts("wulbtvuvbsayhtpjyvzjvwpjzpspjvcvsjhuvjvupvzpz");
  printf("input message to encrypt in lowercase> ");
  scanf("%255s", message);
  int i;
  for (i = 0; message[i]; i++)
    message[i] = rotate_char(message[i], 7);
  printf("encrypted: %s\n", message);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x110(%rbp),%rsi
lea    0xef0(%rip),%rdi
call   1060 <scanf@plt>
movl   $0x0,-0x114(%rbp)
movslq -0x114(%rbp),%rax
cmpb   $0x0,-0x110(%rbp,%rax,1)
je     11e7 <main+0xa7>
movslq -0x114(%rbp),%rax
mov    $0x7,%esi
movsbl -0x110(%rbp,%rax,1),%edi
ff
call   1050 <rotate_char@plt>
mov    %al,%cl
movslq -0x114(%rbp),%rax
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1195 <main+0x55>
lea    -0x110(%rbp),%rsi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xee7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf01(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%al
test   %al,%al
je     11ab <main+0x6b>
lea    0x1(%rsp),%rbx
nopl   0x0(%rax)
movsbl %al,%edi
mov    $0x7,%esi
call   1050 <rotate_char@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1190 <main+0x50>
lea    0xeca(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"You have to decrypt this text: \00"
@.str.1 = [46 x i8] c"wulbtvuvbsayhtpjyvzjvwpjzpspjvcvsjhuvjvupvzpz\00"
@.str.2 = [40 x i8] c"input message to encrypt in lowercase> \00"
@.str.3 = [6 x i8] c"%255s\00"
@.str.4 = [15 x i8] c"encrypted: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @puts(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %7)
store i32 0, i32* %3
br label %9
9: ; preds = %24, %0
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %9
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = call signext i8 @rotate_char(i8 signext %19, i32 7)
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %22
store i8 %20, i8* %23
br label %24
24: ; preds = %15
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %9
27: ; preds = %9
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"You have to decrypt this text: \00"
@.str.1 = [46 x i8] c"wulbtvuvbsayhtpjyvzjvwpjzpspjvcvsjhuvjvupvzpz\00"
@.str.2 = [40 x i8] c"input message to encrypt in lowercase> \00"
@.str.3 = [6 x i8] c"%255s\00"
@.str.4 = [15 x i8] c"encrypted: %s\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%7 = load i8, i8* %2
%8 = icmp eq i8 %7, 0
br i1 %8, label %18, label %9
9: ; preds = %0, %9
%10 = phi i64 [ %14, %9 ], [ 0, %0 ]
%11 = phi i8 [ %16, %9 ], [ %7, %0 ]
%12 = phi i8* [ %15, %9 ], [ %2, %0 ]
%13 = call signext i8 @rotate_char(i8 signext %11, i32 7)
store i8 %13, i8* %12
%14 = add nuw i64 %10, 1
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %9
18: ; preds = %9, %0
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %2)
ret i32 0
}