#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 */
float cos(double);
float sin(double);
float ExTspline(float t, int n) {
  float sn, cs;
  sn = sin(0.5 * 3.14159265358979323846 * t);
  cs = cos(0.5 * 3.14159265358979323846 * t);
  switch (n) {
  case 1:
    return (0.25 * (1 - cs));
  case 2:
    return (0.25 * (1 + sn));
  case 3:
    return (0.25 * (1 + cs));
  case 4:
    return (0.25 * (1 - sn));
  }
  return t;
}


x86 assembly (clang, -O0):
<ExTspline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xebf(%rip),%xmm1
movsd  %xmm1,-0x28(%rbp)
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  -0x28(%rbp),%xmm1
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     1245 <ExTspline+0x125>
mov    -0x20(%rbp),%rax
lea    0xe84(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0xe6f(%rip),%xmm0
subss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe56(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    124f <ExTspline+0x12f>
movss  0xe44(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe2b(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    124f <ExTspline+0x12f>
movss  0xe19(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe00(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    124f <ExTspline+0x12f>
movss  0xdee(%rip),%xmm0
subss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdd5(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    124f <ExTspline+0x12f>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExTspline>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movss  %xmm0,0x4(%rsp)
cvtss2sd %xmm0,%xmm0
mulsd  0xec7(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1030 <sin@plt>
movss  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movss  0x4(%rsp),%xmm1
add    $0xffffffff,%ebx
cmp    $0x3,%ebx
ja     11b9 <ExTspline+0x99>
lea    0xea7(%rip),%rax
movslq (%rax,%rbx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
movss  0xe8e(%rip),%xmm1
subss  %xmm0,%xmm1
jmp    11b1 <ExTspline+0x91>
movss  (%rsp),%xmm1
addss  0xe7b(%rip),%xmm1
jmp    11b1 <ExTspline+0x91>
addss  0xe71(%rip),%xmm0
mulss  0xe6d(%rip),%xmm0
movaps %xmm0,%xmm1
jmp    11b9 <ExTspline+0x99>
movss  0xe5c(%rip),%xmm1
subss  (%rsp),%xmm1
mulss  0xe53(%rip),%xmm1
movaps %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @ExTspline(float %0, i32 %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca i32
%6 = alloca float
%7 = alloca float
store float %0, float* %4
store i32 %1, i32* %5
%8 = load float, float* %4
%9 = fpext float %8 to double
%10 = fmul double 0x3FF921FB54442D18, %9
%11 = call float @sin(double %10)
store float %11, float* %6
%12 = load float, float* %4
%13 = fpext float %12 to double
%14 = fmul double 0x3FF921FB54442D18, %13
%15 = call float @cos(double %14)
store float %15, float* %7
%16 = load i32, i32* %5
switch i32 %16, label %41 [
i32 1, label %17
i32 2, label %23
i32 3, label %29
i32 4, label %35
]
17: ; preds = %2
%18 = load float, float* %7
%19 = fsub float 1.000000e+00, %18
%20 = fpext float %19 to double
%21 = fmul double 2.500000e-01, %20
%22 = fptrunc double %21 to float
store float %22, float* %3
br label %43
23: ; preds = %2
%24 = load float, float* %6
%25 = fadd float 1.000000e+00, %24
%26 = fpext float %25 to double
%27 = fmul double 2.500000e-01, %26
%28 = fptrunc double %27 to float
store float %28, float* %3
br label %43
29: ; preds = %2
%30 = load float, float* %7
%31 = fadd float 1.000000e+00, %30
%32 = fpext float %31 to double
%33 = fmul double 2.500000e-01, %32
%34 = fptrunc double %33 to float
store float %34, float* %3
br label %43
35: ; preds = %2
%36 = load float, float* %6
%37 = fsub float 1.000000e+00, %36
%38 = fpext float %37 to double
%39 = fmul double 2.500000e-01, %38
%40 = fptrunc double %39 to float
store float %40, float* %3
br label %43
41: ; preds = %2
%42 = load float, float* %4
store float %42, float* %3
br label %43
43: ; preds = %41, %35, %29, %23, %17
%44 = load float, float* %3
ret float %44
}

LLVM IR (-O2):
define float @ExTspline(float %0, i32 %1) {
%3 = fpext float %0 to double
%4 = fmul double %3, 0x3FF921FB54442D18
%5 = tail call float @sin(double %4)
%6 = tail call float @cos(double %4)
switch i32 %1, label %19 [
i32 1, label %7
i32 2, label %10
i32 3, label %13
i32 4, label %16
]
7: ; preds = %2
%8 = fsub float 1.000000e+00, %6
%9 = fmul float %8, 2.500000e-01
br label %19
10: ; preds = %2
%11 = fadd float %5, 1.000000e+00
%12 = fmul float %11, 2.500000e-01
br label %19
13: ; preds = %2
%14 = fadd float %6, 1.000000e+00
%15 = fmul float %14, 2.500000e-01
br label %19
16: ; preds = %2
%17 = fsub float 1.000000e+00, %5
%18 = fmul float %17, 2.500000e-01
br label %19
19: ; preds = %2, %16, %13, %10, %7
%20 = phi float [ %18, %16 ], [ %15, %13 ], [ %12, %10 ], [ %9, %7 ], [ %0, %2 ]
ret float %20
}