#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);
  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>
movslq -0x78(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11ab <main+0x8b>
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    119d <main+0x7d>
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    114d <main+0x2d>
lea    -0x70(%rbp),%rsi
lea    0xe50(%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>
mov    0x10(%rsp),%dl
test   %dl,%dl
je     1171 <main+0x51>
mov    0xc(%rsp),%al
lea    0x11(%rsp),%rcx
nopl   0x0(%rax,%rax,1)
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    1150 <main+0x30>
lea    0xe8e(%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)
br label %7
7: ; preds = %43, %0
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %46
14: ; preds = %7
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = load i32, i32* %3
%21 = add nsw i32 %19, %20
%22 = trunc i32 %21 to i8
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %24
store i8 %22, i8* %25
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp sgt i32 %30, 122
br i1 %31, label %32, label %43
32: ; preds = %14
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = sub nsw i32 %37, 26
%39 = trunc i32 %38 to i8
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %41
store i8 %39, i8* %42
br label %43
43: ; preds = %32, %14
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %7
46: ; preds = %7
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %47)
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 i8, i8* %3
%7 = icmp eq i8 %6, 0
br i1 %7, label %23, label %8
8: ; preds = %0
%9 = load i32, i32* %2
%10 = trunc i32 %9 to i8
br label %11
11: ; preds = %8, %11
%12 = phi i64 [ 0, %8 ], [ %19, %11 ]
%13 = phi i8 [ %6, %8 ], [ %21, %11 ]
%14 = phi i8* [ %3, %8 ], [ %20, %11 ]
%15 = add i8 %13, %10
%16 = icmp sgt i8 %15, 122
%17 = add i8 %15, -26
%18 = select i1 %16, i8 %17, i8 %15
store i8 %18, i8* %14
%19 = add nuw nsw i64 %12, 1
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %11
23: ; preds = %11, %0
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret i32 0
}