#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);
double strtod(char *, int /*<<< orphan*/ *);
float strtof(char *, int /*<<< orphan*/ *);
long double strtold(char *, int /*<<< orphan*/ *);
int test_inf(void) {
  int c = 0;
  float finf = strtof("INF()", NULL);
  double dinf = strtod("INF()", NULL);
  long double ldinf = strtold("INF()", NULL);
  assert(finf != 0);
  if (finf) {
    c++;
  } else if (!finf) {
    assert(0);
  }
  assert(dinf != 0);
  if (dinf) {
    c++;
  } else if (!dinf) {
    assert(0);
  }
  assert(ldinf != 0);
  if (ldinf) {
    c++;
  } else if (!ldinf) {
    assert(0);
  }
  return c == 3;
}


x86 assembly (clang, -O0):
<test_inf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    %rdi,-0x30(%rbp)
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,-0x28(%rbp)
call   1040 <strtof@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
movss  %xmm0,-0x8(%rbp)
call   1030 <strtod@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
movsd  %xmm0,-0x10(%rbp)
call   1060 <strtold@plt>
fstpt  -0x20(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11c7 <test_inf+0x87>
jp     11c7 <test_inf+0x87>
jmp    11d5 <test_inf+0x95>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11f8 <test_inf+0xb8>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11f3 <test_inf+0xb3>
jp     11f3 <test_inf+0xb3>
xor    %edi,%edi
call   1050 <assert@plt>
jmp    11f8 <test_inf+0xb8>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1233 <test_inf+0xf3>
jp     1233 <test_inf+0xf3>
jmp    1241 <test_inf+0x101>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1265 <test_inf+0x125>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1260 <test_inf+0x120>
jp     1260 <test_inf+0x120>
xor    %edi,%edi
call   1050 <assert@plt>
jmp    1265 <test_inf+0x125>
fldt   -0x20(%rbp)
fldz
fld    %st(0)
fstpt  -0x3c(%rbp)
fucomip %st(1),%st
fstp   %st(0)
setp   %cl
setne  %al
or     %cl,%al
movzbl %al,%edi
call   1050 <assert@plt>
fldt   -0x3c(%rbp)
fldt   -0x20(%rbp)
fucomip %st(1),%st
fstp   %st(0)
jne    129e <test_inf+0x15e>
jp     129e <test_inf+0x15e>
jmp    12ac <test_inf+0x16c>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    12d4 <test_inf+0x194>
fldt   -0x20(%rbp)
fldz
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    12cf <test_inf+0x18f>
jp     12cf <test_inf+0x18f>
jmp    12c8 <test_inf+0x188>
xor    %edi,%edi
call   1050 <assert@plt>
jmp    12d4 <test_inf+0x194>
cmpl   $0x3,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_inf>:
push   %rbx
sub    $0x20,%rsp
lea    0xec0(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <strtof@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <strtold@plt>
fstpt  0x14(%rsp)
xorps  %xmm1,%xmm1
movss  0x4(%rsp),%xmm0
cmpneqss %xmm1,%xmm0
movd   %xmm0,%edi
and    $0x1,%edi
call   1050 <assert@plt>
movss  0x4(%rsp),%xmm0
ucomiss 0xe67(%rip),%xmm0
mov    $0x1,%ebx
jne    11b3 <test_inf+0x73>
jp     11b3 <test_inf+0x73>
xor    %edi,%edi
call   1050 <assert@plt>
xor    %ebx,%ebx
xorps  %xmm1,%xmm1
movsd  0x8(%rsp),%xmm0
cmpneqsd %xmm1,%xmm0
movq   %xmm0,%rdi
and    $0x1,%edi
call   1050 <assert@plt>
movsd  0x8(%rsp),%xmm0
ucomisd 0xe24(%rip),%xmm0
jne    11e0 <test_inf+0xa0>
jnp    11e5 <test_inf+0xa5>
add    $0x1,%ebx
jmp    11ec <test_inf+0xac>
xor    %edi,%edi
call   1050 <assert@plt>
fldz
fld    %st(0)
fstpt  0x8(%rsp)
fldt   0x14(%rsp)
fucomip %st(1),%st
fstp   %st(0)
setp   %al
setne  %cl
or     %al,%cl
movzbl %cl,%edi
call   1050 <assert@plt>
fldt   0x14(%rsp)
fldt   0x8(%rsp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    121e <test_inf+0xde>
jnp    1223 <test_inf+0xe3>
add    $0x1,%ebx
jmp    122a <test_inf+0xea>
xor    %edi,%edi
call   1050 <assert@plt>
xor    %eax,%eax
cmp    $0x3,%ebx
sete   %al
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"INF()\00"
define i32 @test_inf() {
%1 = alloca i32
%2 = alloca float
%3 = alloca double
%4 = alloca x86_fp80
store i32 0, i32* %1
%5 = call float @strtof(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* null)
store float %5, float* %2
%6 = call double @strtod(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* null)
store double %6, double* %3
%7 = call x86_fp80 @strtold(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* null)
store x86_fp80 %7, x86_fp80* %4
%8 = load float, float* %2
%9 = fcmp une float %8, 0.000000e+00
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load float, float* %2
%13 = fcmp une float %12, 0.000000e+00
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
br label %23
17: ; preds = %0
%18 = load float, float* %2
%19 = fcmp une float %18, 0.000000e+00
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = call i32 @assert(i32 0)
br label %22
22: ; preds = %20, %17
br label %23
23: ; preds = %22, %14
%24 = load double, double* %3
%25 = fcmp une double %24, 0.000000e+00
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = load double, double* %3
%29 = fcmp une double %28, 0.000000e+00
br i1 %29, label %30, label %33
30: ; preds = %23
%31 = load i32, i32* %1
%32 = add nsw i32 %31, 1
store i32 %32, i32* %1
br label %39
33: ; preds = %23
%34 = load double, double* %3
%35 = fcmp une double %34, 0.000000e+00
br i1 %35, label %38, label %36
36: ; preds = %33
%37 = call i32 @assert(i32 0)
br label %38
38: ; preds = %36, %33
br label %39
39: ; preds = %38, %30
%40 = load x86_fp80, x86_fp80* %4
%41 = fcmp une x86_fp80 %40, 0xK00000000000000000000
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = load x86_fp80, x86_fp80* %4
%45 = fcmp une x86_fp80 %44, 0xK00000000000000000000
br i1 %45, label %46, label %49
46: ; preds = %39
%47 = load i32, i32* %1
%48 = add nsw i32 %47, 1
store i32 %48, i32* %1
br label %55
49: ; preds = %39
%50 = load x86_fp80, x86_fp80* %4
%51 = fcmp une x86_fp80 %50, 0xK00000000000000000000
br i1 %51, label %54, label %52
52: ; preds = %49
%53 = call i32 @assert(i32 0)
br label %54
54: ; preds = %52, %49
br label %55
55: ; preds = %54, %46
%56 = load i32, i32* %1
%57 = icmp eq i32 %56, 3
%58 = zext i1 %57 to i32
ret i32 %58
}

LLVM IR (-O2):
@.str = [6 x i8] c"INF()\00"
define i32 @test_inf() {
%1 = tail call float @strtof(i8* nocapture getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* null)
%2 = tail call double @strtod(i8* nocapture getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* null)
%3 = tail call x86_fp80 @strtold(i8* nocapture getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* null)
%4 = fcmp une float %1, 0.000000e+00
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
br i1 %4, label %9, label %7
7: ; preds = %0
%8 = tail call i32 @assert(i32 0)
br label %9
9: ; preds = %0, %7
%10 = phi i32 [ 0, %7 ], [ 1, %0 ]
%11 = fcmp une double %2, 0.000000e+00
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
br i1 %11, label %14, label %16
14: ; preds = %9
%15 = add nuw nsw i32 %10, 1
br label %18
16: ; preds = %9
%17 = tail call i32 @assert(i32 0)
br label %18
18: ; preds = %16, %14
%19 = phi i32 [ %15, %14 ], [ %10, %16 ]
%20 = fcmp une x86_fp80 %3, 0xK00000000000000000000
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
br i1 %20, label %23, label %25
23: ; preds = %18
%24 = add nuw nsw i32 %19, 1
br label %27
25: ; preds = %18
%26 = tail call i32 @assert(i32 0)
br label %27
27: ; preds = %25, %23
%28 = phi i32 [ %24, %23 ], [ %19, %25 ]
%29 = icmp eq i32 %28, 3
%30 = zext i1 %29 to i32
ret i32 %30
}