#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 */
struct lconv {
  char *decimal_point;
};

/* Variables and functions */
scalar_t__ ERANGE;
scalar_t__ errno;
int /*<<< orphan*/ ffpmsg(char *);
struct lconv *localeconv();
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncat(char *, char *, int);
double strtod(char *, char **);
int ffc2dd(char *cval, double *dval, int *status) {
  char *loc, msg[81], tval[73];
  struct lconv *lcc = 0;
  static char decimalpt = 0;
  if (*status > 0)
    return (*status);
  if (!decimalpt) {
    lcc = localeconv();
    decimalpt = *(lcc->decimal_point);
  }
  errno = 0;
  *dval = 0.;
  if (strchr(cval, 'D') || decimalpt == ',') {
    strcpy(tval, cval);
    if (loc = strchr(tval, 'D'))
      *loc = 'E';
    if (decimalpt == ',') {
      if (loc = strchr(tval, '.'))
        *loc = ',';
    }
    *dval = strtod(tval, &loc);
  } else {
    *dval = strtod(cval, &loc);
  }
  if (*loc != '\0' && *loc != ' ') {
    strcpy(msg, "Error in ffc2dd converting string to double: ");
    strncat(msg, cval, 30);
    ffpmsg(msg);
    *status = 409;
  }
  if (errno == ERANGE) {
    strcpy(msg, "Error in ffc2dd converting string to double: ");
    strncat(msg, cval, 30);
    ffpmsg(msg);
    *status = 412;
    errno = 0;
  }
  return (*status);
}


