#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 */
double HUGE_VAL;
double atof(char *);
scalar_t__ s_tokcmpn(char *, char *, int);
double atodn(char *s, int n) {
  return s_tokcmpn("-INF", s, n) == 0  ? -HUGE_VAL
         : s_tokcmpn("INF", s, n) == 0 ? HUGE_VAL
                                       : atof(s);
}


x86 assembly (clang, -O0):
<atodn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xec3(%rip),%rdi
call   1040 <s_tokcmpn@plt>
cmp    $0x0,%rax
jne    1178 <atodn+0x58>
mov    0x2e95(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11c2 <atodn+0xa2>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xe7b(%rip),%rdi
call   1040 <s_tokcmpn@plt>
cmp    $0x0,%rax
jne    11aa <atodn+0x8a>
mov    0x2e4c(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11b8 <atodn+0x98>
mov    -0x8(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atodn>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xee1(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <s_tokcmpn@plt>
test   %rax,%rax
je     1162 <atodn+0x42>
lea    0xecc(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <s_tokcmpn@plt>
test   %rax,%rax
je     1176 <atodn+0x56>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <atof@plt>
mov    0x2e7f(%rip),%rax
movsd  (%rax),%xmm0
xorps  0xe8c(%rip),%xmm0
jmp    1181 <atodn+0x61>
mov    0x2e6b(%rip),%rax
movsd  (%rax),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"-INF\00"
@HUGE_VAL = global double 0.000000e+00
@.str.1 = [4 x i8] c"INF\00"
define double @atodn(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i64 @s_tokcmpn(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load double, double* @HUGE_VAL
%11 = fneg double %10
br label %24
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = load i32, i32* %4
%15 = call i64 @s_tokcmpn(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %13, i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = load double, double* @HUGE_VAL
br label %22
19: ; preds = %12
%20 = load i8*, i8** %3
%21 = call double @atof(i8* %20)
br label %22
22: ; preds = %19, %17
%23 = phi double [ %18, %17 ], [ %21, %19 ]
br label %24
24: ; preds = %22, %9
%25 = phi double [ %11, %9 ], [ %23, %22 ]
ret double %25
}

LLVM IR (-O2):
@.str = [5 x i8] c"-INF\00"
@HUGE_VAL = global double 0.000000e+00
@.str.1 = [4 x i8] c"INF\00"
define double @atodn(i8* %0, i32 %1) {
%3 = tail call i64 @s_tokcmpn(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load double, double* @HUGE_VAL
%7 = fneg double %6
br label %15
8: ; preds = %2
%9 = tail call i64 @s_tokcmpn(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = load double, double* @HUGE_VAL
br label %15
13: ; preds = %8
%14 = tail call double @atof(i8* %0)
br label %15
15: ; preds = %11, %13, %5
%16 = phi double [ %7, %5 ], [ %12, %11 ], [ %14, %13 ]
ret double %16
}