#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 */
float HUGE_VALF;
char *chl_next_arg(char *);
float strtof(char *, char **);
float chl_next_argf(char *args) {
  char *arg, *err;
  float ret;
  if (!(arg = chl_next_arg(args)))
    return -1;
  ret = strtof(arg, &err);
  if ((arg == err) || (ret == HUGE_VALF))
    return -1;
  return ret;
}


x86 assembly (clang, -O0):
<chl_next_argf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <chl_next_arg@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1155 <chl_next_argf+0x35>
movss  0xeb5(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ac <chl_next_argf+0x8c>
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <strtof@plt>
movss  %xmm0,-0x24(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     1190 <chl_next_argf+0x70>
movss  -0x24(%rbp),%xmm0
mov    0x2e6f(%rip),%rax
ucomiss (%rax),%xmm0
jne    11a2 <chl_next_argf+0x82>
jp     11a2 <chl_next_argf+0x82>
movss  0xe68(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ac <chl_next_argf+0x8c>
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chl_next_argf>:
push   %rbx
sub    $0x10,%rsp
call   1030 <chl_next_arg@plt>
test   %rax,%rax
je     1172 <chl_next_argf+0x52>
mov    %rax,%rbx
lea    0x8(%rsp),%rsi
mov    %rax,%rdi
call   1040 <strtof@plt>
movaps %xmm0,%xmm1
movss  0xeb6(%rip),%xmm0
cmp    0x8(%rsp),%rbx
je     117a <chl_next_argf+0x5a>
mov    0x2e98(%rip),%rax
movss  (%rax),%xmm2
cmpeqss %xmm1,%xmm2
movaps %xmm2,%xmm3
andnps %xmm1,%xmm3
andps  %xmm0,%xmm2
orps   %xmm3,%xmm2
movaps %xmm2,%xmm0
jmp    117a <chl_next_argf+0x5a>
movss  0xe86(%rip),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@HUGE_VALF = global float 0.000000e+00
define float @chl_next_argf(i8* %0) {
%2 = alloca float
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca float
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call i8* @chl_next_arg(i8* %7)
store i8* %8, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %11, label %10
10: ; preds = %1
store float -1.000000e+00, float* %2
br label %24
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = call float @strtof(i8* %12, i8** %5)
store float %13, float* %6
%14 = load i8*, i8** %4
%15 = load i8*, i8** %5
%16 = icmp eq i8* %14, %15
br i1 %16, label %21, label %17
17: ; preds = %11
%18 = load float, float* %6
%19 = load float, float* @HUGE_VALF
%20 = fcmp oeq float %18, %19
br i1 %20, label %21, label %22
21: ; preds = %17, %11
store float -1.000000e+00, float* %2
br label %24
22: ; preds = %17
%23 = load float, float* %6
store float %23, float* %2
br label %24
24: ; preds = %22, %21, %10
%25 = load float, float* %2
ret float %25
}

LLVM IR (-O2):
@HUGE_VALF = global float 0.000000e+00
define float @chl_next_argf(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = tail call i8* @chl_next_arg(i8* %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = call float @strtof(i8* %4, i8** %2)
%8 = load i8*, i8** %2
%9 = icmp eq i8* %4, %8
%10 = load float, float* @HUGE_VALF
%11 = fcmp oeq float %7, %10
%12 = select i1 %9, i1 true, i1 %11
%13 = select i1 %12, float -1.000000e+00, float %7
br label %14
14: ; preds = %6, %1
%15 = phi float [ -1.000000e+00, %1 ], [ %13, %6 ]
ret float %15
}