#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[0]);
  if (i == 1)
    return (y[1]);
  if (i == 2)
    return ((-2 * y[1]) /
            pow((1 + 2 * y[1] * y[1] + 2 * y[0] * y[0]), (3 / 2)));
  if (i == 3)
    return ((-2 * y[0]) /
            pow((1 + 2 * y[1] * y[1] + 2 * y[0] * y[0]), (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    1140 <f+0x30>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1275 <f+0x165>
cmpl   $0x1,-0x1c(%rbp)
jne    115d <f+0x4d>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1275 <f+0x165>
cmpl   $0x2,-0x1c(%rbp)
jne    11ec <f+0xdc>
mov    -0x18(%rbp),%rax
movsd  0xe9d(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsd  0xe77(%rip),%xmm1
mulsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe65(%rip),%xmm0
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0xe4d(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%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    1275 <f+0x165>
cmpl   $0x3,-0x1c(%rbp)
jne    1275 <f+0x165>
mov    -0x18(%rbp),%rax
movsd  0xe0e(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movsd  0xde9(%rip),%xmm1
mulsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xdd7(%rip),%xmm0
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0xdbf(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%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     112e <f+0x1e>
mov    %esi,%eax
lea    0xef1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  (%rdi),%xmm0
pop    %rax
ret
pop    %rax
ret
movsd  0x8(%rdi),%xmm0
pop    %rax
ret
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
movsd  0xeb8(%rip),%xmm2
mulsd  %xmm1,%xmm2
jmp    1163 <f+0x53>
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
movsd  0xea1(%rip),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,(%rsp)
movapd %xmm1,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
addsd  0xe8c(%rip),%xmm2
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
cvttsd2si %xmm1,%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 0
%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 %21
17: ; preds = %14
%18 = load double*, double** %6
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
store double %20, double* %4
br label %77
21: ; preds = %14
%22 = load i32, i32* %7
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %49
24: ; preds = %21
%25 = load double*, double** %6
%26 = getelementptr inbounds double, double* %25, i64 1
%27 = load double, double* %26
%28 = fmul double -2.000000e+00, %27
%29 = load double*, double** %6
%30 = getelementptr inbounds double, double* %29, i64 1
%31 = load double, double* %30
%32 = fmul double 2.000000e+00, %31
%33 = load double*, double** %6
%34 = getelementptr inbounds double, double* %33, i64 1
%35 = load double, double* %34
%36 = call double @llvm.fmuladd.f64(double %32, double %35, double 1.000000e+00)
%37 = load double*, double** %6
%38 = getelementptr inbounds double, double* %37, i64 0
%39 = load double, double* %38
%40 = fmul double 2.000000e+00, %39
%41 = load double*, double** %6
%42 = getelementptr inbounds double, double* %41, i64 0
%43 = load double, double* %42
%44 = call double @llvm.fmuladd.f64(double %40, double %43, double %36)
%45 = fptosi double %44 to i32
%46 = call i32 @pow(i32 %45, i32 1)
%47 = sitofp i32 %46 to double
%48 = fdiv double %28, %47
store double %48, double* %4
br label %77
49: ; preds = %21
%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 0
%55 = load double, double* %54
%56 = fmul double -2.000000e+00, %55
%57 = load double*, double** %6
%58 = getelementptr inbounds double, double* %57, i64 1
%59 = load double, double* %58
%60 = fmul double 2.000000e+00, %59
%61 = load double*, double** %6
%62 = getelementptr inbounds double, double* %61, i64 1
%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 0
%67 = load double, double* %66
%68 = fmul double 2.000000e+00, %67
%69 = load double*, double** %6
%70 = getelementptr inbounds double, double* %69, i64 0
%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, %24, %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 %35 [
i32 0, label %4
i32 1, label %6
i32 2, label %9
i32 3, label %22
]
4: ; preds = %3
%5 = load double, double* %1
br label %35
6: ; preds = %3
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
br label %35
9: ; preds = %3
%10 = getelementptr inbounds double, double* %1, i64 1
%11 = load double, double* %10
%12 = fmul double %11, -2.000000e+00
%13 = fmul double %11, 2.000000e+00
%14 = tail call double @llvm.fmuladd.f64(double %13, double %11, double 1.000000e+00)
%15 = load double, double* %1
%16 = fmul double %15, 2.000000e+00
%17 = tail call double @llvm.fmuladd.f64(double %16, double %15, double %14)
%18 = fptosi double %17 to i32
%19 = tail call i32 @pow(i32 %18, i32 1)
%20 = sitofp i32 %19 to double
%21 = fdiv double %12, %20
br label %35
22: ; preds = %3
%23 = load double, double* %1
%24 = fmul double %23, -2.000000e+00
%25 = getelementptr inbounds double, double* %1, i64 1
%26 = load double, double* %25
%27 = fmul double %26, 2.000000e+00
%28 = tail call double @llvm.fmuladd.f64(double %27, double %26, double 1.000000e+00)
%29 = fmul double %23, 2.000000e+00
%30 = tail call double @llvm.fmuladd.f64(double %29, double %23, double %28)
%31 = fptosi double %30 to i32
%32 = tail call i32 @pow(i32 %31, i32 1)
%33 = sitofp i32 %32 to double
%34 = fdiv double %24, %33
br label %35
35: ; preds = %3, %4, %6, %9, %22
%36 = phi double [ %5, %4 ], [ %8, %6 ], [ %21, %9 ], [ %34, %22 ], [ undef, %3 ]
ret double %36
}