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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x74(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     116b <main+0x4b>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    114b <main+0x2b>
lea    0xe91(%rip),%rdi
lea    -0x78(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x74(%rbp),%eax
jge    123e <main+0x11e>
movslq -0x7c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
mov    $0x7a,%ecx
sub    -0x78(%rbp),%ecx
cmp    %ecx,%eax
jg     11e2 <main+0xc2>
movslq -0x7c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
add    -0x78(%rbp),%eax
mov    %al,%cl
movslq -0x7c(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
movslq -0x7c(%rbp),%rax
lea    0xe3c(%rip),%rdi
movsbl -0x70(%rbp,%rax,1),%esi
call   1030 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1239 <main+0x119>
movslq -0x7c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
mov    $0x7a,%ecx
sub    -0x78(%rbp),%ecx
cmp    %ecx,%eax
jle    1234 <main+0x114>
movslq -0x7c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
mov    -0x78(%rbp),%ecx
sub    $0x1a,%ecx
add    %ecx,%eax
mov    %al,%cl
movslq -0x7c(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
movslq -0x7c(%rbp),%rax
lea    0xde5(%rip),%rdi
movsbl -0x70(%rbp,%rax,1),%esi
call   1030 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1239 <main+0x119>
jmp    1184 <main+0x64>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
lea    0xecf(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    $0xffffffff,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1150 <main+0x30>
lea    0xea0(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
test   %ebp,%ebp
je     11b6 <main+0x96>
mov    %ebp,%r15d
xor    %ebx,%ebx
lea    0xe87(%rip),%r14
nop
movsbl 0x10(%rsp,%rbx,1),%eax
mov    0xc(%rsp),%ecx
mov    $0x7a,%edx
sub    %ecx,%edx
lea    -0x1a(%rax),%esi
cmp    %eax,%edx
movzbl %sil,%edx
cmovge %eax,%edx
add    %cl,%dl
mov    %dl,0x10(%rsp,%rbx,1)
movsbl %dl,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1180 <main+0x60>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [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
store i32 0, i32* %1
store i32 0, i32* %3
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %15, %0
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %8
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %8
18: ; preds = %8
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 0, i32* %5
br label %20
20: ; preds = %82, %18
%21 = load i32, i32* %5
%22 = load i32, i32* %3
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %83
24: ; preds = %20
%25 = load i32, i32* %5
%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 = load i32, i32* %4
%31 = sub nsw i32 122, %30
%32 = icmp sle i32 %29, %31
br i1 %32, label %33, label %52
33: ; preds = %24
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = load i32, i32* %4
%40 = add nsw i32 %38, %39
%41 = trunc i32 %40 to i8
%42 = load i32, i32* %5
%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
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %48)
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
br label %82
52: ; preds = %24
%53 = load i32, i32* %5
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = load i32, i32* %4
%59 = sub nsw i32 122, %58
%60 = icmp sgt i32 %57, %59
br i1 %60, label %61, label %81
61: ; preds = %52
%62 = load i32, i32* %5
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %63
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = load i32, i32* %4
%68 = sub nsw i32 %67, 26
%69 = add nsw i32 %66, %68
%70 = trunc i32 %69 to i8
%71 = load i32, i32* %5
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %72
store i8 %70, i8* %73
%74 = load i32, i32* %5
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %75
%77 = load i8, i8* %76
%78 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %77)
%79 = load i32, i32* %5
%80 = add nsw i32 %79, 1
store i32 %80, i32* %5
br label %81
81: ; preds = %61, %52
br label %82
82: ; preds = %81, %33
br label %20
83: ; preds = %20
ret i32 0
}

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