#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 */
int /*<<< orphan*/ ffc2dd(char const *, double *, int *);
int /*<<< orphan*/ ffc2ll(char const *, int *, int *);
int /*<<< orphan*/ ffc2s(char const *, char *, int *);
int /*<<< orphan*/ ffdtyp(char const *, char *, int *);
int /*<<< orphan*/ ffpmsg(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncat(char *, char const *, int);
int ffc2d(const char *cval, double *dval, int *status) {
  char dtype, sval[81], msg[81];
  int lval;
  if (*status > 0)
    return (*status);
  if (cval[0] == '\0')
    return (*status = 204);
  ffdtyp(cval, &dtype, status);
  if (dtype == 'I' || dtype == 'F')
    ffc2dd(cval, dval, status);
  else if (dtype == 'L') {
    ffc2ll(cval, &lval, status);
    *dval = (double)lval;
  } else if (dtype == 'C') {
    ffc2s(cval, sval, status);
    ffc2dd(sval, dval, status);
  } else
    *status = 406;
  if (*status > 0) {
    *dval = 0.;
    strcpy(msg, "Error in ffc2d evaluating string as a double: ");
    strncat(msg, cval, 30);
    ffpmsg(msg);
    return (*status);
  }
  return (*status);
}


x86 assembly (clang, -O0):
<ffc2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jle    11a2 <ffc2d+0x32>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12ea <ffc2d+0x17a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11c8 <ffc2d+0x58>
mov    -0x20(%rbp),%rax
movl   $0xcc,(%rax)
movl   $0xcc,-0x4(%rbp)
jmp    12ea <ffc2d+0x17a>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    -0x21(%rbp),%rsi
call   1050 <ffdtyp@plt>
movsbl -0x21(%rbp),%eax
cmp    $0x49,%eax
je     11f3 <ffc2d+0x83>
movsbl -0x21(%rbp),%eax
cmp    $0x46,%eax
jne    1209 <ffc2d+0x99>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1090 <ffc2dd@plt>
jmp    1287 <ffc2d+0x117>
movsbl -0x21(%rbp),%eax
cmp    $0x4c,%eax
jne    123f <ffc2d+0xcf>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    -0xe4(%rbp),%rsi
call   1080 <ffc2ll@plt>
cvtsi2sdl -0xe4(%rbp),%xmm0
ff
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1282 <ffc2d+0x112>
movsbl -0x21(%rbp),%eax
cmp    $0x43,%eax
jne    1273 <ffc2d+0x103>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <ffc2s@plt>
lea    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1090 <ffc2dd@plt>
jmp    127d <ffc2d+0x10d>
mov    -0x20(%rbp),%rax
movl   $0x196,(%rax)
jmp    1282 <ffc2d+0x112>
jmp    1287 <ffc2d+0x117>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jle    12e1 <ffc2d+0x171>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
lea    -0xe0(%rbp),%rdi
lea    0xd53(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1e,%edx
call   1070 <strncat@plt>
lea    -0xe0(%rbp),%rdi
call   1060 <ffpmsg@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12ea <ffc2d+0x17a>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffc2d>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    (%rdx),%eax
test   %eax,%eax
jg     1259 <ffc2d+0xe9>
mov    %rdx,%rbx
mov    %rdi,%r14
cmpb   $0x0,(%rdi)
je     11c8 <ffc2d+0x58>
mov    %rsi,%r15
lea    0xf(%rsp),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1050 <ffdtyp@plt>
mov    0xf(%rsp),%al
add    $0xbd,%al
cmp    $0x9,%al
ja     11fb <ffc2d+0x8b>
movzbl %al,%eax
lea    0xe46(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %r14,%rdi
jmp    11ee <ffc2d+0x7e>
movl   $0xcc,(%rbx)
mov    $0xcc,%eax
jmp    1259 <ffc2d+0xe9>
lea    0x10(%rsp),%r12
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1030 <ffc2s@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1090 <ffc2dd@plt>
jmp    121e <ffc2d+0xae>
movl   $0x196,(%rbx)
jmp    1224 <ffc2d+0xb4>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1080 <ffc2ll@plt>
cvtsi2sdl 0x10(%rsp),%xmm0
movsd  %xmm0,(%r15)
mov    (%rbx),%eax
test   %eax,%eax
jle    1259 <ffc2d+0xe9>
movq   $0x0,(%r15)
lea    0xdf6(%rip),%rsi
lea    0x70(%rsp),%r15
mov    %r15,%rdi
call   1040 <strcpy@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1e,%edx
call   1070 <strncat@plt>
mov    %r15,%rdi
call   1060 <ffpmsg@plt>
mov    (%rbx),%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Error in ffc2d evaluating string as a double: \00"
define i32 @ffc2d(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 [81 x i8]
%11 = alloca i32
store i8* %0, i8** %5
store double* %1, double** %6
store i32* %2, i32** %7
%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 %88
18: ; preds = %3
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = load i32*, i32** %7
store i32 204, i32* %25
store i32 204, i32* %4
br label %88
26: ; preds = %18
%27 = load i8*, i8** %5
%28 = load i32*, i32** %7
%29 = call i32 @ffdtyp(i8* %27, i8* %8, i32* %28)
%30 = load i8, i8* %8
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 73
br i1 %32, label %37, label %33
33: ; preds = %26
%34 = load i8, i8* %8
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 70
br i1 %36, label %37, label %42
37: ; preds = %33, %26
%38 = load i8*, i8** %5
%39 = load double*, double** %6
%40 = load i32*, i32** %7
%41 = call i32 @ffc2dd(i8* %38, double* %39, i32* %40)
br label %70
42: ; preds = %33
%43 = load i8, i8* %8
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 76
br i1 %45, label %46, label %53
46: ; preds = %42
%47 = load i8*, i8** %5
%48 = load i32*, i32** %7
%49 = call i32 @ffc2ll(i8* %47, i32* %11, i32* %48)
%50 = load i32, i32* %11
%51 = sitofp i32 %50 to double
%52 = load double*, double** %6
store double %51, double* %52
br label %69
53: ; preds = %42
%54 = load i8, i8* %8
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 67
br i1 %56, label %57, label %66
57: ; preds = %53
%58 = load i8*, i8** %5
%59 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%60 = load i32*, i32** %7
%61 = call i32 @ffc2s(i8* %58, i8* %59, i32* %60)
%62 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%63 = load double*, double** %6
%64 = load i32*, i32** %7
%65 = call i32 @ffc2dd(i8* %62, double* %63, i32* %64)
br label %68
66: ; preds = %53
%67 = load i32*, i32** %7
store i32 406, i32* %67
br label %68
68: ; preds = %66, %57
br label %69
69: ; preds = %68, %46
br label %70
70: ; preds = %69, %37
%71 = load i32*, i32** %7
%72 = load i32, i32* %71
%73 = icmp sgt i32 %72, 0
br i1 %73, label %74, label %85
74: ; preds = %70
%75 = load double*, double** %6
store double 0.000000e+00, double* %75
%76 = getelementptr inbounds [81 x i8], [81 x i8]* %10, i64 0, i64 0
%77 = call i32 @strcpy(i8* %76, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%78 = getelementptr inbounds [81 x i8], [81 x i8]* %10, i64 0, i64 0
%79 = load i8*, i8** %5
%80 = call i32 @strncat(i8* %78, i8* %79, i32 30)
%81 = getelementptr inbounds [81 x i8], [81 x i8]* %10, i64 0, i64 0
%82 = call i32 @ffpmsg(i8* %81)
%83 = load i32*, i32** %7
%84 = load i32, i32* %83
store i32 %84, i32* %4
br label %88
85: ; preds = %70
%86 = load i32*, i32** %7
%87 = load i32, i32* %86
store i32 %87, i32* %4
br label %88
88: ; preds = %85, %74, %24, %15
%89 = load i32, i32* %4
ret i32 %89
}

LLVM IR (-O2):
@.str = [47 x i8] c"Error in ffc2d evaluating string as a double: \00"
define i32 @ffc2d(i8* %0, double* %1, i32* %2) {
%4 = alloca i8
%5 = alloca [81 x i8]
%6 = alloca [81 x i8]
%7 = alloca i32
%8 = getelementptr inbounds [81 x i8], [81 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%10 = bitcast i32* %7 to i8*
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 0
br i1 %12, label %38, label %13
13: ; preds = %3
%14 = load i8, i8* %0
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 204, i32* %2
br label %38
17: ; preds = %13
%18 = call i32 @ffdtyp(i8* %0, i8* %4, i32* %2)
%19 = load i8, i8* %4
switch i8 %19, label %29 [
i8 73, label %20
i8 70, label %20
i8 76, label %22
i8 67, label %26
]
20: ; preds = %17, %17
%21 = call i32 @ffc2dd(i8* %0, double* %1, i32* %2)
br label %30
22: ; preds = %17
%23 = call i32 @ffc2ll(i8* %0, i32* %7, i32* %2)
%24 = load i32, i32* %7
%25 = sitofp i32 %24 to double
store double %25, double* %1
br label %30
26: ; preds = %17
%27 = call i32 @ffc2s(i8* %0, i8* %8, i32* %2)
%28 = call i32 @ffc2dd(i8* %8, double* %1, i32* %2)
br label %30
29: ; preds = %17
store i32 406, i32* %2
br label %33
30: ; preds = %22, %26, %20
%31 = load i32, i32* %2
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %29, %30
store double 0.000000e+00, double* %1
%34 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%35 = call i32 @strncat(i8* %9, i8* %0, i32 30)
%36 = call i32 @ffpmsg(i8* %9)
%37 = load i32, i32* %2
br label %38
38: ; preds = %30, %3, %33, %16
%39 = phi i32 [ 204, %16 ], [ %37, %33 ], [ %11, %3 ], [ %31, %30 ]
ret i32 %39
}