#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*/ getchar();
int /*<<< orphan*/ puts(char *);
int main() {
  char a[] = "this is a book.", *p, *q, tmp;
  for (p = q = a; *q; q++)
    ;
  for (q--; p < q; p++, q--) {
    tmp = *p;
    *p = *q;
    *q = tmp;
  }
  puts(a);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     1174 <main+0x54>
jmp    1163 <main+0x43>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1151 <main+0x31>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    11c9 <main+0xa9>
mov    -0x28(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x31(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
mov    -0x31(%rbp),%cl
mov    -0x30(%rbp),%rax
mov    %cl,(%rax)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
jmp    1180 <main+0x60>
lea    -0x20(%rbp),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    -0x2(%rsp),%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x0,0x3(%rax)
lea    0x1(%rax),%rax
jne    1140 <main+0x20>
lea    0x1(%rax),%rcx
mov    %rsp,%rdx
cmp    %rcx,%rdx
jae    118d <main+0x6d>
mov    0x1(%rax),%cl
mov    %cl,(%rsp)
movb   $0x74,0x1(%rax)
lea    0x1(%rsp),%rcx
cmp    %rax,%rcx
jae    118d <main+0x6d>
lea    0x2(%rsp),%rcx
nop
movzbl -0x1(%rcx),%esi
movzbl (%rax),%edx
mov    %dl,-0x1(%rcx)
mov    %sil,(%rax)
add    $0xffffffffffffffff,%rax
lea    0x1(%rcx),%rdx
cmp    %rax,%rcx
mov    %rdx,%rcx
jb     1170 <main+0x50>
mov    %rsp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [16 x i8] c"this is a book.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i32 0, i32* %1
%6 = bitcast [16 x i8]* %2 to i8*
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
store i8* %7, i8** %4
store i8* %7, i8** %3
br label %8
8: ; preds = %13, %0
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %8
br label %13
13: ; preds = %12
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
br label %8
16: ; preds = %8
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i32 -1
store i8* %18, i8** %4
br label %19
19: ; preds = %31, %16
%20 = load i8*, i8** %3
%21 = load i8*, i8** %4
%22 = icmp ult i8* %20, %21
br i1 %22, label %23, label %36
23: ; preds = %19
%24 = load i8*, i8** %3
%25 = load i8, i8* %24
store i8 %25, i8* %5
%26 = load i8*, i8** %4
%27 = load i8, i8* %26
%28 = load i8*, i8** %3
store i8 %27, i8* %28
%29 = load i8, i8* %5
%30 = load i8*, i8** %4
store i8 %29, i8* %30
br label %31
31: ; preds = %23
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %3
%34 = load i8*, i8** %4
%35 = getelementptr inbounds i8, i8* %34, i32 -1
store i8* %35, i8** %4
br label %19
36: ; preds = %19
%37 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%38 = call i32 @puts(i8* %37)
%39 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [16 x i8] c"this is a book.\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 1
br label %4
4: ; preds = %0, %4
%5 = phi i8* [ %3, %0 ], [ %8, %4 ]
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = getelementptr inbounds i8, i8* %5, i64 1
br i1 %7, label %9, label %4
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %5, i64 -1
%11 = icmp ult i8* %2, %10
br i1 %11, label %12, label %25
12: ; preds = %9
%13 = load i8, i8* %10
store i8 %13, i8* %2
store i8 116, i8* %10
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 1
%15 = getelementptr inbounds i8, i8* %5, i64 -2
%16 = icmp ult i8* %14, %15
br i1 %16, label %17, label %25
17: ; preds = %12, %17
%18 = phi i8* [ %23, %17 ], [ %15, %12 ]
%19 = phi i8* [ %22, %17 ], [ %14, %12 ]
%20 = load i8, i8* %19
%21 = load i8, i8* %18
store i8 %21, i8* %19
store i8 %20, i8* %18
%22 = getelementptr inbounds i8, i8* %19, i64 1
%23 = getelementptr inbounds i8, i8* %18, i64 -1
%24 = icmp ult i8* %22, %23
br i1 %24, label %17, label %25
25: ; preds = %17, %12, %9
%26 = call i32 @puts(i8* %2)
%27 = call i32 (...) @getchar()
ret i32 0
}