#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 *, char);
scalar_t__ strlen(char *);
void foo(char *parola) {
  if (parola == NULL)
    return;
  else {
    printf("%c", *parola);
    parola = parola + 1;
    if (strlen(parola) == 0)
      return;
    else {
      foo(parola - 1);
      printf("%c", *parola);
      return;
    }
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114c <foo+0x1c>
jmp    11a3 <foo+0x73>
mov    -0x8(%rbp),%rax
lea    0xea9(%rip),%rdi
movsbl (%rax),%esi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jne    1183 <foo+0x53>
jmp    11a3 <foo+0x73>
mov    -0x8(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
call   1050 <foo@plt>
mov    -0x8(%rbp),%rax
lea    0xe65(%rip),%rdi
movsbl (%rax),%esi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
test   %rdi,%rdi
je     116f <foo+0x3f>
mov    %rdi,%rbx
movsbl (%rdi),%esi
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0x1(%rbx),%rdi
call   1030 <strlen@plt>
test   %rax,%rax
je     116f <foo+0x3f>
mov    %rbx,%rdi
call   1050 <foo@plt>
movsbl 0x1(%rbx),%esi
lea    0xe97(%rip),%rdi
pop    %rbx
jmp    1040 <printf@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @foo(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %4)
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = tail call i64 @strlen(i8* %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1, %3, %10
ret void
10: ; preds = %3
tail call void @foo(i8* %0)
%11 = load i8, i8* %6
%12 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %11)
br label %9
}