#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 */
typedef int ulong;
typedef int uint;

/* Variables and functions */
int /*<<< orphan*/ SIGFPE;
int /*<<< orphan*/ raise(int /*<<< orphan*/);
double __divdf3(double a, double b) {
  long lc[2];
  ulong sign = (((const long *)&a)[1] ^ ((const long *)&b)[1]) & 0x80000000;
  ulong msa = (((const long *)&a)[1] & 0xfffff) | 0x100000,
        lsa = ((const long *)&a)[0];
  ulong msb = (((const long *)&b)[1] & 0xfffff) | 0x100000,
        lsb = ((const long *)&b)[0];
  uint qn[5];
  int i;
  ulong msq, lsq;
  int expt = ((((const long *)&a)[1] >> 20) & 0x7ff) -
             ((((const long *)&b)[1] >> 20) & 0x7ff) + 1023;
  if (!(((const long *)&b)[1] & 0x7fffffff)) {
    raise(SIGFPE);
    lc[0] = 0;
    lc[1] =
        (((const long *)&a)[1] & 0x7fffffff ? sign + 0x7ff00000 : 0x7ff80000);
    return (*(const double *)lc);
  }
  if (!(((const long *)&a)[1] & 0x7fffffff))
    return 0;
  for (i = 0; i < 5; ++i) {
    uint q;
    ulong msp, lsp;
    msa = (msa << 11) + (lsa >> 21);
    lsa <<= 11;
    q = msa / msb;
    msp = q * msb;
    lsp = q * (lsb & 0x1fffff);
    {
      ulong midp = q * (lsb >> 21);
      msp += (midp + (lsp >> 21)) >> 11;
      lsp += midp << 21;
    }
    if (msp > msa || (lsp > lsa && msp == msa)) {
      --q;
      if (lsb > lsp)
        msp--;
      lsp -= lsb;
      msp -= msb;
    }
    if (lsp > lsa)
      msp--;
    lsa -= lsp;
    msa -= msp;
    qn[i] = q;
  }
  msq = (qn[0] << 9) + (qn[1] >> 2);
  lsq = (qn[1] << 30) + (qn[2] << 19) + (qn[3] << 8) + (qn[4] >> 3);
  if (msq < 0x100000) {
    msq = (msq << 1) + (lsq >> 31);
    lsq <<= 1;
    expt--;
  }
  if (expt <= 0) {
    lc[1] = sign;
    lc[0] = 0;
  } else if (expt >= 0x7ff) {
    raise(SIGFPE);
    lc[1] = sign + 0x7ff00000;
    lc[0] = 0;
  } else {
    lc[1] = sign + (expt << 20) + (msq & 0xfffff);
    lc[0] = lsq;
  }
  return (*(const double *)lc);
}


