#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*/ printf(char *, char *);
int /*<<< orphan*/ reverse(char *);
int /*<<< orphan*/ reversewithswap(char *);
void main() {
  char myStr[] = "The quick brown fox jumps over the lazy dog.";
  printf("original:\n%s\n\n", myStr);
  reverse(myStr);
  printf("reverse:\n%s\n\n", myStr);
  reversewithswap(myStr);
  printf("reverse with swap:\n%s\n\n", myStr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x2d,%edx
call   1060 <memcpy@plt>
lea    -0x30(%rbp),%rsi
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x30(%rbp),%rsi
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1050 <reversewithswap@plt>
lea    -0x30(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movups 0xee1(%rip),%xmm0
movups %xmm0,0x1d(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xece(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
lea    0xec3(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <reversewithswap@plt>
lea    0xeba(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.myStr = [45 x i8] c"The quick brown fox jumps over the lazy dog.\00"
@.str = [15 x i8] c"original:\0A%s\0A\0A\00"
@.str.1 = [14 x i8] c"reverse:\0A%s\0A\0A\00"
@.str.2 = [24 x i8] c"reverse with swap:\0A%s\0A\0A\00"
define void @main() {
%1 = alloca [45 x i8]
%2 = bitcast [45 x i8]* %1 to i8*
%3 = getelementptr inbounds [45 x i8], [45 x i8]* %1, i64 0, i64 0
%4 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [45 x i8], [45 x i8]* %1, i64 0, i64 0
%6 = call i32 @reverse(i8* %5)
%7 = getelementptr inbounds [45 x i8], [45 x i8]* %1, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [45 x i8], [45 x i8]* %1, i64 0, i64 0
%10 = call i32 @reversewithswap(i8* %9)
%11 = getelementptr inbounds [45 x i8], [45 x i8]* %1, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %11)
ret void
}

LLVM IR (-O2):
@__const.main.myStr = [45 x i8] c"The quick brown fox jumps over the lazy dog.\00"
@.str = [15 x i8] c"original:\0A%s\0A\0A\00"
@.str.1 = [14 x i8] c"reverse:\0A%s\0A\0A\00"
@.str.2 = [24 x i8] c"reverse with swap:\0A%s\0A\0A\00"
define void @main() {
%1 = alloca [45 x i8]
%2 = getelementptr inbounds [45 x i8], [45 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @reverse(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = call i32 @reversewithswap(i8* %2)
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret void
}