#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 /*<<< orphan*/);
int /*<<< orphan*/ reverse_inplace(char *);
int /*<<< orphan*/ str_cmp(char *, char *);
int main() {
  char str1[] = "Test test test";
  char str2[] = "Gutenberg";
  char str3[] = "Gutenbergs";
  char rev_str1[] = "tset tset tseT";
  char rev_str2[] = "grebnetuG";
  char rev_str3[] = "sgrebnetuG";
  reverse_inplace(str1);
  reverse_inplace(str2);
  reverse_inplace(str3);
  assert(str_cmp(str1, rev_str1));
  assert(str_cmp(str2, rev_str2));
  assert(str_cmp(str3, rev_str3));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0xf(%rbp)
mov    0xebf(%rip),%eax
mov    %eax,-0x7(%rbp)
mov    0xeb9(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xeb1(%rip),%al
mov    %al,-0x1(%rbp)
mov    0xea8(%rip),%rax
mov    %rax,-0x19(%rbp)
mov    0xea5(%rip),%ax
mov    %ax,-0x11(%rbp)
mov    0xe9c(%rip),%rax
mov    %rax,-0x24(%rbp)
mov    0xe99(%rip),%ax
mov    %ax,-0x1c(%rbp)
mov    0xe91(%rip),%al
mov    %al,-0x1a(%rbp)
mov    0xe88(%rip),%rax
mov    %rax,-0x33(%rbp)
mov    0xe86(%rip),%eax
mov    %eax,-0x2b(%rbp)
mov    0xe80(%rip),%ax
mov    %ax,-0x27(%rbp)
mov    0xe78(%rip),%al
mov    %al,-0x25(%rbp)
mov    0xe70(%rip),%rax
mov    %rax,-0x3d(%rbp)
mov    0xe6d(%rip),%ax
mov    %ax,-0x35(%rbp)
mov    0xe59(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe56(%rip),%ax
mov    %ax,-0x40(%rbp)
mov    0xe4e(%rip),%al
mov    %al,-0x3e(%rbp)
lea    -0xf(%rbp),%rdi
call   1050 <reverse_inplace@plt>
lea    -0x19(%rbp),%rdi
call   1050 <reverse_inplace@plt>
lea    -0x24(%rbp),%rdi
call   1050 <reverse_inplace@plt>
lea    -0xf(%rbp),%rdi
lea    -0x33(%rbp),%rsi
call   1030 <str_cmp@plt>
mov    %eax,%edi
call   1040 <assert@plt>
lea    -0x19(%rbp),%rdi
lea    -0x3d(%rbp),%rsi
call   1030 <str_cmp@plt>
mov    %eax,%edi
call   1040 <assert@plt>
lea    -0x24(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1030 <str_cmp@plt>
mov    %eax,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
movabs $0x74736574207473,%rax
mov    %rax,0x57(%rsp)
movabs $0x7365742074736554,%rax
74 65 73
mov    %rax,0x50(%rsp)
movabs $0x7265626e65747547,%rax
62 65 72
mov    %rax,0x10(%rsp)
movw   $0x67,0x18(%rsp)
mov    %rax,0x30(%rsp)
movl   $0x736772,0x37(%rsp)
movabs $0x54657374207465,%rax
mov    %rax,0x47(%rsp)
movabs $0x6573742074657374,%rax
74 73 65
mov    %rax,0x40(%rsp)
movabs $0x7574656e62657267,%rax
65 74 75
mov    %rax,(%rsp)
movw   $0x47,0x8(%rsp)
movabs $0x74656e6265726773,%rax
6e 65 74
mov    %rax,0x20(%rsp)
movl   $0x477574,0x27(%rsp)
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <reverse_inplace@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1050 <reverse_inplace@plt>
lea    0x30(%rsp),%r15
mov    %r15,%rdi
call   1050 <reverse_inplace@plt>
lea    0x40(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <str_cmp@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1030 <str_cmp@plt>
mov    %eax,%edi
call   1040 <assert@plt>
lea    0x20(%rsp),%rsi
mov    %r15,%rdi
call   1030 <str_cmp@plt>
mov    %eax,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.str1 = [15 x i8] c"Test test test\00"
@__const.main.str2 = [10 x i8] c"Gutenberg\00"
@__const.main.str3 = [11 x i8] c"Gutenbergs\00"
@__const.main.rev_str1 = [15 x i8] c"tset tset tseT\00"
@__const.main.rev_str2 = [10 x i8] c"grebnetuG\00"
@__const.main.rev_str3 = [11 x i8] c"sgrebnetuG\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [10 x i8]
%3 = alloca [11 x i8]
%4 = alloca [15 x i8]
%5 = alloca [10 x i8]
%6 = alloca [11 x i8]
%7 = bitcast [15 x i8]* %1 to i8*
%8 = bitcast [10 x i8]* %2 to i8*
%9 = bitcast [11 x i8]* %3 to i8*
%10 = bitcast [15 x i8]* %4 to i8*
%11 = bitcast [10 x i8]* %5 to i8*
%12 = bitcast [11 x i8]* %6 to i8*
%13 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%14 = call i32 @reverse_inplace(i8* %13)
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%16 = call i32 @reverse_inplace(i8* %15)
%17 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%18 = call i32 @reverse_inplace(i8* %17)
%19 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%20 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%21 = call i32 @str_cmp(i8* %19, i8* %20)
%22 = call i32 @assert(i32 %21)
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%25 = call i32 @str_cmp(i8* %23, i8* %24)
%26 = call i32 @assert(i32 %25)
%27 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%28 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%29 = call i32 @str_cmp(i8* %27, i8* %28)
%30 = call i32 @assert(i32 %29)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str1 = [15 x i8] c"Test test test\00"
@__const.main.str2 = [10 x i8] c"Gutenberg\00"
@__const.main.str3 = [11 x i8] c"Gutenbergs\00"
@__const.main.rev_str1 = [15 x i8] c"tset tset tseT\00"
@__const.main.rev_str2 = [10 x i8] c"grebnetuG\00"
@__const.main.rev_str3 = [11 x i8] c"sgrebnetuG\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [10 x i8]
%3 = alloca [11 x i8]
%4 = alloca [15 x i8]
%5 = alloca [10 x i8]
%6 = alloca [11 x i8]
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%13 = call i32 @reverse_inplace(i8* %7)
%14 = call i32 @reverse_inplace(i8* %8)
%15 = call i32 @reverse_inplace(i8* %9)
%16 = call i32 @str_cmp(i8* %7, i8* %10)
%17 = call i32 @assert(i32 %16)
%18 = call i32 @str_cmp(i8* %8, i8* %11)
%19 = call i32 @assert(i32 %18)
%20 = call i32 @str_cmp(i8* %9, i8* %12)
%21 = call i32 @assert(i32 %20)
ret i32 0
}