#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*/ lr_save_string(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char);
int /*<<< orphan*/ sscanf(char *, char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int Reverse(char *Param, char *PName) {
  char n, Character[2000], Varname[2000];
  char FullString[2000];
  int i = strlen(Param);
  strcpy(FullString, "");
  strcpy(&n, "");
  while (i >= 0) {
    sscanf(Param + i, "%c", &n);
    sprintf(Character, "%c", n);
    strcat(FullString, Character);
    i--;
  }
  lr_save_string(FullString, PName);
}


x86 assembly (clang, -O0):
<Reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x17a0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1794(%rbp)
lea    -0x1790(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xe66(%rip),%rsi
lea    -0x19(%rbp),%rdi
call   1030 <strcpy@plt>
cmpl   $0x0,-0x1794(%rbp)
jl     120e <Reverse+0xae>
mov    -0x10(%rbp),%rdi
movslq -0x1794(%rbp),%rax
add    %rax,%rdi
lea    0xe39(%rip),%rsi
lea    -0x19(%rbp),%rdx
call   1060 <sscanf@plt>
lea    -0x7f0(%rbp),%rdi
lea    0xe22(%rip),%rsi
movsbl -0x19(%rbp),%edx
call   1080 <sprintf@plt>
lea    -0x1790(%rbp),%rdi
lea    -0x7f0(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x1794(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1794(%rbp)
jmp    11a5 <Reverse+0x45>
lea    -0x1790(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <lr_save_string@plt>
mov    -0x4(%rbp),%eax
add    $0x17a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Reverse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xfb8,%rsp
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ebp
lea    0xe8b(%rip),%r15
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    0x7(%rsp),%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
test   %ebp,%ebp
js     11f4 <Reverse+0xa4>
mov    %ebp,%r14d
lea    0xe61(%rip),%r15
lea    0x7(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0x7e0(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%r14,1),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1060 <sscanf@plt>
movzbl 0x7(%rsp),%eax
mov    %al,0x7e0(%rsp)
movb   $0x0,0x7e1(%rsp)
mov    %r13,%rdi
mov    %rbp,%rsi
call   1070 <strcat@plt>
add    $0xffffffffffffffff,%r14
jb     11c0 <Reverse+0x70>
lea    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1050 <lr_save_string@plt>
add    $0xfb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [3 x i8] c"%c\00"
define i32 @Reverse(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca [2000 x i8]
%8 = alloca [2000 x i8]
%9 = alloca [2000 x i8]
%10 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%11 = load i8*, i8** %4
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %10
%13 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 0
%14 = call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %19, %2
%17 = load i32, i32* %10
%18 = icmp sge i32 %17, 0
br i1 %18, label %19, label %33
19: ; preds = %16
%20 = load i8*, i8** %4
%21 = load i32, i32* %10
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%25 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 0
%26 = load i8, i8* %6
%27 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %26)
%28 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 0
%29 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 0
%30 = call i32 @strcat(i8* %28, i8* %29)
%31 = load i32, i32* %10
%32 = add nsw i32 %31, -1
store i32 %32, i32* %10
br label %16
33: ; preds = %16
%34 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 0
%35 = load i8*, i8** %5
%36 = call i32 @lr_save_string(i8* %34, i8* %35)
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [3 x i8] c"%c\00"
define i32 @Reverse(i8* %0, i8* %1) {
%3 = alloca i8
%4 = alloca [2000 x i8]
%5 = alloca [2000 x i8]
%6 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [2000 x i8], [2000 x i8]* %5, i64 0, i64 0
%8 = tail call i32 @strlen(i8* %0)
%9 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%11 = icmp sgt i32 %8, -1
br i1 %11, label %12, label %23
12: ; preds = %2
%13 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 1
%14 = zext i32 %8 to i64
br label %15
15: ; preds = %12, %15
%16 = phi i64 [ %14, %12 ], [ %21, %15 ]
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%19 = load i8, i8* %3
store i8 %19, i8* %6
store i8 0, i8* %13
%20 = call i32 @strcat(i8* %7, i8* %6)
%21 = add nsw i64 %16, -1
%22 = icmp eq i64 %16, 0
br i1 %22, label %23, label %15
23: ; preds = %15, %2
%24 = call i32 @lr_save_string(i8* %7, i8* %1)
ret i32 undef
}