#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*/ error(char *);
int /*<<< orphan*/ swap_double(double *, double *);
int check_ell(double *eparam) {
  if (eparam == NULL)
    error("check_ell: invalid ellipse.");
  if ((eparam[2] <= 1) || (eparam[3] <= 1))
    return 0;
  if (eparam[2] < eparam[3]) {
    swap_double(&(eparam[2]), &(eparam[3]));
    eparam[4] += 1.57079632679;
  }
  if (eparam[2] / eparam[3] > 100)
    return 0;
  if (eparam[4] > 1.57079632679)
    eparam[4] -= 3.14159265358979323846;
  if (eparam[4] > 3.14159265358979323846)
    eparam[4] -= 3.14159265358979323846;
  if (eparam[4] < -1.57079632679)
    eparam[4] += 3.14159265358979323846;
  return 1;
}


x86 assembly (clang, -O0):
<check_ell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <check_ell+0x23>
lea    0xeea(%rip),%rdi
call   1030 <error@plt>
mov    -0x10(%rbp),%rax
movsd  0xeb1(%rip),%xmm0
ucomisd 0x10(%rax),%xmm0
jae    1171 <check_ell+0x51>
mov    -0x10(%rbp),%rax
movsd  0xe9a(%rip),%xmm0
ucomisd 0x18(%rax),%xmm0
jb     117d <check_ell+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    1292 <check_ell+0x172>
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c4 <check_ell+0xa4>
mov    -0x10(%rbp),%rdi
add    $0x10,%rdi
mov    -0x10(%rbp),%rsi
add    $0x18,%rsi
call   1040 <swap_double@plt>
mov    -0x10(%rbp),%rax
movsd  0xe4e(%rip),%xmm0
addsd  0x20(%rax),%xmm0
movsd  %xmm0,0x20(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x18(%rax),%xmm0
movsd  0xe32(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11f4 <check_ell+0xd4>
movl   $0x0,-0x4(%rbp)
jmp    1292 <check_ell+0x172>
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  0xe03(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1229 <check_ell+0x109>
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  0xdf8(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rax)
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  0xdde(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    125e <check_ell+0x13e>
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  0xdc3(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rax)
mov    -0x10(%rbp),%rax
movsd  0xdb6(%rip),%xmm0
ucomisd 0x20(%rax),%xmm0
jbe    128b <check_ell+0x16b>
mov    -0x10(%rbp),%rax
movsd  0xd97(%rip),%xmm0
addsd  0x20(%rax),%xmm0
movsd  %xmm0,0x20(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_ell>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %rdi,%rdi
jne    1137 <check_ell+0x17>
lea    0xefe(%rip),%rdi
call   1030 <error@plt>
movsd  0x10(%rbx),%xmm0
xor    %ebp,%ebp
movsd  0xeba(%rip),%xmm2
ucomisd %xmm0,%xmm2
jae    1238 <check_ell+0x118>
movsd  0x18(%rbx),%xmm1
ucomisd %xmm1,%xmm2
jae    1238 <check_ell+0x118>
ucomisd %xmm0,%xmm1
jbe    118e <check_ell+0x6e>
lea    0x10(%rbx),%rdi
lea    0x18(%rbx),%rsi
call   1040 <swap_double@plt>
movsd  0x20(%rbx),%xmm0
addsd  0xe89(%rip),%xmm0
movsd  %xmm0,0x20(%rbx)
movsd  0x10(%rbx),%xmm0
movsd  0x18(%rbx),%xmm1
divsd  %xmm1,%xmm0
ucomisd 0xe76(%rip),%xmm0
ja     1238 <check_ell+0x118>
movsd  0x20(%rbx),%xmm0
movsd  0xe5b(%rip),%xmm1
ucomisd %xmm1,%xmm0
movsd  0xe5f(%rip),%xmm2
movapd %xmm0,%xmm3
addsd  %xmm2,%xmm3
cmpltsd %xmm0,%xmm1
andpd  %xmm1,%xmm3
andnpd %xmm0,%xmm1
orpd   %xmm3,%xmm1
addsd  %xmm1,%xmm2
movsd  0xe42(%rip),%xmm0
cmpltsd %xmm1,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
mov    $0x1,%ebp
ja     120e <check_ell+0xee>
ucomisd 0xe22(%rip),%xmm1
ja     120e <check_ell+0xee>
movsd  0xe20(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1238 <check_ell+0x118>
movsd  0xe0a(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm0,%xmm2
cmpltsd 0xe01(%rip),%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm1,%xmm2
movlpd %xmm2,0x20(%rbx)
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"check_ell: invalid ellipse.\00"
define i32 @check_ell(double* %0) {
%2 = alloca i32
%3 = alloca double*
store double* %0, double** %3
%4 = load double*, double** %3
%5 = icmp eq double* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 2
%11 = load double, double* %10
%12 = fcmp ole double %11, 1.000000e+00
br i1 %12, label %18, label %13
13: ; preds = %8
%14 = load double*, double** %3
%15 = getelementptr inbounds double, double* %14, i64 3
%16 = load double, double* %15
%17 = fcmp ole double %16, 1.000000e+00
br i1 %17, label %18, label %19
18: ; preds = %13, %8
store i32 0, i32* %2
br label %78
19: ; preds = %13
%20 = load double*, double** %3
%21 = getelementptr inbounds double, double* %20, i64 2
%22 = load double, double* %21
%23 = load double*, double** %3
%24 = getelementptr inbounds double, double* %23, i64 3
%25 = load double, double* %24
%26 = fcmp olt double %22, %25
br i1 %26, label %27, label %37
27: ; preds = %19
%28 = load double*, double** %3
%29 = getelementptr inbounds double, double* %28, i64 2
%30 = load double*, double** %3
%31 = getelementptr inbounds double, double* %30, i64 3
%32 = call i32 @swap_double(double* %29, double* %31)
%33 = load double*, double** %3
%34 = getelementptr inbounds double, double* %33, i64 4
%35 = load double, double* %34
%36 = fadd double %35, 0x3FF921FB5443D6F4
store double %36, double* %34
br label %37
37: ; preds = %27, %19
%38 = load double*, double** %3
%39 = getelementptr inbounds double, double* %38, i64 2
%40 = load double, double* %39
%41 = load double*, double** %3
%42 = getelementptr inbounds double, double* %41, i64 3
%43 = load double, double* %42
%44 = fdiv double %40, %43
%45 = fcmp ogt double %44, 1.000000e+02
br i1 %45, label %46, label %47
46: ; preds = %37
store i32 0, i32* %2
br label %78
47: ; preds = %37
%48 = load double*, double** %3
%49 = getelementptr inbounds double, double* %48, i64 4
%50 = load double, double* %49
%51 = fcmp ogt double %50, 0x3FF921FB5443D6F4
br i1 %51, label %52, label %57
52: ; preds = %47
%53 = load double*, double** %3
%54 = getelementptr inbounds double, double* %53, i64 4
%55 = load double, double* %54
%56 = fsub double %55, 0x400921FB54442D18
store double %56, double* %54
br label %57
57: ; preds = %52, %47
%58 = load double*, double** %3
%59 = getelementptr inbounds double, double* %58, i64 4
%60 = load double, double* %59
%61 = fcmp ogt double %60, 0x400921FB54442D18
br i1 %61, label %62, label %67
62: ; preds = %57
%63 = load double*, double** %3
%64 = getelementptr inbounds double, double* %63, i64 4
%65 = load double, double* %64
%66 = fsub double %65, 0x400921FB54442D18
store double %66, double* %64
br label %67
67: ; preds = %62, %57
%68 = load double*, double** %3
%69 = getelementptr inbounds double, double* %68, i64 4
%70 = load double, double* %69
%71 = fcmp olt double %70, 0xBFF921FB5443D6F4
br i1 %71, label %72, label %77
72: ; preds = %67
%73 = load double*, double** %3
%74 = getelementptr inbounds double, double* %73, i64 4
%75 = load double, double* %74
%76 = fadd double %75, 0x400921FB54442D18
store double %76, double* %74
br label %77
77: ; preds = %72, %67
store i32 1, i32* %2
br label %78
78: ; preds = %77, %46, %18
%79 = load i32, i32* %2
ret i32 %79
}

LLVM IR (-O2):
@.str = [28 x i8] c"check_ell: invalid ellipse.\00"
define i32 @check_ell(double* %0) {
%2 = icmp eq double* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = getelementptr inbounds double, double* %0, i64 2
%7 = load double, double* %6
%8 = fcmp ugt double %7, 1.000000e+00
br i1 %8, label %9, label %42
9: ; preds = %5
%10 = getelementptr inbounds double, double* %0, i64 3
%11 = load double, double* %10
%12 = fcmp ugt double %11, 1.000000e+00
br i1 %12, label %13, label %42
13: ; preds = %9
%14 = fcmp olt double %7, %11
br i1 %14, label %15, label %22
15: ; preds = %13
%16 = tail call i32 @swap_double(double* %6, double* %10)
%17 = getelementptr inbounds double, double* %0, i64 4
%18 = load double, double* %17
%19 = fadd double %18, 0x3FF921FB5443D6F4
store double %19, double* %17
%20 = load double, double* %6
%21 = load double, double* %10
br label %22
22: ; preds = %15, %13
%23 = phi double [ %21, %15 ], [ %11, %13 ]
%24 = phi double [ %20, %15 ], [ %7, %13 ]
%25 = fdiv double %24, %23
%26 = fcmp ogt double %25, 1.000000e+02
br i1 %26, label %42, label %27
27: ; preds = %22
%28 = getelementptr inbounds double, double* %0, i64 4
%29 = load double, double* %28
%30 = fcmp ogt double %29, 0x3FF921FB5443D6F4
%31 = fadd double %29, 0xC00921FB54442D18
%32 = select i1 %30, double %31, double %29
%33 = fcmp ogt double %32, 0x400921FB54442D18
%34 = fadd double %32, 0xC00921FB54442D18
%35 = select i1 %33, double %34, double %32
%36 = or i1 %30, %33
%37 = fcmp olt double %35, 0xBFF921FB5443D6F4
%38 = or i1 %36, %37
br i1 %38, label %39, label %42
39: ; preds = %27
%40 = fadd double %35, 0x400921FB54442D18
%41 = select i1 %37, double %40, double %35
store double %41, double* %28
br label %42
42: ; preds = %39, %27, %22, %5, %9
%43 = phi i32 [ 0, %9 ], [ 0, %5 ], [ 0, %22 ], [ 1, %27 ], [ 1, %39 ]
ret i32 %43
}