#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*/ putchar(char);
int main() {
  char *string = "Hello my darling";
  char *start_string = string;
  while (*string++ != '\0')
    ;
  while (--string >= start_string)
    putchar(*string);
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1152 <main+0x42>
jmp    1132 <main+0x22>
jmp    1157 <main+0x47>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
cmp    -0x18(%rbp),%rax
jb     117e <main+0x6e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    1157 <main+0x47>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <putchar@plt>
mov    $0x67,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x69,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
call   1030 <putchar@plt>
mov    $0x61,%edi
call   1030 <putchar@plt>
mov    $0x64,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x79,%edi
call   1030 <putchar@plt>
mov    $0x6d,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1030 <putchar@plt>
mov    $0x48,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Hello my darling\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %11, %0
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %2
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %5
br label %5
12: ; preds = %5
br label %13
13: ; preds = %18, %12
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i32 -1
store i8* %15, i8** %2
%16 = load i8*, i8** %3
%17 = icmp uge i8* %15, %16
br i1 %17, label %18, label %22
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = call i32 @putchar(i8 signext %20)
br label %13
22: ; preds = %13
%23 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @putchar(i8 signext 0)
%2 = tail call i32 @putchar(i8 signext 103)
%3 = tail call i32 @putchar(i8 signext 110)
%4 = tail call i32 @putchar(i8 signext 105)
%5 = tail call i32 @putchar(i8 signext 108)
%6 = tail call i32 @putchar(i8 signext 114)
%7 = tail call i32 @putchar(i8 signext 97)
%8 = tail call i32 @putchar(i8 signext 100)
%9 = tail call i32 @putchar(i8 signext 32)
%10 = tail call i32 @putchar(i8 signext 121)
%11 = tail call i32 @putchar(i8 signext 109)
%12 = tail call i32 @putchar(i8 signext 32)
%13 = tail call i32 @putchar(i8 signext 111)
%14 = tail call i32 @putchar(i8 signext 108)
%15 = tail call i32 @putchar(i8 signext 108)
%16 = tail call i32 @putchar(i8 signext 101)
%17 = tail call i32 @putchar(i8 signext 72)
%18 = tail call i32 @putchar(i8 signext 10)
ret i32 0
}