#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";
  int element = 0;
  while (++element && *string++ != '\0')
    ;
  while (element >= 0)
    putchar(string[-element--]);
  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)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
je     1163 <main+0x53>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1173 <main+0x63>
jmp    1178 <main+0x68>
jmp    1131 <main+0x21>
jmp    117d <main+0x6d>
cmpl   $0x0,-0x14(%rbp)
jl     11ab <main+0x9b>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%edx
mov    %edx,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
xor    %ecx,%ecx
sub    %edx,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
jmp    117d <main+0x6d>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x48,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x6d,%edi
call   1030 <putchar@plt>
mov    $0x79,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x64,%edi
call   1030 <putchar@plt>
mov    $0x61,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x69,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x67,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1030 <putchar@plt>
xor    %edi,%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 i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %3
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br label %14
14: ; preds = %8, %4
%15 = phi i1 [ false, %4 ], [ %13, %8 ]
br i1 %15, label %16, label %17
16: ; preds = %14
br label %4
17: ; preds = %14
br label %18
18: ; preds = %21, %17
%19 = load i32, i32* %3
%20 = icmp sge i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %18
%22 = load i8*, i8** %2
%23 = load i32, i32* %3
%24 = add nsw i32 %23, -1
store i32 %24, i32* %3
%25 = sub nsw i32 0, %23
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %22, i64 %26
%28 = load i8, i8* %27
%29 = call i32 @putchar(i8 signext %28)
br label %18
30: ; preds = %18
%31 = call i32 @putchar(i8 signext 10)
ret i32 0
}

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