#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*/ puts(char *);
int /*<<< orphan*/ reverseWords(char *);
int main(void) {
  char str1[] = "";
  char str2[] = " Daniel Zhang";
  char str3[] = "Daniel Zhang ";
  reverseWords(str1);
  puts(str1);
  reverseWords(str2);
  puts(str2);
  reverseWords(str3);
  puts(str3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x1(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    0xeb1(%rip),%rax
mov    %rax,-0xf(%rbp)
mov    0xeaf(%rip),%eax
mov    %eax,-0x7(%rbp)
mov    0xea9(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xea0(%rip),%rax
mov    %rax,-0x1d(%rbp)
mov    0xe9e(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xe98(%rip),%ax
mov    %ax,-0x11(%rbp)
lea    -0x1(%rbp),%rdi
call   1050 <reverseWords@plt>
lea    -0x1(%rbp),%rdi
call   1030 <puts@plt>
lea    -0xf(%rbp),%rdi
call   1050 <reverseWords@plt>
lea    -0xf(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x1d(%rbp),%rdi
call   1050 <reverseWords@plt>
lea    -0x1d(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movb   $0x0,0xf(%rsp)
movabs $0x676e61685a206c,%rax
mov    %rax,0x26(%rsp)
movabs $0x206c65696e614420,%rax
65 6c 20
mov    %rax,0x20(%rsp)
movabs $0x20676e61685a20,%rax
mov    %rax,0x16(%rsp)
movabs $0x5a206c65696e6144,%rax
6c 20 5a
mov    %rax,0x10(%rsp)
lea    0xf(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <reverseWords@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <reverseWords@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <reverseWords@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str2 = [14 x i8] c" Daniel Zhang\00"
@__const.main.str3 = [14 x i8] c"Daniel Zhang \00"
define i32 @main() {
%1 = alloca [1 x i8]
%2 = alloca [14 x i8]
%3 = alloca [14 x i8]
%4 = bitcast [1 x i8]* %1 to i8*
%5 = bitcast [14 x i8]* %2 to i8*
%6 = bitcast [14 x i8]* %3 to i8*
%7 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
%8 = call i32 @reverseWords(i8* %7)
%9 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
%10 = call i32 @puts(i8* %9)
%11 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%12 = call i32 @reverseWords(i8* %11)
%13 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%14 = call i32 @puts(i8* %13)
%15 = getelementptr inbounds [14 x i8], [14 x i8]* %3, i64 0, i64 0
%16 = call i32 @reverseWords(i8* %15)
%17 = getelementptr inbounds [14 x i8], [14 x i8]* %3, i64 0, i64 0
%18 = call i32 @puts(i8* %17)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str2 = [14 x i8] c" Daniel Zhang\00"
@__const.main.str3 = [14 x i8] c"Daniel Zhang \00"
define i32 @main() {
%1 = alloca [1 x i8]
%2 = alloca [14 x i8]
%3 = alloca [14 x i8]
%4 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
store i8 0, i8* %4
%5 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [14 x i8], [14 x i8]* %3, i64 0, i64 0
%7 = call i32 @reverseWords(i8* %4)
%8 = call i32 @puts(i8* %4)
%9 = call i32 @reverseWords(i8* %5)
%10 = call i32 @puts(i8* %5)
%11 = call i32 @reverseWords(i8* %6)
%12 = call i32 @puts(i8* %6)
ret i32 0
}