#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 *);
char *reverseIterate(char *);
int /*<<< orphan*/ reverseSwapPointer(char *);
char *reverseSwapReference(char *);
int main() {
  char string[] = "abcdefghijklmnopqrstuvwxyz";
  printf("Regular string:          %s\n", string);
  printf("Regular reversed String: %s\n", reverseIterate(string));
  printf("Swap reversed String:    %s\n", reverseSwapReference(string));
  reverseSwapPointer(string);
  printf("Swap reversed String:    %s\n", string);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xeb1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeab(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xea8(%rip),%ax
mov    %ax,-0x8(%rbp)
mov    0xea0(%rip),%al
mov    %al,-0x6(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <reverseIterate@plt>
mov    %rax,%rsi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1060 <reverseSwapReference@plt>
mov    %rax,%rsi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <reverseSwapPointer@plt>
lea    -0x20(%rbp),%rsi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movups 0xebd(%rip),%xmm0
movups %xmm0,0xb(%rsp)
movaps 0xea6(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xeb6(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <reverseIterate@plt>
lea    0xeb9(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1060 <reverseSwapReference@plt>
lea    0xebf(%rip),%r14
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1050 <reverseSwapPointer@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.string = [27 x i8] c"abcdefghijklmnopqrstuvwxyz\00"
@.str = [29 x i8] c"Regular string: %s\0A\00"
@.str.1 = [29 x i8] c"Regular reversed String: %s\0A\00"
@.str.2 = [29 x i8] c"Swap reversed String: %s\0A\00"
define i32 @main() {
%1 = alloca [27 x i8]
%2 = bitcast [27 x i8]* %1 to i8*
%3 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 0
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 0
%6 = call i8* @reverseIterate(i8* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 0
%9 = call i8* @reverseSwapReference(i8* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 0
%12 = call i32 @reverseSwapPointer(i8* %11)
%13 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 0
%14 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %13)
ret i32 0
}

LLVM IR (-O2):
@__const.main.string = [27 x i8] c"abcdefghijklmnopqrstuvwxyz\00"
@.str = [29 x i8] c"Regular string: %s\0A\00"
@.str.1 = [29 x i8] c"Regular reversed String: %s\0A\00"
@.str.2 = [29 x i8] c"Swap reversed String: %s\0A\00"
define i32 @main() {
%1 = alloca [27 x i8]
%2 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i8* @reverseIterate(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i8* @reverseSwapReference(i8* %2)
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = call i32 @reverseSwapPointer(i8* %2)
%9 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
}