#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);
char *str_reverse(char *);
int /*<<< orphan*/ str_reverse_1(char *, int /*<<< orphan*/, int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int main() {
  assert(strcmp("a", str_reverse("a")) == 0);
  assert(strcmp("tikna", str_reverse("ankit")) == 0);
  assert(strcmp("lerhkop tikna", str_reverse("ankit pokhrel")) == 0);
  assert(strcmp(".egaugnaL gnimmargorP C",
                str_reverse("C Programming Language.")) == 0);
  assert(strcmp("!dlrow yzarc a si sihT",
                str_reverse("This is a crazy world!")) == 0);
  assert(
      strcmp(".tile gnicsipida rutetcesnoc ,tema tis rolod muspi meroL",
             str_reverse(
                 "Lorem ipsum dolor sit amet, consectetur adipiscing elit.")) ==
      0);
  char s[20] = "ankit";
  str_reverse_1(s, 0, (int)strlen(s) - 1);
  assert(strcmp("tikna", s) == 0);
  strcpy(s, "ankit pokhrel");
  str_reverse_1(s, 0, (int)strlen(s) - 1);
  assert(strcmp("lerhkop tikna", s) == 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9c(%rip),%rdi
call   1050 <str_reverse@plt>
mov    %rax,%rsi
lea    0xe8d(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
lea    0xe5e(%rip),%rdi
call   1050 <str_reverse@plt>
mov    %rax,%rsi
lea    0xe5d(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
lea    0xe46(%rip),%rdi
call   1050 <str_reverse@plt>
mov    %rax,%rsi
lea    0xe29(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
lea    0xe40(%rip),%rdi
call   1050 <str_reverse@plt>
mov    %rax,%rsi
lea    0xe19(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
lea    0xe43(%rip),%rdi
call   1050 <str_reverse@plt>
mov    %rax,%rsi
lea    0xe1d(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
lea    0xe67(%rip),%rdi
call   1050 <str_reverse@plt>
mov    %rax,%rsi
lea    0xe1f(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    0xe82(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe7f(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe7d(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1080 <str_reverse_1@plt>
lea    -0x20(%rbp),%rsi
lea    0xd4c(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
lea    -0x20(%rbp),%rdi
lea    0xd31(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1080 <str_reverse_1@plt>
lea    -0x20(%rbp),%rsi
lea    0xcf2(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xea0(%rip),%rbx
mov    %rbx,%rdi
call   1050 <str_reverse@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1060 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
lea    0xe66(%rip),%rdi
call   1050 <str_reverse@plt>
lea    0xe68(%rip),%r12
mov    %r12,%rdi
mov    %rax,%rsi
call   1060 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
lea    0xe4e(%rip),%r15
mov    %r15,%rdi
call   1050 <str_reverse@plt>
lea    0xe31(%rip),%r14
mov    %r14,%rdi
mov    %rax,%rsi
call   1060 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
lea    0xe45(%rip),%rdi
call   1050 <str_reverse@plt>
lea    0xe21(%rip),%rdi
mov    %rax,%rsi
call   1060 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
lea    0xe4b(%rip),%rdi
call   1050 <str_reverse@plt>
lea    0xe28(%rip),%rdi
mov    %rax,%rsi
call   1060 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
lea    0xe72(%rip),%rdi
call   1050 <str_reverse@plt>
lea    0xe2d(%rip),%rdi
mov    %rax,%rsi
call   1060 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
movaps 0xe90(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    -0x1(%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <str_reverse_1@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    -0x1(%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <str_reverse_1@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@.str.1 = [6 x i8] c"tikna\00"
@.str.2 = [6 x i8] c"ankit\00"
@.str.3 = [14 x i8] c"lerhkop tikna\00"
@.str.4 = [14 x i8] c"ankit pokhrel\00"
@.str.5 = [24 x i8] c".egaugnaL gnimmargorP C\00"
@.str.6 = [24 x i8] c"C Programming Language.\00"
@.str.7 = [23 x i8] c"!dlrow yzarc a si sihT\00"
@.str.8 = [23 x i8] c"This is a crazy world!\00"
@.str.9 = [57 x i8] c".tile gnicsipida rutetcesnoc ,tema tis rolod muspi meroL\00"
@.str.10 = [57 x i8] c"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\00"
@__const.main.s = [20 x i8] c"ankit\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
store i32 0, i32* %1
%3 = call i8* @str_reverse(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = call i8* @str_reverse(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%9 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i8* @str_reverse(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%14 = call i64 @strcmp(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %13)
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i8* @str_reverse(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%19 = call i64 @strcmp(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %18)
%20 = icmp eq i64 %19, 0
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = call i8* @str_reverse(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%24 = call i64 @strcmp(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %23)
%25 = icmp eq i64 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = call i8* @str_reverse(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.10, i64 0, i64 0))
%29 = call i64 @strcmp(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0), i8* %28)
%30 = icmp eq i64 %29, 0
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = bitcast [20 x i8]* %2 to i8*
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%35 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%36 = call i64 @strlen(i8* %35)
%37 = trunc i64 %36 to i32
%38 = sub nsw i32 %37, 1
%39 = call i32 @str_reverse_1(i8* %34, i32 0, i32 %38)
%40 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%41 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %40)
%42 = icmp eq i64 %41, 0
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%46 = call i32 @strcpy(i8* %45, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%47 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%48 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%49 = call i64 @strlen(i8* %48)
%50 = trunc i64 %49 to i32
%51 = sub nsw i32 %50, 1
%52 = call i32 @str_reverse_1(i8* %47, i32 0, i32 %51)
%53 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%54 = call i64 @strcmp(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %53)
%55 = icmp eq i64 %54, 0
%56 = zext i1 %55 to i32
%57 = call i32 @assert(i32 %56)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
@.str.1 = [6 x i8] c"tikna\00"
@.str.2 = [6 x i8] c"ankit\00"
@.str.3 = [14 x i8] c"lerhkop tikna\00"
@.str.4 = [14 x i8] c"ankit pokhrel\00"
@.str.5 = [24 x i8] c".egaugnaL gnimmargorP C\00"
@.str.6 = [24 x i8] c"C Programming Language.\00"
@.str.7 = [23 x i8] c"!dlrow yzarc a si sihT\00"
@.str.8 = [23 x i8] c"This is a crazy world!\00"
@.str.9 = [57 x i8] c".tile gnicsipida rutetcesnoc ,tema tis rolod muspi meroL\00"
@.str.10 = [57 x i8] c"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\00"
@__const.main.s = [20 x i8] c"ankit\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = tail call i8* @str_reverse(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i8* @str_reverse(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = tail call i8* @str_reverse(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%13 = tail call i64 @strcmp(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %12)
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = tail call i8* @str_reverse(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%18 = tail call i64 @strcmp(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %17)
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = tail call i8* @str_reverse(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%23 = tail call i64 @strcmp(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %22)
%24 = icmp eq i64 %23, 0
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = tail call i8* @str_reverse(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.10, i64 0, i64 0))
%28 = tail call i64 @strcmp(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0), i8* %27)
%29 = icmp eq i64 %28, 0
%30 = zext i1 %29 to i32
%31 = tail call i32 @assert(i32 %30)
%32 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%33 = call i64 @strlen(i8* %32)
%34 = trunc i64 %33 to i32
%35 = add nsw i32 %34, -1
%36 = call i32 @str_reverse_1(i8* %32, i32 0, i32 %35)
%37 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %32)
%38 = icmp eq i64 %37, 0
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%42 = call i64 @strlen(i8* %32)
%43 = trunc i64 %42 to i32
%44 = add nsw i32 %43, -1
%45 = call i32 @str_reverse_1(i8* %32, i32 0, i32 %44)
%46 = call i64 @strcmp(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %32)
%47 = icmp eq i64 %46, 0
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
ret i32 0
}