int main(void) {
  char s[] = "ravindra";
  printf("%d\n", Strlen(s));
  printf("%s\n", s);
  Reverse2(s);
  printf("%s\n", s);
  Reverse1(s);
  printf("%s\n", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xeb1(%rip),%rax
mov    %rax,-0x9(%rbp)
mov    0xeaf(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x9(%rbp),%rdi
mov    $0x0,%al
call   1060 <Strlen@plt>
mov    %eax,%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x9(%rbp),%rsi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x9(%rbp),%rdi
mov    $0x0,%al
call   1030 <Reverse2@plt>
lea    -0x9(%rbp),%rsi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x9(%rbp),%rdi
mov    $0x0,%al
call   1050 <Reverse1@plt>
lea    -0x9(%rbp),%rsi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x6172646e69766172,%rax
64 72 61
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <Strlen@plt>
lea    0xe8d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <Reverse2@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <Reverse1@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = [9 x i8] c"ravindra\00"
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [9 x i8]
%2 = bitcast [9 x i8]* %1 to i8*
%3 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @Strlen to i32 (i8*, ...)*)(i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @Reverse2 to i32 (i8*, ...)*)(i8* %8)
%10 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @Reverse1 to i32 (i8*, ...)*)(i8* %12)
%14 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [9 x i8] c"ravindra\00"
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [9 x i8]
%2 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @Strlen to i32 (i8*, ...)*)(i8* %2)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @puts(i8* %2)
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @Reverse2 to i32 (i8*, ...)*)(i8* %2)
%7 = call i32 @puts(i8* %2)
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @Reverse1 to i32 (i8*, ...)*)(i8* %2)
%9 = call i32 @puts(i8* %2)
ret i32 0
}