double geom_dA_cyl_rpz(double xm[], double xp[], int dir) {
  double dA;
  if (dir == 0)
    dA = xm[0] * (xp[1] - xm[1]);
  else if (dir == 1)
    dA = xp[0] - xm[0];
  else
    dA = 0.0;
  return dA;
}


x86 assembly (clang, -O0):
<geom_dA_cyl_rpz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1141 <geom_dA_cyl_rpz+0x41>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1172 <geom_dA_cyl_rpz+0x72>
cmpl   $0x1,-0x14(%rbp)
jne    1165 <geom_dA_cyl_rpz+0x65>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    116d <geom_dA_cyl_rpz+0x6d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1172 <geom_dA_cyl_rpz+0x72>
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_dA_cyl_rpz>:
cmp    $0x1,%edx
je     111c <geom_dA_cyl_rpz+0x1c>
xorpd  %xmm0,%xmm0
test   %edx,%edx
jne    1124 <geom_dA_cyl_rpz+0x24>
movsd  0x8(%rsi),%xmm0
subsd  0x8(%rdi),%xmm0
mulsd  (%rdi),%xmm0
ret
movsd  (%rsi),%xmm0
subsd  (%rdi),%xmm0
ret

LLVM IR (-O0):
define double @geom_dA_cyl_rpz(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, 0
br i1 %9, label %10, label %22
10: ; preds = %3
%11 = load double*, double** %4
%12 = getelementptr inbounds double, double* %11, i64 0
%13 = load double, double* %12
%14 = load double*, double** %5
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = load double*, double** %4
%18 = getelementptr inbounds double, double* %17, i64 1
%19 = load double, double* %18
%20 = fsub double %16, %19
%21 = fmul double %13, %20
store double %21, double* %7
br label %35
22: ; preds = %3
%23 = load i32, i32* %6
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %33
25: ; preds = %22
%26 = load double*, double** %5
%27 = getelementptr inbounds double, double* %26, i64 0
%28 = load double, double* %27
%29 = load double*, double** %4
%30 = getelementptr inbounds double, double* %29, i64 0
%31 = load double, double* %30
%32 = fsub double %28, %31
store double %32, double* %7
br label %34
33: ; preds = %22
store double 0.000000e+00, double* %7
br label %34
34: ; preds = %33, %25
br label %35
35: ; preds = %34, %10
%36 = load double, double* %7
ret double %36
}

LLVM IR (-O2):
define double @geom_dA_cyl_rpz(double* nocapture %0, double* nocapture %1, i32 %2) {
switch i32 %2, label %16 [
i32 0, label %4
i32 1, label %12
]
4: ; preds = %3
%5 = load double, double* %0
%6 = getelementptr inbounds double, double* %1, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = load double, double* %8
%10 = fsub double %7, %9
%11 = fmul double %5, %10
br label %16
12: ; preds = %3
%13 = load double, double* %1
%14 = load double, double* %0
%15 = fsub double %13, %14
br label %16
16: ; preds = %3, %12, %4
%17 = phi double [ %11, %4 ], [ %15, %12 ], [ 0.000000e+00, %3 ]
ret double %17
}