#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 __fsdiv_org(float, float);
float __fsdiv(float a1, float a2) {
  float f;
  unsigned long *p = (unsigned long *)&f;
  if (a2 == 0.0f && a1 > 0.0f)
    *p = 0x7f800000;
  else if (a2 == 0.0f && a1 < 0.0f)
    *p = 0xff800000;
  else if (a2 == 0.0f && a1 == 0.0f)
    *p = 0xffc00000;
  else
    f = __fsdiv_org(a1, a2);
  return f;
}


x86 assembly (clang, -O0):
<__fsdiv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1162 <__fsdiv+0x52>
jp     1162 <__fsdiv+0x52>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1162 <__fsdiv+0x52>
mov    -0x18(%rbp),%rax
movq   $0x7f800000,(%rax)
jmp    11f4 <__fsdiv+0xe4>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1197 <__fsdiv+0x87>
jp     1197 <__fsdiv+0x87>
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1197 <__fsdiv+0x87>
mov    -0x18(%rbp),%rax
mov    $0xff800000,%ecx
mov    %rcx,(%rax)
jmp    11ef <__fsdiv+0xdf>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11d6 <__fsdiv+0xc6>
jp     11d6 <__fsdiv+0xc6>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11d6 <__fsdiv+0xc6>
jp     11d6 <__fsdiv+0xc6>
mov    -0x18(%rbp),%rax
mov    $0xffc00000,%ecx
mov    %rcx,(%rax)
jmp    11ea <__fsdiv+0xda>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <__fsdiv_org@plt>
movss  %xmm0,-0xc(%rbp)
jmp    11ef <__fsdiv+0xdf>
jmp    11f4 <__fsdiv+0xe4>
movss  -0xc(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fsdiv>:
ucomiss %xmm0,%xmm0
jp     1120 <__fsdiv+0x10>
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm1
jne    1120 <__fsdiv+0x10>
jp     1120 <__fsdiv+0x10>
ret
jmp    1030 <__fsdiv_org@plt>

LLVM IR (-O0):
define float @__fsdiv(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i64*
store float %0, float* %3
store float %1, float* %4
%7 = bitcast float* %5 to i64*
store i64* %7, i64** %6
%8 = load float, float* %4
%9 = fcmp oeq float %8, 0.000000e+00
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load float, float* %3
%12 = fcmp ogt float %11, 0.000000e+00
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = load i64*, i64** %6
store i64 2139095040, i64* %14
br label %37
15: ; preds = %10, %2
%16 = load float, float* %4
%17 = fcmp oeq float %16, 0.000000e+00
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = load float, float* %3
%20 = fcmp olt float %19, 0.000000e+00
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = load i64*, i64** %6
store i64 4286578688, i64* %22
br label %36
23: ; preds = %18, %15
%24 = load float, float* %4
%25 = fcmp oeq float %24, 0.000000e+00
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load float, float* %3
%28 = fcmp oeq float %27, 0.000000e+00
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = load i64*, i64** %6
store i64 4290772992, i64* %30
br label %35
31: ; preds = %26, %23
%32 = load float, float* %3
%33 = load float, float* %4
%34 = call float @__fsdiv_org(float %32, float %33)
store float %34, float* %5
br label %35
35: ; preds = %31, %29
br label %36
36: ; preds = %35, %21
br label %37
37: ; preds = %36, %13
%38 = load float, float* %5
ret float %38
}

LLVM IR (-O2):
define float @__fsdiv(float %0, float %1) {
%3 = fcmp oeq float %1, 0.000000e+00
%4 = fcmp ord float %0, 0.000000e+00
%5 = and i1 %4, %3
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call float @__fsdiv_org(float %0, float %1)
br label %8
8: ; preds = %2, %6
%9 = phi float [ %7, %6 ], [ undef, %2 ]
ret float %9
}