#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 */
struct collision_box {
  int dummy;
};

/* Variables and functions */
scalar_t__ collision_test_box(struct collision_box const *, float, float);
int collision_test_complex(const struct collision_box *box,
                           int (*points)(const void *handle, float *x, float *y,
                                         int off),
                           const void *handle) {
  float x, y;
  int off = 0;
  while (points(handle, &x, &y, off)) {
    if (collision_test_box(box, x, y)) {
      return 1;
    }
    off++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<collision_test_complex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%ecx
lea    -0x24(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   *%rax
cmp    $0x0,%eax
je     1180 <collision_test_complex+0x70>
mov    -0x10(%rbp),%rdi
movss  -0x24(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
call   1030 <collision_test_box@plt>
cmp    $0x0,%rax
je     1172 <collision_test_complex+0x62>
movl   $0x1,-0x4(%rbp)
jmp    1187 <collision_test_complex+0x77>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    112b <collision_test_complex+0x1b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<collision_test_complex>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %rdi,%r15
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
xor    %r14d,%r14d
mov    %rbx,%rdi
xor    %ecx,%ecx
call   *%rbp
test   %eax,%eax
je     1189 <collision_test_complex+0x79>
lea    0x4(%rsp),%r12
mov    %rsp,%r13
mov    $0x1,%r14d
nopl   0x0(%rax,%rax,1)
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
mov    %r15,%rdi
call   1030 <collision_test_box@plt>
test   %rax,%rax
jne    1183 <collision_test_complex+0x73>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %r14d,%ecx
call   *%rbp
add    $0x1,%r14d
test   %eax,%eax
jne    1150 <collision_test_complex+0x40>
xor    %r14d,%r14d
jmp    1189 <collision_test_complex+0x79>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.collision_box = type { i32 }
define i32 @collision_test_complex(%struct.collision_box* %0, i32 (i8*, float*, float*, i32)* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.collision_box*
%6 = alloca i32 (i8*, float*, float*, i32)*
%7 = alloca i8*
%8 = alloca float
%9 = alloca float
%10 = alloca i32
store %struct.collision_box* %0, %struct.collision_box** %5
store i32 (i8*, float*, float*, i32)* %1, i32 (i8*, float*, float*, i32)** %6
store i8* %2, i8** %7
store i32 0, i32* %10
br label %11
11: ; preds = %24, %3
%12 = load i32 (i8*, float*, float*, i32)*, i32 (i8*, float*, float*, i32)** %6
%13 = load i8*, i8** %7
%14 = load i32, i32* %10
%15 = call i32 %12(i8* %13, float* %8, float* %9, i32 %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %11
%18 = load %struct.collision_box*, %struct.collision_box** %5
%19 = load float, float* %8
%20 = load float, float* %9
%21 = call i64 @collision_test_box(%struct.collision_box* %18, float %19, float %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %17
store i32 1, i32* %4
br label %28
24: ; preds = %17
%25 = load i32, i32* %10
%26 = add nsw i32 %25, 1
store i32 %26, i32* %10
br label %11
27: ; preds = %11
store i32 0, i32* %4
br label %28
28: ; preds = %27, %23
%29 = load i32, i32* %4
ret i32 %29
}

LLVM IR (-O2):
%struct.collision_box = type { i32 }
define i32 @collision_test_complex(%struct.collision_box* %0, i32 (i8*, float*, float*, i32)* nocapture %1, i8* %2) {
%4 = alloca float
%5 = alloca float
%6 = bitcast float* %4 to i8*
%7 = bitcast float* %5 to i8*
%8 = call i32 %1(i8* %2, float* %4, float* %5, i32 0)
%9 = icmp eq i32 %8, 0
br i1 %9, label %20, label %13
10: ; preds = %13
%11 = call i32 %1(i8* %2, float* %4, float* %5, i32 %19)
%12 = icmp eq i32 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %3, %10
%14 = phi i32 [ %19, %10 ], [ 0, %3 ]
%15 = load float, float* %4
%16 = load float, float* %5
%17 = call i64 @collision_test_box(%struct.collision_box* %0, float %15, float %16)
%18 = icmp eq i64 %17, 0
%19 = add nuw nsw i32 %14, 1
br i1 %18, label %10, label %20
20: ; preds = %13, %10, %3
%21 = phi i32 [ 0, %3 ], [ 0, %10 ], [ 1, %13 ]
ret i32 %21
}