#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*/ LC_ALL;
int /*<<< orphan*/ printText(char *, int);
int /*<<< orphan*/ printf(char *);
int rand();
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  setlocale(LC_ALL, "RUS");
  char text[80], sym;
  char *head, *tail;
  int i;
  srand(time(NULL));
  for (i = 0; i < 80; i++) {
    text[i] = 97 + (rand() % 25);
  }
  printf("Исходный массив символов:\n");
  printText(text, 80);
  for (head = text, tail = &text[80 - 1]; head < tail;) {
    sym = *head;
    *head++ = *tail;
    *tail-- = sym;
  }
  printf("В обратном порядке:\n");
  printText(text, 80);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
lea    0xe7e(%rip),%rsi
call   1060 <setlocale@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x7c(%rbp)
cmpl   $0x50,-0x7c(%rbp)
jge    11d2 <main+0x72>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x19,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %dl,%cl
movslq -0x7c(%rbp),%rax
mov    %cl,-0x60(%rbp,%rax,1)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    119e <main+0x3e>
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x50,%esi
call   1070 <printText@plt>
lea    -0x60(%rbp),%rax
mov    %rax,-0x70(%rbp)
lea    -0x60(%rbp),%rax
add    $0x4f,%rax
mov    %rax,-0x78(%rbp)
mov    -0x70(%rbp),%rax
cmp    -0x78(%rbp),%rax
jae    1247 <main+0xe7>
mov    -0x70(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x61(%rbp)
mov    -0x78(%rbp),%rax
mov    (%rax),%cl
mov    -0x70(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x70(%rbp)
mov    %cl,(%rax)
mov    -0x61(%rbp),%cl
mov    -0x78(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x78(%rbp)
mov    %cl,(%rax)
jmp    1200 <main+0xa0>
lea    0xde7(%rip),%rdi
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x50,%esi
call   1070 <printText@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
lea    0xe8b(%rip),%rsi
call   1060 <setlocale@plt>
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x61,%al
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x50,%rbx
jne    1190 <main+0x30>
lea    0xe39(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
mov    $0x50,%esi
call   1070 <printText@plt>
lea    0x4f(%rsp),%rax
lea    0x1(%rsp),%rcx
nopw   0x0(%rax,%rax,1)
movzbl -0x1(%rcx),%edx
movzbl (%rax),%ebx
mov    %bl,-0x1(%rcx)
mov    %dl,(%rax)
add    $0xffffffffffffffff,%rax
lea    0x1(%rcx),%rdx
cmp    %rax,%rcx
mov    %rdx,%rcx
jb     11f0 <main+0x90>
lea    0xe21(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
mov    $0x50,%esi
call   1070 <printText@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [4 x i8] c"RUS\00"
@.str.1 = [49 x i8] c"\D0\98\D1\81\D1\85\D0\BE\D0\B4\D0\BD\D1\8B\D0\B9 \D0\BC\D0\B0\D1\81\D1\81\D0\B8\D0\B2 \D1\81\D0\B8\D0\BC\D0\B2\D0\BE\D0\BB\D0\BE\D0\B2:\0A\00"
@.str.2 = [37 x i8] c"\D0\92 \D0\BE\D0\B1\D1\80\D0\B0\D1\82\D0\BD\D0\BE\D0\BC \D0\BF\D0\BE\D1\80\D1\8F\D0\B4\D0\BA\D0\B5:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i32 0, i32* %1
%7 = load i32, i32* @LC_ALL
%8 = call i32 @setlocale(i32 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @time(i32* null)
%10 = call i32 @srand(i32 %9)
store i32 0, i32* %6
br label %11
11: ; preds = %22, %0
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 80
br i1 %13, label %14, label %25
14: ; preds = %11
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 25
%17 = add nsw i32 97, %16
%18 = trunc i32 %17 to i8
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %20
store i8 %18, i8* %21
br label %22
22: ; preds = %14
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 1
store i32 %24, i32* %6
br label %11
25: ; preds = %11
%26 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%27 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%28 = call i32 @printText(i8* %27, i32 80)
%29 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
store i8* %29, i8** %4
%30 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 79
store i8* %30, i8** %5
br label %31
31: ; preds = %35, %25
%32 = load i8*, i8** %4
%33 = load i8*, i8** %5
%34 = icmp ult i8* %32, %33
br i1 %34, label %35, label %45
35: ; preds = %31
%36 = load i8*, i8** %4
%37 = load i8, i8* %36
store i8 %37, i8* %3
%38 = load i8*, i8** %5
%39 = load i8, i8* %38
%40 = load i8*, i8** %4
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %4
store i8 %39, i8* %40
%42 = load i8, i8* %3
%43 = load i8*, i8** %5
%44 = getelementptr inbounds i8, i8* %43, i32 -1
store i8* %44, i8** %5
store i8 %42, i8* %43
br label %31
45: ; preds = %31
%46 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%47 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%48 = call i32 @printText(i8* %47, i32 80)
ret i32 0
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [4 x i8] c"RUS\00"
@str = [48 x i8] c"\D0\98\D1\81\D1\85\D0\BE\D0\B4\D0\BD\D1\8B\D0\B9 \D0\BC\D0\B0\D1\81\D1\81\D0\B8\D0\B2 \D1\81\D0\B8\D0\BC\D0\B2\D0\BE\D0\BB\D0\BE\D0\B2:\00"
@str.3 = [36 x i8] c"\D0\92 \D0\BE\D0\B1\D1\80\D0\B0\D1\82\D0\BD\D0\BE\D0\BC \D0\BF\D0\BE\D1\80\D1\8F\D0\B4\D0\BA\D0\B5:\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = load i32, i32* @LC_ALL
%3 = tail call i32 @setlocale(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srand(i32 %5)
br label %7
7: ; preds = %0, %7
%8 = phi i64 [ 0, %0 ], [ %14, %7 ]
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 25
%11 = trunc i32 %10 to i8
%12 = add nsw i8 %11, 97
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %8
store i8 %12, i8* %13
%14 = add nuw nsw i64 %8, 1
%15 = icmp eq i64 %14, 80
br i1 %15, label %16, label %7
16: ; preds = %7
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%18 = call i32 @printText(i8* %4, i32 80)
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 79
br label %20
20: ; preds = %16, %20
%21 = phi i8* [ %19, %16 ], [ %26, %20 ]
%22 = phi i8* [ %4, %16 ], [ %25, %20 ]
%23 = load i8, i8* %22
%24 = load i8, i8* %21
%25 = getelementptr inbounds i8, i8* %22, i64 1
store i8 %24, i8* %22
%26 = getelementptr inbounds i8, i8* %21, i64 -1
store i8 %23, i8* %21
%27 = icmp ult i8* %25, %26
br i1 %27, label %20, label %28
28: ; preds = %20
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.3, i64 0, i64 0))
%30 = call i32 @printText(i8* %4, i32 80)
ret i32 0
}