#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 dist2(float, float, float, float);
scalar_t__ point_in_rectangle(float, float, float, float, float, float);
int collision_circle_box(float cx, float cy, float radius, float bx, float by,
                         float width, float height) {
  if (point_in_rectangle(cx, cy, bx - radius, by - radius, bx + width + radius,
                         by + height + radius)) {
    float radius2 = radius * radius;
    if (dist2(bx, by, cx, cy) < radius2 ||
        dist2(bx + width, by, cx, cy) < radius2 ||
        dist2(bx + width, by + height, cx, cy) < radius2 ||
        dist2(bx, by + height, cx, cy) < radius2 ||
        point_in_rectangle(cx, cy, bx - radius, by, bx + width + radius,
                           by + height) ||
        point_in_rectangle(cx, cy, bx, by - radius, bx + width,
                           by + height + radius))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<collision_circle_box>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
movss  %xmm4,-0x18(%rbp)
movss  %xmm5,-0x1c(%rbp)
movss  %xmm6,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
subss  -0x10(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
subss  -0x10(%rbp),%xmm3
movss  -0x14(%rbp),%xmm4
addss  -0x1c(%rbp),%xmm4
addss  -0x10(%rbp),%xmm4
movss  -0x18(%rbp),%xmm5
addss  -0x20(%rbp),%xmm5
addss  -0x10(%rbp),%xmm5
call   1040 <point_in_rectangle@plt>
cmp    $0x0,%rax
je     12f4 <collision_circle_box+0x1d4>
movss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
movss  -0xc(%rbp),%xmm3
call   1030 <dist2@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
ucomiss %xmm1,%xmm0
ja     12e3 <collision_circle_box+0x1c3>
movss  -0x14(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
movss  -0xc(%rbp),%xmm3
call   1030 <dist2@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
ucomiss %xmm1,%xmm0
ja     12e3 <collision_circle_box+0x1c3>
movss  -0x14(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
addss  -0x20(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
movss  -0xc(%rbp),%xmm3
call   1030 <dist2@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
ucomiss %xmm1,%xmm0
ja     12e3 <collision_circle_box+0x1c3>
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
addss  -0x20(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
movss  -0xc(%rbp),%xmm3
call   1030 <dist2@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
ucomiss %xmm1,%xmm0
ja     12e3 <collision_circle_box+0x1c3>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
subss  -0x10(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
movss  -0x14(%rbp),%xmm4
addss  -0x1c(%rbp),%xmm4
addss  -0x10(%rbp),%xmm4
movss  -0x18(%rbp),%xmm5
addss  -0x20(%rbp),%xmm5
call   1040 <point_in_rectangle@plt>
cmp    $0x0,%rax
jne    12e3 <collision_circle_box+0x1c3>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
subss  -0x10(%rbp),%xmm3
movss  -0x14(%rbp),%xmm4
addss  -0x1c(%rbp),%xmm4
movss  -0x18(%rbp),%xmm5
addss  -0x20(%rbp),%xmm5
addss  -0x10(%rbp),%xmm5
call   1040 <point_in_rectangle@plt>
cmp    $0x0,%rax
je     12ef <collision_circle_box+0x1cf>
movl   $0x1,-0x4(%rbp)
jmp    12fb <collision_circle_box+0x1db>
jmp    12f4 <collision_circle_box+0x1d4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<collision_circle_box>:
push   %rbx
sub    $0x30,%rsp
movaps %xmm3,%xmm8
movaps %xmm2,%xmm7
movaps %xmm3,%xmm2
subss  %xmm7,%xmm2
movaps %xmm4,%xmm3
subss  %xmm7,%xmm3
movss  %xmm8,0x18(%rsp)
addss  %xmm8,%xmm5
movss  %xmm5,0x14(%rsp)
movaps %xmm5,%xmm8
addss  %xmm7,%xmm8
movss  %xmm4,0x1c(%rsp)
addss  %xmm4,%xmm6
movss  %xmm6,0x10(%rsp)
movaps %xmm6,%xmm5
movss  %xmm7,0xc(%rsp)
addss  %xmm7,%xmm5
movss  %xmm0,0x4(%rsp)
movss  %xmm1,0x8(%rsp)
movss  %xmm2,0x2c(%rsp)
movss  %xmm3,0x24(%rsp)
movss  %xmm8,0x28(%rsp)
movaps %xmm8,%xmm4
movss  %xmm5,0x20(%rsp)
call   1040 <point_in_rectangle@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     12c8 <collision_circle_box+0x1a8>
movss  0xc(%rsp),%xmm0
mulss  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x18(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
movss  0x4(%rsp),%xmm2
movss  0x8(%rsp),%xmm3
call   1030 <dist2@plt>
movss  0xc(%rsp),%xmm1
ucomiss %xmm0,%xmm1
ja     12c3 <collision_circle_box+0x1a3>
movss  0x14(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
movss  0x4(%rsp),%xmm2
movss  0x8(%rsp),%xmm3
call   1030 <dist2@plt>
movss  0xc(%rsp),%xmm1
ucomiss %xmm0,%xmm1
ja     12c3 <collision_circle_box+0x1a3>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movss  0x4(%rsp),%xmm2
movss  0x8(%rsp),%xmm3
call   1030 <dist2@plt>
movss  0xc(%rsp),%xmm1
ucomiss %xmm0,%xmm1
ja     12c3 <collision_circle_box+0x1a3>
movss  0x18(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movss  0x4(%rsp),%xmm2
movss  0x8(%rsp),%xmm3
call   1030 <dist2@plt>
movss  0xc(%rsp),%xmm1
ucomiss %xmm0,%xmm1
ja     12c3 <collision_circle_box+0x1a3>
movss  0x4(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
movss  0x2c(%rsp),%xmm2
movss  0x1c(%rsp),%xmm3
movss  0x28(%rsp),%xmm4
movss  0x10(%rsp),%xmm5
call   1040 <point_in_rectangle@plt>
test   %rax,%rax
jne    12c3 <collision_circle_box+0x1a3>
movss  0x4(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
movss  0x18(%rsp),%xmm2
movss  0x24(%rsp),%xmm3
movss  0x14(%rsp),%xmm4
movss  0x20(%rsp),%xmm5
call   1040 <point_in_rectangle@plt>
test   %rax,%rax
je     12c8 <collision_circle_box+0x1a8>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @collision_circle_box(float %0, float %1, float %2, float %3, float %4, float %5, float %6) {
%8 = fsub float %3, %2
%9 = fsub float %4, %2
%10 = fadd float %3, %5
%11 = fadd float %10, %2
%12 = fadd float %4, %6
%13 = fadd float %12, %2
%14 = tail call i64 @point_in_rectangle(float %0, float %1, float %8, float %9, float %11, float %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %36, label %16
16: ; preds = %7
%17 = fmul float %2, %2
%18 = tail call float @dist2(float %3, float %4, float %0, float %1)
%19 = fcmp olt float %18, %17
br i1 %19, label %35, label %20
20: ; preds = %16
%21 = tail call float @dist2(float %10, float %4, float %0, float %1)
%22 = fcmp olt float %21, %17
br i1 %22, label %35, label %23
23: ; preds = %20
%24 = tail call float @dist2(float %10, float %12, float %0, float %1)
%25 = fcmp olt float %24, %17
br i1 %25, label %35, label %26
26: ; preds = %23
%27 = tail call float @dist2(float %3, float %12, float %0, float %1)
%28 = fcmp olt float %27, %17
br i1 %28, label %35, label %29
29: ; preds = %26
%30 = tail call i64 @point_in_rectangle(float %0, float %1, float %8, float %4, float %11, float %12)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = tail call i64 @point_in_rectangle(float %0, float %1, float %3, float %9, float %10, float %13)
%34 = icmp eq i64 %33, 0
br i1 %34, label %36, label %35
35: ; preds = %29, %26, %23, %20, %16, %32
br label %36
36: ; preds = %7, %32, %35
%37 = phi i32 [ 1, %35 ], [ 0, %32 ], [ 0, %7 ]
ret i32 %37
}