#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 */
double acos(double);
double asin(double);
double dot_product(double *, double *);
int /*<<< orphan*/ informd(char *);
int /*<<< orphan*/ normalize(double *);
int /*<<< orphan*/ sprintf(char *, char *, double, double, double);
int disk_contain(double sphere_center[3], double rad, double disk1_center[3],
                 double disk2_center[3], double rad1, double rad2) {
  int k;
  double angle1, angle2;
  double axis1[3], axis2[3];
  double angle12;
  double dot12;
  char message[255];
  angle1 = asin(rad1 / rad);
  angle2 = asin(rad2 / rad);
  for (k = 0; k < 3; k++)
    axis1[k] = (disk1_center[k] - sphere_center[k]);
  normalize(axis1);
  for (k = 0; k < 3; k++)
    axis2[k] = (disk2_center[k] - sphere_center[k]);
  normalize(axis2);
  dot12 = dot_product(axis1, axis2);
  if (dot12 < -1.0)
    dot12 = -1.0;
  else if (dot12 > 1.0)
    dot12 = 1.0;
  angle12 = acos(dot12);
  sprintf(message, "angle1 = %8.3f; angle2 = %8.3f; angle12 = %8.3f", angle1,
          angle2, angle12);
  informd(message);
  return (angle1 >= angle12 + angle2);
}


