#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 exp(double);
double sin(double);
double acffunc(int index, double deltax, double ksi) {
  double a;
  if (ksi == 0.0)
    return (0.0);
  switch (index) {
  case 1:
    return (exp(-deltax / ksi));
  case 2:
    return (exp(-deltax * deltax / ksi / ksi / 2.0));
  case 3:
    a = 1.0 - deltax / (2.0 * ksi);
    return (a < 0.0 ? 0.0 : a);
  case 4:
    a = 2.0 * deltax / ksi;
    return (a == 0.0 ? 1.0 : sin(a) / a);
  default:
    return 0.0;
  }
}


x86 assembly (clang, -O0):
<acffunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    115a <acffunc+0x3a>
jp     115a <acffunc+0x3a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c0 <acffunc+0x1a0>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x3,%eax
ja     12b8 <acffunc+0x198>
mov    -0x30(%rbp),%rax
lea    0xe96(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x20(%rbp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    12c0 <acffunc+0x1a0>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  0xe1a(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    12c0 <acffunc+0x1a0>
movsd  -0x18(%rbp),%xmm1
movsd  0xdfa(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xdf1(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    123b <acffunc+0x11b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1245 <acffunc+0x125>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c0 <acffunc+0x1a0>
movsd  0xda4(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1295 <acffunc+0x175>
jp     1295 <acffunc+0x175>
movsd  0xd7d(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    12a9 <acffunc+0x189>
movsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c0 <acffunc+0x1a0>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acffunc>:
sub    $0x18,%rsp
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1139 <acffunc+0x19>
jp     1139 <acffunc+0x19>
add    $0x18,%rsp
ret
add    $0xffffffff,%edi
cmp    $0x3,%edi
ja     1134 <acffunc+0x14>
lea    0xed8(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
xorpd  0xeb7(%rip),%xmm2
divsd  %xmm1,%xmm2
jmp    1173 <acffunc+0x53>
mulsd  %xmm2,%xmm2
divsd  %xmm1,%xmm2
divsd  %xmm1,%xmm2
mulsd  0xe95(%rip),%xmm2
movapd %xmm2,%xmm0
add    $0x18,%rsp
jmp    1040 <exp@plt>
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm2
movsd  0xe70(%rip),%xmm1
subsd  %xmm2,%xmm1
xorpd  %xmm0,%xmm0
maxsd  %xmm1,%xmm0
add    $0x18,%rsp
ret
addsd  %xmm2,%xmm2
divsd  %xmm1,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    11c2 <acffunc+0xa2>
jp     11c2 <acffunc+0xa2>
movsd  0xe43(%rip),%xmm0
add    $0x18,%rsp
ret
movapd %xmm2,%xmm0
movapd %xmm2,(%rsp)
call   1030 <sin@plt>
divsd  (%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @acffunc(i32 %0, double %1, double %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %5
store double %1, double* %6
store double %2, double* %7
%9 = load double, double* %7
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %3
store double 0.000000e+00, double* %4
br label %60
12: ; preds = %3
%13 = load i32, i32* %5
switch i32 %13, label %59 [
i32 1, label %14
i32 2, label %20
i32 3, label %31
i32 4, label %44
]
14: ; preds = %12
%15 = load double, double* %6
%16 = fneg double %15
%17 = load double, double* %7
%18 = fdiv double %16, %17
%19 = call double @exp(double %18)
store double %19, double* %4
br label %60
20: ; preds = %12
%21 = load double, double* %6
%22 = fneg double %21
%23 = load double, double* %6
%24 = fmul double %22, %23
%25 = load double, double* %7
%26 = fdiv double %24, %25
%27 = load double, double* %7
%28 = fdiv double %26, %27
%29 = fdiv double %28, 2.000000e+00
%30 = call double @exp(double %29)
store double %30, double* %4
br label %60
31: ; preds = %12
%32 = load double, double* %6
%33 = load double, double* %7
%34 = fmul double 2.000000e+00, %33
%35 = fdiv double %32, %34
%36 = fsub double 1.000000e+00, %35
store double %36, double* %8
%37 = load double, double* %8
%38 = fcmp olt double %37, 0.000000e+00
br i1 %38, label %39, label %40
39: ; preds = %31
br label %42
40: ; preds = %31
%41 = load double, double* %8
br label %42
42: ; preds = %40, %39
%43 = phi double [ 0.000000e+00, %39 ], [ %41, %40 ]
store double %43, double* %4
br label %60
44: ; preds = %12
%45 = load double, double* %6
%46 = fmul double 2.000000e+00, %45
%47 = load double, double* %7
%48 = fdiv double %46, %47
store double %48, double* %8
%49 = load double, double* %8
%50 = fcmp oeq double %49, 0.000000e+00
br i1 %50, label %51, label %52
51: ; preds = %44
br label %57
52: ; preds = %44
%53 = load double, double* %8
%54 = call double @sin(double %53)
%55 = load double, double* %8
%56 = fdiv double %54, %55
br label %57
57: ; preds = %52, %51
%58 = phi double [ 1.000000e+00, %51 ], [ %56, %52 ]
store double %58, double* %4
br label %60
59: ; preds = %12
store double 0.000000e+00, double* %4
br label %60
60: ; preds = %59, %57, %42, %20, %14, %11
%61 = load double, double* %4
ret double %61
}

LLVM IR (-O2):
define double @acffunc(i32 %0, double %1, double %2) {
%4 = fcmp oeq double %2, 0.000000e+00
br i1 %4, label %30, label %5
5: ; preds = %3
switch i32 %0, label %30 [
i32 1, label %6
i32 2, label %10
i32 3, label %17
i32 4, label %23
]
6: ; preds = %5
%7 = fneg double %1
%8 = fdiv double %7, %2
%9 = tail call double @exp(double %8)
br label %30
10: ; preds = %5
%11 = fneg double %1
%12 = fmul double %11, %1
%13 = fdiv double %12, %2
%14 = fdiv double %13, %2
%15 = fmul double %14, 5.000000e-01
%16 = tail call double @exp(double %15)
br label %30
17: ; preds = %5
%18 = fmul double %2, 2.000000e+00
%19 = fdiv double %1, %18
%20 = fsub double 1.000000e+00, %19
%21 = fcmp olt double %20, 0.000000e+00
%22 = select i1 %21, double 0.000000e+00, double %20
br label %30
23: ; preds = %5
%24 = fmul double %1, 2.000000e+00
%25 = fdiv double %24, %2
%26 = fcmp oeq double %25, 0.000000e+00
br i1 %26, label %30, label %27
27: ; preds = %23
%28 = tail call double @sin(double %25)
%29 = fdiv double %28, %25
br label %30
30: ; preds = %5, %27, %23, %3, %17, %10, %6
%31 = phi double [ %22, %17 ], [ %16, %10 ], [ %9, %6 ], [ 0.000000e+00, %3 ], [ %29, %27 ], [ 1.000000e+00, %23 ], [ 0.000000e+00, %5 ]
ret double %31
}