#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 */
char *skip_whitespace(char const *);
int sscanf(char const *, char *, ...);
const char *string_parse_fractional_12(const char *string, double *v) {
  int i, n = 0, ret = 1, count = 0, neg = 0;
  double divisor = 1., digit;
  const char *p = string;
  *v = 0.;
  p = skip_whitespace(p);
  if (p[0] == '-') {
    neg = 1;
    p++;
  }
  for (i = 0; i < 20 && ret == 1; i++) {
    n = 0;
    ret = sscanf(p, "%lf%n", &digit, &n);
    p = &p[n];
    if (ret == 1) {
      count++;
      *v += digit / divisor;
      divisor *= 12.;
    }
    n = 0;
    sscanf(p, ";%n", &n);
    p = &p[n];
    if (p[0] == ' ' || p[0] == '\t')
      ret = 0;
  }
  if (count == 0)
    return string;
  if (neg)
    *v = -*v;
  return p;
}


x86 assembly (clang, -O0):
<string_parse_fractional_12>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movsd  0xeac(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rdi
call   1030 <skip_whitespace@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    119c <string_parse_fractional_12+0x7c>
movl   $0x1,-0x2c(%rbp)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x1c(%rbp)
xor    %eax,%eax
cmpl   $0x14,-0x1c(%rbp)
mov    %al,-0x49(%rbp)
jge    11bc <string_parse_fractional_12+0x9c>
cmpl   $0x1,-0x24(%rbp)
sete   %al
mov    %al,-0x49(%rbp)
mov    -0x49(%rbp),%al
test   $0x1,%al
jne    11cc <string_parse_fractional_12+0xac>
jmp    12a0 <string_parse_fractional_12+0x180>
movl   $0x0,-0x20(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xe32(%rip),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    %eax,-0x24(%rbp)
mov    -0x48(%rbp),%rax
movslq -0x20(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
cmpl   $0x1,-0x24(%rbp)
jne    123a <string_parse_fractional_12+0x11a>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
movsd  -0x40(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  0xdd8(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xdca(%rip),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x48(%rbp),%rax
movslq -0x20(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1286 <string_parse_fractional_12+0x166>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
jne    128d <string_parse_fractional_12+0x16d>
movl   $0x0,-0x24(%rbp)
jmp    1292 <string_parse_fractional_12+0x172>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a3 <string_parse_fractional_12+0x83>
cmpl   $0x0,-0x28(%rbp)
jne    12b7 <string_parse_fractional_12+0x197>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12f0 <string_parse_fractional_12+0x1d0>
cmpl   $0x0,-0x2c(%rbp)
je     12e8 <string_parse_fractional_12+0x1c8>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_parse_fractional_12>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,0x8(%rsp)
movq   $0x0,(%rsi)
mov    %rdi,0x18(%rsp)
call   1030 <skip_whitespace@plt>
mov    (%rax),%cl
xor    %r14d,%r14d
mov    %cl,0x3(%rsp)
cmp    $0x2d,%cl
sete   %r14b
add    %rax,%r14
movsd  0xea1(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0x4(%rsp),%rbx
xor    %ebp,%ebp
xor    %r13d,%r13d
nop
movl   $0x0,0x4(%rsp)
mov    %r14,%rdi
lea    0xe9e(%rip),%rsi
lea    0x20(%rsp),%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    %eax,%r15d
movslq 0x4(%rsp),%r12
add    %r14,%r12
cmp    $0x1,%eax
jne    11cf <string_parse_fractional_12+0xaf>
add    $0x1,%ebp
movsd  0x20(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm1,%xmm0
mov    0x8(%rsp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mulsd  0xe3f(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
movl   $0x0,0x4(%rsp)
mov    %r12,%rdi
lea    0xe45(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
movslq 0x4(%rsp),%rax
lea    (%r12,%rax,1),%r14
movzbl (%r12,%rax,1),%eax
cmp    $0x9,%al
je     1215 <string_parse_fractional_12+0xf5>
cmp    $0x20,%al
je     1215 <string_parse_fractional_12+0xf5>
cmp    $0x12,%r13d
ja     1215 <string_parse_fractional_12+0xf5>
add    $0x1,%r13d
cmp    $0x1,%r15d
je     1170 <string_parse_fractional_12+0x50>
test   %ebp,%ebp
mov    0x18(%rsp),%rax
cmovne %r14,%rax
je     1241 <string_parse_fractional_12+0x121>
cmpb   $0x2d,0x3(%rsp)
jne    1241 <string_parse_fractional_12+0x121>
mov    0x8(%rsp),%rax
movsd  (%rax),%xmm0
xorpd  0xdd6(%rip),%xmm0
movlpd %xmm0,(%rax)
mov    %r14,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%lf%n\00"
@.str.1 = [4 x i8] c";%n\00"
define i8* @string_parse_fractional_12(i8* %0, double* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca i8*
store i8* %0, i8** %4
store double* %1, double** %5
store i32 0, i32* %7
store i32 1, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store double 1.000000e+00, double* %11
%14 = load i8*, i8** %4
store i8* %14, i8** %13
%15 = load double*, double** %5
store double 0.000000e+00, double* %15
%16 = load i8*, i8** %13
%17 = call i8* @skip_whitespace(i8* %16)
store i8* %17, i8** %13
%18 = load i8*, i8** %13
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 45
br i1 %22, label %23, label %26
23: ; preds = %2
store i32 1, i32* %10
%24 = load i8*, i8** %13
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %13
br label %26
26: ; preds = %23, %2
store i32 0, i32* %6
br label %27
27: ; preds = %75, %26
%28 = load i32, i32* %6
%29 = icmp slt i32 %28, 20
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* %8
%32 = icmp eq i32 %31, 1
br label %33
33: ; preds = %30, %27
%34 = phi i1 [ false, %27 ], [ %32, %30 ]
br i1 %34, label %35, label %78
35: ; preds = %33
store i32 0, i32* %7
%36 = load i8*, i8** %13
%37 = call i32 (i8*, i8*, ...) @sscanf(i8* %36, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double* %12, i32* %7)
store i32 %37, i32* %8
%38 = load i8*, i8** %13
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
store i8* %41, i8** %13
%42 = load i32, i32* %8
%43 = icmp eq i32 %42, 1
br i1 %43, label %44, label %55
44: ; preds = %35
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
%47 = load double, double* %12
%48 = load double, double* %11
%49 = fdiv double %47, %48
%50 = load double*, double** %5
%51 = load double, double* %50
%52 = fadd double %51, %49
store double %52, double* %50
%53 = load double, double* %11
%54 = fmul double %53, 1.200000e+01
store double %54, double* %11
br label %55
55: ; preds = %44, %35
store i32 0, i32* %7
%56 = load i8*, i8** %13
%57 = call i32 (i8*, i8*, ...) @sscanf(i8* %56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%58 = load i8*, i8** %13
%59 = load i32, i32* %7
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %58, i64 %60
store i8* %61, i8** %13
%62 = load i8*, i8** %13
%63 = getelementptr inbounds i8, i8* %62, i64 0
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %65, 32
br i1 %66, label %73, label %67
67: ; preds = %55
%68 = load i8*, i8** %13
%69 = getelementptr inbounds i8, i8* %68, i64 0
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp eq i32 %71, 9
br i1 %72, label %73, label %74
73: ; preds = %67, %55
store i32 0, i32* %8
br label %74
74: ; preds = %73, %67
br label %75
75: ; preds = %74
%76 = load i32, i32* %6
%77 = add nsw i32 %76, 1
store i32 %77, i32* %6
br label %27
78: ; preds = %33
%79 = load i32, i32* %9
%80 = icmp eq i32 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %78
%82 = load i8*, i8** %4
store i8* %82, i8** %3
br label %93
83: ; preds = %78
%84 = load i32, i32* %10
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %91
86: ; preds = %83
%87 = load double*, double** %5
%88 = load double, double* %87
%89 = fneg double %88
%90 = load double*, double** %5
store double %89, double* %90
br label %91
91: ; preds = %86, %83
%92 = load i8*, i8** %13
store i8* %92, i8** %3
br label %93
93: ; preds = %91, %81
%94 = load i8*, i8** %3
ret i8* %94
}

LLVM IR (-O2):
@.str = [6 x i8] c"%lf%n\00"
@.str.1 = [4 x i8] c";%n\00"
define i8* @string_parse_fractional_12(i8* %0, double* nocapture %1) {
%3 = alloca i32
%4 = alloca double
%5 = bitcast i32* %3 to i8*
%6 = bitcast double* %4 to i8*
store double 0.000000e+00, double* %1
%7 = tail call i8* @skip_whitespace(i8* %0)
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 45
%10 = zext i1 %9 to i64
%11 = getelementptr i8, i8* %7, i64 %10
br label %12
12: ; preds = %2, %37
%13 = phi i8* [ %11, %2 ], [ %35, %37 ]
%14 = phi double [ 1.000000e+00, %2 ], [ %31, %37 ]
%15 = phi i32 [ 0, %2 ], [ %30, %37 ]
%16 = phi i32 [ 0, %2 ], [ %38, %37 ]
store i32 0, i32* %3
%17 = call i32 (i8*, i8*, ...) @sscanf(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double* %4, i32* %3)
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %13, i64 %19
%21 = icmp eq i32 %17, 1
br i1 %21, label %22, label %29
22: ; preds = %12
%23 = add nsw i32 %15, 1
%24 = load double, double* %4
%25 = fdiv double %24, %14
%26 = load double, double* %1
%27 = fadd double %26, %25
store double %27, double* %1
%28 = fmul double %14, 1.200000e+01
br label %29
29: ; preds = %22, %12
%30 = phi i32 [ %23, %22 ], [ %15, %12 ]
%31 = phi double [ %28, %22 ], [ %14, %12 ]
store i32 0, i32* %3
%32 = call i32 (i8*, i8*, ...) @sscanf(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %20, i64 %34
%36 = load i8, i8* %35
switch i8 %36, label %37 [
i8 32, label %42
i8 9, label %42
]
37: ; preds = %29
%38 = add nuw nsw i32 %16, 1
%39 = icmp ult i32 %16, 19
%40 = icmp eq i32 %17, 1
%41 = and i1 %39, %40
br i1 %41, label %12, label %42
42: ; preds = %29, %29, %37
%43 = icmp eq i32 %30, 0
%44 = xor i1 %9, true
%45 = select i1 %43, i1 true, i1 %44
%46 = select i1 %43, i8* %0, i8* %35
br i1 %45, label %50, label %47
47: ; preds = %42
%48 = load double, double* %1
%49 = fneg double %48
store double %49, double* %1
br label %50
50: ; preds = %42, %47
%51 = phi i8* [ %46, %42 ], [ %35, %47 ]
ret i8* %51
}