#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 double int16_t;

/* Variables and functions */
double seed_sample_rate(int16_t factor, int16_t multiplier) {
  if (factor >= 0 && multiplier >= 0) {
    return (double)factor * multiplier;
  } else if (factor >= 0 && multiplier < 0) {
    return -1.0 * factor / multiplier;
  } else if (factor < 0 && multiplier >= 0) {
    return -1.0 / factor * multiplier;
  } else {
    return 1.0 / factor / multiplier;
  }
}


x86 assembly (clang, -O0):
<seed_sample_rate>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1146 <seed_sample_rate+0x46>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1146 <seed_sample_rate+0x46>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d5 <seed_sample_rate+0xd5>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1182 <seed_sample_rate+0x82>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1182 <seed_sample_rate+0x82>
movsd  0xe9a(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d5 <seed_sample_rate+0xd5>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11be <seed_sample_rate+0xbe>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11be <seed_sample_rate+0xbe>
movsd  0xe5e(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d5 <seed_sample_rate+0xd5>
movsd  0xe3a(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<seed_sample_rate>:
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jb     1115 <seed_sample_rate+0x15>
ucomisd %xmm2,%xmm1
jb     1115 <seed_sample_rate+0x15>
mulsd  %xmm1,%xmm0
ret
ucomisd %xmm2,%xmm0
jb     1132 <seed_sample_rate+0x32>
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jbe    1132 <seed_sample_rate+0x32>
xorpd  0xee3(%rip),%xmm0
divsd  %xmm1,%xmm0
ret
xorpd  %xmm2,%xmm2
ucomisd %xmm0,%xmm2
jbe    1157 <seed_sample_rate+0x57>
ucomisd %xmm2,%xmm1
jb     1157 <seed_sample_rate+0x57>
movsd  0xebe(%rip),%xmm2
divsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
ret
movsd  0xea1(%rip),%xmm2
divsd  %xmm0,%xmm2
divsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @seed_sample_rate(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = fcmp oge double %6, 0.000000e+00
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load double, double* %5
%10 = fcmp oge double %9, 0.000000e+00
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load double, double* %4
%13 = load double, double* %5
%14 = fmul double %12, %13
store double %14, double* %3
br label %42
15: ; preds = %8, %2
%16 = load double, double* %4
%17 = fcmp oge double %16, 0.000000e+00
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load double, double* %5
%20 = fcmp olt double %19, 0.000000e+00
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = load double, double* %4
%23 = fmul double -1.000000e+00, %22
%24 = load double, double* %5
%25 = fdiv double %23, %24
store double %25, double* %3
br label %42
26: ; preds = %18, %15
%27 = load double, double* %4
%28 = fcmp olt double %27, 0.000000e+00
br i1 %28, label %29, label %37
29: ; preds = %26
%30 = load double, double* %5
%31 = fcmp oge double %30, 0.000000e+00
br i1 %31, label %32, label %37
32: ; preds = %29
%33 = load double, double* %4
%34 = fdiv double -1.000000e+00, %33
%35 = load double, double* %5
%36 = fmul double %34, %35
store double %36, double* %3
br label %42
37: ; preds = %29, %26
%38 = load double, double* %4
%39 = fdiv double 1.000000e+00, %38
%40 = load double, double* %5
%41 = fdiv double %39, %40
store double %41, double* %3
br label %42
42: ; preds = %37, %32, %21, %11
%43 = load double, double* %3
ret double %43
}

LLVM IR (-O2):
define double @seed_sample_rate(double %0, double %1) {
%3 = fcmp oge double %0, 0.000000e+00
%4 = fcmp oge double %1, 0.000000e+00
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = fmul double %0, %1
br label %23
8: ; preds = %2
%9 = fcmp olt double %1, 0.000000e+00
%10 = and i1 %3, %9
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = fneg double %0
%13 = fdiv double %12, %1
br label %23
14: ; preds = %8
%15 = fcmp olt double %0, 0.000000e+00
%16 = and i1 %15, %4
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = fdiv double -1.000000e+00, %0
%19 = fmul double %18, %1
br label %23
20: ; preds = %14
%21 = fdiv double 1.000000e+00, %0
%22 = fdiv double %21, %1
br label %23
23: ; preds = %20, %17, %11, %6
%24 = phi double [ %7, %6 ], [ %13, %11 ], [ %19, %17 ], [ %22, %20 ]
ret double %24
}