#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 interv2cents(double);
int sscanf(char *, char *, double *, double *);
int /*<<< orphan*/ *strchr(char *, char);
double scl2cents(char *s) {
  double n = 0.0, d = 1.0;
  int c;
  if ((c = sscanf(s, "%lf/%lf\n", &n, &d))) {
    if (c == 1 && strchr(s, '.') != NULL) {
      return n;
    }
  }
  return interv2cents(n / d);
}


x86 assembly (clang, -O0):
<scl2cents>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb4(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeac(%rip),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1050 <sscanf@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
je     11ab <scl2cents+0x7b>
cmpl   $0x1,-0x24(%rbp)
jne    11a6 <scl2cents+0x76>
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     11a6 <scl2cents+0x76>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11bf <scl2cents+0x8f>
jmp    11ab <scl2cents+0x7b>
movsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
call   1040 <interv2cents@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scl2cents>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movq   $0x0,(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x8(%rsp)
lea    0xeaa(%rip),%rsi
mov    %rsp,%rdx
lea    0x8(%rsp),%rcx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1181 <scl2cents+0x51>
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1181 <scl2cents+0x51>
movsd  (%rsp),%xmm0
jmp    1191 <scl2cents+0x61>
movsd  (%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
call   1040 <interv2cents@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%lf/%lf\0A\00"
define double @scl2cents(i8* %0) {
%2 = alloca double
%3 = alloca i8*
%4 = alloca double
%5 = alloca double
%6 = alloca i32
store i8* %0, i8** %3
store double 0.000000e+00, double* %4
store double 1.000000e+00, double* %5
%7 = load i8*, i8** %3
%8 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double* %4, double* %5)
store i32 %8, i32* %6
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %1
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = load i8*, i8** %3
%15 = call i32* @strchr(i8* %14, i8 signext 46)
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load double, double* %4
store double %18, double* %2
br label %25
19: ; preds = %13, %10
br label %20
20: ; preds = %19, %1
%21 = load double, double* %4
%22 = load double, double* %5
%23 = fdiv double %21, %22
%24 = call double @interv2cents(double %23)
store double %24, double* %2
br label %25
25: ; preds = %20, %17
%26 = load double, double* %2
ret double %26
}

LLVM IR (-O2):
@.str = [9 x i8] c"%lf/%lf\0A\00"
define double @scl2cents(i8* %0) {
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %2 to i8*
store double 0.000000e+00, double* %2
%5 = bitcast double* %3 to i8*
store double 1.000000e+00, double* %3
%6 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double* %2, double* %3)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = call i32* @strchr(i8* %0, i8 signext 46)
%10 = icmp eq i32* %9, null
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = load double, double* %2
br label %18
13: ; preds = %8, %1
%14 = load double, double* %2
%15 = load double, double* %3
%16 = fdiv double %14, %15
%17 = call double @interv2cents(double %16)
br label %18
18: ; preds = %13, %11
%19 = phi double [ %12, %11 ], [ %17, %13 ]
ret double %19
}