#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 scalar_t__ a;

/* Variables and functions */
scalar_t__ fabs(float);
void sladiv(float a, float b, float c, float d, float *p, float *q) {
  static float e, f;
  if (fabs(d) < fabs(c)) {
    e = d / c;
    f = c + d * e;
    *p = (a + b * e) / f;
    *q = (b - a * e) / f;
  } else {
    e = c / d;
    f = d + c * e;
    *p = (b + a * e) / f;
    *q = (-(double)(a) + b * e) / f;
  }
}


x86 assembly (clang, -O0):
<sladiv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %rax,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jge    11f6 <sladiv+0xe6>
movss  -0x10(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,0x2ebe(%rip)
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
movss  0x2eac(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,0x2ea0(%rip)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
movss  0x2e8a(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
divss  0x2e7e(%rip),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x8(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
movss  0x2e60(%rip),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
divss  0x2e47(%rip),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
jmp    12a5 <sladiv+0x195>
movss  -0xc(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
movss  %xmm0,0x2e24(%rip)
movss  -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
movss  0x2e12(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,0x2e06(%rip)
movss  -0x8(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
movss  0x2df0(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
divss  0x2de4(%rip),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movss  -0x8(%rbp),%xmm1
mulss  0x2dab(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm0
movss  0x2d9f(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sladiv>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movss  %xmm2,(%rsp)
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
movss  %xmm3,0x4(%rsp)
movaps %xmm3,%xmm0
call   1030 <fabs@plt>
mov    %rax,%rbx
movss  (%rsp),%xmm0
call   1030 <fabs@plt>
cmp    %rax,%rbx
jge    1198 <sladiv+0x88>
movss  0x4(%rsp),%xmm4
movaps %xmm4,%xmm0
movss  (%rsp),%xmm1
divss  %xmm1,%xmm0
mulss  %xmm0,%xmm4
addss  %xmm1,%xmm4
movss  0xc(%rsp),%xmm2
movaps %xmm2,%xmm1
mulss  %xmm0,%xmm1
movss  0x8(%rsp),%xmm3
addss  %xmm3,%xmm1
divss  %xmm4,%xmm1
movss  %xmm1,(%r15)
mulss  %xmm3,%xmm0
subss  %xmm0,%xmm2
divss  %xmm4,%xmm2
jmp    11f4 <sladiv+0xe4>
movss  (%rsp),%xmm4
movaps %xmm4,%xmm0
movss  0x4(%rsp),%xmm1
divss  %xmm1,%xmm0
mulss  %xmm0,%xmm4
addss  %xmm1,%xmm4
movss  0x8(%rsp),%xmm3
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
mulss  %xmm0,%xmm3
movss  0xc(%rsp),%xmm2
addss  %xmm2,%xmm3
divss  %xmm4,%xmm3
movss  %xmm3,(%r15)
mulss  %xmm2,%xmm0
cvtss2sd %xmm0,%xmm0
subsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm4,%xmm1
divsd  %xmm1,%xmm0
xorps  %xmm2,%xmm2
cvtsd2ss %xmm0,%xmm2
movss  %xmm2,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@sladiv.e = internal global float 0.000000e+00
@sladiv.f = internal global float 0.000000e+00
define void @sladiv(float %0, float %1, float %2, float %3, float* %4, float* %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float*
%12 = alloca float*
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float* %4, float** %11
store float* %5, float** %12
%13 = load float, float* %10
%14 = call i64 @fabs(float %13)
%15 = load float, float* %9
%16 = call i64 @fabs(float %15)
%17 = icmp slt i64 %14, %16
br i1 %17, label %18, label %41
18: ; preds = %6
%19 = load float, float* %10
%20 = load float, float* %9
%21 = fdiv float %19, %20
store float %21, float* @sladiv.e
%22 = load float, float* %9
%23 = load float, float* %10
%24 = load float, float* @sladiv.e
%25 = call float @llvm.fmuladd.f32(float %23, float %24, float %22)
store float %25, float* @sladiv.f
%26 = load float, float* %7
%27 = load float, float* %8
%28 = load float, float* @sladiv.e
%29 = call float @llvm.fmuladd.f32(float %27, float %28, float %26)
%30 = load float, float* @sladiv.f
%31 = fdiv float %29, %30
%32 = load float*, float** %11
store float %31, float* %32
%33 = load float, float* %8
%34 = load float, float* %7
%35 = load float, float* @sladiv.e
%36 = fneg float %34
%37 = call float @llvm.fmuladd.f32(float %36, float %35, float %33)
%38 = load float, float* @sladiv.f
%39 = fdiv float %37, %38
%40 = load float*, float** %12
store float %39, float* %40
br label %69
41: ; preds = %6
%42 = load float, float* %9
%43 = load float, float* %10
%44 = fdiv float %42, %43
store float %44, float* @sladiv.e
%45 = load float, float* %10
%46 = load float, float* %9
%47 = load float, float* @sladiv.e
%48 = call float @llvm.fmuladd.f32(float %46, float %47, float %45)
store float %48, float* @sladiv.f
%49 = load float, float* %8
%50 = load float, float* %7
%51 = load float, float* @sladiv.e
%52 = call float @llvm.fmuladd.f32(float %50, float %51, float %49)
%53 = load float, float* @sladiv.f
%54 = fdiv float %52, %53
%55 = load float*, float** %11
store float %54, float* %55
%56 = load float, float* %7
%57 = fpext float %56 to double
%58 = fneg double %57
%59 = load float, float* %8
%60 = load float, float* @sladiv.e
%61 = fmul float %59, %60
%62 = fpext float %61 to double
%63 = fadd double %58, %62
%64 = load float, float* @sladiv.f
%65 = fpext float %64 to double
%66 = fdiv double %63, %65
%67 = fptrunc double %66 to float
%68 = load float*, float** %12
store float %67, float* %68
br label %69
69: ; preds = %41, %18
ret void
}

LLVM IR (-O2):
define void @sladiv(float %0, float %1, float %2, float %3, float* nocapture writeonly %4, float* nocapture writeonly %5) {
%7 = tail call i64 @fabs(float %3)
%8 = tail call i64 @fabs(float %2)
%9 = icmp slt i64 %7, %8
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = fdiv float %3, %2
%12 = tail call float @llvm.fmuladd.f32(float %3, float %11, float %2)
%13 = tail call float @llvm.fmuladd.f32(float %1, float %11, float %0)
%14 = fdiv float %13, %12
store float %14, float* %4
%15 = fneg float %0
%16 = tail call float @llvm.fmuladd.f32(float %15, float %11, float %1)
%17 = fdiv float %16, %12
br label %30
18: ; preds = %6
%19 = fdiv float %2, %3
%20 = tail call float @llvm.fmuladd.f32(float %2, float %19, float %3)
%21 = tail call float @llvm.fmuladd.f32(float %0, float %19, float %1)
%22 = fdiv float %21, %20
store float %22, float* %4
%23 = fpext float %0 to double
%24 = fmul float %19, %1
%25 = fpext float %24 to double
%26 = fsub double %25, %23
%27 = fpext float %20 to double
%28 = fdiv double %26, %27
%29 = fptrunc double %28 to float
br label %30
30: ; preds = %18, %10
%31 = phi float [ %29, %18 ], [ %17, %10 ]
store float %31, float* %5
ret void
}