#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*/ scanf(char *, ...);
int main() {
  int i, j, m, n;
  printf("Enter the String now more than %d character long \n", 100);
  char str1[100], str2[100];
  scanf("%s", str1);
  printf("Enter the Value of M and N: ");
  scanf("%d %d", &m, &n);
  for (i = n - 1, j = 0; i < n + m; i++, j++)
    str2[j] = str1[i];
  str2[j] = '\0';
  printf("Ans: %s \n", str2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x80(%rbp),%rsi
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    11c6 <main+0xa6>
movslq -0x8(%rbp),%rax
mov    -0x80(%rbp,%rax,1),%cl
movslq -0xc(%rbp),%rax
mov    %cl,-0xf0(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118b <main+0x6b>
movslq -0xc(%rbp),%rax
movb   $0x0,-0xf0(%rbp,%rax,1)
lea    -0xf0(%rbp),%rsi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xe8,%rsp
lea    0xebf(%rip),%rdi
xor    %r14d,%r14d
mov    $0x64,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    0x80(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebx
test   %ebx,%ebx
js     11c6 <main+0x96>
mov    0x8(%rsp),%eax
add    %eax,%ebx
lea    -0x1(%rax),%ecx
movslq %ecx,%rcx
lea    (%rsp,%rcx,1),%rsi
add    $0x80,%rsi
cmp    %ebx,%eax
cmovg  %eax,%ebx
sub    %eax,%ebx
lea    0x1(%rbx),%rdx
lea    0x10(%rsp),%rdi
call   1040 <memcpy@plt>
add    $0x1,%ebx
mov    %rbx,%r14
movb   $0x0,0x10(%rsp,%r14,1)
lea    0xe86(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Enter the String now more than %d character long \0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [29 x i8] c"Enter the Value of M and N: \00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [10 x i8] c"Ans: %s \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 100)
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %5)
%13 = load i32, i32* %5
%14 = sub nsw i32 %13, 1
store i32 %14, i32* %2
store i32 0, i32* %3
br label %15
15: ; preds = %29, %0
%16 = load i32, i32* %2
%17 = load i32, i32* %5
%18 = load i32, i32* %4
%19 = add nsw i32 %17, %18
%20 = icmp slt i32 %16, %19
br i1 %20, label %21, label %34
21: ; preds = %15
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %27
store i8 %25, i8* %28
br label %29
29: ; preds = %21
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %15
34: ; preds = %15
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %36
store i8 0, i8* %37
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [51 x i8] c"Enter the String now more than %d character long \0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [29 x i8] c"Enter the Value of M and N: \00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [10 x i8] c"Ans: %s \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 100)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2)
%13 = load i32, i32* %2
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, -1
br i1 %15, label %16, label %29
16: ; preds = %0
%17 = add i32 %14, %13
%18 = add i32 %13, -1
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%20 = sext i32 %18 to i64
%21 = getelementptr [100 x i8], [100 x i8]* %3, i64 0, i64 %20
%22 = call i32 @llvm.smax.i32(i32 %13, i32 %17)
%23 = sub i32 %22, %13
%24 = zext i32 %23 to i64
%25 = add nuw nsw i64 %24, 1
%26 = add i32 %22, 1
%27 = sub i32 %26, %13
%28 = zext i32 %27 to i64
br label %29
29: ; preds = %0, %16
%30 = phi i64 [ %28, %16 ], [ 0, %0 ]
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %30
store i8 0, i8* %31
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %9)
ret i32 0
}