#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*/ assert(int /*<<< orphan*/);
char *strrev_(char *pStr) {
  assert(pStr != NULL);
  char *head = pStr;
  char *tail = pStr;
  char tmp;
  while (*tail != '\0')
    ++tail;
  for (--tail; head < tail; ++head, --tail) {
    tmp = *head;
    *head = *tail;
    *tail = tmp;
  }
  return pStr;
}


x86 assembly (clang, -O0):
<strrev_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115f <strrev_+0x4f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    113e <strrev_+0x2e>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11b4 <strrev_+0xa4>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x19(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    116b <strrev_+0x5b>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strrev_>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
lea    -0x2(%r14),%rax
nopl   0x0(%rax)
cmpb   $0x0,0x2(%rax)
lea    0x1(%rax),%rax
jne    1130 <strrev_+0x20>
cmp    %r14,%rax
jbe    116c <strrev_+0x5c>
lea    0x1(%r14),%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
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     1150 <strrev_+0x40>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strrev_(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = icmp ne i8* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i8*, i8** %2
store i8* %10, i8** %3
%11 = load i8*, i8** %2
store i8* %11, i8** %4
br label %12
12: ; preds = %17, %1
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %4
br label %12
20: ; preds = %12
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i32 -1
store i8* %22, i8** %4
br label %23
23: ; preds = %35, %20
%24 = load i8*, i8** %3
%25 = load i8*, i8** %4
%26 = icmp ult i8* %24, %25
br i1 %26, label %27, label %40
27: ; preds = %23
%28 = load i8*, i8** %3
%29 = load i8, i8* %28
store i8 %29, i8* %5
%30 = load i8*, i8** %4
%31 = load i8, i8* %30
%32 = load i8*, i8** %3
store i8 %31, i8* %32
%33 = load i8, i8* %5
%34 = load i8*, i8** %4
store i8 %33, i8* %34
br label %35
35: ; preds = %27
%36 = load i8*, i8** %3
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %3
%38 = load i8*, i8** %4
%39 = getelementptr inbounds i8, i8* %38, i32 -1
store i8* %39, i8** %4
br label %23
40: ; preds = %23
%41 = load i8*, i8** %2
ret i8* %41
}

LLVM IR (-O2):
define i8* @strrev_(i8* returned %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
br label %5
5: ; preds = %5, %1
%6 = phi i8* [ %0, %1 ], [ %9, %5 ]
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = getelementptr inbounds i8, i8* %6, i64 1
br i1 %8, label %10, label %5
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %6, i64 -1
%12 = icmp ugt i8* %11, %0
br i1 %12, label %13, label %21
13: ; preds = %10, %13
%14 = phi i8* [ %19, %13 ], [ %11, %10 ]
%15 = phi i8* [ %18, %13 ], [ %0, %10 ]
%16 = load i8, i8* %15
%17 = load i8, i8* %14
store i8 %17, i8* %15
store i8 %16, i8* %14
%18 = getelementptr inbounds i8, i8* %15, i64 1
%19 = getelementptr inbounds i8, i8* %14, i64 -1
%20 = icmp ult i8* %18, %19
br i1 %20, label %13, label %21
21: ; preds = %13, %10
ret i8* %0
}