#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*/ assert(int);
int os_atof_alt(char *);
void test_atof(void) {
  assert(os_atof_alt("0") == 0.0);
  assert(os_atof_alt("0.0") == 0.0);
  assert(os_atof_alt("1.0") == 1.0);
  assert(os_atof_alt("0.0") == 0.0);
  assert(os_atof_alt("100") == 100.0);
  assert(os_atof_alt("100.1001") == 100.1001);
  assert(os_atof_alt("10e2") == 10e2);
  assert(os_atof_alt("1E3") == 1E3);
  assert(os_atof_alt("2e-4") > 2.0e-4);
  assert(os_atof_alt("2e-4") < 2.1e-4);
  assert(os_atof_alt("9.9e2") == 9.9e2);
  assert(os_atof_alt("-1e0") == -1e0);
}


x86 assembly (clang, -O0):
<test_atof>:
push   %rbp
mov    %rsp,%rbp
lea    0xf17(%rip),%rdi
call   1040 <os_atof_alt@plt>
cvtsi2sd %eax,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xeec(%rip),%rdi
call   1040 <os_atof_alt@plt>
cvtsi2sd %eax,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xec7(%rip),%rdi
call   1040 <os_atof_alt@plt>
cvtsi2sd %eax,%xmm0
movsd  0xeaa(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xe95(%rip),%rdi
call   1040 <os_atof_alt@plt>
cvtsi2sd %eax,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xe74(%rip),%rdi
call   1040 <os_atof_alt@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe4b(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xe4a(%rip),%rdi
call   1040 <os_atof_alt@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe15(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xe25(%rip),%rdi
call   1040 <os_atof_alt@plt>
cvtsi2sd %eax,%xmm0
movsd  0xddf(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xdfc(%rip),%rdi
call   1040 <os_atof_alt@plt>
cvtsi2sd %eax,%xmm0
movsd  0xdb1(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xdd2(%rip),%rdi
call   1040 <os_atof_alt@plt>
cvtsi2sd %eax,%xmm0
movsd  0xd7b(%rip),%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xda9(%rip),%rdi
call   1040 <os_atof_alt@plt>
cvtsi2sd %eax,%xmm1
movsd  0xd4a(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xd85(%rip),%rdi
call   1040 <os_atof_alt@plt>
cvtsi2sd %eax,%xmm0
movsd  0xd19(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xd5d(%rip),%rdi
call   1040 <os_atof_alt@plt>
cvtsi2sd %eax,%xmm0
movsd  0xce3(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_atof>:
push   %rbx
lea    0xeda(%rip),%rdi
call   1040 <os_atof_alt@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xebf(%rip),%rbx
mov    %rbx,%rdi
call   1040 <os_atof_alt@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xea7(%rip),%rdi
call   1040 <os_atof_alt@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <os_atof_alt@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xe7c(%rip),%rdi
call   1040 <os_atof_alt@plt>
xor    %edi,%edi
cmp    $0x64,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xe66(%rip),%rdi
call   1040 <os_atof_alt@plt>
xor    %edi,%edi
call   1030 <assert@plt>
lea    0xe5c(%rip),%rdi
call   1040 <os_atof_alt@plt>
xor    %edi,%edi
cmp    $0x3e8,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xe45(%rip),%rdi
call   1040 <os_atof_alt@plt>
xor    %edi,%edi
cmp    $0x3e8,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xe2d(%rip),%rbx
mov    %rbx,%rdi
call   1040 <os_atof_alt@plt>
xor    %edi,%edi
test   %eax,%eax
setg   %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <os_atof_alt@plt>
xor    %edi,%edi
test   %eax,%eax
setle  %dil
call   1030 <assert@plt>
lea    0xe01(%rip),%rdi
call   1040 <os_atof_alt@plt>
xor    %edi,%edi
cmp    $0x3de,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xdeb(%rip),%rdi
call   1040 <os_atof_alt@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
pop    %rbx
jmp    1030 <assert@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@.str.1 = [4 x i8] c"0.0\00"
@.str.2 = [4 x i8] c"1.0\00"
@.str.3 = [4 x i8] c"100\00"
@.str.4 = [9 x i8] c"100.1001\00"
@.str.5 = [5 x i8] c"10e2\00"
@.str.6 = [4 x i8] c"1E3\00"
@.str.7 = [5 x i8] c"2e-4\00"
@.str.8 = [6 x i8] c"9.9e2\00"
@.str.9 = [5 x i8] c"-1e0\00"
define void @test_atof() {
%1 = call i32 @os_atof_alt(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = sitofp i32 %1 to double
%3 = fcmp oeq double %2, 0.000000e+00
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
%6 = call i32 @os_atof_alt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%7 = sitofp i32 %6 to double
%8 = fcmp oeq double %7, 0.000000e+00
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i32 @os_atof_alt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%12 = sitofp i32 %11 to double
%13 = fcmp oeq double %12, 1.000000e+00
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i32 @os_atof_alt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%17 = sitofp i32 %16 to double
%18 = fcmp oeq double %17, 0.000000e+00
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 @os_atof_alt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%22 = sitofp i32 %21 to double
%23 = fcmp oeq double %22, 1.000000e+02
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = call i32 @os_atof_alt(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%27 = sitofp i32 %26 to double
%28 = fcmp oeq double %27, 0x4059066809D49518
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = call i32 @os_atof_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%32 = sitofp i32 %31 to double
%33 = fcmp oeq double %32, 1.000000e+03
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = call i32 @os_atof_alt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%37 = sitofp i32 %36 to double
%38 = fcmp oeq double %37, 1.000000e+03
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = call i32 @os_atof_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%42 = sitofp i32 %41 to double
%43 = fcmp ogt double %42, 2.000000e-04
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = call i32 @os_atof_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%47 = sitofp i32 %46 to double
%48 = fcmp olt double %47, 2.100000e-04
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
%51 = call i32 @os_atof_alt(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%52 = sitofp i32 %51 to double
%53 = fcmp oeq double %52, 9.900000e+02
%54 = zext i1 %53 to i32
%55 = call i32 @assert(i32 %54)
%56 = call i32 @os_atof_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%57 = sitofp i32 %56 to double
%58 = fcmp oeq double %57, -1.000000e+00
%59 = zext i1 %58 to i32
%60 = call i32 @assert(i32 %59)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@.str.1 = [4 x i8] c"0.0\00"
@.str.2 = [4 x i8] c"1.0\00"
@.str.3 = [4 x i8] c"100\00"
@.str.4 = [9 x i8] c"100.1001\00"
@.str.5 = [5 x i8] c"10e2\00"
@.str.6 = [4 x i8] c"1E3\00"
@.str.7 = [5 x i8] c"2e-4\00"
@.str.8 = [6 x i8] c"9.9e2\00"
@.str.9 = [5 x i8] c"-1e0\00"
define void @test_atof() {
%1 = tail call i32 @os_atof_alt(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @os_atof_alt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @os_atof_alt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 %9, 1
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @os_atof_alt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = tail call i32 @os_atof_alt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i32 %17, 100
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = tail call i32 @os_atof_alt(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%22 = tail call i32 @assert(i32 0)
%23 = tail call i32 @os_atof_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%24 = icmp eq i32 %23, 1000
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = tail call i32 @os_atof_alt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%28 = icmp eq i32 %27, 1000
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = tail call i32 @os_atof_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%32 = icmp sgt i32 %31, 0
%33 = zext i1 %32 to i32
%34 = tail call i32 @assert(i32 %33)
%35 = tail call i32 @os_atof_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%36 = icmp slt i32 %35, 1
%37 = zext i1 %36 to i32
%38 = tail call i32 @assert(i32 %37)
%39 = tail call i32 @os_atof_alt(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%40 = icmp eq i32 %39, 990
%41 = zext i1 %40 to i32
%42 = tail call i32 @assert(i32 %41)
%43 = tail call i32 @os_atof_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%44 = icmp eq i32 %43, -1
%45 = zext i1 %44 to i32
%46 = tail call i32 @assert(i32 %45)
ret void
}