#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 *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ right_shift_str(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  char str[10] = "abcdefhij";
  int shift_digit = 0;
  printf("please input the number to right shift the str.\"abcdefhij\"\n");
  scanf("%d", &shift_digit);
  right_shift_str(str, shift_digit);
  puts(str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xea7(%rip),%ax
mov    %ax,-0x6(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0xe(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <right_shift_str@plt>
lea    -0xe(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movabs $0x6968666564636261,%rax
66 68 69
mov    %rax,0x10(%rsp)
movw   $0x6a,0x18(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <right_shift_str@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [10 x i8] c"abcdefhij\00"
@.str = [60 x i8] c"please input the number to right shift the str.\22abcdefhij\22\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [10 x i8]* %2 to i8*
store i32 0, i32* %3
%5 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call i32 @right_shift_str(i8* %7, i32 %8)
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%11 = call i32 @puts(i8* %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [10 x i8] c"abcdefhij\00"
@.str.1 = [3 x i8] c"%d\00"
@str = [59 x i8] c"please input the number to right shift the str.\22abcdefhij\22\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = call i32 @right_shift_str(i8* %3, i32 %7)
%9 = call i32 @puts(i8* %3)
ret i32 0
}