#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 EXIT_SUCCESS;
int /*<<< orphan*/ clear_memory(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
char *input;
char *make_char(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
char *reverse_input(char *);
double reverse_number(char *, int *);
char *reverteInput;
int /*<<< orphan*/ stdin;
int main() {
  int error;
  char *input = make_char(input, 20);
  char *reverteInput = make_char(reverteInput, 20);
  printf("Enter number: ");
  fgets(input, 20, stdin);
  reverteInput = reverse_input(input);
  double reversed = reverse_number(reverteInput, &error);
  if (error != 1) {
    printf("%.3f", reversed);
  } else {
    printf("Invalid format");
  }
  clear_memory(input);
  clear_memory(reverteInput);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%edi
mov    $0x14,%esi
call   1080 <make_char@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%edi
mov    $0x14,%esi
call   1080 <make_char@plt>
mov    %rax,-0x18(%rbp)
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e38(%rip),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   1060 <fgets@plt>
mov    -0x10(%rbp),%rdi
call   1050 <reverse_input@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <reverse_number@plt>
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     11fd <main+0x9d>
movsd  -0x20(%rbp),%xmm0
lea    0xe1e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    120b <main+0xab>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <clear_memory@plt>
mov    -0x18(%rbp),%rdi
call   1070 <clear_memory@plt>
mov    0x2db4(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x14,%esi
call   1080 <make_char@plt>
mov    %rax,%r14
mov    $0x14,%esi
call   1080 <make_char@plt>
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0x14,%esi
call   1060 <fgets@plt>
mov    %r14,%rdi
call   1050 <reverse_input@plt>
mov    %rax,%rbx
lea    0x4(%rsp),%rsi
mov    %rax,%rdi
call   1030 <reverse_number@plt>
cmpl   $0x1,0x4(%rsp)
jne    11ce <main+0x6e>
lea    0xe4f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11dc <main+0x7c>
lea    0xe3a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r14,%rdi
call   1070 <clear_memory@plt>
mov    %rbx,%rdi
call   1070 <clear_memory@plt>
mov    0x2de5(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter number: \00"
@stdin = global i32 0
@.str.1 = [5 x i8] c"%.3f\00"
@.str.2 = [15 x i8] c"Invalid format\00"
@EXIT_SUCCESS = global i32 0
@input = global i8* null
@reverteInput = global i8* null
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca double
store i32 0, i32* %1
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %6 to i32
%8 = call i8* @make_char(i32 %7, i32 20)
store i8* %8, i8** %3
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i32
%11 = call i8* @make_char(i32 %10, i32 20)
store i8* %11, i8** %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %3
%14 = load i32, i32* @stdin
%15 = call i32 @fgets(i8* %13, i32 20, i32 %14)
%16 = load i8*, i8** %3
%17 = call i8* @reverse_input(i8* %16)
store i8* %17, i8** %4
%18 = load i8*, i8** %4
%19 = call double @reverse_number(i8* %18, i32* %2)
store double %19, double* %5
%20 = load i32, i32* %2
%21 = icmp ne i32 %20, 1
br i1 %21, label %22, label %25
22: ; preds = %0
%23 = load double, double* %5
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %23)
br label %27
25: ; preds = %0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
%28 = load i8*, i8** %3
%29 = call i32 @clear_memory(i8* %28)
%30 = load i8*, i8** %4
%31 = call i32 @clear_memory(i8* %30)
%32 = load i32, i32* @EXIT_SUCCESS
ret i32 %32
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter number: \00"
@stdin = global i32 0
@.str.1 = [5 x i8] c"%.3f\00"
@.str.2 = [15 x i8] c"Invalid format\00"
@EXIT_SUCCESS = global i32 0
@input = global i8* null
@reverteInput = global i8* null
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i8* @make_char(i32 undef, i32 20)
%4 = tail call i8* @make_char(i32 undef, i32 20)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = tail call i32 @fgets(i8* %3, i32 20, i32 %6)
%8 = tail call i8* @reverse_input(i8* %3)
%9 = call double @reverse_number(i8* %8, i32* %1)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 1
br i1 %11, label %14, label %12
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %9)
br label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
%17 = call i32 @clear_memory(i8* %3)
%18 = call i32 @clear_memory(i8* %8)
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}