#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 *, char *);
int strlen(char *);
int main(void) {
  char arr[256];
  int x, i;
  while (1) {
    printf("Enter string:\n\nYour statement:");
    scanf("%s", arr);
    x = strlen(arr);
    printf("Reverse:       ");
    for (i = x - 1; i >= 0; i--)
      printf("%c", arr[i]);
    printf("\n");
    for (i = 0; i <= x + 15; i++)
      printf("*");
    printf("\n\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x110(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x110(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x114(%rbp)
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x114(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x118(%rbp)
cmpl   $0x0,-0x118(%rbp)
jl     11d0 <main+0xa0>
movslq -0x118(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%esi
ff
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x118(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x118(%rbp)
jmp    1192 <main+0x62>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x118(%rbp)
mov    -0x118(%rbp),%eax
mov    -0x114(%rbp),%ecx
add    $0xf,%ecx
cmp    %ecx,%eax
jg     1221 <main+0xf1>
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x118(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x118(%rbp)
jmp    11e8 <main+0xb8>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1142 <main+0x12>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
lea    0xeb7(%rip),%r15
mov    %rsp,%rbx
lea    0xeb0(%rip),%r12
lea    0xeb9(%rip),%r13
jmp    1188 <main+0x38>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1040 <puts@plt>
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
test   %ebp,%ebp
jle    11d7 <main+0x87>
mov    %ebp,%r14d
add    $0x1,%r14
lea    -0x2(%r14),%eax
movsbl (%rsp,%rax,1),%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%r14
cmp    $0x1,%r14
ja     11c0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0xfffffff1,%ebp
jl     1180 <main+0x30>
add    $0xf,%ebp
test   %ebp,%ebp
mov    $0x0,%eax
cmovle %eax,%ebp
add    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1200 <main+0xb0>
jmp    1180 <main+0x30>

LLVM IR (-O0):
@.str = [31 x i8] c"Enter string:\0A\0AYour statement:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [16 x i8] c"Reverse: \00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [2 x i8] c"*\00"
@.str.6 = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %0, %39
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %4
br label %14
14: ; preds = %24, %5
%15 = load i32, i32* %4
%16 = icmp sge i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %17
%25 = load i32, i32* %4
%26 = add nsw i32 %25, -1
store i32 %26, i32* %4
br label %14
27: ; preds = %14
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %4
br label %29
29: ; preds = %36, %27
%30 = load i32, i32* %4
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 15
%33 = icmp sle i32 %30, %32
br i1 %33, label %34, label %39
34: ; preds = %29
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %36
36: ; preds = %34
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %29
39: ; preds = %29
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %5
}

LLVM IR (-O2):
@.str = [31 x i8] c"Enter string:\0A\0AYour statement:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [16 x i8] c"Reverse: \00"
@str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %31, %0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = call i32 @strlen(i8* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp sgt i32 %6, 0
br i1 %8, label %9, label %20
9: ; preds = %3
%10 = zext i32 %6 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ %10, %9 ], [ %13, %11 ]
%13 = add nsw i64 %12, -1
%14 = and i64 %13, 4294967295
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = call i32 @putchar(i32 %17)
%19 = icmp ugt i64 %12, 1
br i1 %19, label %11, label %20
20: ; preds = %11, %3
%21 = call i32 @putchar(i32 10)
%22 = icmp slt i32 %6, -15
br i1 %22, label %31, label %23
23: ; preds = %20
%24 = add i32 %6, 15
%25 = call i32 @llvm.smax.i32(i32 %24, i32 0)
br label %26
26: ; preds = %23, %26
%27 = phi i32 [ %29, %26 ], [ 0, %23 ]
%28 = call i32 @putchar(i32 42)
%29 = add nuw i32 %27, 1
%30 = icmp eq i32 %27, %25
br i1 %30, label %31, label %26
31: ; preds = %26, %20
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %3
}