#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 strlen(char *);
void voltea(void) {
  int i;
  int j;
  extern char linea[], linea_max[];
  i = 0;
  j = strlen(linea) - 1;
  while (j != 0) {
    *(linea_max + i) = *(linea + j);
    i++, j--;
  }
}


x86 assembly (clang, -O0):
<voltea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eca(%rip),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     116e <voltea+0x5e>
movslq -0x8(%rbp),%rcx
mov    0x2eaa(%rip),%rax
mov    (%rax,%rcx,1),%dl
movslq -0x4(%rbp),%rcx
mov    0x2e84(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1131 <voltea+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<voltea>:
push   %r14
push   %rbx
push   %rax
mov    0x2ed5(%rip),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
add    $0xffffffff,%eax
je     1293 <voltea+0x183>
movslq %eax,%rcx
mov    %ecx,%r9d
cmp    $0x8,%ecx
jae    113e <voltea+0x2e>
xor    %eax,%eax
jmp    1267 <voltea+0x157>
cmp    $0x20,%eax
jae    114a <voltea+0x3a>
xor    %eax,%eax
jmp    11fc <voltea+0xec>
mov    %r9d,%eax
and    $0xffffffe0,%eax
mov    %rax,%r8
neg    %r8
lea    (%rcx,%r14,1),%rdi
add    $0xfffffffffffffff1,%rdi
mov    0x2e73(%rip),%rbx
add    $0x10,%rbx
xor    %esi,%esi
pxor   %xmm0,%xmm0
nop
movdqu -0x10(%rdi,%rsi,1),%xmm1
movdqu (%rdi,%rsi,1),%xmm2
movdqa %xmm2,%xmm3
punpcklbw %xmm0,%xmm3
pshufd $0x4e,%xmm3,%xmm3
pshuflw $0x1b,%xmm3,%xmm3
pshufhw $0x1b,%xmm3,%xmm3
punpckhbw %xmm0,%xmm2
pshufd $0x4e,%xmm2,%xmm2
pshuflw $0x1b,%xmm2,%xmm2
pshufhw $0x1b,%xmm2,%xmm2
packuswb %xmm3,%xmm2
movdqa %xmm1,%xmm3
punpcklbw %xmm0,%xmm3
pshufd $0x4e,%xmm3,%xmm3
pshuflw $0x1b,%xmm3,%xmm3
pshufhw $0x1b,%xmm3,%xmm3
punpckhbw %xmm0,%xmm1
pshufd $0x4e,%xmm1,%xmm1
pshuflw $0x1b,%xmm1,%xmm1
pshufhw $0x1b,%xmm1,%xmm1
packuswb %xmm3,%xmm1
movdqu %xmm2,-0x10(%rbx)
movdqu %xmm1,(%rbx)
add    $0x20,%rbx
add    $0xffffffffffffffe0,%rsi
cmp    %rsi,%r8
jne    1170 <voltea+0x60>
cmp    %r9,%rax
je     1293 <voltea+0x183>
test   $0x18,%r9b
je     1264 <voltea+0x154>
mov    %rax,%rsi
mov    %r9d,%eax
and    $0xfffffff8,%eax
mov    0x2dcc(%rip),%rdi
add    %rsi,%rdi
mov    %rax,%rbx
neg    %rbx
neg    %rsi
lea    (%rcx,%r14,1),%rdx
add    $0xfffffffffffffff9,%rdx
sub    %rax,%rcx
pxor   %xmm0,%xmm0
nopw   0x0(%rax,%rax,1)
movq   (%rdx,%rsi,1),%xmm1
punpcklbw %xmm0,%xmm1
pshufd $0x4e,%xmm1,%xmm1
pshuflw $0x1b,%xmm1,%xmm1
pshufhw $0x1b,%xmm1,%xmm1
packuswb %xmm1,%xmm1
movq   %xmm1,(%rdi)
add    $0x8,%rdi
add    $0xfffffffffffffff8,%rsi
cmp    %rsi,%rbx
jne    1230 <voltea+0x120>
cmp    %r9,%rax
jne    1267 <voltea+0x157>
jmp    1293 <voltea+0x183>
sub    %rax,%rcx
add    0x2d82(%rip),%rcx
mov    0x2d63(%rip),%rdx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rcx),%ebx
mov    %bl,(%rdx,%rax,1)
add    $0x1,%rax
add    $0xffffffffffffffff,%rcx
cmp    %rax,%r9
jne    1280 <voltea+0x170>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@linea = external global [0 x i8]
@linea_max = external global [0 x i8]
define void @voltea() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @strlen(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @linea, i64 0, i64 0))
%4 = sub nsw i32 %3, 1
store i32 %4, i32* %2
br label %5
5: ; preds = %8, %0
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @linea, i64 0, i64 0), i64 %10
%12 = load i8, i8* %11
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @linea_max, i64 0, i64 0), i64 %14
store i8 %12, i8* %15
%16 = load i32, i32* %1
%17 = add nsw i32 %16, 1
store i32 %17, i32* %1
%18 = load i32, i32* %2
%19 = add nsw i32 %18, -1
store i32 %19, i32* %2
br label %5
20: ; preds = %5
ret void
}

