#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int strlen(char *);
void main(void) {
  char l, w[1000];
  int a;
  int b;
  int c;
  b = 0;
  printf("insert text:", c);
  scanf("%d", &c);
  gets(w);
  a = strlen(w) - 1;
  while (a > b) {
    l = w[a];
    w[a] = w[b];
    w[b] = l;
    (b = b + 1, a = a - 1);
  }
  puts(w);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x3f8(%rbp)
mov    -0x3fc(%rbp),%esi
lea    0xe8e(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8f(%rip),%rdi
lea    -0x3fc(%rbp),%rsi
call   1070 <scanf@plt>
lea    -0x3f0(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x3f0(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
mov    -0x3f4(%rbp),%eax
cmp    -0x3f8(%rbp),%eax
jle    121e <main+0xce>
movslq -0x3f4(%rbp),%rax
mov    -0x3f0(%rbp,%rax,1),%al
mov    %al,-0x1(%rbp)
movslq -0x3f8(%rbp),%rax
mov    -0x3f0(%rbp,%rax,1),%cl
movslq -0x3f4(%rbp),%rax
mov    %cl,-0x3f0(%rbp,%rax,1)
mov    -0x1(%rbp),%cl
movslq -0x3f8(%rbp),%rax
mov    %cl,-0x3f0(%rbp,%rax,1)
mov    -0x3f8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f8(%rbp)
mov    -0x3f4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
jmp    11ab <main+0x5b>
lea    -0x3f0(%rbp),%rdi
call   1030 <puts@plt>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
lea    0xea1(%rip),%rdi
call   1050 <printf@plt>
lea    0xea2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     11c2 <main+0x72>
mov    %eax,%eax
add    $0xfffffffffffffffe,%rax
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
movzbl 0x11(%rsp,%rax,1),%edx
movzbl 0x10(%rsp,%rcx,1),%ebx
mov    %bl,0x11(%rsp,%rax,1)
mov    %dl,0x10(%rsp,%rcx,1)
add    $0x1,%rcx
lea    -0x1(%rax),%rdx
cmp    %rcx,%rax
mov    %rdx,%rax
jg     11a0 <main+0x50>
lea    0x10(%rsp),%rdi
call   1030 <puts@plt>
add    $0x400,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"insert text:\00"
@.str.1 = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca [1000 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 undef)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 @gets(i8* %3)
%8 = call i32 @strlen(i8* %3)
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %23
10: ; preds = %0
%11 = zext i32 %8 to i64
%12 = add nsw i64 %11, -1
br label %13
13: ; preds = %10, %13
%14 = phi i64 [ 0, %10 ], [ %20, %13 ]
%15 = phi i64 [ %12, %10 ], [ %21, %13 ]
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %14
%19 = load i8, i8* %18
store i8 %19, i8* %16
store i8 %17, i8* %18
%20 = add nuw nsw i64 %14, 1
%21 = add nsw i64 %15, -1
%22 = icmp sgt i64 %21, %20
br i1 %22, label %13, label %23
23: ; preds = %13, %0
%24 = call i32 @puts(i8* %3)
ret void
}