#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 /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ is_internal(int, int);
double lambda_B(int, int);
double lambda_C(int, int);
double lambda_D(int, int);
double lambda_E(int, int);
int /*<<< orphan*/ stderr;
double avg_lambda(int i, int j) {
  if (is_internal(i, j)) {
    return (lambda_B(i, j) + lambda_C(i, j)) *
           (lambda_D(i, j) + lambda_E(i, j)) / 4.0;
  } else {
    fprintf(stderr, "don't use sum_lambda with external points!");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<avg_lambda>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <is_internal@plt>
cmp    $0x0,%rax
je     1201 <avg_lambda+0x91>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1080 <lambda_B@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <lambda_C@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1090 <lambda_D@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <lambda_E@plt>
movsd  -0x18(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x10(%rbp),%xmm0
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe09(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
lea    0xdf7(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<avg_lambda>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
call   1060 <is_internal@plt>
test   %rax,%rax
je     11db <avg_lambda+0x6b>
mov    %ebp,%edi
mov    %ebx,%esi
call   1080 <lambda_B@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <lambda_C@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1090 <lambda_D@plt>
movsd  %xmm0,0x10(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1050 <lambda_E@plt>
addsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
mulsd  0xe2c(%rip),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
lea    0xe1d(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"don't use sum_lambda with external points!\00"
@EXIT_FAILURE = global i32 0
define double @avg_lambda(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i64 @is_internal(i32 %5, i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %26
9: ; preds = %2
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call double @lambda_B(i32 %10, i32 %11)
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call double @lambda_C(i32 %13, i32 %14)
%16 = fadd double %12, %15
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = call double @lambda_D(i32 %17, i32 %18)
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = call double @lambda_E(i32 %20, i32 %21)
%23 = fadd double %19, %22
%24 = fmul double %16, %23
%25 = fdiv double %24, 4.000000e+00
ret double %25
26: ; preds = %2
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @exit(i32 %29)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"don't use sum_lambda with external points!\00"
@EXIT_FAILURE = global i32 0
define double @avg_lambda(i32 %0, i32 %1) {
%3 = tail call i64 @is_internal(i32 %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2
%6 = tail call double @lambda_B(i32 %0, i32 %1)
%7 = tail call double @lambda_C(i32 %0, i32 %1)
%8 = fadd double %6, %7
%9 = tail call double @lambda_D(i32 %0, i32 %1)
%10 = tail call double @lambda_E(i32 %0, i32 %1)
%11 = fadd double %9, %10
%12 = fmul double %8, %11
%13 = fmul double %12, 2.500000e-01
ret double %13
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = tail call i32 @exit(i32 %17)
unreachable
}