#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*/ strcpy(char *, char *);
int strlen(char *);
void invertString(char *inverterized) {
  int size = strlen(inverterized) - 1;
  char *invertable = inverterized;
  char output[size];
  int x = 0;
  while (size >= x) {
    output[x] = invertable[size - x];
    ++x;
  }
  strcpy(invertable, output);
}


x86 assembly (clang, -O0):
<invertString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jl     11a5 <invertString+0x85>
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    -0xc(%rbp),%edx
sub    -0x2c(%rbp),%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,1),%dl
movslq -0x2c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1170 <invertString+0x50>
mov    -0x38(%rbp),%rsi
mov    -0x18(%rbp),%rdi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<invertString>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    -0x1(%rax),%ecx
mov    %rsp,%rsi
lea    0xf(%rcx),%rdx
and    $0xfffffffffffffff0,%rdx
sub    %rdx,%rsi
mov    %rsi,%rsp
test   %eax,%eax
jle    1283 <invertString+0x163>
mov    %ecx,%edx
mov    %eax,%r8d
cmp    $0x8,%eax
jae    115c <invertString+0x3c>
xor    %eax,%eax
jmp    1262 <invertString+0x142>
cmp    $0x20,%eax
jae    1168 <invertString+0x48>
xor    %eax,%eax
jmp    120c <invertString+0xec>
mov    %r8d,%eax
and    $0xffffffe0,%eax
lea    (%rdx,%r14,1),%rdi
add    $0xfffffffffffffff1,%rdi
xor    %ebx,%ebx
pxor   %xmm0,%xmm0
nopl   0x0(%rax)
movdqu -0x10(%rdi),%xmm1
movdqu (%rdi),%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
movdqa %xmm2,(%rsi,%rbx,1)
movdqa %xmm1,0x10(%rsi,%rbx,1)
add    $0x20,%rbx
add    $0xffffffffffffffe0,%rdi
cmp    %rbx,%rax
jne    1180 <invertString+0x60>
cmp    %r8,%rax
je     1283 <invertString+0x163>
test   $0x18,%r8b
je     1262 <invertString+0x142>
mov    %rax,%rdi
mov    %r8d,%eax
and    $0xfffffff8,%eax
mov    %rdx,%rcx
sub    %rdi,%rcx
lea    (%rcx,%r14,1),%rbx
add    $0xfffffffffffffff9,%rbx
pxor   %xmm0,%xmm0
nopw   0x0(%rax,%rax,1)
movq   (%rbx),%xmm1
punpcklbw %xmm0,%xmm1
pshufd $0x4e,%xmm1,%xmm1
pshuflw $0x1b,%xmm1,%xmm1
pshufhw $0x1b,%xmm1,%xmm1
packuswb %xmm1,%xmm1
movq   %xmm1,(%rsi,%rdi,1)
add    $0x8,%rdi
add    $0xfffffffffffffff8,%rbx
cmp    %rdi,%rax
jne    1230 <invertString+0x110>
cmp    %r8,%rax
je     1283 <invertString+0x163>
sub    %rax,%rdx
add    %r14,%rdx
nopl   0x0(%rax,%rax,1)
movzbl (%rdx),%ecx
mov    %cl,(%rsi,%rax,1)
add    $0x1,%rax
add    $0xffffffffffffffff,%rdx
cmp    %rax,%r8
jne    1270 <invertString+0x150>
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @invertString(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i8* %0, i8** %2
%8 = load i8*, i8** %2
%9 = call i32 @strlen(i8* %8)
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %3
%11 = load i8*, i8** %2
store i8* %11, i8** %4
%12 = load i32, i32* %3
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %5
%15 = alloca i8, i64 %13
store i64 %13, i64* %6
store i32 0, i32* %7
br label %16
16: ; preds = %20, %1
%17 = load i32, i32* %3
%18 = load i32, i32* %7
%19 = icmp sge i32 %17, %18
br i1 %19, label %20, label %33
20: ; preds = %16
%21 = load i8*, i8** %4
%22 = load i32, i32* %3
%23 = load i32, i32* %7
%24 = sub nsw i32 %22, %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %21, i64 %25
%27 = load i8, i8* %26
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %15, i64 %29
store i8 %27, i8* %30
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %16
33: ; preds = %16
%34 = load i8*, i8** %4
%35 = call i32 @strcpy(i8* %34, i8* %15)
%36 = load i8*, i8** %5
ret void
}

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