#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 */
int pow(int, int);
double f(double x, double y[], int i) {
  if (i == 0)
    return (y[1]);
  if (i == 1)
    return ((-2 * y[0]) /
            pow((1 + 2 * y[0] * y[0] + 2 * y[2] * y[2]), (3 / 2)));
  if (i == 2)
    return (y[3]);
  if (i == 3)
    return ((-2 * y[2]) /
            pow((1 + 2 * y[0] * y[0] + 2 * y[2] * y[2]), (3 / 2)));
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1141 <f+0x31>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1276 <f+0x166>
cmpl   $0x1,-0x1c(%rbp)
jne    11cf <f+0xbf>
mov    -0x18(%rbp),%rax
movsd  0xeb9(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsd  0xe94(%rip),%xmm1
mulsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe84(%rip),%xmm0
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0xe6c(%rip),%xmm0
mulsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
mov    $0x1,%esi
call   1030 <pow@plt>
movsd  -0x28(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1276 <f+0x166>
cmpl   $0x2,-0x1c(%rbp)
jne    11ec <f+0xdc>
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1276 <f+0x166>
cmpl   $0x3,-0x1c(%rbp)
jne    1276 <f+0x166>
mov    -0x18(%rbp),%rax
movsd  0xe0e(%rip),%xmm0
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movsd  0xde8(%rip),%xmm1
mulsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xdd8(%rip),%xmm0
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0xdc0(%rip),%xmm0
mulsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
mov    $0x1,%esi
call   1030 <pow@plt>
movsd  -0x30(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rax
cmp    $0x3,%esi
ja     112f <f+0x1f>
mov    %esi,%eax
lea    0xef1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  0x8(%rdi),%xmm0
pop    %rax
ret
pop    %rax
ret
movsd  (%rdi),%xmm0
movsd  0x10(%rdi),%xmm1
movsd  0xebe(%rip),%xmm2
mulsd  %xmm0,%xmm2
jmp    1164 <f+0x54>
movsd  0x18(%rdi),%xmm0
pop    %rax
ret
movsd  (%rdi),%xmm0
movsd  0x10(%rdi),%xmm1
movsd  0xea0(%rip),%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
movapd %xmm0,%xmm2
addsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
addsd  0xe8b(%rip),%xmm2
movapd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edi
mov    $0x1,%esi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @f(double %0, double* %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double*
%7 = alloca i32
store double %0, double* %5
store double* %1, double** %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load double*, double** %6
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
store double %13, double* %4
br label %77
14: ; preds = %3
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %42
17: ; preds = %14
%18 = load double*, double** %6
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
%21 = fmul double -2.000000e+00, %20
%22 = load double*, double** %6
%23 = getelementptr inbounds double, double* %22, i64 0
%24 = load double, double* %23
%25 = fmul double 2.000000e+00, %24
%26 = load double*, double** %6
%27 = getelementptr inbounds double, double* %26, i64 0
%28 = load double, double* %27
%29 = call double @llvm.fmuladd.f64(double %25, double %28, double 1.000000e+00)
%30 = load double*, double** %6
%31 = getelementptr inbounds double, double* %30, i64 2
%32 = load double, double* %31
%33 = fmul double 2.000000e+00, %32
%34 = load double*, double** %6
%35 = getelementptr inbounds double, double* %34, i64 2
%36 = load double, double* %35
%37 = call double @llvm.fmuladd.f64(double %33, double %36, double %29)
%38 = fptosi double %37 to i32
%39 = call i32 @pow(i32 %38, i32 1)
%40 = sitofp i32 %39 to double
%41 = fdiv double %21, %40
store double %41, double* %4
br label %77
42: ; preds = %14
%43 = load i32, i32* %7
%44 = icmp eq i32 %43, 2
br i1 %44, label %45, label %49
45: ; preds = %42
%46 = load double*, double** %6
%47 = getelementptr inbounds double, double* %46, i64 3
%48 = load double, double* %47
store double %48, double* %4
br label %77
49: ; preds = %42
%50 = load i32, i32* %7
%51 = icmp eq i32 %50, 3
br i1 %51, label %52, label %77
52: ; preds = %49
%53 = load double*, double** %6
%54 = getelementptr inbounds double, double* %53, i64 2
%55 = load double, double* %54
%56 = fmul double -2.000000e+00, %55
%57 = load double*, double** %6
%58 = getelementptr inbounds double, double* %57, i64 0
%59 = load double, double* %58
%60 = fmul double 2.000000e+00, %59
%61 = load double*, double** %6
%62 = getelementptr inbounds double, double* %61, i64 0
%63 = load double, double* %62
%64 = call double @llvm.fmuladd.f64(double %60, double %63, double 1.000000e+00)
%65 = load double*, double** %6
%66 = getelementptr inbounds double, double* %65, i64 2
%67 = load double, double* %66
%68 = fmul double 2.000000e+00, %67
%69 = load double*, double** %6
%70 = getelementptr inbounds double, double* %69, i64 2
%71 = load double, double* %70
%72 = call double @llvm.fmuladd.f64(double %68, double %71, double %64)
%73 = fptosi double %72 to i32
%74 = call i32 @pow(i32 %73, i32 1)
%75 = sitofp i32 %74 to double
%76 = fdiv double %56, %75
store double %76, double* %4
br label %77
77: ; preds = %10, %17, %45, %52, %49
%78 = load double, double* %4
ret double %78
}

LLVM IR (-O2):
define double @f(double %0, double* nocapture %1, i32 %2) {
switch i32 %2, label %36 [
i32 0, label %4
i32 1, label %7
i32 2, label %20
i32 3, label %23
]
4: ; preds = %3
%5 = getelementptr inbounds double, double* %1, i64 1
%6 = load double, double* %5
br label %36
7: ; preds = %3
%8 = load double, double* %1
%9 = fmul double %8, -2.000000e+00
%10 = fmul double %8, 2.000000e+00
%11 = tail call double @llvm.fmuladd.f64(double %10, double %8, double 1.000000e+00)
%12 = getelementptr inbounds double, double* %1, i64 2
%13 = load double, double* %12
%14 = fmul double %13, 2.000000e+00
%15 = tail call double @llvm.fmuladd.f64(double %14, double %13, double %11)
%16 = fptosi double %15 to i32
%17 = tail call i32 @pow(i32 %16, i32 1)
%18 = sitofp i32 %17 to double
%19 = fdiv double %9, %18
br label %36
20: ; preds = %3
%21 = getelementptr inbounds double, double* %1, i64 3
%22 = load double, double* %21
br label %36
23: ; preds = %3
%24 = getelementptr inbounds double, double* %1, i64 2
%25 = load double, double* %24
%26 = fmul double %25, -2.000000e+00
%27 = load double, double* %1
%28 = fmul double %27, 2.000000e+00
%29 = tail call double @llvm.fmuladd.f64(double %28, double %27, double 1.000000e+00)
%30 = fmul double %25, 2.000000e+00
%31 = tail call double @llvm.fmuladd.f64(double %30, double %25, double %29)
%32 = fptosi double %31 to i32
%33 = tail call i32 @pow(i32 %32, i32 1)
%34 = sitofp i32 %33 to double
%35 = fdiv double %26, %34
br label %36
36: ; preds = %3, %4, %7, %20, %23
%37 = phi double [ %6, %4 ], [ %19, %7 ], [ %22, %20 ], [ %35, %23 ], [ undef, %3 ]
ret double %37
}