#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 */
scalar_t__ module(double);
double area(double incr, double y1, double y2) {
  double area;
  if ((y1 > -incr && y1 < incr) || (y2 > -incr && y2 < incr)) {
    return 0;
  }
  if (y1 <= y2) {
    area = incr * y1;
    if (module(y2) > module(y1) + 0.001) {
      area += incr * (y2 - y1) / 2;
    }
  } else {
    area = incr * y2;
    if (module(y1) > module(y2) + 0.001) {
      area += incr * (y1 - y2) / 2;
    }
  }
  return area;
}


x86 assembly (clang, -O0):
<area>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
ucomisd %xmm1,%xmm0
jbe    1166 <area+0x56>
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     11a5 <area+0x95>
movsd  -0x20(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
ucomisd %xmm1,%xmm0
jbe    11b2 <area+0xa2>
movsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11b2 <area+0xa2>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c6 <area+0x1b6>
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1241 <area+0x131>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <module@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <module@plt>
movsd  -0x30(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
movsd  0xdfb(%rip),%xmm2
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    123c <area+0x12c>
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdda(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    12bc <area+0x1ac>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <module@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <module@plt>
movsd  -0x38(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
movsd  0xd80(%rip),%xmm2
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    12b7 <area+0x1a7>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd5f(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    12bc <area+0x1ac>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<area>:
sub    $0x48,%rsp
movapd %xmm0,%xmm4
movapd 0xee0(%rip),%xmm3
xorpd  %xmm0,%xmm3
ucomisd %xmm3,%xmm1
xorpd  %xmm0,%xmm0
jbe    1139 <area+0x29>
ucomisd %xmm1,%xmm4
jbe    1139 <area+0x29>
add    $0x48,%rsp
ret
ucomisd %xmm3,%xmm2
jbe    1145 <area+0x35>
ucomisd %xmm2,%xmm4
ja     1134 <area+0x24>
ucomisd %xmm1,%xmm2
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
movapd %xmm4,0x30(%rsp)
movapd %xmm4,%xmm0
jae    11b7 <area+0xa7>
mulsd  %xmm2,%xmm0
movapd %xmm0,0x20(%rsp)
movapd %xmm1,%xmm0
call   1030 <module@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <module@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0xe73(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    1228 <area+0x118>
movsd  0x10(%rsp),%xmm1
subsd  0x18(%rsp),%xmm1
jmp    120b <area+0xfb>
mulsd  %xmm1,%xmm0
movapd %xmm0,0x20(%rsp)
movapd %xmm2,%xmm0
call   1030 <module@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <module@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0xe1d(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    1228 <area+0x118>
movsd  0x18(%rsp),%xmm1
subsd  0x10(%rsp),%xmm1
mulsd  0x30(%rsp),%xmm1
mulsd  0xdff(%rip),%xmm1
movapd 0x20(%rsp),%xmm0
addsd  %xmm1,%xmm0
add    $0x48,%rsp
ret
movaps 0x20(%rsp),%xmm0
add    $0x48,%rsp
ret

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

LLVM IR (-O2):
define double @area(double %0, double %1, double %2) {
%4 = fneg double %0
%5 = fcmp olt double %4, %1
%6 = fcmp olt double %1, %0
%7 = and i1 %5, %6
br i1 %7, label %40, label %8
8: ; preds = %3
%9 = fcmp olt double %4, %2
%10 = fcmp olt double %2, %0
%11 = and i1 %9, %10
br i1 %11, label %40, label %12
12: ; preds = %8
%13 = fcmp ugt double %1, %2
br i1 %13, label %27, label %14
14: ; preds = %12
%15 = fmul double %0, %1
%16 = tail call i64 @module(double %2)
%17 = sitofp i64 %16 to double
%18 = tail call i64 @module(double %1)
%19 = sitofp i64 %18 to double
%20 = fadd double %19, 1.000000e-03
%21 = fcmp olt double %20, %17
br i1 %21, label %22, label %40
22: ; preds = %14
%23 = fsub double %2, %1
%24 = fmul double %23, %0
%25 = fmul double %24, 5.000000e-01
%26 = fadd double %15, %25
br label %40
27: ; preds = %12
%28 = fmul double %0, %2
%29 = tail call i64 @module(double %1)
%30 = sitofp i64 %29 to double
%31 = tail call i64 @module(double %2)
%32 = sitofp i64 %31 to double
%33 = fadd double %32, 1.000000e-03
%34 = fcmp olt double %33, %30
br i1 %34, label %35, label %40
35: ; preds = %27
%36 = fsub double %1, %2
%37 = fmul double %36, %0
%38 = fmul double %37, 5.000000e-01
%39 = fadd double %28, %38
br label %40
40: ; preds = %22, %14, %35, %27, %3, %8
%41 = phi double [ 0.000000e+00, %8 ], [ 0.000000e+00, %3 ], [ %26, %22 ], [ %15, %14 ], [ %39, %35 ], [ %28, %27 ]
ret double %41
}