#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 find_angle(double *angles) {
  double *missing_angle;
  double sum_of_known_angles;
  register int i, given;
  missing_angle = NULL;
  sum_of_known_angles = 0;
  given = 0;
  for (i = 0; i < 3; i++) {
    if (!((angles[i]) > 0)) {
      missing_angle = &(angles[i]);
      continue;
    }
    ++given;
    sum_of_known_angles += angles[i];
  }
  if (given != 3 - 1)
    return 0;
  *(missing_angle) = (180 * ((3) - 2)) - sum_of_known_angles;
  return 1;
}


x86 assembly (clang, -O0):
<find_angle>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    1190 <find_angle+0x90>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     1162 <find_angle+0x62>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    1182 <find_angle+0x82>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1126 <find_angle+0x26>
cmpl   $0x2,-0x28(%rbp)
je     11a6 <find_angle+0xa6>
movl   $0x0,-0x4(%rbp)
jmp    11c2 <find_angle+0xc2>
movsd  0xe52(%rip),%xmm0
subsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_angle>:
movsd  (%rdi),%xmm0
xorpd  %xmm2,%xmm2
xor    %eax,%eax
ucomisd %xmm2,%xmm0
movsd  0x8(%rdi),%xmm1
seta   %al
xor    %ecx,%ecx
ucomisd %xmm2,%xmm1
seta   %cl
add    %eax,%ecx
movsd  0x10(%rdi),%xmm3
xor    %edx,%edx
ucomisd %xmm2,%xmm3
seta   %dl
add    %ecx,%edx
xor    %eax,%eax
cmp    $0x2,%edx
jne    118f <find_angle+0x8f>
xor    %eax,%eax
ucomisd %xmm2,%xmm0
cmovbe %rdi,%rax
lea    0x8(%rdi),%rcx
ucomisd %xmm2,%xmm1
lea    0x10(%rdi),%rdx
cmovbe %rcx,%rax
ucomisd %xmm2,%xmm3
movsd  0xea2(%rip),%xmm4
maxsd  %xmm4,%xmm0
addsd  %xmm2,%xmm0
maxsd  %xmm4,%xmm1
addsd  %xmm0,%xmm1
maxsd  %xmm4,%xmm3
addsd  %xmm1,%xmm3
cmovbe %rdx,%rax
movsd  0xe86(%rip),%xmm0
subsd  %xmm3,%xmm0
movsd  %xmm0,(%rax)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @find_angle(double* %0) {
%2 = alloca i32
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
store double* %0, double** %3
store double* null, double** %4
store double 0.000000e+00, double* %5
store i32 0, i32* %7
store i32 0, i32* %6
br label %8
8: ; preds = %33, %1
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %36
11: ; preds = %8
%12 = load double*, double** %3
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
%16 = load double, double* %15
%17 = fcmp ogt double %16, 0.000000e+00
br i1 %17, label %23, label %18
18: ; preds = %11
%19 = load double*, double** %3
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
store double* %22, double** %4
br label %33
23: ; preds = %11
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
%26 = load double*, double** %3
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
%30 = load double, double* %29
%31 = load double, double* %5
%32 = fadd double %31, %30
store double %32, double* %5
br label %33
33: ; preds = %23, %18
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %8
36: ; preds = %8
%37 = load i32, i32* %7
%38 = icmp ne i32 %37, 2
br i1 %38, label %39, label %40
39: ; preds = %36
store i32 0, i32* %2
br label %44
40: ; preds = %36
%41 = load double, double* %5
%42 = fsub double 1.800000e+02, %41
%43 = load double*, double** %4
store double %42, double* %43
store i32 1, i32* %2
br label %44
44: ; preds = %40, %39
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
define i32 @find_angle(double* nocapture %0) {
%2 = load double, double* %0
%3 = fcmp ogt double %2, 0.000000e+00
%4 = zext i1 %3 to i32
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = fcmp ogt double %6, 0.000000e+00
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %4, %8
%10 = getelementptr inbounds double, double* %0, i64 2
%11 = load double, double* %10
%12 = fcmp ogt double %11, 0.000000e+00
%13 = zext i1 %12 to i32
%14 = add nuw nsw i32 %9, %13
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %30
16: ; preds = %1
%17 = fcmp ogt double %2, -0.000000e+00
%18 = select i1 %17, double %2, double -0.000000e+00
%19 = fadd double %18, 0.000000e+00
%20 = fcmp ogt double %6, -0.000000e+00
%21 = select i1 %20, double %6, double -0.000000e+00
%22 = fadd double %19, %21
%23 = fcmp ogt double %11, -0.000000e+00
%24 = select i1 %23, double %11, double -0.000000e+00
%25 = fadd double %22, %24
%26 = select i1 %3, double* null, double* %0
%27 = select i1 %7, double* %26, double* %5
%28 = select i1 %12, double* %27, double* %10
%29 = fsub double 1.800000e+02, %25
store double %29, double* %28
br label %30
30: ; preds = %1, %16
%31 = phi i32 [ 1, %16 ], [ 0, %1 ]
ret i32 %31
}