LLVM IR (-O2):
@linea = external global [0 x i8]
@linea_max = external global [0 x i8]
define void @voltea() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @linea, i64 0, i64 0))
%2 = add i32 %1, -1
%3 = icmp eq i32 %2, 0
br i1 %3, label %66, label %4
4: ; preds = %0
%5 = sext i32 %2 to i64
%6 = zext i32 %2 to i64
%7 = icmp ult i32 %2, 8
br i1 %7, label %54, label %8
8: ; preds = %4
%9 = icmp ult i32 %2, 32
br i1 %9, label %36, label %10
10: ; preds = %8
%11 = and i64 %6, 4294967264
br label %12
12: ; preds = %12, %10
%13 = phi i64 [ 0, %10 ], [ %28, %12 ]
%14 = sub i64 %5, %13
%15 = getelementptr inbounds [0 x i8], [0 x i8]* @linea, i64 0, i64 %14
%16 = getelementptr inbounds i8, i8* %15, i64 -15
%17 = bitcast i8* %16 to <16 x i8>*
%18 = load <16 x i8>, <16 x i8>* %17
%19 = shufflevector <16 x i8> %18, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%20 = getelementptr inbounds i8, i8* %15, i64 -31
%21 = bitcast i8* %20 to <16 x i8>*
%22 = load <16 x i8>, <16 x i8>* %21
%23 = shufflevector <16 x i8> %22, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%24 = getelementptr inbounds [0 x i8], [0 x i8]* @linea_max, i64 0, i64 %13
%25 = bitcast i8* %24 to <16 x i8>*
store <16 x i8> %19, <16 x i8>* %25
%26 = getelementptr inbounds i8, i8* %24, i64 16
%27 = bitcast i8* %26 to <16 x i8>*
store <16 x i8> %23, <16 x i8>* %27
%28 = add nuw i64 %13, 32
%29 = icmp eq i64 %28, %11
br i1 %29, label %30, label %12
30: ; preds = %12
%31 = icmp eq i64 %11, %6
br i1 %31, label %66, label %32
32: ; preds = %30
%33 = sub nsw i64 %5, %11
%34 = and i64 %6, 24
%35 = icmp eq i64 %34, 0
br i1 %35, label %54, label %36
36: ; preds = %8, %32
%37 = phi i64 [ %11, %32 ], [ 0, %8 ]
%38 = and i64 %6, 4294967288
%39 = sub nsw i64 %5, %38
br label %40
40: ; preds = %40, %36
%41 = phi i64 [ %37, %36 ], [ %50, %40 ]
%42 = sub i64 %5, %41
%43 = getelementptr inbounds [0 x i8], [0 x i8]* @linea, i64 0, i64 %42
%44 = getelementptr inbounds i8, i8* %43, i64 -7
%45 = bitcast i8* %44 to <8 x i8>*
%46 = load <8 x i8>, <8 x i8>* %45
%47 = shufflevector <8 x i8> %46, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%48 = getelementptr inbounds [0 x i8], [0 x i8]* @linea_max, i64 0, i64 %41
%49 = bitcast i8* %48 to <8 x i8>*
store <8 x i8> %47, <8 x i8>* %49
%50 = add nuw i64 %41, 8
%51 = icmp eq i64 %50, %38
br i1 %51, label %52, label %40
52: ; preds = %40
%53 = icmp eq i64 %38, %6
br i1 %53, label %66, label %54
54: ; preds = %4, %32, %52
%55 = phi i64 [ 0, %4 ], [ %11, %32 ], [ %38, %52 ]
%56 = phi i64 [ %5, %4 ], [ %33, %32 ], [ %39, %52 ]
br label %57
57: ; preds = %54, %57
%58 = phi i64 [ %63, %57 ], [ %55, %54 ]
%59 = phi i64 [ %64, %57 ], [ %56, %54 ]
%60 = getelementptr inbounds [0 x i8], [0 x i8]* @linea, i64 0, i64 %59
%61 = load i8, i8* %60
%62 = getelementptr inbounds [0 x i8], [0 x i8]* @linea_max, i64 0, i64 %58
store i8 %61, i8* %62
%63 = add nuw nsw i64 %58, 1
%64 = add nsw i64 %59, -1
%65 = icmp eq i64 %63, %6
br i1 %65, label %66, label %57
66: ; preds = %57, %30, %52, %0
ret void
}