x86 assembly (clang, -O0):
<__divdf3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x8(%rbp),%rax
xor    -0x10(%rbp),%rax
movabs $0x80000000,%rcx
and    %rcx,%rax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
and    $0xfffff,%rax
or     $0x100000,%rax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
and    $0xfffff,%rax
or     $0x100000,%rax
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rax
sar    $0x14,%rax
and    $0x7ff,%rax
mov    -0x10(%rbp),%rcx
sar    $0x14,%rcx
and    $0x7ff,%rcx
sub    %rcx,%rax
add    $0x3ff,%rax
mov    %eax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
and    $0x7fffffff,%rax
cmp    $0x0,%rax
jne    1216 <__divdf3+0x106>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
movq   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x7fffffff,%rax
cmp    $0x0,%rax
je     11eb <__divdf3+0xdb>
mov    -0x34(%rbp),%eax
add    $0x7ff00000,%eax
mov    %eax,-0x84(%rbp)
jmp    11fb <__divdf3+0xeb>
mov    $0x7ff80000,%eax
mov    %eax,-0x84(%rbp)
jmp    11fb <__divdf3+0xeb>
mov    -0x84(%rbp),%eax
cltq
mov    %rax,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    143d <__divdf3+0x32d>
mov    -0x8(%rbp),%rax
and    $0x7fffffff,%rax
cmp    $0x0,%rax
jne    1237 <__divdf3+0x127>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    143d <__divdf3+0x32d>
movl   $0x0,-0x64(%rbp)
cmpl   $0x5,-0x64(%rbp)
jge    1353 <__divdf3+0x243>
mov    -0x38(%rbp),%eax
shl    $0xb,%eax
mov    -0x3c(%rbp),%ecx
sar    $0x15,%ecx
add    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
shl    $0xb,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
cltd
idivl  -0x40(%rbp)
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%eax
imul   -0x40(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    -0x74(%rbp),%eax
mov    -0x44(%rbp),%ecx
and    $0x1fffff,%ecx
imul   %ecx,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x74(%rbp),%eax
mov    -0x44(%rbp),%ecx
sar    $0x15,%ecx
imul   %ecx,%eax
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%eax
mov    -0x7c(%rbp),%ecx
sar    $0x15,%ecx
add    %ecx,%eax
sar    $0xb,%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    -0x80(%rbp),%eax
shl    $0x15,%eax
add    -0x7c(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x38(%rbp),%eax
jg     12db <__divdf3+0x1cb>
mov    -0x7c(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jle    130f <__divdf3+0x1ff>
mov    -0x78(%rbp),%eax
cmp    -0x38(%rbp),%eax
jne    130f <__divdf3+0x1ff>
mov    -0x74(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x74(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jle    12f9 <__divdf3+0x1e9>
mov    -0x78(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x78(%rbp)
mov    -0x44(%rbp),%ecx
mov    -0x7c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x40(%rbp),%ecx
mov    -0x78(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x78(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jle    1324 <__divdf3+0x214>
mov    -0x78(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x78(%rbp)
mov    -0x7c(%rbp),%ecx
mov    -0x3c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x78(%rbp),%ecx
mov    -0x38(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x74(%rbp),%ecx
movslq -0x64(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    123e <__divdf3+0x12e>
mov    -0x60(%rbp),%eax
shl    $0x9,%eax
mov    -0x5c(%rbp),%ecx
sar    $0x2,%ecx
add    %ecx,%eax
mov    %eax,-0x68(%rbp)
mov    -0x5c(%rbp),%eax
shl    $0x1e,%eax
mov    -0x58(%rbp),%ecx
shl    $0x13,%ecx
add    %ecx,%eax
mov    -0x54(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x50(%rbp),%ecx
sar    $0x3,%ecx
add    %ecx,%eax
mov    %eax,-0x6c(%rbp)
cmpl   $0x100000,-0x68(%rbp)
jge    13b5 <__divdf3+0x2a5>
mov    -0x68(%rbp),%eax
shl    $0x1,%eax
mov    -0x6c(%rbp),%ecx
sar    $0x1f,%ecx
add    %ecx,%eax
mov    %eax,-0x68(%rbp)
mov    -0x6c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x70(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x70(%rbp)
cmpl   $0x0,-0x70(%rbp)
jg     13d4 <__divdf3+0x2c4>
movslq -0x34(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
jmp    1433 <__divdf3+0x323>
cmpl   $0x7ff,-0x70(%rbp)
jl     140a <__divdf3+0x2fa>
mov    0x2c00(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    -0x34(%rbp),%eax
add    $0x7ff00000,%eax
cltq
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
jmp    142e <__divdf3+0x31e>
mov    -0x34(%rbp),%eax
mov    -0x70(%rbp),%ecx
shl    $0x14,%ecx
add    %ecx,%eax
mov    -0x68(%rbp),%ecx
and    $0xfffff,%ecx
add    %ecx,%eax
cltq
mov    %rax,-0x28(%rbp)
movslq -0x6c(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    1433 <__divdf3+0x323>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__divdf3>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@SIGFPE = global i32 0
define double @__divdf3(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca [2 x i64]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [5 x i32]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store double %0, double* %4
store double %1, double* %5
%21 = bitcast double* %4 to i64*
%22 = getelementptr inbounds i64, i64* %21, i64 1
%23 = load i64, i64* %22
%24 = bitcast double* %5 to i64*
%25 = getelementptr inbounds i64, i64* %24, i64 1
%26 = load i64, i64* %25
%27 = xor i64 %23, %26
%28 = and i64 %27, 2147483648
%29 = trunc i64 %28 to i32
store i32 %29, i32* %7
%30 = bitcast double* %4 to i64*
%31 = getelementptr inbounds i64, i64* %30, i64 1
%32 = load i64, i64* %31
%33 = and i64 %32, 1048575
%34 = or i64 %33, 1048576
%35 = trunc i64 %34 to i32
store i32 %35, i32* %8
%36 = bitcast double* %4 to i64*
%37 = getelementptr inbounds i64, i64* %36, i64 0
%38 = load i64, i64* %37
%39 = trunc i64 %38 to i32
store i32 %39, i32* %9
%40 = bitcast double* %5 to i64*
%41 = getelementptr inbounds i64, i64* %40, i64 1
%42 = load i64, i64* %41
%43 = and i64 %42, 1048575
%44 = or i64 %43, 1048576
%45 = trunc i64 %44 to i32
store i32 %45, i32* %10
%46 = bitcast double* %5 to i64*
%47 = getelementptr inbounds i64, i64* %46, i64 0
%48 = load i64, i64* %47
%49 = trunc i64 %48 to i32
store i32 %49, i32* %11
%50 = bitcast double* %4 to i64*
%51 = getelementptr inbounds i64, i64* %50, i64 1
%52 = load i64, i64* %51
%53 = ashr i64 %52, 20
%54 = and i64 %53, 2047
%55 = bitcast double* %5 to i64*
%56 = getelementptr inbounds i64, i64* %55, i64 1
%57 = load i64, i64* %56
%58 = ashr i64 %57, 20
%59 = and i64 %58, 2047
%60 = sub nsw i64 %54, %59
%61 = add nsw i64 %60, 1023
%62 = trunc i64 %61 to i32
store i32 %62, i32* %16
%63 = bitcast double* %5 to i64*
%64 = getelementptr inbounds i64, i64* %63, i64 1
%65 = load i64, i64* %64
%66 = and i64 %65, 2147483647
%67 = icmp ne i64 %66, 0
br i1 %67, label %88, label %68
68: ; preds = %2
%69 = load i32, i32* @SIGFPE
%70 = call i32 @raise(i32 %69)
%71 = getelementptr inbounds [2 x i64], [2 x i64]* %6, i64 0, i64 0
store i64 0, i64* %71
%72 = bitcast double* %4 to i64*
%73 = getelementptr inbounds i64, i64* %72, i64 1
%74 = load i64, i64* %73
%75 = and i64 %74, 2147483647
%76 = icmp ne i64 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %68
%78 = load i32, i32* %7
%79 = add nsw i32 %78, 2146435072
br label %81
80: ; preds = %68
br label %81
81: ; preds = %80, %77
%82 = phi i32 [ %79, %77 ], [ 2146959360, %80 ]
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [2 x i64], [2 x i64]* %6, i64 0, i64 1
store i64 %83, i64* %84
%85 = getelementptr inbounds [2 x i64], [2 x i64]* %6, i64 0, i64 0
%86 = bitcast i64* %85 to double*
%87 = load double, double* %86
store double %87, double* %3
br label %252
88: ; preds = %2
%89 = bitcast double* %4 to i64*
%90 = getelementptr inbounds i64, i64* %89, i64 1
%91 = load i64, i64* %90
%92 = and i64 %91, 2147483647
%93 = icmp ne i64 %92, 0
br i1 %93, label %95, label %94
94: ; preds = %88
store double 0.000000e+00, double* %3
br label %252
95: ; preds = %88
store i32 0, i32* %13
br label %96
96: ; preds = %177, %95
%97 = load i32, i32* %13
%98 = icmp slt i32 %97, 5
br i1 %98, label %99, label %180
99: ; preds = %96
%100 = load i32, i32* %8
%101 = shl i32 %100, 11
%102 = load i32, i32* %9
%103 = ashr i32 %102, 21
%104 = add nsw i32 %101, %103
store i32 %104, i32* %8
%105 = load i32, i32* %9
%106 = shl i32 %105, 11
store i32 %106, i32* %9
%107 = load i32, i32* %8
%108 = load i32, i32* %10
%109 = sdiv i32 %107, %108
store i32 %109, i32* %17
%110 = load i32, i32* %17
%111 = load i32, i32* %10
%112 = mul nsw i32 %110, %111
store i32 %112, i32* %18
%113 = load i32, i32* %17
%114 = load i32, i32* %11
%115 = and i32 %114, 2097151
%116 = mul nsw i32 %113, %115
store i32 %116, i32* %19
%117 = load i32, i32* %17
%118 = load i32, i32* %11
%119 = ashr i32 %118, 21
%120 = mul nsw i32 %117, %119
store i32 %120, i32* %20
%121 = load i32, i32* %20
%122 = load i32, i32* %19
%123 = ashr i32 %122, 21
%124 = add nsw i32 %121, %123
%125 = ashr i32 %124, 11
%126 = load i32, i32* %18
%127 = add nsw i32 %126, %125
store i32 %127, i32* %18
%128 = load i32, i32* %20
%129 = shl i32 %128, 21
%130 = load i32, i32* %19
%131 = add nsw i32 %130, %129
store i32 %131, i32* %19
%132 = load i32, i32* %18
%133 = load i32, i32* %8
%134 = icmp sgt i32 %132, %133
br i1 %134, label %143, label %135
135: ; preds = %99
%136 = load i32, i32* %19
%137 = load i32, i32* %9
%138 = icmp sgt i32 %136, %137
br i1 %138, label %139, label %159
139: ; preds = %135
%140 = load i32, i32* %18
%141 = load i32, i32* %8
%142 = icmp eq i32 %140, %141
br i1 %142, label %143, label %159
143: ; preds = %139, %99
%144 = load i32, i32* %17
%145 = add nsw i32 %144, -1
store i32 %145, i32* %17
%146 = load i32, i32* %11
%147 = load i32, i32* %19
%148 = icmp sgt i32 %146, %147
br i1 %148, label %149, label %152
149: ; preds = %143
%150 = load i32, i32* %18
%151 = add nsw i32 %150, -1
store i32 %151, i32* %18
br label %152
152: ; preds = %149, %143
%153 = load i32, i32* %11
%154 = load i32, i32* %19
%155 = sub nsw i32 %154, %153
store i32 %155, i32* %19
%156 = load i32, i32* %10
%157 = load i32, i32* %18
%158 = sub nsw i32 %157, %156
store i32 %158, i32* %18
br label %159
159: ; preds = %152, %139, %135
%160 = load i32, i32* %19
%161 = load i32, i32* %9
%162 = icmp sgt i32 %160, %161
br i1 %162, label %163, label %166
163: ; preds = %159
%164 = load i32, i32* %18
%165 = add nsw i32 %164, -1
store i32 %165, i32* %18
br label %166
166: ; preds = %163, %159
%167 = load i32, i32* %19
%168 = load i32, i32* %9
%169 = sub nsw i32 %168, %167
store i32 %169, i32* %9
%170 = load i32, i32* %18
%171 = load i32, i32* %8
%172 = sub nsw i32 %171, %170
store i32 %172, i32* %8
%173 = load i32, i32* %17
%174 = load i32, i32* %13
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds [5 x i32], [5 x i32]* %12, i64 0, i64 %175
store i32 %173, i32* %176
br label %177
177: ; preds = %166
%178 = load i32, i32* %13
%179 = add nsw i32 %178, 1
store i32 %179, i32* %13
br label %96
180: ; preds = %96
%181 = getelementptr inbounds [5 x i32], [5 x i32]* %12, i64 0, i64 0
%182 = load i32, i32* %181
%183 = shl i32 %182, 9
%184 = getelementptr inbounds [5 x i32], [5 x i32]* %12, i64 0, i64 1
%185 = load i32, i32* %184
%186 = ashr i32 %185, 2
%187 = add nsw i32 %183, %186
store i32 %187, i32* %14
%188 = getelementptr inbounds [5 x i32], [5 x i32]* %12, i64 0, i64 1
%189 = load i32, i32* %188
%190 = shl i32 %189, 30
%191 = getelementptr inbounds [5 x i32], [5 x i32]* %12, i64 0, i64 2
%192 = load i32, i32* %191
%193 = shl i32 %192, 19
%194 = add nsw i32 %190, %193
%195 = getelementptr inbounds [5 x i32], [5 x i32]* %12, i64 0, i64 3
%196 = load i32, i32* %195
%197 = shl i32 %196, 8
%198 = add nsw i32 %194, %197
%199 = getelementptr inbounds [5 x i32], [5 x i32]* %12, i64 0, i64 4
%200 = load i32, i32* %199
%201 = ashr i32 %200, 3
%202 = add nsw i32 %198, %201
store i32 %202, i32* %15
%203 = load i32, i32* %14
%204 = icmp slt i32 %203, 1048576
br i1 %204, label %205, label %215
205: ; preds = %180
%206 = load i32, i32* %14
%207 = shl i32 %206, 1
%208 = load i32, i32* %15
%209 = ashr i32 %208, 31
%210 = add nsw i32 %207, %209
store i32 %210, i32* %14
%211 = load i32, i32* %15
%212 = shl i32 %211, 1
store i32 %212, i32* %15
%213 = load i32, i32* %16
%214 = add nsw i32 %213, -1
store i32 %214, i32* %16
br label %215
215: ; preds = %205, %180
%216 = load i32, i32* %16
%217 = icmp sle i32 %216, 0
br i1 %217, label %218, label %223
218: ; preds = %215
%219 = load i32, i32* %7
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds [2 x i64], [2 x i64]* %6, i64 0, i64 1
store i64 %220, i64* %221
%222 = getelementptr inbounds [2 x i64], [2 x i64]* %6, i64 0, i64 0
store i64 0, i64* %222
br label %248
223: ; preds = %215
%224 = load i32, i32* %16
%225 = icmp sge i32 %224, 2047
br i1 %225, label %226, label %234
226: ; preds = %223
%227 = load i32, i32* @SIGFPE
%228 = call i32 @raise(i32 %227)
%229 = load i32, i32* %7
%230 = add nsw i32 %229, 2146435072
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds [2 x i64], [2 x i64]* %6, i64 0, i64 1
store i64 %231, i64* %232
%233 = getelementptr inbounds [2 x i64], [2 x i64]* %6, i64 0, i64 0
store i64 0, i64* %233
br label %247
234: ; preds = %223
%235 = load i32, i32* %7
%236 = load i32, i32* %16
%237 = shl i32 %236, 20
%238 = add nsw i32 %235, %237
%239 = load i32, i32* %14
%240 = and i32 %239, 1048575
%241 = add nsw i32 %238, %240
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds [2 x i64], [2 x i64]* %6, i64 0, i64 1
store i64 %242, i64* %243
%244 = load i32, i32* %15
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds [2 x i64], [2 x i64]* %6, i64 0, i64 0
store i64 %245, i64* %246
br label %247
247: ; preds = %234, %226
br label %248
248: ; preds = %247, %218
%249 = getelementptr inbounds [2 x i64], [2 x i64]* %6, i64 0, i64 0
%250 = bitcast i64* %249 to double*
%251 = load double, double* %250
store double %251, double* %3
br label %252
252: ; preds = %248, %94, %81
%253 = load double, double* %3
ret double %253
}

LLVM IR (-O2):
@SIGFPE = global i32 0
define double @__divdf3(double %0, double %1) {
%3 = load i32, i32* @SIGFPE
%4 = tail call i32 @raise(i32 %3)
ret double 0.000000e+00
}