void main(void) {
  char a[1000];
  int i = 0, b = 0;
  printf("\n enter word:");
  scanf("%s", &a);
  while (b = 0) {
    if (a[i] == '\0')
      b = 1;
    else
      i++;
  }
  while (i != 0) {
    printf(" %s ", a[i]);
    i--;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x3f4(%rbp)
movl   $0x0,-0x3f8(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x3f0(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x3f8(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    117b <main+0x5b>
jmp    11b6 <main+0x96>
movslq -0x3f4(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    11a2 <main+0x82>
movl   $0x1,-0x3f8(%rbp)
jmp    11b1 <main+0x91>
mov    -0x3f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
jmp    1162 <main+0x42>
jmp    11bb <main+0x9b>
cmpl   $0x0,-0x3f4(%rbp)
je     11f9 <main+0xd9>
movslq -0x3f4(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%esi
ff
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x3f4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3f4(%rbp)
jmp    11bb <main+0x9b>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x3e8,%rsp
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x3e8,%rsp
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"\0A enter word:\00"
@.str.1 = [3 x i8] c"%s\00"
define void @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [1000 x i8]* %1)
ret void
}