#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 */
double decmify(char);
double wholedec(char *s) {
  int i = 0;
  char c;
  double decnum = 0.0;
  i = 0;
  while ((c = s[i++]) != '\0' && c != ';')
    decnum = decnum * 12 + decmify(c);
  return decnum;
}


x86 assembly (clang, -O0):
<wholedec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xd(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1168 <wholedec+0x58>
movsbl -0xd(%rbp),%eax
cmp    $0x3b,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1178 <wholedec+0x68>
jmp    11ad <wholedec+0x9d>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsbl -0xd(%rbp),%edi
call   1030 <decmify@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  0xe65(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1132 <wholedec+0x22>
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wholedec>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xorpd  %xmm1,%xmm1
nopl   0x0(%rax)
movzbl (%rbx),%eax
test   %al,%al
je     1151 <wholedec+0x41>
cmp    $0x3b,%al
je     1151 <wholedec+0x41>
movsbl %al,%edi
movsd  %xmm1,0x8(%rsp)
call   1030 <decmify@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0xeb9(%rip),%xmm1
addsd  %xmm0,%xmm1
add    $0x1,%rbx
jmp    1120 <wholedec+0x10>
movapd %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @wholedec(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8
%5 = alloca double
store i8* %0, i8** %2
store i32 0, i32* %3
store double 0.000000e+00, double* %5
store i32 0, i32* %3
br label %6
6: ; preds = %21, %1
%7 = load i8*, i8** %2
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds i8, i8* %7, i64 %10
%12 = load i8, i8* %11
store i8 %12, i8* %4
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %6
%16 = load i8, i8* %4
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 59
br label %19
19: ; preds = %15, %6
%20 = phi i1 [ false, %6 ], [ %18, %15 ]
br i1 %20, label %21, label %26
21: ; preds = %19
%22 = load double, double* %5
%23 = load i8, i8* %4
%24 = call double @decmify(i8 signext %23)
%25 = call double @llvm.fmuladd.f64(double %22, double 1.200000e+01, double %24)
store double %25, double* %5
br label %6
26: ; preds = %19
%27 = load double, double* %5
ret double %27
}

LLVM IR (-O2):
define double @wholedec(i8* nocapture %0) {
br label %2
2: ; preds = %7, %1
%3 = phi i64 [ %8, %7 ], [ 0, %1 ]
%4 = phi double [ %10, %7 ], [ 0.000000e+00, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
switch i8 %6, label %7 [
i8 59, label %11
i8 0, label %11
]
7: ; preds = %2
%8 = add nuw i64 %3, 1
%9 = tail call double @decmify(i8 signext %6)
%10 = tail call double @llvm.fmuladd.f64(double %4, double 1.200000e+01, double %9)
br label %2
11: ; preds = %2, %2
ret double %4
}