x86 assembly (clang, -O0):
<disk_contain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1070 <asin@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1070 <asin@plt>
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x3,-0x34(%rbp)
jge    11f1 <disk_contain+0x91>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x34(%rbp),%rax
movsd  %xmm0,-0x60(%rbp,%rax,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11b5 <disk_contain+0x55>
lea    -0x60(%rbp),%rdi
call   1040 <normalize@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x3,-0x34(%rbp)
jge    123d <disk_contain+0xdd>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x34(%rbp),%rax
movsd  %xmm0,-0x80(%rbp,%rax,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1201 <disk_contain+0xa1>
lea    -0x80(%rbp),%rdi
call   1040 <normalize@plt>
lea    -0x60(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1050 <dot_product@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xd9d(%rip),%xmm0
ucomisd -0x90(%rbp),%xmm0
ff
jbe    1286 <disk_contain+0x126>
movsd  0xd87(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    12b5 <disk_contain+0x155>
movsd  -0x90(%rbp),%xmm0
ff
movsd  0xd72(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12b0 <disk_contain+0x150>
movsd  0xd60(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    12b5 <disk_contain+0x155>
movsd  -0x90(%rbp),%xmm0
ff
call   1030 <acos@plt>
movsd  %xmm0,-0x88(%rbp)
ff
lea    -0x190(%rbp),%rdi
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm2
ff
lea    0xd26(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x190(%rbp),%rdi
call   1060 <informd@plt>
movsd  -0x40(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm1
ff
addsd  -0x48(%rbp),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disk_contain>:
push   %r15
push   %r14
push   %rbx
sub    $0x160,%rsp
movsd  %xmm2,0x8(%rsp)
mov    %rdx,%r14
mov    %rsi,%r15
movsd  %xmm0,0x10(%rsp)
mov    %rdi,%rbx
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1070 <asin@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
divsd  0x10(%rsp),%xmm0
call   1070 <asin@plt>
movsd  %xmm0,0x8(%rsp)
movupd (%r15),%xmm0
movupd (%rbx),%xmm1
subpd  %xmm1,%xmm0
movapd %xmm0,0x40(%rsp)
movsd  0x10(%r15),%xmm0
subsd  0x10(%rbx),%xmm0
movsd  %xmm0,0x50(%rsp)
lea    0x40(%rsp),%r15
mov    %r15,%rdi
call   1040 <normalize@plt>
movupd (%r14),%xmm0
movupd (%rbx),%xmm1
subpd  %xmm1,%xmm0
movapd %xmm0,0x20(%rsp)
movsd  0x10(%r14),%xmm0
subsd  0x10(%rbx),%xmm0
movsd  %xmm0,0x30(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <normalize@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <dot_product@plt>
movapd %xmm0,%xmm1
movsd  0xddc(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1240 <disk_contain+0xe0>
ucomisd 0xdd6(%rip),%xmm1
movapd %xmm1,%xmm0
jbe    1240 <disk_contain+0xe0>
movsd  0xdc8(%rip),%xmm0
call   1030 <acos@plt>
movapd %xmm0,%xmm2
movsd  %xmm0,0x10(%rsp)
lea    0xdba(%rip),%rsi
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1060 <informd@plt>
movsd  0x8(%rsp),%xmm1
addsd  0x10(%rsp),%xmm1
xor    %eax,%eax
movsd  0x18(%rsp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
add    $0x160,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [48 x i8] c"angle1 = %8.3f; angle2 = %8.3f; angle12 = %8.3f\00"
define i32 @disk_contain(double* %0, double %1, double* %2, double* %3, double %4, double %5) {
%7 = alloca double*
%8 = alloca double
%9 = alloca double*
%10 = alloca double*
%11 = alloca double
%12 = alloca double
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca [3 x double]
%17 = alloca [3 x double]
%18 = alloca double
%19 = alloca double
%20 = alloca [255 x i8]
store double* %0, double** %7
store double %1, double* %8
store double* %2, double** %9
store double* %3, double** %10
store double %4, double* %11
store double %5, double* %12
%21 = load double, double* %11
%22 = load double, double* %8
%23 = fdiv double %21, %22
%24 = call double @asin(double %23)
store double %24, double* %14
%25 = load double, double* %12
%26 = load double, double* %8
%27 = fdiv double %25, %26
%28 = call double @asin(double %27)
store double %28, double* %15
store i32 0, i32* %13
br label %29
29: ; preds = %47, %6
%30 = load i32, i32* %13
%31 = icmp slt i32 %30, 3
br i1 %31, label %32, label %50
32: ; preds = %29
%33 = load double*, double** %9
%34 = load i32, i32* %13
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
%38 = load double*, double** %7
%39 = load i32, i32* %13
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
%42 = load double, double* %41
%43 = fsub double %37, %42
%44 = load i32, i32* %13
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [3 x double], [3 x double]* %16, i64 0, i64 %45
store double %43, double* %46
br label %47
47: ; preds = %32
%48 = load i32, i32* %13
%49 = add nsw i32 %48, 1
store i32 %49, i32* %13
br label %29
50: ; preds = %29
%51 = getelementptr inbounds [3 x double], [3 x double]* %16, i64 0, i64 0
%52 = call i32 @normalize(double* %51)
store i32 0, i32* %13
br label %53
53: ; preds = %71, %50
%54 = load i32, i32* %13
%55 = icmp slt i32 %54, 3
br i1 %55, label %56, label %74
56: ; preds = %53
%57 = load double*, double** %10
%58 = load i32, i32* %13
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %57, i64 %59
%61 = load double, double* %60
%62 = load double*, double** %7
%63 = load i32, i32* %13
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %62, i64 %64
%66 = load double, double* %65
%67 = fsub double %61, %66
%68 = load i32, i32* %13
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [3 x double], [3 x double]* %17, i64 0, i64 %69
store double %67, double* %70
br label %71
71: ; preds = %56
%72 = load i32, i32* %13
%73 = add nsw i32 %72, 1
store i32 %73, i32* %13
br label %53
74: ; preds = %53
%75 = getelementptr inbounds [3 x double], [3 x double]* %17, i64 0, i64 0
%76 = call i32 @normalize(double* %75)
%77 = getelementptr inbounds [3 x double], [3 x double]* %16, i64 0, i64 0
%78 = getelementptr inbounds [3 x double], [3 x double]* %17, i64 0, i64 0
%79 = call double @dot_product(double* %77, double* %78)
store double %79, double* %19
%80 = load double, double* %19
%81 = fcmp olt double %80, -1.000000e+00
br i1 %81, label %82, label %83
82: ; preds = %74
store double -1.000000e+00, double* %19
br label %88
83: ; preds = %74
%84 = load double, double* %19
%85 = fcmp ogt double %84, 1.000000e+00
br i1 %85, label %86, label %87
86: ; preds = %83
store double 1.000000e+00, double* %19
br label %87
87: ; preds = %86, %83
br label %88
88: ; preds = %87, %82
%89 = load double, double* %19
%90 = call double @acos(double %89)
store double %90, double* %18
%91 = getelementptr inbounds [255 x i8], [255 x i8]* %20, i64 0, i64 0
%92 = load double, double* %14
%93 = load double, double* %15
%94 = load double, double* %18
%95 = call i32 @sprintf(i8* %91, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), double %92, double %93, double %94)
%96 = getelementptr inbounds [255 x i8], [255 x i8]* %20, i64 0, i64 0
%97 = call i32 @informd(i8* %96)
%98 = load double, double* %14
%99 = load double, double* %18
%100 = load double, double* %15
%101 = fadd double %99, %100
%102 = fcmp oge double %98, %101
%103 = zext i1 %102 to i32
ret i32 %103
}

LLVM IR (-O2):
@.str = [48 x i8] c"angle1 = %8.3f; angle2 = %8.3f; angle12 = %8.3f\00"
define i32 @disk_contain(double* nocapture %0, double %1, double* nocapture %2, double* nocapture %3, double %4, double %5) {
%7 = alloca [3 x double]
%8 = alloca [3 x double]
%9 = alloca [255 x i8]
%10 = bitcast [3 x double]* %7 to i8*
%11 = bitcast [3 x double]* %8 to i8*
%12 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%13 = fdiv double %4, %1
%14 = tail call double @asin(double %13)
%15 = fdiv double %5, %1
%16 = tail call double @asin(double %15)
%17 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%18 = bitcast double* %2 to <2 x double>*
%19 = load <2 x double>, <2 x double>* %18
%20 = bitcast double* %0 to <2 x double>*
%21 = load <2 x double>, <2 x double>* %20
%22 = fsub <2 x double> %19, %21
%23 = bitcast [3 x double]* %7 to <2 x double>*
store <2 x double> %22, <2 x double>* %23
%24 = getelementptr inbounds double, double* %2, i64 2
%25 = load double, double* %24
%26 = getelementptr inbounds double, double* %0, i64 2
%27 = load double, double* %26
%28 = fsub double %25, %27
%29 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 2
store double %28, double* %29
%30 = call i32 @normalize(double* %17)
%31 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%32 = bitcast double* %3 to <2 x double>*
%33 = load <2 x double>, <2 x double>* %32
%34 = bitcast double* %0 to <2 x double>*
%35 = load <2 x double>, <2 x double>* %34
%36 = fsub <2 x double> %33, %35
%37 = bitcast [3 x double]* %8 to <2 x double>*
store <2 x double> %36, <2 x double>* %37
%38 = getelementptr inbounds double, double* %3, i64 2
%39 = load double, double* %38
%40 = load double, double* %26
%41 = fsub double %39, %40
%42 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 2
store double %41, double* %42
%43 = call i32 @normalize(double* %31)
%44 = call double @dot_product(double* %17, double* %31)
%45 = fcmp olt double %44, -1.000000e+00
br i1 %45, label %49, label %46
46: ; preds = %6
%47 = fcmp ogt double %44, 1.000000e+00
br i1 %47, label %48, label %49
48: ; preds = %46
br label %49
49: ; preds = %6, %46, %48
%50 = phi double [ 1.000000e+00, %48 ], [ %44, %46 ], [ -1.000000e+00, %6 ]
%51 = call double @acos(double %50)
%52 = call i32 @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), double %14, double %16, double %51)
%53 = call i32 @informd(i8* %12)
%54 = fadd double %16, %51
%55 = fcmp oge double %14, %54
%56 = zext i1 %55 to i32
ret i32 %56
}