#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 *, int);
int strlen(char *);
void reverse_my(char string[100], int start) {
  char temp = 0;
  unsigned short int len = 0;
  len = strlen(string) - 1;
  printf("start = %d;\n", start);
  if (start < (len / 2 - 1)) {
    reverse_my(string, start + 1);
  };
  temp = string[len - start];
  string[len - start] = string[start];
  string[start] = temp;
}


x86 assembly (clang, -O0):
<reverse_my>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movb   $0x0,-0xd(%rbp)
movw   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %ax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
movzwl -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1199 <reverse_my+0x69>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
call   1050 <reverse_my@plt>
mov    -0x8(%rbp),%rax
movzwl -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movzwl -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xd(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_my>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
add    $0xffffffff,%ebp
lea    0xeb5(%rip),%rdi
mov    %r14d,%esi
call   1040 <printf@plt>
movzwl %bp,%ebp
mov    %ebp,%eax
shr    %eax
add    $0xffffffff,%eax
cmp    %r14d,%eax
jle    116e <reverse_my+0x3e>
lea    0x1(%r14),%esi
mov    %rbx,%rdi
call   1050 <reverse_my@plt>
sub    %r14d,%ebp
movslq %ebp,%rax
mov    (%rbx,%rax,1),%sil
movslq %r14d,%rdx
mov    (%rbx,%rdx,1),%cl
mov    %cl,(%rbx,%rax,1)
mov    %sil,(%rbx,%rdx,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"start = %d;\0A\00"
define void @reverse_my(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
%6 = alloca i16
store i8* %0, i8** %3
store i32 %1, i32* %4
store i8 0, i8* %5
store i16 0, i16* %6
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = sub nsw i32 %8, 1
%10 = trunc i32 %9 to i16
store i16 %10, i16* %6
%11 = load i32, i32* %4
%12 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %4
%14 = load i16, i16* %6
%15 = zext i16 %14 to i32
%16 = sdiv i32 %15, 2
%17 = sub nsw i32 %16, 1
%18 = icmp slt i32 %13, %17
br i1 %18, label %19, label %23
19: ; preds = %2
%20 = load i8*, i8** %3
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
br label %23
23: ; preds = %19, %2
%24 = load i8*, i8** %3
%25 = load i16, i16* %6
%26 = zext i16 %25 to i32
%27 = load i32, i32* %4
%28 = sub nsw i32 %26, %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %24, i64 %29
%31 = load i8, i8* %30
store i8 %31, i8* %5
%32 = load i8*, i8** %3
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = load i8*, i8** %3
%38 = load i16, i16* %6
%39 = zext i16 %38 to i32
%40 = load i32, i32* %4
%41 = sub nsw i32 %39, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %37, i64 %42
store i8 %36, i8* %43
%44 = load i8, i8* %5
%45 = load i8*, i8** %3
%46 = load i32, i32* %4
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
store i8 %44, i8* %48
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"start = %d;\0A\00"
define void @reverse_my(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = add i32 %3, 65535
%5 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
%6 = and i32 %4, 65535
%7 = lshr i32 %6, 1
%8 = add nsw i32 %7, -1
%9 = icmp sgt i32 %8, %1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = add nsw i32 %1, 1
tail call void @reverse_my(i8* %0, i32 %11)
br label %12
12: ; preds = %10, %2
%13 = sub nsw i32 %6, %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = sext i32 %1 to i64
%18 = getelementptr inbounds i8, i8* %0, i64 %17
%19 = load i8, i8* %18
store i8 %19, i8* %15
store i8 %16, i8* %18
ret void
}