#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 */
double sin(double);
double sinh(double);
double sqrt(double);
double c1(double z) {
  if (z < 0) {
    double sqrtz = sqrt(-z);
    return sinh(sqrtz) / sqrtz;
  } else if (z > 0) {
    double sqrtz = sqrt(z);
    return sin(sqrtz) / sqrtz;
  } else {
    return 1.0;
  }
}


x86 assembly (clang, -O0):
<c1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    118a <c1+0x5a>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sinh@plt>
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d1 <c1+0xa1>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11c4 <c1+0x94>
movsd  -0x10(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d1 <c1+0xa1>
movsd  0xe34(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c1>:
push   %rax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    115e <c1+0x2e>
movapd 0xecd(%rip),%xmm1
xorpd  %xmm0,%xmm1
movsd  0xeb9(%rip),%xmm2
ucomisd %xmm0,%xmm2
jb     1174 <c1+0x44>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    117d <c1+0x4d>
ucomisd %xmm1,%xmm0
jbe    1189 <c1+0x59>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1193 <c1+0x63>
sqrtsd %xmm0,%xmm0
jmp    1198 <c1+0x68>
movapd %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,(%rsp)
call   1030 <sinh@plt>
jmp    11a2 <c1+0x72>
movsd  0xe6f(%rip),%xmm0
pop    %rax
ret
call   1050 <sqrt@plt>
movsd  %xmm0,(%rsp)
call   1040 <sin@plt>
divsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @c1(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
%6 = load double, double* %3
%7 = fcmp olt double %6, 0.000000e+00
br i1 %7, label %8, label %16
8: ; preds = %1
%9 = load double, double* %3
%10 = fneg double %9
%11 = call double @sqrt(double %10)
store double %11, double* %4
%12 = load double, double* %4
%13 = call double @sinh(double %12)
%14 = load double, double* %4
%15 = fdiv double %13, %14
store double %15, double* %2
br label %27
16: ; preds = %1
%17 = load double, double* %3
%18 = fcmp ogt double %17, 0.000000e+00
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = load double, double* %3
%21 = call double @sqrt(double %20)
store double %21, double* %5
%22 = load double, double* %5
%23 = call double @sin(double %22)
%24 = load double, double* %5
%25 = fdiv double %23, %24
store double %25, double* %2
br label %27
26: ; preds = %16
store double 1.000000e+00, double* %2
br label %27
27: ; preds = %26, %19, %8
%28 = load double, double* %2
ret double %28
}

LLVM IR (-O2):
define double @c1(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = fneg double %0
%5 = tail call double @sqrt(double %4)
%6 = tail call double @sinh(double %5)
%7 = fdiv double %6, %5
br label %14
8: ; preds = %1
%9 = fcmp ogt double %0, 0.000000e+00
br i1 %9, label %10, label %14
10: ; preds = %8
%11 = tail call double @sqrt(double %0)
%12 = tail call double @sin(double %11)
%13 = fdiv double %12, %11
br label %14
14: ; preds = %8, %10, %3
%15 = phi double [ %7, %3 ], [ %13, %10 ], [ 1.000000e+00, %8 ]
ret double %15
}