#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*/ atan2(double, double);
double fmod(int /*<<< orphan*/, int);
double sqrt(double);
void data_from_contour(double *cont, int anz, double *a, double *b,
                       double *tet) {
  int i, ai, bi;
  double d, center[2];
  ai = 0;
  *a = *b = sqrt(((cont[0] - center[0]) * (cont[0] - center[0])) +
                 ((cont[1] - center[1]) * (cont[1] - center[1])));
  for (i = 0; i < anz; i++) {
    d = sqrt(((cont[i * 2] - center[0]) * (cont[i * 2] - center[0])) +
             ((cont[i * 2 + 1] - center[1]) * (cont[i * 2 + 1] - center[1])));
    if (*a < d) {
      ai = i;
      *a = d;
    }
    if (*b > d) {
      bi = i;
      *b = d;
    }
  }
  *tet =
      fmod(atan2(cont[ai * 2 + 1] - center[1], cont[ai * 2] - center[0]), 90);
}


x86 assembly (clang, -O0):
<data_from_contour>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x50(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
subsd  -0x50(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
subsd  -0x48(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm3
subsd  -0x48(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1297 <data_from_contour+0x167>
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x50(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
subsd  -0x50(%rbp),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
subsd  -0x48(%rbp),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm3
subsd  -0x48(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    125e <data_from_contour+0x12e>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    1284 <data_from_contour+0x154>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x34(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1289 <data_from_contour+0x159>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11b0 <data_from_contour+0x80>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
subsd  -0x50(%rbp),%xmm1
call   1030 <atan2@plt>
mov    %eax,%edi
mov    $0x5a,%esi
call   1040 <fmod@plt>
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<data_from_contour>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %esi,%r12d
movsd  0xeb4(%rip),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,(%r15)
movsd  %xmm0,(%rbx)
test   %r12d,%r12d
jle    1192 <data_from_contour+0x62>
cmp    $0x1,%r12d
jne    11bc <data_from_contour+0x8c>
test   $0x1,%r12b
je     1192 <data_from_contour+0x62>
movsd  0xe8d(%rip),%xmm0
call   1050 <sqrt@plt>
ucomisd (%rbx),%xmm0
jbe    1182 <data_from_contour+0x52>
movsd  %xmm0,(%rbx)
movsd  (%r15),%xmm1
ucomisd %xmm0,%xmm1
jbe    1192 <data_from_contour+0x62>
movsd  %xmm0,(%r15)
movsd  0xe66(%rip),%xmm0
movaps %xmm0,%xmm1
call   1030 <atan2@plt>
mov    %eax,%edi
mov    $0x5a,%esi
call   1040 <fmod@plt>
movsd  %xmm0,(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12d,%ebp
and    $0xfffffffe,%ebp
jmp    11d5 <data_from_contour+0xa5>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xfffffffe,%ebp
je     1165 <data_from_contour+0x35>
movsd  0xe23(%rip),%xmm0
call   1050 <sqrt@plt>
ucomisd (%rbx),%xmm0
jbe    11ec <data_from_contour+0xbc>
movsd  %xmm0,(%rbx)
movsd  (%r15),%xmm1
ucomisd %xmm0,%xmm1
jbe    11fc <data_from_contour+0xcc>
movsd  %xmm0,(%r15)
movsd  0xdfc(%rip),%xmm0
call   1050 <sqrt@plt>
ucomisd (%rbx),%xmm0
jbe    1213 <data_from_contour+0xe3>
movsd  %xmm0,(%rbx)
movsd  (%r15),%xmm1
ucomisd %xmm0,%xmm1
jbe    11d0 <data_from_contour+0xa0>
movsd  %xmm0,(%r15)
jmp    11d0 <data_from_contour+0xa0>

LLVM IR (-O0):
define void @data_from_contour(double* %0, i32 %1, double* %2, double* %3, double* %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca [2 x double]
store double* %0, double** %6
store i32 %1, i32* %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
store i32 0, i32* %12
%16 = load double*, double** %6
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
%19 = getelementptr inbounds [2 x double], [2 x double]* %15, i64 0, i64 0
%20 = load double, double* %19
%21 = fsub double %18, %20
%22 = load double*, double** %6
%23 = getelementptr inbounds double, double* %22, i64 0
%24 = load double, double* %23
%25 = getelementptr inbounds [2 x double], [2 x double]* %15, i64 0, i64 0
%26 = load double, double* %25
%27 = fsub double %24, %26
%28 = load double*, double** %6
%29 = getelementptr inbounds double, double* %28, i64 1
%30 = load double, double* %29
%31 = getelementptr inbounds [2 x double], [2 x double]* %15, i64 0, i64 1
%32 = load double, double* %31
%33 = fsub double %30, %32
%34 = load double*, double** %6
%35 = getelementptr inbounds double, double* %34, i64 1
%36 = load double, double* %35
%37 = getelementptr inbounds [2 x double], [2 x double]* %15, i64 0, i64 1
%38 = load double, double* %37
%39 = fsub double %36, %38
%40 = fmul double %33, %39
%41 = call double @llvm.fmuladd.f64(double %21, double %27, double %40)
%42 = call double @sqrt(double %41)
%43 = load double*, double** %9
store double %42, double* %43
%44 = load double*, double** %8
store double %42, double* %44
store i32 0, i32* %11
br label %45
45: ; preds = %109, %5
%46 = load i32, i32* %11
%47 = load i32, i32* %7
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %112
49: ; preds = %45
%50 = load double*, double** %6
%51 = load i32, i32* %11
%52 = mul nsw i32 %51, 2
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %50, i64 %53
%55 = load double, double* %54
%56 = getelementptr inbounds [2 x double], [2 x double]* %15, i64 0, i64 0
%57 = load double, double* %56
%58 = fsub double %55, %57
%59 = load double*, double** %6
%60 = load i32, i32* %11
%61 = mul nsw i32 %60, 2
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %59, i64 %62
%64 = load double, double* %63
%65 = getelementptr inbounds [2 x double], [2 x double]* %15, i64 0, i64 0
%66 = load double, double* %65
%67 = fsub double %64, %66
%68 = load double*, double** %6
%69 = load i32, i32* %11
%70 = mul nsw i32 %69, 2
%71 = add nsw i32 %70, 1
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %68, i64 %72
%74 = load double, double* %73
%75 = getelementptr inbounds [2 x double], [2 x double]* %15, i64 0, i64 1
%76 = load double, double* %75
%77 = fsub double %74, %76
%78 = load double*, double** %6
%79 = load i32, i32* %11
%80 = mul nsw i32 %79, 2
%81 = add nsw i32 %80, 1
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %78, i64 %82
%84 = load double, double* %83
%85 = getelementptr inbounds [2 x double], [2 x double]* %15, i64 0, i64 1
%86 = load double, double* %85
%87 = fsub double %84, %86
%88 = fmul double %77, %87
%89 = call double @llvm.fmuladd.f64(double %58, double %67, double %88)
%90 = call double @sqrt(double %89)
store double %90, double* %14
%91 = load double*, double** %8
%92 = load double, double* %91
%93 = load double, double* %14
%94 = fcmp olt double %92, %93
br i1 %94, label %95, label %99
95: ; preds = %49
%96 = load i32, i32* %11
store i32 %96, i32* %12
%97 = load double, double* %14
%98 = load double*, double** %8
store double %97, double* %98
br label %99
99: ; preds = %95, %49
%100 = load double*, double** %9
%101 = load double, double* %100
%102 = load double, double* %14
%103 = fcmp ogt double %101, %102
br i1 %103, label %104, label %108
104: ; preds = %99
%105 = load i32, i32* %11
store i32 %105, i32* %13
%106 = load double, double* %14
%107 = load double*, double** %9
store double %106, double* %107
br label %108
108: ; preds = %104, %99
br label %109
109: ; preds = %108
%110 = load i32, i32* %11
%111 = add nsw i32 %110, 1
store i32 %111, i32* %11
br label %45
112: ; preds = %45
%113 = load double*, double** %6
%114 = load i32, i32* %12
%115 = mul nsw i32 %114, 2
%116 = add nsw i32 %115, 1
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %113, i64 %117
%119 = load double, double* %118
%120 = getelementptr inbounds [2 x double], [2 x double]* %15, i64 0, i64 1
%121 = load double, double* %120
%122 = fsub double %119, %121
%123 = load double*, double** %6
%124 = load i32, i32* %12
%125 = mul nsw i32 %124, 2
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds double, double* %123, i64 %126
%128 = load double, double* %127
%129 = getelementptr inbounds [2 x double], [2 x double]* %15, i64 0, i64 0
%130 = load double, double* %129
%131 = fsub double %128, %130
%132 = call i32 @atan2(double %122, double %131)
%133 = call double @fmod(i32 %132, i32 90)
%134 = load double*, double** %10
store double %133, double* %134
ret void
}

LLVM IR (-O2):
define void @data_from_contour(double* nocapture readnone %0, i32 %1, double* nocapture %2, double* nocapture %3, double* nocapture writeonly %4) {
%6 = tail call double @sqrt(double 0x7FF8000000000000)
store double %6, double* %3
store double %6, double* %2
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %46
8: ; preds = %5
%9 = and i32 %1, 1
%10 = icmp eq i32 %1, 1
br i1 %10, label %35, label %11
11: ; preds = %8
%12 = and i32 %1, -2
br label %13
13: ; preds = %32, %11
%14 = phi i32 [ 0, %11 ], [ %33, %32 ]
%15 = tail call double @sqrt(double 0x7FF8000000000000)
%16 = load double, double* %2
%17 = fcmp olt double %16, %15
br i1 %17, label %18, label %19
18: ; preds = %13
store double %15, double* %2
br label %19
19: ; preds = %18, %13
%20 = load double, double* %3
%21 = fcmp ogt double %20, %15
br i1 %21, label %22, label %23
22: ; preds = %19
store double %15, double* %3
br label %23
23: ; preds = %19, %22
%24 = tail call double @sqrt(double 0x7FF8000000000000)
%25 = load double, double* %2
%26 = fcmp olt double %25, %24
br i1 %26, label %27, label %28
27: ; preds = %23
store double %24, double* %2
br label %28
28: ; preds = %27, %23
%29 = load double, double* %3
%30 = fcmp ogt double %29, %24
br i1 %30, label %31, label %32
31: ; preds = %28
store double %24, double* %3
br label %32
32: ; preds = %31, %28
%33 = add i32 %14, 2
%34 = icmp eq i32 %33, %12
br i1 %34, label %35, label %13
35: ; preds = %32, %8
%36 = icmp eq i32 %9, 0
br i1 %36, label %46, label %37
37: ; preds = %35
%38 = tail call double @sqrt(double 0x7FF8000000000000)
%39 = load double, double* %2
%40 = fcmp olt double %39, %38
br i1 %40, label %41, label %42
41: ; preds = %37
store double %38, double* %2
br label %42
42: ; preds = %41, %37
%43 = load double, double* %3
%44 = fcmp ogt double %43, %38
br i1 %44, label %45, label %46
45: ; preds = %42
store double %38, double* %3
br label %46
46: ; preds = %35, %45, %42, %5
%47 = tail call i32 @atan2(double 0x7FF8000000000000, double 0x7FF8000000000000)
%48 = tail call double @fmod(i32 %47, i32 90)
store double %48, double* %4
ret void
}