#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 *, char *);
int /*<<< orphan*/ scanf(char *, char *, int *);
int main() {
  char str[100];
  int n, i = 0;
  scanf("%s\n%d", str, &n);
  n = n % 26;
  while (str[i] != '\0') {
    str[i] = str[i] + n;
    if (str[i] > 'z') {
      str[i] = str[i] - 26;
    }
    i++;
  }
  printf("%s", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x78(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xebc(%rip),%rdi
lea    -0x74(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x74(%rbp),%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %edx,-0x74(%rbp)
movslq -0x78(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11b9 <main+0x99>
movslq -0x78(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
add    -0x74(%rbp),%eax
mov    %al,%cl
movslq -0x78(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
movslq -0x78(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jle    11ab <main+0x8b>
movslq -0x78(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
sub    $0x1a,%eax
mov    %al,%cl
movslq -0x78(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    115b <main+0x3b>
lea    -0x70(%rbp),%rsi
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x78,%rsp
lea    0xed5(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rax
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
mov    %eax,0xc(%rsp)
mov    0x10(%rsp),%dl
test   %dl,%dl
je     1191 <main+0x71>
lea    0x11(%rsp),%rcx
xchg   %ax,%ax
add    %al,%dl
lea    -0x1a(%rdx),%esi
cmp    $0x7b,%dl
movzbl %dl,%edx
movzbl %sil,%esi
cmovl  %edx,%esi
mov    %sil,-0x1(%rcx)
movzbl (%rcx),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1170 <main+0x50>
lea    0xe6e(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x78,%rsp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s\0A%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %5, i32* %3)
%7 = load i32, i32* %3
%8 = srem i32 %7, 26
store i32 %8, i32* %3
br label %9
9: ; preds = %45, %0
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %48
16: ; preds = %9
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = load i32, i32* %3
%23 = add nsw i32 %21, %22
%24 = trunc i32 %23 to i8
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %26
store i8 %24, i8* %27
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp sgt i32 %32, 122
br i1 %33, label %34, label %45
34: ; preds = %16
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = sub nsw i32 %39, 26
%41 = trunc i32 %40 to i8
%42 = load i32, i32* %4
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %43
store i8 %41, i8* %44
br label %45
45: ; preds = %34, %16
%46 = load i32, i32* %4
%47 = add nsw i32 %46, 1
store i32 %47, i32* %4
br label %9
48: ; preds = %9
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%50 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %49)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s\0A%d\00"
@.str.1 = [3 x i8] c"%s\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*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3, i32* %2)
%6 = load i32, i32* %2
%7 = srem i32 %6, 26
store i32 %7, i32* %2
%8 = load i8, i8* %3
%9 = icmp eq i8 %8, 0
br i1 %9, label %24, label %10
10: ; preds = %0
%11 = trunc i32 %7 to i8
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ 0, %10 ], [ %20, %12 ]
%14 = phi i8 [ %8, %10 ], [ %22, %12 ]
%15 = phi i8* [ %3, %10 ], [ %21, %12 ]
%16 = add i8 %14, %11
%17 = icmp sgt i8 %16, 122
%18 = add i8 %16, -26
%19 = select i1 %17, i8 %18, i8 %16
store i8 %19, i8* %15
%20 = add nuw nsw i64 %13, 1
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %24, label %12
24: ; preds = %12, %0
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret i32 0
}