#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 */
float elevazione(int, int);
float numero(char);
float creavirgola(char *c, int passi) {
  float num = 0;
  int cont = 0, i = -1;
  cont = -(passi);
  for (i = (cont - 1); i >= 0; i--) {
    num = num + (numero(c[i]) * elevazione(10, passi));
    passi++;
  }
  return num;
}


x86 assembly (clang, -O0):
<creavirgola>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0xffffffff,-0x18(%rbp)
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     11be <creavirgola+0x9e>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <numero@plt>
movss  %xmm0,-0x1c(%rbp)
mov    -0xc(%rbp),%esi
mov    $0xa,%edi
call   1040 <elevazione@plt>
movss  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x1c(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1156 <creavirgola+0x36>
movss  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<creavirgola>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xorps  %xmm0,%xmm0
test   %esi,%esi
jns    1187 <creavirgola+0x67>
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%ebx
not    %ebx
xorps  %xmm0,%xmm0
nopl   0x0(%rax,%rax,1)
movss  %xmm0,0x8(%rsp)
movsbl (%r14,%rbx,1),%edi
call   1030 <numero@plt>
movss  %xmm0,0xc(%rsp)
mov    $0xa,%edi
mov    %ebp,%esi
call   1040 <elevazione@plt>
mulss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
movss  0x8(%rsp),%xmm0
add    $0x1,%ebp
add    $0xffffffffffffffff,%rbx
jb     1140 <creavirgola+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define float @creavirgola(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca float
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store float 0.000000e+00, float* %5
store i32 0, i32* %6
store i32 -1, i32* %7
%8 = load i32, i32* %4
%9 = sub nsw i32 0, %8
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %7
br label %12
12: ; preds = %28, %2
%13 = load i32, i32* %7
%14 = icmp sge i32 %13, 0
br i1 %14, label %15, label %31
15: ; preds = %12
%16 = load float, float* %5
%17 = load i8*, i8** %3
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = call float @numero(i8 signext %21)
%23 = load i32, i32* %4
%24 = call float @elevazione(i32 10, i32 %23)
%25 = call float @llvm.fmuladd.f32(float %22, float %24, float %16)
store float %25, float* %5
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %28
28: ; preds = %15
%29 = load i32, i32* %7
%30 = add nsw i32 %29, -1
store i32 %30, i32* %7
br label %12
31: ; preds = %12
%32 = load float, float* %5
ret float %32
}

LLVM IR (-O2):
define float @creavirgola(i8* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 0
br i1 %3, label %4, label %19
4: ; preds = %2
%5 = xor i32 %1, -1
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %4, %7
%8 = phi i64 [ %6, %4 ], [ %17, %7 ]
%9 = phi i32 [ %1, %4 ], [ %16, %7 ]
%10 = phi float [ 0.000000e+00, %4 ], [ %15, %7 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %8
%12 = load i8, i8* %11
%13 = tail call float @numero(i8 signext %12)
%14 = tail call float @elevazione(i32 10, i32 %9)
%15 = tail call float @llvm.fmuladd.f32(float %13, float %14, float %10)
%16 = add nsw i32 %9, 1
%17 = add nsw i64 %8, -1
%18 = icmp eq i64 %8, 0
br i1 %18, label %19, label %7
19: ; preds = %7, %2
%20 = phi float [ 0.000000e+00, %2 ], [ %15, %7 ]
ret float %20
}