#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
char *strchr(char *, char);
int strlen(char *);
int main() {
  printf("###############################\n");
  printf("### Move To Front Technique ###\n");
  printf("###############################\n");
  char string[100];
  char alphabets[27];
  char ch, *tmp;
  int i, j, index_ch, probes;
  for (i = 0; i < 26; i++)
    alphabets[i] = (char)(i + 97);
  alphabets[26] = ' ';
  printf("\nAlphabets: ");
  for (i = 0; i < 27; i++)
    printf("%c", alphabets[i]);
  printf("\n\n");
  printf("Enter String [max 100 chars]: ");
  fgets(string, 100, stdin);
  tmp = strchr(string, '\n');
  if (tmp != NULL)
    *tmp = '\0';
  probes = 0;
  for (i = 0; i < strlen(string); i++) {
    ch = string[i];
    index_ch = -1;
    for (j = 0; j < 27; j++) {
      if (alphabets[j] == ch) {
        index_ch = j;
        break;
      }
    }
    if (index_ch == -1)
      continue;
    j = index_ch;
    while (j > 0) {
      alphabets[j] = alphabets[j - 1];
      j--;
    }
    alphabets[0] = ch;
    probes += index_ch + 1;
  }
  printf("\nAlphabets: ");
  for (i = 0; i < 27; i++)
    printf("%c", alphabets[i]);
  printf("\nProbes   : %d", probes);
  printf("\n\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xa4(%rbp)
cmpl   $0x1a,-0xa4(%rbp)
jge    11c0 <main+0x80>
mov    -0xa4(%rbp),%eax
add    $0x61,%eax
mov    %al,%cl
movslq -0xa4(%rbp),%rax
mov    %cl,-0x90(%rbp,%rax,1)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    1186 <main+0x46>
movb   $0x20,-0x76(%rbp)
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xa4(%rbp)
cmpl   $0x1b,-0xa4(%rbp)
jge    121a <main+0xda>
movslq -0xa4(%rbp),%rax
movsbl -0x90(%rbp,%rax,1),%esi
ff
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    11dc <main+0x9c>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    0x2da7(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1060 <fgets@plt>
lea    -0x70(%rbp),%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
mov    %rax,-0xa0(%rbp)
cmpq   $0x0,-0xa0(%rbp)
je     127a <main+0x13a>
mov    -0xa0(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0xb0(%rbp)
movl   $0x0,-0xa4(%rbp)
mov    -0xa4(%rbp),%eax
mov    %eax,-0xb4(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xb4(%rbp),%eax
cmp    %ecx,%eax
jge    13c1 <main+0x281>
movslq -0xa4(%rbp),%rax
mov    -0x70(%rbp,%rax,1),%al
mov    %al,-0x91(%rbp)
movl   $0xffffffff,-0xac(%rbp)
ff ff ff
movl   $0x0,-0xa8(%rbp)
cmpl   $0x1b,-0xa8(%rbp)
jge    132d <main+0x1ed>
movslq -0xa8(%rbp),%rax
movsbl -0x90(%rbp,%rax,1),%eax
ff
movsbl -0x91(%rbp),%ecx
cmp    %ecx,%eax
jne    1314 <main+0x1d4>
mov    -0xa8(%rbp),%eax
mov    %eax,-0xac(%rbp)
jmp    132d <main+0x1ed>
jmp    1319 <main+0x1d9>
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    12d8 <main+0x198>
cmpl   $0xffffffff,-0xac(%rbp)
jne    133f <main+0x1ff>
jmp    13ad <main+0x26d>
mov    -0xac(%rbp),%eax
mov    %eax,-0xa8(%rbp)
cmpl   $0x0,-0xa8(%rbp)
jle    138c <main+0x24c>
mov    -0xa8(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x90(%rbp,%rax,1),%cl
movslq -0xa8(%rbp),%rax
mov    %cl,-0x90(%rbp,%rax,1)
mov    -0xa8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xa8(%rbp)
jmp    134b <main+0x20b>
mov    -0x91(%rbp),%al
mov    %al,-0x90(%rbp)
mov    -0xac(%rbp),%eax
add    $0x1,%eax
add    -0xb0(%rbp),%eax
mov    %eax,-0xb0(%rbp)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    128e <main+0x14e>
lea    0xc7a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xa4(%rbp)
cmpl   $0x1b,-0xa4(%rbp)
jge    1417 <main+0x2d7>
movslq -0xa4(%rbp),%rax
movsbl -0x90(%rbp,%rax,1),%esi
ff
lea    0xc53(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    13d9 <main+0x299>
mov    -0xb0(%rbp),%esi
lea    0xc50(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
lea    0xef8(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xec9(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
movaps 0xe6a(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x7877767574737271,%rax
76 77 78
mov    %rax,0x10(%rsp)
movw   $0x7a79,0x18(%rsp)
movb   $0x20,0x1a(%rsp)
lea    0xe54(%rip),%rdi
xor    %r15d,%r15d
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x61,%edi
call   1030 <putchar@plt>
mov    $0x62,%edi
call   1030 <putchar@plt>
mov    $0x63,%edi
call   1030 <putchar@plt>
mov    $0x64,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1030 <putchar@plt>
mov    $0x66,%edi
call   1030 <putchar@plt>
mov    $0x67,%edi
call   1030 <putchar@plt>
mov    $0x68,%edi
call   1030 <putchar@plt>
mov    $0x69,%edi
call   1030 <putchar@plt>
mov    $0x6a,%edi
call   1030 <putchar@plt>
mov    $0x6b,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x6d,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x70,%edi
call   1030 <putchar@plt>
mov    $0x71,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
call   1030 <putchar@plt>
mov    $0x73,%edi
call   1030 <putchar@plt>
mov    $0x74,%edi
call   1030 <putchar@plt>
mov    $0x75,%edi
call   1030 <putchar@plt>
mov    $0x76,%edi
call   1030 <putchar@plt>
mov    $0x77,%edi
call   1030 <putchar@plt>
mov    $0x78,%edi
call   1030 <putchar@plt>
mov    $0x79,%edi
call   1030 <putchar@plt>
mov    $0x7a,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xdb0(%rip),%rdi
call   1040 <puts@plt>
lea    0xd36(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2cf3(%rip),%rax
mov    (%rax),%edx
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x64,%esi
call   1080 <fgets@plt>
mov    %r14,%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     131e <main+0x1be>
movb   $0x0,(%rax)
lea    0x20(%rsp),%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    1544 <main+0x3e4>
xor    %ebx,%ebx
lea    0x20(%rsp),%r14
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
mov    0x20(%rsp,%rbx,1),%r8b
mov    $0x0,%esi
cmp    %r8b,(%rsp)
je     1522 <main+0x3c2>
mov    $0x1,%esi
cmp    %r8b,0x1(%rsp)
je     14d0 <main+0x370>
mov    $0x2,%esi
cmp    %r8b,0x2(%rsp)
je     14d0 <main+0x370>
mov    $0x3,%esi
cmp    %r8b,0x3(%rsp)
je     14d0 <main+0x370>
mov    $0x4,%esi
cmp    %r8b,0x4(%rsp)
je     14d0 <main+0x370>
mov    $0x5,%esi
cmp    %r8b,0x5(%rsp)
je     14d0 <main+0x370>
mov    $0x6,%esi
cmp    %r8b,0x6(%rsp)
je     14d0 <main+0x370>
mov    $0x7,%esi
cmp    %r8b,0x7(%rsp)
je     14d0 <main+0x370>
mov    $0x8,%esi
cmp    %r8b,0x8(%rsp)
je     14d0 <main+0x370>
mov    $0x9,%esi
cmp    %r8b,0x9(%rsp)
je     14d0 <main+0x370>
mov    $0xa,%esi
cmp    %r8b,0xa(%rsp)
je     14d0 <main+0x370>
mov    $0xb,%esi
cmp    %r8b,0xb(%rsp)
je     14d0 <main+0x370>
mov    $0xc,%esi
cmp    %r8b,0xc(%rsp)
je     14d0 <main+0x370>
mov    $0xd,%esi
cmp    %r8b,0xd(%rsp)
je     14d0 <main+0x370>
mov    $0xe,%esi
cmp    %r8b,0xe(%rsp)
je     14d0 <main+0x370>
mov    $0xf,%esi
cmp    %r8b,0xf(%rsp)
je     14d0 <main+0x370>
mov    $0x10,%esi
cmp    %r8b,0x10(%rsp)
je     14d0 <main+0x370>
mov    $0x11,%esi
cmp    %r8b,0x11(%rsp)
je     14d0 <main+0x370>
mov    $0x12,%esi
cmp    %r8b,0x12(%rsp)
je     14d0 <main+0x370>
mov    $0x13,%esi
cmp    %r8b,0x13(%rsp)
je     14d0 <main+0x370>
mov    $0x14,%esi
cmp    %r8b,0x14(%rsp)
je     14d0 <main+0x370>
mov    $0x15,%esi
cmp    %r8b,0x15(%rsp)
je     14d0 <main+0x370>
mov    $0x16,%esi
cmp    %r8b,0x16(%rsp)
je     14d0 <main+0x370>
mov    $0x17,%esi
cmp    %r8b,0x17(%rsp)
je     14d0 <main+0x370>
mov    $0x18,%esi
cmp    %r8b,0x18(%rsp)
je     14d0 <main+0x370>
mov    $0x19,%esi
cmp    %r8b,0x19(%rsp)
je     14d0 <main+0x370>
mov    $0x1a,%esi
cmp    %r8b,0x1a(%rsp)
jne    152d <main+0x3cd>
nopl   0x0(%rax)
lea    -0x1(%rsi),%r9
mov    %rsi,%rdi
mov    %rsi,%rdx
and    $0x3,%rdi
je     1505 <main+0x3a5>
mov    %rsi,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    -0x1(%rcx),%rdx
movzbl -0x1(%rsp,%rcx,1),%eax
mov    %al,(%rsp,%rcx,1)
mov    %rdx,%rcx
add    $0xffffffffffffffff,%rdi
jne    14f0 <main+0x390>
cmp    $0x3,%r9
jb     1522 <main+0x3c2>
add    $0x1,%rdx
nop
mov    -0x5(%rsp,%rdx,1),%eax
mov    %eax,-0x4(%rsp,%rdx,1)
add    $0xfffffffffffffffc,%rdx
cmp    $0x1,%rdx
ja     1510 <main+0x3b0>
mov    %r8b,(%rsp)
add    %esi,%r15d
add    $0x1,%r15d
add    $0x1,%rbx
mov    %r14,%rdi
call   1050 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1340 <main+0x1e0>
lea    0xac5(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movsbl (%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x1(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x2(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x3(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x4(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x5(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x6(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x7(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x8(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x9(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xa(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xb(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xc(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xd(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xe(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xf(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x10(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x11(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x12(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x13(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x14(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x15(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x16(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x17(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x18(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x19(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x1a(%rsp),%edi
call   1030 <putchar@plt>
lea    0x9d6(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xa14(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"###############################\0A\00"
@.str.1 = [33 x i8] c"### Move To Front Technique ###\0A\00"
@.str.2 = [13 x i8] c"\0AAlphabets: \00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [3 x i8] c"\0A\0A\00"
@.str.5 = [31 x i8] c"Enter String [max 100 chars]: \00"
@stdin = global i32 0
@.str.6 = [15 x i8] c"\0AProbes : %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [27 x i8]
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %13
13: ; preds = %23, %0
%14 = load i32, i32* %6
%15 = icmp slt i32 %14, 26
br i1 %15, label %16, label %26
16: ; preds = %13
%17 = load i32, i32* %6
%18 = add nsw i32 %17, 97
%19 = trunc i32 %18 to i8
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 %21
store i8 %19, i8* %22
br label %23
23: ; preds = %16
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %13
26: ; preds = %13
%27 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 26
store i8 32, i8* %27
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %29
29: ; preds = %39, %26
%30 = load i32, i32* %6
%31 = icmp slt i32 %30, 27
br i1 %31, label %32, label %42
32: ; preds = %29
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %32
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %29
42: ; preds = %29
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%45 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%46 = load i32, i32* @stdin
%47 = call i32 @fgets(i8* %45, i32 100, i32 %46)
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%49 = call i8* @strchr(i8* %48, i8 signext 10)
store i8* %49, i8** %5
%50 = load i8*, i8** %5
%51 = icmp ne i8* %50, null
br i1 %51, label %52, label %54
52: ; preds = %42
%53 = load i8*, i8** %5
store i8 0, i8* %53
br label %54
54: ; preds = %52, %42
store i32 0, i32* %9
store i32 0, i32* %6
br label %55
55: ; preds = %110, %54
%56 = load i32, i32* %6
%57 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%58 = call i32 @strlen(i8* %57)
%59 = icmp slt i32 %56, %58
br i1 %59, label %60, label %113
60: ; preds = %55
%61 = load i32, i32* %6
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %62
%64 = load i8, i8* %63
store i8 %64, i8* %4
store i32 -1, i32* %8
store i32 0, i32* %7
br label %65
65: ; preds = %80, %60
%66 = load i32, i32* %7
%67 = icmp slt i32 %66, 27
br i1 %67, label %68, label %83
68: ; preds = %65
%69 = load i32, i32* %7
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = load i8, i8* %4
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %73, %75
br i1 %76, label %77, label %79
77: ; preds = %68
%78 = load i32, i32* %7
store i32 %78, i32* %8
br label %83
79: ; preds = %68
br label %80
80: ; preds = %79
%81 = load i32, i32* %7
%82 = add nsw i32 %81, 1
store i32 %82, i32* %7
br label %65
83: ; preds = %77, %65
%84 = load i32, i32* %8
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %87
86: ; preds = %83
br label %110
87: ; preds = %83
%88 = load i32, i32* %8
store i32 %88, i32* %7
br label %89
89: ; preds = %92, %87
%90 = load i32, i32* %7
%91 = icmp sgt i32 %90, 0
br i1 %91, label %92, label %103
92: ; preds = %89
%93 = load i32, i32* %7
%94 = sub nsw i32 %93, 1
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 %95
%97 = load i8, i8* %96
%98 = load i32, i32* %7
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 %99
store i8 %97, i8* %100
%101 = load i32, i32* %7
%102 = add nsw i32 %101, -1
store i32 %102, i32* %7
br label %89
103: ; preds = %89
%104 = load i8, i8* %4
%105 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 0
store i8 %104, i8* %105
%106 = load i32, i32* %8
%107 = add nsw i32 %106, 1
%108 = load i32, i32* %9
%109 = add nsw i32 %108, %107
store i32 %109, i32* %9
br label %110
110: ; preds = %103, %86
%111 = load i32, i32* %6
%112 = add nsw i32 %111, 1
store i32 %112, i32* %6
br label %55
113: ; preds = %55
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %115
115: ; preds = %125, %113
%116 = load i32, i32* %6
%117 = icmp slt i32 %116, 27
br i1 %117, label %118, label %128
118: ; preds = %115
%119 = load i32, i32* %6
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 %120
%122 = load i8, i8* %121
%123 = sext i8 %122 to i32
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %123)
br label %125
125: ; preds = %118
%126 = load i32, i32* %6
%127 = add nsw i32 %126, 1
store i32 %127, i32* %6
br label %115
128: ; preds = %115
%129 = load i32, i32* %9
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %129)
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [13 x i8] c"\0AAlphabets: \00"
@.str.5 = [31 x i8] c"Enter String [max 100 chars]: \00"
@stdin = global i32 0
@.str.6 = [15 x i8] c"\0AProbes : %d\00"
@str.7 = [32 x i8] c"### Move To Front Technique ###\00"
@str.8 = [32 x i8] c"###############################\00"
@str.10 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [27 x i8]
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 1
%9 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 2
%10 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 3
%11 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 4
%12 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 5
%13 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 6
%14 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 7
%15 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 8
%16 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 9
%17 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 10
%18 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 11
%19 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 12
%20 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 13
%21 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 14
%22 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 15
%23 = bitcast [27 x i8]* %2 to <16 x i8>*
store <16 x i8> <i8 97, i8 98, i8 99, i8 100, i8 101, i8 102, i8 103, i8 104, i8 105, i8 106, i8 107, i8 108, i8 109, i8 110, i8 111, i8 112>, <16 x i8>* %23
%24 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 16
store i8 113, i8* %24
%25 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 17
store i8 114, i8* %25
%26 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 18
store i8 115, i8* %26
%27 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 19
store i8 116, i8* %27
%28 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 20
store i8 117, i8* %28
%29 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 21
store i8 118, i8* %29
%30 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 22
store i8 119, i8* %30
%31 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 23
store i8 120, i8* %31
%32 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 24
store i8 121, i8* %32
%33 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 25
store i8 122, i8* %33
%34 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 26
store i8 32, i8* %34
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%36 = tail call i32 @putchar(i32 97)
%37 = tail call i32 @putchar(i32 98)
%38 = tail call i32 @putchar(i32 99)
%39 = tail call i32 @putchar(i32 100)
%40 = tail call i32 @putchar(i32 101)
%41 = tail call i32 @putchar(i32 102)
%42 = tail call i32 @putchar(i32 103)
%43 = tail call i32 @putchar(i32 104)
%44 = tail call i32 @putchar(i32 105)
%45 = tail call i32 @putchar(i32 106)
%46 = tail call i32 @putchar(i32 107)
%47 = tail call i32 @putchar(i32 108)
%48 = tail call i32 @putchar(i32 109)
%49 = tail call i32 @putchar(i32 110)
%50 = tail call i32 @putchar(i32 111)
%51 = tail call i32 @putchar(i32 112)
%52 = tail call i32 @putchar(i32 113)
%53 = tail call i32 @putchar(i32 114)
%54 = tail call i32 @putchar(i32 115)
%55 = tail call i32 @putchar(i32 116)
%56 = tail call i32 @putchar(i32 117)
%57 = tail call i32 @putchar(i32 118)
%58 = tail call i32 @putchar(i32 119)
%59 = tail call i32 @putchar(i32 120)
%60 = tail call i32 @putchar(i32 121)
%61 = tail call i32 @putchar(i32 122)
%62 = tail call i32 @putchar(i32 32)
%63 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%65 = load i32, i32* @stdin
%66 = call i32 @fgets(i8* %6, i32 100, i32 %65)
%67 = call i8* @strchr(i8* %6, i8 signext 10)
%68 = icmp eq i8* %67, null
br i1 %68, label %70, label %69
69: ; preds = %0
store i8 0, i8* %67
br label %70
70: ; preds = %69, %0
%71 = call i32 @strlen(i8* %6)
%72 = icmp sgt i32 %71, 0
br i1 %72, label %73, label %205
73: ; preds = %70, %199
%74 = phi i64 [ %201, %199 ], [ 0, %70 ]
%75 = phi i32 [ %200, %199 ], [ 0, %70 ]
%76 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %74
%77 = load i8, i8* %76
%78 = load i8, i8* %7
%79 = icmp eq i8 %78, %77
br i1 %79, label %195, label %98
80: ; preds = %98, %101, %104, %107, %110, %113, %116, %119, %122, %125, %128, %131, %134, %137, %140, %143, %146, %149, %152, %155, %158, %161, %164, %167, %170, %173
%81 = phi i64 [ 26, %173 ], [ 25, %170 ], [ 24, %167 ], [ 23, %164 ], [ 22, %161 ], [ 21, %158 ], [ 20, %155 ], [ 19, %152 ], [ 18, %149 ], [ 17, %146 ], [ 16, %143 ], [ 15, %140 ], [ 14, %137 ], [ 13, %134 ], [ 12, %131 ], [ 11, %128 ], [ 10, %125 ], [ 9, %122 ], [ 8, %119 ], [ 7, %116 ], [ 6, %113 ], [ 5, %110 ], [ 4, %107 ], [ 3, %104 ], [ 2, %101 ], [ 1, %98 ]
%82 = trunc i64 %81 to i32
%83 = add nsw i64 %81, -1
%84 = and i64 %81, 3
%85 = icmp eq i64 %84, 0
br i1 %85, label %95, label %86
86: ; preds = %80, %86
%87 = phi i64 [ %89, %86 ], [ %81, %80 ]
%88 = phi i64 [ %93, %86 ], [ 0, %80 ]
%89 = add nsw i64 %87, -1
%90 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 %89
%91 = load i8, i8* %90
%92 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 %87
store i8 %91, i8* %92
%93 = add i64 %88, 1
%94 = icmp eq i64 %93, %84
br i1 %94, label %95, label %86
95: ; preds = %86, %80
%96 = phi i64 [ %81, %80 ], [ %89, %86 ]
%97 = icmp ult i64 %83, 3
br i1 %97, label %195, label %176
98: ; preds = %73
%99 = load i8, i8* %8
%100 = icmp eq i8 %99, %77
br i1 %100, label %80, label %101
101: ; preds = %98
%102 = load i8, i8* %9
%103 = icmp eq i8 %102, %77
br i1 %103, label %80, label %104
104: ; preds = %101
%105 = load i8, i8* %10
%106 = icmp eq i8 %105, %77
br i1 %106, label %80, label %107
107: ; preds = %104
%108 = load i8, i8* %11
%109 = icmp eq i8 %108, %77
br i1 %109, label %80, label %110
110: ; preds = %107
%111 = load i8, i8* %12
%112 = icmp eq i8 %111, %77
br i1 %112, label %80, label %113
113: ; preds = %110
%114 = load i8, i8* %13
%115 = icmp eq i8 %114, %77
br i1 %115, label %80, label %116
116: ; preds = %113
%117 = load i8, i8* %14
%118 = icmp eq i8 %117, %77
br i1 %118, label %80, label %119
119: ; preds = %116
%120 = load i8, i8* %15
%121 = icmp eq i8 %120, %77
br i1 %121, label %80, label %122
122: ; preds = %119
%123 = load i8, i8* %16
%124 = icmp eq i8 %123, %77
br i1 %124, label %80, label %125
125: ; preds = %122
%126 = load i8, i8* %17
%127 = icmp eq i8 %126, %77
br i1 %127, label %80, label %128
128: ; preds = %125
%129 = load i8, i8* %18
%130 = icmp eq i8 %129, %77
br i1 %130, label %80, label %131
131: ; preds = %128
%132 = load i8, i8* %19
%133 = icmp eq i8 %132, %77
br i1 %133, label %80, label %134
134: ; preds = %131
%135 = load i8, i8* %20
%136 = icmp eq i8 %135, %77
br i1 %136, label %80, label %137
137: ; preds = %134
%138 = load i8, i8* %21
%139 = icmp eq i8 %138, %77
br i1 %139, label %80, label %140
140: ; preds = %137
%141 = load i8, i8* %22
%142 = icmp eq i8 %141, %77
br i1 %142, label %80, label %143
143: ; preds = %140
%144 = load i8, i8* %24
%145 = icmp eq i8 %144, %77
br i1 %145, label %80, label %146
146: ; preds = %143
%147 = load i8, i8* %25
%148 = icmp eq i8 %147, %77
br i1 %148, label %80, label %149
149: ; preds = %146
%150 = load i8, i8* %26
%151 = icmp eq i8 %150, %77
br i1 %151, label %80, label %152
152: ; preds = %149
%153 = load i8, i8* %27
%154 = icmp eq i8 %153, %77
br i1 %154, label %80, label %155
155: ; preds = %152
%156 = load i8, i8* %28
%157 = icmp eq i8 %156, %77
br i1 %157, label %80, label %158
158: ; preds = %155
%159 = load i8, i8* %29
%160 = icmp eq i8 %159, %77
br i1 %160, label %80, label %161
161: ; preds = %158
%162 = load i8, i8* %30
%163 = icmp eq i8 %162, %77
br i1 %163, label %80, label %164
164: ; preds = %161
%165 = load i8, i8* %31
%166 = icmp eq i8 %165, %77
br i1 %166, label %80, label %167
167: ; preds = %164
%168 = load i8, i8* %32
%169 = icmp eq i8 %168, %77
br i1 %169, label %80, label %170
170: ; preds = %167
%171 = load i8, i8* %33
%172 = icmp eq i8 %171, %77
br i1 %172, label %80, label %173
173: ; preds = %170
%174 = load i8, i8* %34
%175 = icmp eq i8 %174, %77
br i1 %175, label %80, label %199
176: ; preds = %95, %176
%177 = phi i64 [ %190, %176 ], [ %96, %95 ]
%178 = add nsw i64 %177, -1
%179 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 %178
%180 = load i8, i8* %179
%181 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 %177
store i8 %180, i8* %181
%182 = add nsw i64 %177, -2
%183 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 %182
%184 = load i8, i8* %183
%185 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 %178
store i8 %184, i8* %185
%186 = add nsw i64 %177, -3
%187 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 %186
%188 = load i8, i8* %187
%189 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 %182
store i8 %188, i8* %189
%190 = add nsw i64 %177, -4
%191 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 %190
%192 = load i8, i8* %191
%193 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 %186
store i8 %192, i8* %193
%194 = icmp ugt i64 %186, 1
br i1 %194, label %176, label %195
195: ; preds = %95, %176, %73
%196 = phi i32 [ 0, %73 ], [ %82, %176 ], [ %82, %95 ]
store i8 %77, i8* %7
%197 = add nuw nsw i32 %196, 1
%198 = add nsw i32 %197, %75
br label %199
199: ; preds = %173, %195
%200 = phi i32 [ %198, %195 ], [ %75, %173 ]
%201 = add nuw nsw i64 %74, 1
%202 = call i32 @strlen(i8* %6)
%203 = sext i32 %202 to i64
%204 = icmp slt i64 %201, %203
br i1 %204, label %73, label %205
205: ; preds = %199, %70
%206 = phi i32 [ 0, %70 ], [ %200, %199 ]
%207 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%208 = load i8, i8* %7
%209 = sext i8 %208 to i32
%210 = call i32 @putchar(i32 %209)
%211 = load i8, i8* %8
%212 = sext i8 %211 to i32
%213 = call i32 @putchar(i32 %212)
%214 = load i8, i8* %9
%215 = sext i8 %214 to i32
%216 = call i32 @putchar(i32 %215)
%217 = load i8, i8* %10
%218 = sext i8 %217 to i32
%219 = call i32 @putchar(i32 %218)
%220 = load i8, i8* %11
%221 = sext i8 %220 to i32
%222 = call i32 @putchar(i32 %221)
%223 = load i8, i8* %12
%224 = sext i8 %223 to i32
%225 = call i32 @putchar(i32 %224)
%226 = load i8, i8* %13
%227 = sext i8 %226 to i32
%228 = call i32 @putchar(i32 %227)
%229 = load i8, i8* %14
%230 = sext i8 %229 to i32
%231 = call i32 @putchar(i32 %230)
%232 = load i8, i8* %15
%233 = sext i8 %232 to i32
%234 = call i32 @putchar(i32 %233)
%235 = load i8, i8* %16
%236 = sext i8 %235 to i32
%237 = call i32 @putchar(i32 %236)
%238 = load i8, i8* %17
%239 = sext i8 %238 to i32
%240 = call i32 @putchar(i32 %239)
%241 = load i8, i8* %18
%242 = sext i8 %241 to i32
%243 = call i32 @putchar(i32 %242)
%244 = load i8, i8* %19
%245 = sext i8 %244 to i32
%246 = call i32 @putchar(i32 %245)
%247 = load i8, i8* %20
%248 = sext i8 %247 to i32
%249 = call i32 @putchar(i32 %248)
%250 = load i8, i8* %21
%251 = sext i8 %250 to i32
%252 = call i32 @putchar(i32 %251)
%253 = load i8, i8* %22
%254 = sext i8 %253 to i32
%255 = call i32 @putchar(i32 %254)
%256 = load i8, i8* %24
%257 = sext i8 %256 to i32
%258 = call i32 @putchar(i32 %257)
%259 = load i8, i8* %25
%260 = sext i8 %259 to i32
%261 = call i32 @putchar(i32 %260)
%262 = load i8, i8* %26
%263 = sext i8 %262 to i32
%264 = call i32 @putchar(i32 %263)
%265 = load i8, i8* %27
%266 = sext i8 %265 to i32
%267 = call i32 @putchar(i32 %266)
%268 = load i8, i8* %28
%269 = sext i8 %268 to i32
%270 = call i32 @putchar(i32 %269)
%271 = load i8, i8* %29
%272 = sext i8 %271 to i32
%273 = call i32 @putchar(i32 %272)
%274 = load i8, i8* %30
%275 = sext i8 %274 to i32
%276 = call i32 @putchar(i32 %275)
%277 = load i8, i8* %31
%278 = sext i8 %277 to i32
%279 = call i32 @putchar(i32 %278)
%280 = load i8, i8* %32
%281 = sext i8 %280 to i32
%282 = call i32 @putchar(i32 %281)
%283 = load i8, i8* %33
%284 = sext i8 %283 to i32
%285 = call i32 @putchar(i32 %284)
%286 = load i8, i8* %34
%287 = sext i8 %286 to i32
%288 = call i32 @putchar(i32 %287)
%289 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %206)
%290 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}