x86 assembly (clang, -O0):
<ffc2dd>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0xd8(%rbp)
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jle    119d <ffc2dd+0x3d>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1369 <ffc2dd+0x209>
cmpb   $0x0,0x2eb4(%rip)
jne    11ca <ffc2dd+0x6a>
mov    $0x0,%al
call   1050 <localeconv@plt>
mov    %rax,-0xd8(%rbp)
mov    -0xd8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%al
mov    %al,0x2e8e(%rip)
mov    0x2e07(%rip),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rdi
mov    $0x44,%esi
call   1070 <strchr@plt>
cmp    $0x0,%rax
jne    120b <ffc2dd+0xab>
movsbl 0x2e56(%rip),%eax
cmp    $0x2c,%eax
jne    1299 <ffc2dd+0x139>
lea    -0xd0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0xd0(%rbp),%rdi
mov    $0x44,%esi
call   1070 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1241 <ffc2dd+0xe1>
mov    -0x28(%rbp),%rax
movb   $0x45,(%rax)
movsbl 0x2e10(%rip),%eax
cmp    $0x2c,%eax
jne    127c <ffc2dd+0x11c>
lea    -0xd0(%rbp),%rdi
mov    $0x2e,%esi
call   1070 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1277 <ffc2dd+0x117>
mov    -0x28(%rbp),%rax
movb   $0x2c,(%rax)
jmp    127c <ffc2dd+0x11c>
lea    -0xd0(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <strtod@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    12ae <ffc2dd+0x14e>
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <strtod@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1303 <ffc2dd+0x1a3>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1303 <ffc2dd+0x1a3>
lea    -0x80(%rbp),%rdi
lea    0xd27(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1e,%edx
call   1080 <strncat@plt>
lea    -0x80(%rbp),%rdi
call   1060 <ffpmsg@plt>
mov    -0x20(%rbp),%rax
movl   $0x199,(%rax)
mov    0x2cce(%rip),%rax
mov    (%rax),%rax
mov    0x2cd4(%rip),%rcx
cmp    (%rcx),%rax
jne    1360 <ffc2dd+0x200>
lea    -0x80(%rbp),%rdi
lea    0xcd8(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1e,%edx
call   1080 <strncat@plt>
lea    -0x80(%rbp),%rdi
call   1060 <ffpmsg@plt>
mov    -0x20(%rbp),%rax
movl   $0x19c,(%rax)
mov    0x2c7f(%rip),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffc2dd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    (%rdx),%eax
test   %eax,%eax
jg     12cc <ffc2dd+0x16c>
mov    %rdx,%rbp
mov    %rsi,%r15
mov    %rdi,%r14
mov    0x2ece(%rip),%bl
test   %bl,%bl
jne    11a0 <ffc2dd+0x40>
xor    %eax,%eax
call   1050 <localeconv@plt>
mov    (%rax),%rax
mov    (%rax),%bl
mov    %bl,0x2eb8(%rip)
mov    0x2e31(%rip),%r13
movq   $0x0,0x0(%r13)
movq   $0x0,(%r15)
mov    %r14,%rdi
mov    $0x44,%esi
call   1070 <strchr@plt>
test   %rax,%rax
jne    11d7 <ffc2dd+0x77>
cmp    $0x2c,%bl
je     11d7 <ffc2dd+0x77>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
jmp    1230 <ffc2dd+0xd0>
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    $0x44,%esi
call   1070 <strchr@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     1201 <ffc2dd+0xa1>
movb   $0x45,(%rax)
cmpb   $0x2c,0x2e50(%rip)
jne    1226 <ffc2dd+0xc6>
lea    0x10(%rsp),%rdi
mov    $0x2e,%esi
call   1070 <strchr@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     1226 <ffc2dd+0xc6>
movb   $0x2c,(%rax)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <strtod@plt>
movsd  %xmm0,(%r15)
mov    0x8(%rsp),%rax
testb  $0xdf,(%rax)
je     1277 <ffc2dd+0x117>
lea    0xdb5(%rip),%rsi
lea    0x60(%rsp),%r15
mov    %r15,%rdi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1e,%edx
call   1080 <strncat@plt>
mov    %r15,%rdi
call   1060 <ffpmsg@plt>
movl   $0x199,0x0(%rbp)
mov    0x0(%r13),%rax
mov    0x2d66(%rip),%rcx
cmp    (%rcx),%rax
jne    12c9 <ffc2dd+0x169>
lea    0xd72(%rip),%rsi
lea    0x60(%rsp),%r15
mov    %r15,%rdi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1e,%edx
call   1080 <strncat@plt>
mov    %r15,%rdi
call   1060 <ffpmsg@plt>
movl   $0x19c,0x0(%rbp)
movq   $0x0,0x0(%r13)
mov    $0x19c,%eax
jmp    12cc <ffc2dd+0x16c>
mov    0x0(%rbp),%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.lconv = type { i8* }
@ffc2dd.decimalpt = internal global i8 0
@errno = global i64 0
@.str = [46 x i8] c"Error in ffc2dd converting string to double: \00"
@ERANGE = global i64 0
define i32 @ffc2dd(i8* %0, double* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca double*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca [81 x i8]
%10 = alloca [73 x i8]
%11 = alloca %struct.lconv*
store i8* %0, i8** %5
store double* %1, double** %6
store i32* %2, i32** %7
store %struct.lconv* null, %struct.lconv** %11
%12 = load i32*, i32** %7
%13 = load i32, i32* %12
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %3
%16 = load i32*, i32** %7
%17 = load i32, i32* %16
store i32 %17, i32* %4
br label %99
18: ; preds = %3
%19 = load i8, i8* @ffc2dd.decimalpt
%20 = icmp ne i8 %19, 0
br i1 %20, label %27, label %21
21: ; preds = %18
%22 = call %struct.lconv* (...) @localeconv()
store %struct.lconv* %22, %struct.lconv** %11
%23 = load %struct.lconv*, %struct.lconv** %11
%24 = getelementptr inbounds %struct.lconv, %struct.lconv* %23, i32 0, i32 0
%25 = load i8*, i8** %24
%26 = load i8, i8* %25
store i8 %26, i8* @ffc2dd.decimalpt
br label %27
27: ; preds = %21, %18
store i64 0, i64* @errno
%28 = load double*, double** %6
store double 0.000000e+00, double* %28
%29 = load i8*, i8** %5
%30 = call i8* @strchr(i8* %29, i8 signext 68)
%31 = icmp ne i8* %30, null
br i1 %31, label %36, label %32
32: ; preds = %27
%33 = load i8, i8* @ffc2dd.decimalpt
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 44
br i1 %35, label %36, label %60
36: ; preds = %32, %27
%37 = getelementptr inbounds [73 x i8], [73 x i8]* %10, i64 0, i64 0
%38 = load i8*, i8** %5
%39 = call i32 @strcpy(i8* %37, i8* %38)
%40 = getelementptr inbounds [73 x i8], [73 x i8]* %10, i64 0, i64 0
%41 = call i8* @strchr(i8* %40, i8 signext 68)
store i8* %41, i8** %8
%42 = icmp ne i8* %41, null
br i1 %42, label %43, label %45
43: ; preds = %36
%44 = load i8*, i8** %8
store i8 69, i8* %44
br label %45
45: ; preds = %43, %36
%46 = load i8, i8* @ffc2dd.decimalpt
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 44
br i1 %48, label %49, label %56
49: ; preds = %45
%50 = getelementptr inbounds [73 x i8], [73 x i8]* %10, i64 0, i64 0
%51 = call i8* @strchr(i8* %50, i8 signext 46)
store i8* %51, i8** %8
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = load i8*, i8** %8
store i8 44, i8* %54
br label %55
55: ; preds = %53, %49
br label %56
56: ; preds = %55, %45
%57 = getelementptr inbounds [73 x i8], [73 x i8]* %10, i64 0, i64 0
%58 = call double @strtod(i8* %57, i8** %8)
%59 = load double*, double** %6
store double %58, double* %59
br label %64
60: ; preds = %32
%61 = load i8*, i8** %5
%62 = call double @strtod(i8* %61, i8** %8)
%63 = load double*, double** %6
store double %62, double* %63
br label %64
64: ; preds = %60, %56
%65 = load i8*, i8** %8
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %83
69: ; preds = %64
%70 = load i8*, i8** %8
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp ne i32 %72, 32
br i1 %73, label %74, label %83
74: ; preds = %69
%75 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%76 = call i32 @strcpy(i8* %75, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%77 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%78 = load i8*, i8** %5
%79 = call i32 @strncat(i8* %77, i8* %78, i32 30)
%80 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%81 = call i32 @ffpmsg(i8* %80)
%82 = load i32*, i32** %7
store i32 409, i32* %82
br label %83
83: ; preds = %74, %69, %64
%84 = load i64, i64* @errno
%85 = load i64, i64* @ERANGE
%86 = icmp eq i64 %84, %85
br i1 %86, label %87, label %96
87: ; preds = %83
%88 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%89 = call i32 @strcpy(i8* %88, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%90 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%91 = load i8*, i8** %5
%92 = call i32 @strncat(i8* %90, i8* %91, i32 30)
%93 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%94 = call i32 @ffpmsg(i8* %93)
%95 = load i32*, i32** %7
store i32 412, i32* %95
store i64 0, i64* @errno
br label %96
96: ; preds = %87, %83
%97 = load i32*, i32** %7
%98 = load i32, i32* %97
store i32 %98, i32* %4
br label %99
99: ; preds = %96, %15
%100 = load i32, i32* %4
ret i32 %100
}

LLVM IR (-O2):
%struct.lconv = type { i8* }
@ffc2dd.decimalpt = internal unnamed_addr global i8 0
@errno = global i64 0
@.str = [46 x i8] c"Error in ffc2dd converting string to double: \00"
@ERANGE = global i64 0
define i32 @ffc2dd(i8* %0, double* nocapture writeonly %1, i32* nocapture %2) {
%4 = alloca i8*
%5 = alloca [81 x i8]
%6 = alloca [73 x i8]
%7 = bitcast i8** %4 to i8*
%8 = getelementptr inbounds [81 x i8], [81 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [73 x i8], [73 x i8]* %6, i64 0, i64 0
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %60, label %12
12: ; preds = %3
%13 = load i8, i8* @ffc2dd.decimalpt
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = tail call %struct.lconv* (...) @localeconv()
%17 = getelementptr inbounds %struct.lconv, %struct.lconv* %16, i64 0, i32 0
%18 = load i8*, i8** %17
%19 = load i8, i8* %18
store i8 %19, i8* @ffc2dd.decimalpt
br label %20
20: ; preds = %15, %12
%21 = phi i8 [ %19, %15 ], [ %13, %12 ]
store i64 0, i64* @errno
store double 0.000000e+00, double* %1
%22 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 68)
%23 = icmp ne i8* %22, null
%24 = icmp eq i8 %21, 44
%25 = select i1 %23, i1 true, i1 %24
br i1 %25, label %26, label %40
26: ; preds = %20
%27 = call i32 @strcpy(i8* %9, i8* %0)
%28 = call i8* @strchr(i8* %9, i8 signext 68)
store i8* %28, i8** %4
%29 = icmp eq i8* %28, null
br i1 %29, label %31, label %30
30: ; preds = %26
store i8 69, i8* %28
br label %31
31: ; preds = %30, %26
%32 = load i8, i8* @ffc2dd.decimalpt
%33 = icmp eq i8 %32, 44
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = call i8* @strchr(i8* %9, i8 signext 46)
store i8* %35, i8** %4
%36 = icmp eq i8* %35, null
br i1 %36, label %38, label %37
37: ; preds = %34
store i8 44, i8* %35
br label %38
38: ; preds = %34, %37, %31
%39 = call double @strtod(i8* %9, i8** %4)
br label %42
40: ; preds = %20
%41 = call double @strtod(i8* %0, i8** %4)
br label %42
42: ; preds = %40, %38
%43 = phi double [ %41, %40 ], [ %39, %38 ]
store double %43, double* %1
%44 = load i8*, i8** %4
%45 = load i8, i8* %44
switch i8 %45, label %46 [
i8 0, label %50
i8 32, label %50
]
46: ; preds = %42
%47 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%48 = call i32 @strncat(i8* %8, i8* %0, i32 30)
%49 = call i32 @ffpmsg(i8* %8)
store i32 409, i32* %2
br label %50
50: ; preds = %42, %42, %46
%51 = load i64, i64* @errno
%52 = load i64, i64* @ERANGE
%53 = icmp eq i64 %51, %52
br i1 %53, label %56, label %54
54: ; preds = %50
%55 = load i32, i32* %2
br label %60
56: ; preds = %50
%57 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%58 = call i32 @strncat(i8* %8, i8* %0, i32 30)
%59 = call i32 @ffpmsg(i8* %8)
store i32 412, i32* %2
store i64 0, i64* @errno
br label %60
60: ; preds = %56, %54, %3
%61 = phi i32 [ %10, %3 ], [ %55, %54 ], [ 412, %56 ]
ret i32 %61
}