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


x86 assembly (clang, -O0):
<creanumero>:
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   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11b6 <creanumero+0x96>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <numero@plt>
movss  %xmm0,-0x1c(%rbp)
mov    -0x18(%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    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    114e <creanumero+0x2e>
movss  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<creanumero>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %esi,%esi
jle    118e <creanumero+0x6e>
mov    %rdi,%r14
mov    %esi,%ebx
add    $0xffffffffffffffff,%rbx
xorps  %xmm0,%xmm0
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movss  %xmm0,0x8(%rsp)
mov    %ebx,%eax
movsbl (%r14,%rax,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
cmp    $0xffffffff,%ebx
jne    1140 <creanumero+0x20>
jmp    1191 <creanumero+0x71>
xorps  %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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