#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*/ print_byte_array(char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ reverse(char *, int);
int main(int argc, char **argv) {
  printf("Ben Andre Hello, world!\n");
  char str[17] = "This is a string.";
  char numbers[18] = "some NUMmbers12345";
  char does_it_reverse[30] = "Does it reverse \n\0\t correctly?";
  int length = 17;
  printf("Before:\n");
  print_byte_array(str, length);
  reverse(str, length);
  printf("After:\n");
  print_byte_array(str, length);
  length = 18;
  printf("Before:\n");
  print_byte_array(numbers, length);
  reverse(numbers, length);
  printf("After:\n");
  print_byte_array(numbers, length);
  length = 30;
  printf("Before:\n");
  print_byte_array(does_it_reverse, length);
  reverse(does_it_reverse, length);
  printf("After:\n");
  print_byte_array(does_it_reverse, length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
mov    0xed4(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xecf(%rip),%al
mov    %al,-0x20(%rbp)
mov    0xed5(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xed2(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xecf(%rip),%ax
mov    %ax,-0x40(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x58(%rbp)
mov    0xec6(%rip),%ax
mov    %ax,-0x54(%rbp)
movl   $0x11,-0x74(%rbp)
lea    0xe41(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x74(%rbp),%esi
call   1050 <print_byte_array@plt>
lea    -0x30(%rbp),%rdi
mov    -0x74(%rbp),%esi
call   1030 <reverse@plt>
lea    0xe26(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x74(%rbp),%esi
call   1050 <print_byte_array@plt>
movl   $0x12,-0x74(%rbp)
lea    0xdfe(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    -0x74(%rbp),%esi
call   1050 <print_byte_array@plt>
lea    -0x50(%rbp),%rdi
mov    -0x74(%rbp),%esi
call   1030 <reverse@plt>
lea    0xde3(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    -0x74(%rbp),%esi
call   1050 <print_byte_array@plt>
movl   $0x1e,-0x74(%rbp)
lea    0xdbb(%rip),%rdi
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x74(%rbp),%esi
call   1050 <print_byte_array@plt>
lea    -0x70(%rbp),%rdi
mov    -0x74(%rbp),%esi
call   1030 <reverse@plt>
lea    0xda0(%rip),%rdi
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x74(%rbp),%esi
call   1050 <print_byte_array@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
lea    0xf1e(%rip),%rdi
call   1040 <puts@plt>
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x2e,0x10(%rsp)
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movw   $0x3534,0x30(%rsp)
movups 0xedf(%rip),%xmm0
movups %xmm0,0x4e(%rsp)
movaps 0xec5(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0xeef(%rip),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x11,%esi
call   1050 <print_byte_array@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
call   1030 <reverse@plt>
lea    0xecb(%rip),%r15
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
call   1050 <print_byte_array@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x12,%esi
call   1050 <print_byte_array@plt>
mov    %rbx,%rdi
mov    $0x12,%esi
call   1030 <reverse@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x12,%esi
call   1050 <print_byte_array@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1050 <print_byte_array@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1030 <reverse@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1050 <print_byte_array@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Ben Andre Hello, world!\0A\00"
@__const.main.str = [17 x i8] c"This is a string."
@__const.main.numbers = [18 x i8] c"some NUMmbers12345"
@__const.main.does_it_reverse = [30 x i8] c"Does it reverse \0A\00\09 correctly?"
@.str.1 = [9 x i8] c"Before:\0A\00"
@.str.2 = [8 x i8] c"After:\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [17 x i8]
%7 = alloca [18 x i8]
%8 = alloca [30 x i8]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%11 = bitcast [17 x i8]* %6 to i8*
%12 = bitcast [18 x i8]* %7 to i8*
%13 = bitcast [30 x i8]* %8 to i8*
store i32 17, i32* %9
%14 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%15 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%16 = load i32, i32* %9
%17 = call i32 @print_byte_array(i8* %15, i32 %16)
%18 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%19 = load i32, i32* %9
%20 = call i32 @reverse(i8* %18, i32 %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%22 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%23 = load i32, i32* %9
%24 = call i32 @print_byte_array(i8* %22, i32 %23)
store i32 18, i32* %9
%25 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%26 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%27 = load i32, i32* %9
%28 = call i32 @print_byte_array(i8* %26, i32 %27)
%29 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%30 = load i32, i32* %9
%31 = call i32 @reverse(i8* %29, i32 %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%33 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%34 = load i32, i32* %9
%35 = call i32 @print_byte_array(i8* %33, i32 %34)
store i32 30, i32* %9
%36 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%37 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%38 = load i32, i32* %9
%39 = call i32 @print_byte_array(i8* %37, i32 %38)
%40 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%41 = load i32, i32* %9
%42 = call i32 @reverse(i8* %40, i32 %41)
%43 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%44 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%45 = load i32, i32* %9
%46 = call i32 @print_byte_array(i8* %44, i32 %45)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [17 x i8] c"This is a string."
@__const.main.numbers = [18 x i8] c"some NUMmbers12345"
@__const.main.does_it_reverse = [30 x i8] c"Does it reverse \0A\00\09 correctly?"
@str = [24 x i8] c"Ben Andre Hello, world!\00"
@str.7 = [8 x i8] c"Before:\00"
@str.8 = [7 x i8] c"After:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [17 x i8]
%4 = alloca [18 x i8]
%5 = alloca [30 x i8]
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%7 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [18 x i8], [18 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.7, i64 0, i64 0))
%11 = call i32 @print_byte_array(i8* %7, i32 17)
%12 = call i32 @reverse(i8* %7, i32 17)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.8, i64 0, i64 0))
%14 = call i32 @print_byte_array(i8* %7, i32 17)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.7, i64 0, i64 0))
%16 = call i32 @print_byte_array(i8* %8, i32 18)
%17 = call i32 @reverse(i8* %8, i32 18)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.8, i64 0, i64 0))
%19 = call i32 @print_byte_array(i8* %8, i32 18)
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.7, i64 0, i64 0))
%21 = call i32 @print_byte_array(i8* %9, i32 30)
%22 = call i32 @reverse(i8* %9, i32 30)
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.8, i64 0, i64 0))
%24 = call i32 @print_byte_array(i8* %9, i32 30)
ret i32 0
}