#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 c_x(double x, double y, int I) {
  double speed;
  if (I == 2) {
    speed = -0.8 * exp(-10.0 * (y - 0.3) * (y - 0.3)) *
            exp(-20.0 * (x - 0.25) * (x - 0.25));
    speed = -40.0 * speed * (x - 0.25);
  } else if (I == 1)
    speed = 0;
  return (speed);
}


x86 assembly (clang, -O0):
<c_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jne    11ee <c_x+0xde>
movsd  -0x10(%rbp),%xmm1
movsd  0xee4(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xee0(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xec7(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xea7(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xe79(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe7d(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xe5c(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe3e(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xe24(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1205 <c_x+0xf5>
cmpl   $0x1,-0x14(%rbp)
jne    1200 <c_x+0xf0>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1205 <c_x+0xf5>
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_x>:
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
cmp    $0x2,%edi
jne    1193 <c_x+0x83>
sub    $0x18,%rsp
addsd  0xed7(%rip),%xmm1
movsd  0xed7(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm2,0x8(%rsp)
call   1030 <exp@plt>
mulsd  0xec4(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm1
addsd  0xeb8(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xeb2(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
mulsd  0x10(%rsp),%xmm0
mulsd  0xe9f(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @c_x(double %0, double %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %32
10: ; preds = %3
%11 = load double, double* %5
%12 = fsub double %11, 3.000000e-01
%13 = fmul double -1.000000e+01, %12
%14 = load double, double* %5
%15 = fsub double %14, 3.000000e-01
%16 = fmul double %13, %15
%17 = call double @exp(double %16)
%18 = fmul double -8.000000e-01, %17
%19 = load double, double* %4
%20 = fsub double %19, 2.500000e-01
%21 = fmul double -2.000000e+01, %20
%22 = load double, double* %4
%23 = fsub double %22, 2.500000e-01
%24 = fmul double %21, %23
%25 = call double @exp(double %24)
%26 = fmul double %18, %25
store double %26, double* %7
%27 = load double, double* %7
%28 = fmul double -4.000000e+01, %27
%29 = load double, double* %4
%30 = fsub double %29, 2.500000e-01
%31 = fmul double %28, %30
store double %31, double* %7
br label %37
32: ; preds = %3
%33 = load i32, i32* %6
%34 = icmp eq i32 %33, 1
br i1 %34, label %35, label %36
35: ; preds = %32
store double 0.000000e+00, double* %7
br label %36
36: ; preds = %35, %32
br label %37
37: ; preds = %36, %10
%38 = load double, double* %7
ret double %38
}

LLVM IR (-O2):
define double @c_x(double %0, double %1, i32 %2) {
%4 = icmp eq i32 %2, 2
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = fadd double %1, -3.000000e-01
%7 = fmul double %6, -1.000000e+01
%8 = fmul double %6, %7
%9 = tail call double @exp(double %8)
%10 = fmul double %9, -8.000000e-01
%11 = fadd double %0, -2.500000e-01
%12 = fmul double %11, -2.000000e+01
%13 = fmul double %11, %12
%14 = tail call double @exp(double %13)
%15 = fmul double %10, %14
%16 = fmul double %15, -4.000000e+01
%17 = fmul double %11, %16
br label %18
18: ; preds = %3, %5
%19 = phi double [ %17, %5 ], [ 0.000000e+00, %3 ]
ret double %19
}