#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*/ rotate_string(char *, int, int);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  char input_arr[100];
  int n, i, j, count, N;
  scanf("%s", input_arr);
  scanf("%d", &n);
  for (count = 0, j = 0; input_arr[j] != '\0'; j++, count++) {
    ;
  }
  N = n % count;
  rotate_string(input_arr, N, count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x74(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x80(%rbp)
movl   $0x0,-0x7c(%rbp)
movslq -0x7c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1192 <main+0x72>
jmp    117b <main+0x5b>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1164 <main+0x44>
mov    -0x74(%rbp),%eax
cltd
idivl  -0x80(%rbp)
mov    %edx,-0x84(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x84(%rbp),%esi
mov    -0x80(%rbp),%edx
call   1030 <rotate_string@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
lea    0xed1(%rip),%rdi
xor    %ebx,%ebx
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xebf(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpb   $0x0,0x10(%rsp)
je     116b <main+0x4b>
xor    %ebx,%ebx
nopl   0x0(%rax)
cmpb   $0x0,0x11(%rsp,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1160 <main+0x40>
mov    0xc(%rsp),%eax
cltd
idiv   %ebx
lea    0x10(%rsp),%rdi
mov    %edx,%esi
mov    %ebx,%edx
call   1030 <rotate_string@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

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

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