#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 */
float M_PI;
float acos(float);
float atan2(float, float);
float chaine_rayon_max(float, float);
float chaine_rayon_min(float, float);
float sqrt(float);
int chaine_calcule_angles(float l1, float l2, float x, float y, float *alpha,
                          float *beta) {
  float r = sqrt(x * x + y * y);
  if (r > chaine_rayon_max(l1, l2)) {
    *alpha = atan2(y, x);
    *beta = 0;
    return 0;
  } else if (r < chaine_rayon_min(l1, l2)) {
    if (l1 < l2)
      *alpha = atan2(y, x) + M_PI;
    else
      *alpha = atan2(y, x);
    *beta = M_PI;
    return 0;
  } else {
    if (r > 0.) {
      *alpha = atan2(y, x) + acos((r * r + l1 * l1 - l2 * l2) / (2. * l1 * r));
      *beta = M_PI + acos((l1 * l1 + l2 * l2 - r * r) / (2. * l1 * l2));
    } else {
      *alpha = 0.;
      *beta = M_PI;
    }
    return 1;
  }
}


x86 assembly (clang, -O0):
<chaine_calcule_angles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
movss  -0x14(%rbp),%xmm1
mulss  -0x14(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1060 <sqrt@plt>
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <chaine_rayon_max@plt>
movaps %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11f2 <chaine_calcule_angles+0xa2>
movss  -0x14(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1040 <atan2@plt>
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    13f1 <chaine_calcule_angles+0x2a1>
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1070 <chaine_rayon_min@plt>
movss  -0x34(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jbe    1289 <chaine_calcule_angles+0x139>
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1253 <chaine_calcule_angles+0x103>
movss  -0x14(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1040 <atan2@plt>
mov    0x2da6(%rip),%rax
addss  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
jmp    126a <chaine_calcule_angles+0x11a>
movss  -0x14(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1040 <atan2@plt>
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    0x2d77(%rip),%rax
movss  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    13f1 <chaine_calcule_angles+0x2a1>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13cc <chaine_calcule_angles+0x27c>
movss  -0x14(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1040 <atan2@plt>
movss  %xmm0,-0x3c(%rbp)
movss  -0x2c(%rbp),%xmm1
movss  -0x2c(%rbp),%xmm2
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xcfd(%rip),%xmm1
mulsd  %xmm2,%xmm1
movss  -0x2c(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <acos@plt>
movaps %xmm0,%xmm1
movss  -0x3c(%rbp),%xmm0
addss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    0x2cac(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xc6b(%rip),%xmm1
mulsd  %xmm2,%xmm1
movss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <acos@plt>
movaps %xmm0,%xmm1
movss  -0x38(%rbp),%xmm0
addss  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
jmp    13ea <chaine_calcule_angles+0x29a>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    0x2c0a(%rip),%rax
movss  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chaine_calcule_angles>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movaps %xmm0,%xmm4
movss  %xmm3,0x10(%rsp)
mulss  %xmm3,%xmm3
movss  %xmm2,0x8(%rsp)
movaps %xmm2,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm3,%xmm0
xorps  %xmm3,%xmm3
ucomiss %xmm3,%xmm0
movaps %xmm4,0x20(%rsp)
movss  %xmm1,0xc(%rsp)
jb     1194 <chaine_calcule_angles+0x44>
sqrtss %xmm0,%xmm0
jmp    11a4 <chaine_calcule_angles+0x54>
call   1060 <sqrt@plt>
movss  0xc(%rsp),%xmm1
movaps 0x20(%rsp),%xmm4
movss  %xmm0,0x4(%rsp)
movaps %xmm4,%xmm0
call   1030 <chaine_rayon_max@plt>
movss  0x4(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jbe    11dc <chaine_calcule_angles+0x8c>
movss  0x10(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
call   1040 <atan2@plt>
movss  %xmm0,(%rbx)
xor    %eax,%eax
xorps  %xmm0,%xmm0
jmp    1349 <chaine_calcule_angles+0x1f9>
movaps 0x20(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1070 <chaine_rayon_min@plt>
ucomiss 0x4(%rsp),%xmm0
jbe    123f <chaine_calcule_angles+0xef>
movss  0x10(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
call   1040 <atan2@plt>
mov    0x2ddd(%rip),%rax
movaps 0x20(%rsp),%xmm3
cmpltss 0xc(%rsp),%xmm3
movss  (%rax),%xmm1
andps  %xmm3,%xmm1
movss  0xdda(%rip),%xmm2
andnps %xmm2,%xmm3
orps   %xmm1,%xmm3
addss  %xmm0,%xmm3
movss  %xmm3,(%rbx)
movss  (%rax),%xmm0
xor    %eax,%eax
jmp    1349 <chaine_calcule_angles+0x1f9>
xorps  %xmm0,%xmm0
movss  0x4(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jbe    1333 <chaine_calcule_angles+0x1e3>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x30(%rsp)
movss  0x10(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
call   1040 <atan2@plt>
movss  %xmm0,0x8(%rsp)
movaps 0x20(%rsp),%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm1,%xmm2
mulss  %xmm1,%xmm1
movaps %xmm1,0x20(%rsp)
movss  0x4(%rsp),%xmm0
mulss  %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
addss  %xmm1,%xmm0
movss  0xc(%rsp),%xmm1
mulss  %xmm1,%xmm1
movss  %xmm1,0x1c(%rsp)
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movaps %xmm2,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x30(%rsp),%xmm2
mulsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <acos@plt>
addss  0x8(%rsp),%xmm0
movss  %xmm0,(%rbx)
mov    0x2cfa(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0x1c(%rsp),%xmm0
addss  0x20(%rsp),%xmm0
subss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0x10(%rsp),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <acos@plt>
addss  0x8(%rsp),%xmm0
jmp    1344 <chaine_calcule_angles+0x1f4>
movl   $0x0,(%rbx)
mov    0x2ca8(%rip),%rax
movss  (%rax),%xmm0
mov    $0x1,%eax
movss  %xmm0,(%r14)
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@M_PI = global float 0.000000e+00
define i32 @chaine_calcule_angles(float %0, float %1, float %2, float %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float*
%13 = alloca float*
%14 = alloca float
store float %0, float* %8
store float %1, float* %9
store float %2, float* %10
store float %3, float* %11
store float* %4, float** %12
store float* %5, float** %13
%15 = load float, float* %10
%16 = load float, float* %10
%17 = load float, float* %11
%18 = load float, float* %11
%19 = fmul float %17, %18
%20 = call float @llvm.fmuladd.f32(float %15, float %16, float %19)
%21 = call float @sqrt(float %20)
store float %21, float* %14
%22 = load float, float* %14
%23 = load float, float* %8
%24 = load float, float* %9
%25 = call float @chaine_rayon_max(float %23, float %24)
%26 = fcmp ogt float %22, %25
br i1 %26, label %27, label %33
27: ; preds = %6
%28 = load float, float* %11
%29 = load float, float* %10
%30 = call float @atan2(float %28, float %29)
%31 = load float*, float** %12
store float %30, float* %31
%32 = load float*, float** %13
store float 0.000000e+00, float* %32
store i32 0, i32* %7
br label %116
33: ; preds = %6
%34 = load float, float* %14
%35 = load float, float* %8
%36 = load float, float* %9
%37 = call float @chaine_rayon_min(float %35, float %36)
%38 = fcmp olt float %34, %37
br i1 %38, label %39, label %58
39: ; preds = %33
%40 = load float, float* %8
%41 = load float, float* %9
%42 = fcmp olt float %40, %41
br i1 %42, label %43, label %50
43: ; preds = %39
%44 = load float, float* %11
%45 = load float, float* %10
%46 = call float @atan2(float %44, float %45)
%47 = load float, float* @M_PI
%48 = fadd float %46, %47
%49 = load float*, float** %12
store float %48, float* %49
br label %55
50: ; preds = %39
%51 = load float, float* %11
%52 = load float, float* %10
%53 = call float @atan2(float %51, float %52)
%54 = load float*, float** %12
store float %53, float* %54
br label %55
55: ; preds = %50, %43
%56 = load float, float* @M_PI
%57 = load float*, float** %13
store float %56, float* %57
store i32 0, i32* %7
br label %116
58: ; preds = %33
%59 = load float, float* %14
%60 = fpext float %59 to double
%61 = fcmp ogt double %60, 0.000000e+00
br i1 %61, label %62, label %111
62: ; preds = %58
%63 = load float, float* %11
%64 = load float, float* %10
%65 = call float @atan2(float %63, float %64)
%66 = load float, float* %14
%67 = load float, float* %14
%68 = load float, float* %8
%69 = load float, float* %8
%70 = fmul float %68, %69
%71 = call float @llvm.fmuladd.f32(float %66, float %67, float %70)
%72 = load float, float* %9
%73 = load float, float* %9
%74 = fneg float %72
%75 = call float @llvm.fmuladd.f32(float %74, float %73, float %71)
%76 = fpext float %75 to double
%77 = load float, float* %8
%78 = fpext float %77 to double
%79 = fmul double 2.000000e+00, %78
%80 = load float, float* %14
%81 = fpext float %80 to double
%82 = fmul double %79, %81
%83 = fdiv double %76, %82
%84 = fptrunc double %83 to float
%85 = call float @acos(float %84)
%86 = fadd float %65, %85
%87 = load float*, float** %12
store float %86, float* %87
%88 = load float, float* @M_PI
%89 = load float, float* %8
%90 = load float, float* %8
%91 = load float, float* %9
%92 = load float, float* %9
%93 = fmul float %91, %92
%94 = call float @llvm.fmuladd.f32(float %89, float %90, float %93)
%95 = load float, float* %14
%96 = load float, float* %14
%97 = fneg float %95
%98 = call float @llvm.fmuladd.f32(float %97, float %96, float %94)
%99 = fpext float %98 to double
%100 = load float, float* %8
%101 = fpext float %100 to double
%102 = fmul double 2.000000e+00, %101
%103 = load float, float* %9
%104 = fpext float %103 to double
%105 = fmul double %102, %104
%106 = fdiv double %99, %105
%107 = fptrunc double %106 to float
%108 = call float @acos(float %107)
%109 = fadd float %88, %108
%110 = load float*, float** %13
store float %109, float* %110
br label %115
111: ; preds = %58
%112 = load float*, float** %12
store float 0.000000e+00, float* %112
%113 = load float, float* @M_PI
%114 = load float*, float** %13
store float %113, float* %114
br label %115
115: ; preds = %111, %62
store i32 1, i32* %7
br label %116
116: ; preds = %115, %55, %27
%117 = load i32, i32* %7
ret i32 %117
}

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
define i32 @chaine_calcule_angles(float %0, float %1, float %2, float %3, float* nocapture writeonly %4, float* nocapture writeonly %5) {
%7 = fmul float %3, %3
%8 = tail call float @llvm.fmuladd.f32(float %2, float %2, float %7)
%9 = tail call float @sqrt(float %8)
%10 = tail call float @chaine_rayon_max(float %0, float %1)
%11 = fcmp ogt float %9, %10
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = tail call float @atan2(float %3, float %2)
store float %13, float* %4
br label %55
14: ; preds = %6
%15 = tail call float @chaine_rayon_min(float %0, float %1)
%16 = fcmp olt float %9, %15
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = fcmp olt float %0, %1
%19 = tail call float @atan2(float %3, float %2)
%20 = load float, float* @M_PI
%21 = select i1 %18, float %20, float -0.000000e+00
%22 = fadd float %19, %21
store float %22, float* %4
%23 = load float, float* @M_PI
br label %55
24: ; preds = %14
%25 = fcmp ogt float %9, 0.000000e+00
br i1 %25, label %26, label %53
26: ; preds = %24
%27 = fpext float %9 to double
%28 = tail call float @atan2(float %3, float %2)
%29 = fmul float %0, %0
%30 = tail call float @llvm.fmuladd.f32(float %9, float %9, float %29)
%31 = fneg float %1
%32 = tail call float @llvm.fmuladd.f32(float %31, float %1, float %30)
%33 = fpext float %32 to double
%34 = fpext float %0 to double
%35 = fmul double %34, 2.000000e+00
%36 = fmul double %35, %27
%37 = fdiv double %33, %36
%38 = fptrunc double %37 to float
%39 = tail call float @acos(float %38)
%40 = fadd float %28, %39
store float %40, float* %4
%41 = load float, float* @M_PI
%42 = fmul float %1, %1
%43 = tail call float @llvm.fmuladd.f32(float %0, float %0, float %42)
%44 = fneg float %9
%45 = tail call float @llvm.fmuladd.f32(float %44, float %9, float %43)
%46 = fpext float %45 to double
%47 = fpext float %1 to double
%48 = fmul double %35, %47
%49 = fdiv double %46, %48
%50 = fptrunc double %49 to float
%51 = tail call float @acos(float %50)
%52 = fadd float %41, %51
br label %55
53: ; preds = %24
store float 0.000000e+00, float* %4
%54 = load float, float* @M_PI
br label %55
55: ; preds = %26, %53, %17, %12
%56 = phi float [ %23, %17 ], [ 0.000000e+00, %12 ], [ %54, %53 ], [ %52, %26 ]
%57 = phi i32 [ 0, %17 ], [ 0, %12 ], [ 1, %53 ], [ 1, %26 ]
store float %56, float* %5
ret i32 %57
}