#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 fabs(double);
scalar_t__ pow(double, int);
double sin(int);
double sqrt(scalar_t__);
double func(double x) {
  if (x < 0)
    return fabs(x);
  else if (x >= 0 && x < 1)
    return sin(2 * x);
  else if (x >= 1 && x < 5)
    return sqrt(pow(x, 3) + x);
  else
    return (2 * x + 10);
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1165 <func+0x35>
movsd  -0x10(%rbp),%xmm0
movaps 0xec9(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    121b <func+0xeb>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11aa <func+0x7a>
movsd  0xe81(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11aa <func+0x7a>
movsd  0xe86(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    121b <func+0xeb>
movsd  -0x10(%rbp),%xmm0
movsd  0xe49(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1201 <func+0xd1>
movsd  0xe3f(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1201 <func+0xd1>
movsd  -0x10(%rbp),%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%rdi
call   1050 <sqrt@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    121b <func+0xeb>
movsd  -0x10(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xdfe(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
sub    $0x18,%rsp
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    114b <func+0x1b>
andpd  0xeda(%rip),%xmm0
add    $0x18,%rsp
ret
ucomisd %xmm1,%xmm0
jb     1170 <func+0x40>
movsd  0xea7(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1170 <func+0x40>
addsd  %xmm0,%xmm0
cvttsd2si %xmm0,%edi
add    $0x18,%rsp
jmp    1030 <sin@plt>
ucomisd 0xe88(%rip),%xmm0
jb     11b2 <func+0x82>
movsd  0xe86(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11b2 <func+0x82>
mov    $0x3,%edi
movapd %xmm0,(%rsp)
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
cvttsd2si %xmm0,%rdi
add    $0x18,%rsp
jmp    1050 <sqrt@plt>
addsd  %xmm0,%xmm0
addsd  0xe52(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @func(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load double, double* %3
%8 = call double @llvm.fabs.f64(double %7)
store double %8, double* %2
br label %37
9: ; preds = %1
%10 = load double, double* %3
%11 = fcmp oge double %10, 0.000000e+00
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load double, double* %3
%14 = fcmp olt double %13, 1.000000e+00
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load double, double* %3
%17 = fmul double 2.000000e+00, %16
%18 = fptosi double %17 to i32
%19 = call double @sin(i32 %18)
store double %19, double* %2
br label %37
20: ; preds = %12, %9
%21 = load double, double* %3
%22 = fcmp oge double %21, 1.000000e+00
br i1 %22, label %23, label %34
23: ; preds = %20
%24 = load double, double* %3
%25 = fcmp olt double %24, 5.000000e+00
br i1 %25, label %26, label %34
26: ; preds = %23
%27 = load double, double* %3
%28 = call i64 @pow(double %27, i32 3)
%29 = sitofp i64 %28 to double
%30 = load double, double* %3
%31 = fadd double %29, %30
%32 = fptosi double %31 to i64
%33 = call double @sqrt(i64 %32)
store double %33, double* %2
br label %37
34: ; preds = %23, %20
%35 = load double, double* %3
%36 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %35, double 1.000000e+01)
store double %36, double* %2
br label %37
37: ; preds = %34, %26, %15, %6
%38 = load double, double* %2
ret double %38
}

LLVM IR (-O2):
define double @func(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call double @llvm.fabs.f64(double %0)
br label %25
5: ; preds = %1
%6 = fcmp oge double %0, 0.000000e+00
%7 = fcmp olt double %0, 1.000000e+00
%8 = and i1 %6, %7
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = fmul double %0, 2.000000e+00
%11 = fptosi double %10 to i32
%12 = tail call double @sin(i32 %11)
br label %25
13: ; preds = %5
%14 = fcmp oge double %0, 1.000000e+00
%15 = fcmp olt double %0, 5.000000e+00
%16 = and i1 %14, %15
br i1 %16, label %17, label %23
17: ; preds = %13
%18 = tail call i64 @pow(double %0, i32 3)
%19 = sitofp i64 %18 to double
%20 = fadd double %19, %0
%21 = fptosi double %20 to i64
%22 = tail call double @sqrt(i64 %21)
br label %25
23: ; preds = %13
%24 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double 1.000000e+01)
br label %25
25: ; preds = %23, %17, %9, %3
%26 = phi double [ %4, %3 ], [ %12, %9 ], [ %22, %17 ], [ %24, %23 ]
ret double %26
}