#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() {
  int k, i;
  char str[1000], c;
  scanf("%s%d", str, &k);
  for (i = 0; str[i]; i++) {
    c = str[i] - k;
    if (c - 'A' < 0)
      c += 26;
    printf("%c", c);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x400(%rbp),%rsi
lea    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmpb   $0x0,-0x400(%rbp,%rax,1)
je     11bb <main+0x9b>
movslq -0xc(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
sub    -0x8(%rbp),%eax
mov    %al,-0x401(%rbp)
movsbl -0x401(%rbp),%eax
sub    $0x41,%eax
cmp    $0x0,%eax
jge    119a <main+0x7a>
movsbl -0x401(%rbp),%eax
add    $0x1a,%eax
mov    %al,-0x401(%rbp)
lea    0xe64(%rip),%rdi
movsbl -0x401(%rbp),%esi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3f8,%rsp
lea    0xecf(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <scanf@plt>
mov    0x10(%rsp),%al
test   %al,%al
je     1188 <main+0x68>
lea    0x11(%rsp),%rbx
lea    0xeb1(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
sub    0xc(%rsp),%al
lea    0x1a(%rax),%ecx
cmp    $0x41,%al
movzbl %al,%eax
movzbl %cl,%ecx
cmovge %eax,%ecx
movsbl %cl,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x3f8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%s%d\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %4, i32* %1)
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %22, label %8
8: ; preds = %0, %8
%9 = phi i64 [ %18, %8 ], [ 0, %0 ]
%10 = phi i8 [ %20, %8 ], [ %6, %0 ]
%11 = load i32, i32* %1
%12 = trunc i32 %11 to i8
%13 = sub i8 %10, %12
%14 = icmp slt i8 %13, 65
%15 = add i8 %13, 26
%16 = select i1 %14, i8 %15, i8 %13
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %16)
%18 = add nuw i64 %9, 1
%19 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %8
22: ; preds = %8, %0
ret i32 0
}