#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 */
scalar_t__ ERANGE;
scalar_t__ errno;
int /*<<< orphan*/ ffpmsg(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncat(char *, char *, int);
scalar_t__ strtod(char *, char **);
int ffc2rr(char *cval, float *fval, int *status) {
  char *loc, msg[81];
  if (*status > 0)
    return (*status);
  errno = 0;
  *fval = 0.;
  *fval = (float)strtod(cval, &loc);
  if (*loc != '\0' && *loc != ' ') {
    strcpy(msg, "Error in ffc2rr converting string to float: ");
    strncat(msg, cval, 30);
    ffpmsg(msg);
    *status = 408;
  }
  if (errno == ERANGE) {
    strcpy(msg, "Error in ffc2rr converting string to float: ");
    strncat(msg, cval, 30);
    ffpmsg(msg);
    *status = 412;
    errno = 0;
  }
  return (*status);
}


x86 assembly (clang, -O0):
<ffc2rr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jle    1172 <ffc2rr+0x32>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1260 <ffc2rr+0x120>
mov    0x2e5f(%rip),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <strtod@plt>
cvtsi2ss %rax,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11fa <ffc2rr+0xba>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     11fa <ffc2rr+0xba>
lea    -0x80(%rbp),%rdi
lea    0xe30(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1e,%edx
call   1060 <strncat@plt>
lea    -0x80(%rbp),%rdi
call   1050 <ffpmsg@plt>
mov    -0x20(%rbp),%rax
movl   $0x198,(%rax)
mov    0x2dd7(%rip),%rax
mov    (%rax),%rax
mov    0x2ddd(%rip),%rcx
cmp    (%rcx),%rax
jne    1257 <ffc2rr+0x117>
lea    -0x80(%rbp),%rdi
lea    0xde1(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1e,%edx
call   1060 <strncat@plt>
lea    -0x80(%rbp),%rdi
call   1050 <ffpmsg@plt>
mov    -0x20(%rbp),%rax
movl   $0x19c,(%rax)
mov    0x2d88(%rip),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffc2rr>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    (%rdx),%eax
test   %eax,%eax
jg     1218 <ffc2rr+0xd8>
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
mov    0x2e73(%rip),%r12
movq   $0x0,(%r12)
movl   $0x0,(%rsi)
lea    0x8(%rsp),%rsi
call   1040 <strtod@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,(%rbx)
mov    0x8(%rsp),%rax
testb  $0xdf,(%rax)
je     11c3 <ffc2rr+0x83>
lea    0xe69(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1e,%edx
call   1060 <strncat@plt>
mov    %rbx,%rdi
call   1050 <ffpmsg@plt>
movl   $0x198,(%r15)
mov    (%r12),%rax
mov    0x2e1a(%rip),%rcx
cmp    (%rcx),%rax
jne    1215 <ffc2rr+0xd5>
lea    0xe26(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1e,%edx
call   1060 <strncat@plt>
mov    %rbx,%rdi
call   1050 <ffpmsg@plt>
movl   $0x19c,(%r15)
movq   $0x0,(%r12)
mov    $0x19c,%eax
jmp    1218 <ffc2rr+0xd8>
mov    (%r15),%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i64 0
@.str = [45 x i8] c"Error in ffc2rr converting string to float: \00"
@ERANGE = global i64 0
define i32 @ffc2rr(i8* %0, float* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca float*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca [81 x i8]
store i8* %0, i8** %5
store float* %1, float** %6
store i32* %2, i32** %7
%10 = load i32*, i32** %7
%11 = load i32, i32* %10
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load i32*, i32** %7
%15 = load i32, i32* %14
store i32 %15, i32* %4
br label %56
16: ; preds = %3
store i64 0, i64* @errno
%17 = load float*, float** %6
store float 0.000000e+00, float* %17
%18 = load i8*, i8** %5
%19 = call i64 @strtod(i8* %18, i8** %8)
%20 = sitofp i64 %19 to float
%21 = load float*, float** %6
store float %20, float* %21
%22 = load i8*, i8** %8
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %40
26: ; preds = %16
%27 = load i8*, i8** %8
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 32
br i1 %30, label %31, label %40
31: ; preds = %26
%32 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%33 = call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%34 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%35 = load i8*, i8** %5
%36 = call i32 @strncat(i8* %34, i8* %35, i32 30)
%37 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%38 = call i32 @ffpmsg(i8* %37)
%39 = load i32*, i32** %7
store i32 408, i32* %39
br label %40
40: ; preds = %31, %26, %16
%41 = load i64, i64* @errno
%42 = load i64, i64* @ERANGE
%43 = icmp eq i64 %41, %42
br i1 %43, label %44, label %53
44: ; preds = %40
%45 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%46 = call i32 @strcpy(i8* %45, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%47 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%48 = load i8*, i8** %5
%49 = call i32 @strncat(i8* %47, i8* %48, i32 30)
%50 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%51 = call i32 @ffpmsg(i8* %50)
%52 = load i32*, i32** %7
store i32 412, i32* %52
store i64 0, i64* @errno
br label %53
53: ; preds = %44, %40
%54 = load i32*, i32** %7
%55 = load i32, i32* %54
store i32 %55, i32* %4
br label %56
56: ; preds = %53, %13
%57 = load i32, i32* %4
ret i32 %57
}

LLVM IR (-O2):
@errno = global i64 0
@.str = [45 x i8] c"Error in ffc2rr converting string to float: \00"
@ERANGE = global i64 0
define i32 @ffc2rr(i8* %0, float* nocapture writeonly %1, i32* nocapture %2) {
%4 = alloca i8*
%5 = alloca [81 x i8]
%6 = bitcast i8** %4 to i8*
%7 = getelementptr inbounds [81 x i8], [81 x i8]* %5, i64 0, i64 0
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %29, label %10
10: ; preds = %3
store i64 0, i64* @errno
store float 0.000000e+00, float* %1
%11 = call i64 @strtod(i8* %0, i8** %4)
%12 = sitofp i64 %11 to float
store float %12, float* %1
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
switch i8 %14, label %15 [
i8 0, label %19
i8 32, label %19
]
15: ; preds = %10
%16 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @strncat(i8* %7, i8* %0, i32 30)
%18 = call i32 @ffpmsg(i8* %7)
store i32 408, i32* %2
br label %19
19: ; preds = %10, %10, %15
%20 = load i64, i64* @errno
%21 = load i64, i64* @ERANGE
%22 = icmp eq i64 %20, %21
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = load i32, i32* %2
br label %29
25: ; preds = %19
%26 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @strncat(i8* %7, i8* %0, i32 30)
%28 = call i32 @ffpmsg(i8* %7)
store i32 412, i32* %2
store i64 0, i64* @errno
br label %29
29: ; preds = %25, %23, %3
%30 = phi i32 [ %8, %3 ], [ %24, %23 ], [ 412, %25 ]
ret i32 %30
}