#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int /*<<< orphan*/ stderr;
double strtod(char const *, char **);
double arg_float(const char *str, const char *error_hint) {
  if (!str) {
    fprintf(stderr, "%smissing number argument\n", error_hint);
    exit(1);
  }
  if (!*str) {
    fprintf(stderr, "%sempty number argument\n", error_hint);
    exit(1);
  }
  while (*str == ' ' || *str == '=')
    ++str;
  char *endptr;
  double val = strtod(str, &endptr);
  if (str == endptr) {
    fprintf(stderr, "%sinvalid number argument (%s)\n", error_hint, str);
    exit(1);
  }
  return val;
}


x86 assembly (clang, -O0):
<arg_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1170 <arg_float+0x40>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11a2 <arg_float+0x72>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    11a7 <arg_float+0x77>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x21(%rbp)
je     11cc <arg_float+0x9c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11dc <arg_float+0xac>
jmp    11ed <arg_float+0xbd>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11a7 <arg_float+0x77>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1236 <arg_float+0x106>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe0f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg_float>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
test   %rdi,%rdi
je     1189 <arg_float+0x59>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
jne    1168 <arg_float+0x38>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
jmp    1199 <arg_float+0x69>
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
cmp    $0x3d,%al
je     1160 <arg_float+0x30>
cmp    $0x20,%al
je     1160 <arg_float+0x30>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strtod@plt>
cmp    (%rsp),%rbx
je     11ad <arg_float+0x7d>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
lea    0xe67(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
lea    0xe77(%rip),%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"%smissing number argument\0A\00"
@.str.1 = [25 x i8] c"%sempty number argument\0A\00"
@.str.2 = [32 x i8] c"%sinvalid number argument (%s)\0A\00"
define double @arg_float(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %14, label %9
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %4
%12 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = icmp ne i8 %16, 0
br i1 %17, label %23, label %18
18: ; preds = %14
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %4
%21 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %14
br label %24
24: ; preds = %36, %23
%25 = load i8*, i8** %3
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 32
br i1 %28, label %34, label %29
29: ; preds = %24
%30 = load i8*, i8** %3
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 61
br label %34
34: ; preds = %29, %24
%35 = phi i1 [ true, %24 ], [ %33, %29 ]
br i1 %35, label %36, label %39
36: ; preds = %34
%37 = load i8*, i8** %3
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %3
br label %24
39: ; preds = %34
%40 = load i8*, i8** %3
%41 = call double @strtod(i8* %40, i8** %5)
store double %41, double* %6
%42 = load i8*, i8** %3
%43 = load i8*, i8** %5
%44 = icmp eq i8* %42, %43
br i1 %44, label %45, label %51
45: ; preds = %39
%46 = load i32, i32* @stderr
%47 = load i8*, i8** %4
%48 = load i8*, i8** %3
%49 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %47, i8* %48)
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %39
%52 = load double, double* %6
ret double %52
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"%smissing number argument\0A\00"
@.str.1 = [25 x i8] c"%sempty number argument\0A\00"
@.str.2 = [32 x i8] c"%sinvalid number argument (%s)\0A\00"
define double @arg_float(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %1)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = load i8, i8* %0
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %9, %19
%17 = phi i8 [ %21, %19 ], [ %10, %9 ]
%18 = phi i8* [ %20, %19 ], [ %0, %9 ]
switch i8 %17, label %22 [
i8 32, label %19
i8 61, label %19
]
19: ; preds = %16, %16
%20 = getelementptr inbounds i8, i8* %18, i64 1
%21 = load i8, i8* %20
br label %16
22: ; preds = %16
%23 = bitcast i8** %3 to i8*
%24 = call double @strtod(i8* %18, i8** %3)
%25 = load i8*, i8** %3
%26 = icmp eq i8* %18, %25
br i1 %26, label %27, label %31
27: ; preds = %22
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %1, i8* %18)
%30 = tail call i32 @exit(i32 1)
unreachable
31: ; preds = %22
ret double %24
}