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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x80(%rbp),%rsi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1184 <main+0x64>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1164 <main+0x44>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x8(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1214 <main+0xf4>
mov    -0x84(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    $0x0,%eax
jge    11df <main+0xbf>
mov    -0xc(%rbp),%eax
mov    -0x84(%rbp),%ecx
sub    -0x8(%rbp),%ecx
add    %ecx,%eax
cltq
lea    0xe36(%rip),%rdi
movsbl -0x80(%rbp,%rax,1),%esi
call   1030 <printf@plt>
jmp    11fb <main+0xdb>
mov    -0x84(%rbp),%eax
sub    -0x8(%rbp),%eax
cltq
lea    0xe15(%rip),%rdi
movsbl -0x80(%rbp,%rax,1),%esi
call   1030 <printf@plt>
jmp    1200 <main+0xe0>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1198 <main+0x78>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
lea    0xecf(%rip),%rdi
xor    %ebx,%ebx
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0x0,0x10(%rsp,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1160 <main+0x40>
lea    -0x1(%rbx),%ecx
mov    0xc(%rsp),%eax
cltd
idiv   %ecx
mov    %edx,0xc(%rsp)
cmp    $0x1,%ebx
je     11ee <main+0xce>
mov    %edx,%eax
neg    %eax
mov    %edx,%ecx
not    %ecx
add    %ebx,%ecx
test   %edx,%edx
movslq %ecx,%rcx
cmovle %rax,%rcx
movsbl 0x10(%rsp,%rcx,1),%esi
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x2,%ebx
je     11ee <main+0xce>
lea    -0x2(%rbx),%r15
mov    $0x1,%ebp
lea    0xe4f(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    0xc(%rsp),%eax
mov    %ebp,%ecx
sub    %eax,%ecx
mov    %ebx,%edx
sub    %eax,%edx
test   %ecx,%ecx
movslq %edx,%rax
cmovs  %rax,%rcx
movsbl 0x10(%rsp,%rcx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
add    $0x1,%ebx
add    $0xffffffff,%r15d
jne    11c0 <main+0xa0>
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 i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [100 x i8]
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %12
12: ; preds = %19, %0
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %12
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %12
22: ; preds = %12
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = srem i32 %23, %24
store i32 %25, i32* %2
store i32 0, i32* %8
br label %26
26: ; preds = %54, %22
%27 = load i32, i32* %8
%28 = load i32, i32* %3
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %57
30: ; preds = %26
%31 = load i32, i32* %8
%32 = load i32, i32* %2
%33 = sub nsw i32 %31, %32
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %45
35: ; preds = %30
%36 = load i32, i32* %3
%37 = load i32, i32* %8
%38 = load i32, i32* %2
%39 = sub nsw i32 %37, %38
%40 = add nsw i32 %36, %39
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %43)
br label %53
45: ; preds = %30
%46 = load i32, i32* %8
%47 = load i32, i32* %2
%48 = sub nsw i32 %46, %47
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %51)
br label %53
53: ; preds = %45, %35
br label %54
54: ; preds = %53
%55 = load i32, i32* %8
%56 = add nsw i32 %55, 1
store i32 %56, i32* %8
br label %26
57: ; preds = %26
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 i32
%2 = alloca [100 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %7
7: ; preds = %7, %0
%8 = phi i64 [ %12, %7 ], [ 0, %0 ]
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
%12 = add nuw i64 %8, 1
br i1 %11, label %13, label %7
13: ; preds = %7
%14 = trunc i64 %8 to i32
%15 = load i32, i32* %1
%16 = srem i32 %15, %14
store i32 %16, i32* %1
%17 = icmp eq i32 %14, 0
br i1 %17, label %29, label %18
18: ; preds = %13
%19 = sub nsw i32 0, %16
%20 = icmp sgt i32 %16, 0
%21 = sub i32 %14, %16
%22 = sext i32 %21 to i64
%23 = zext i32 %19 to i64
%24 = select i1 %20, i64 %22, i64 %23
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %26)
%28 = icmp eq i32 %14, 1
br i1 %28, label %29, label %30
29: ; preds = %30, %18, %13
ret i32 0
30: ; preds = %18, %30
%31 = phi i32 [ %42, %30 ], [ 1, %18 ]
%32 = load i32, i32* %1
%33 = sub nsw i32 %31, %32
%34 = icmp slt i32 %33, 0
%35 = add nsw i32 %33, %14
%36 = sext i32 %35 to i64
%37 = zext i32 %33 to i64
%38 = select i1 %34, i64 %36, i64 %37
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %40)
%42 = add nuw i32 %31, 1
%43 = icmp eq i32 %42, %14
br i1 %43, label %29, label %30
}